-
Notifications
You must be signed in to change notification settings - Fork 277
Closed
Description
When the variable declaration does not have an initializer, and it is assigned, CC0009 is incorrectly triggered. This should not raise a diagnostic for CC0009:
class Foo
{
public Foo F { get; set; }
static void Baz()
{
Foo foo;
foo = new Foo();
foo.F = foo;
}
}We should check for that specific scenario.
This should still raise a diagnostic:
class Foo
{
public Foo F { get; set; }
static void Baz()
{
Foo foo;
foo = Whatever();
foo = new Foo();
foo.F = foo;
}
}When there is a prior assignment between the variable declaration and it's assignment (or the variable being passed as ref or out to a method) CC0009 should still be raised.
This is a bug on the analyzer, not on the code fix provider.