I ran across this issue today and was able to determine that, when doing code cleanup, R# will not convert properties from having backing fields to auto properties in classes that are decorated with the SerializableAttribute, e.g.
using System;
namespace DataContracts
{
[Serializable]
public class Class1
{
private bool _wontChange;
public bool WontChange
{
get { return _wontChange; }
set { _wontChange = value; }
}
}
}
The above code will not be changed during automatic code cleanup. Of course, I can do this manually, and I still get the quick-action menu option from R# to do it at the individual property level. But it's got me wondering if there's an underlying issue that I'm not aware of in using auto properties in [Serializable]
classes.
In the JetBrains forum thread we're referred to an issue in which this problem is discussed, but it does not seem to be definitively resolved.