dotnet/roslyn

IDE0059 Incorrectly reported for out arguments

Ouverte

#58 564 ouverte le 3 janv. 2022

 (3 commentaires) (1 réaction) (0 personne assignée)C# (4 257 forks)batch import
Area-IDEBugFeature - IDE0059help wanted

Métriques du dépôt

Stars
 (20 414 étoiles)
Métriques de merge PR
 (Merge moyen 6j 17h) (256 PRs mergées en 30 j)

Description

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'

Guide contributeur