dotnet/roslyn

IDE0059 Incorrectly reported for out arguments

Open

#58,564 opened on Jan 3, 2022

View on GitHub
 (3 comments) (1 reaction) (0 assignees)C# (4,257 forks)batch import
Area-IDEBugFeature - IDE0059help wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (Avg merge 6d 17h) (256 merged PRs in 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'

Contributor guide