dotnet/roslyn

Bug with ref properties and IDE0052

Open

#72.884 geöffnet am 5. Apr. 2024

Auf GitHub ansehen
 (0 Kommentare) (1 Reaktion) (1 zugewiesene Person)C# (4.257 Forks)batch import
Area-IDEBugFeature - IDE0052help wanted

Repository-Metriken

Stars
 (20.414 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)

Beschreibung

Version Used: VS 17.9.0 on .NET 8.0

Steps to Reproduce:

class C1
{
	int a;
	private ref int A => ref a;
	public void Increment() => A++;
}

Diagnostic Id: IDE0052

Expected Behavior:

No diagnostic, since it's read, incremented, then written.

Actual Behavior:

There is a diagnostic claiming it's never been read.

Related:

Potentially https://github.com/dotnet/roslyn/issues/25057

Contributor Guide