dotnet/roslyn

IDE0059 Incorrectly reported for out arguments

Aberta

#58.564 aberto em 3 de jan. de 2022

 (3 comentários) (1 reação) (0 responsável)C# (4.257 forks)batch import
Area-IDEBugFeature - IDE0059help wanted

Métricas do repositório

Stars
 (20.414 estrelas)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (256 fundiu PRs em 30d)

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'

Guia do colaborador