dotnet/roslyn

IDE0059 Incorrectly reported for out arguments

Offen

#58.564 geöffnet am 03.01.2022

 (3 Kommentare) (1 Reaktion) (0 zugewiesene Personen)C# (4.257 Forks)batch import
Area-IDEBugFeature - IDE0059help wanted

Repository-Metriken

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

Beschreibung

Version Used: 6.0

Steps to Reproduce:

class Test
{
		public static void Foo ()
		{
			int i;
			OutFoo (out i, 9); // error IDE0059: Unnecessary assignment of a value to 'i'
			OutFoo (out i, i);
            Console.WriteLine (i);
		}

		public static void OutFoo (out int i, int arg)
		{
			i = ++arg;
		}
}

Expected Behavior:

No IDE0059 reported

Actual Behavior:

error IDE0059: Unnecessary assignment of a value to 'i'

Contributor Guide