If the C# 5.0 language version is selected in the advanced build settings, code cleanup leads to uncompilable code.
Original code:
C#public class Person {}
public class Test
{
Person person = new Person();
public Person Person
{
get { return person; }
set { person = value; }
}
}
Code after the code cleanup:
C#public class Person {}
public class Test
{
Person person;
public Person Person { get; set; } = new Person();
}
Expected result:
C#public class Test
{
Person person = new Person();
public Person Person
{
get { return person; }
set { person = value; }
}
}
Code cleanup should not change such properties.
We have reproduced this issue and will work on resolving it in future versions of the product.
As a workaround please disable the 'Make properties auto implemented' code cleanup rule if you are working in projects using the C# 5.0 language.
This can be done on the Code Cleanup options page.
Editor\Code Style