Refactor convert property to auto property not available
I see 2 other posts but no answer information. I am trying to use this refactor Convert Property to Auto-Property refactoring | ReSharper Documentation
For a class
public class xxxxxxx
{
private string xxx;
private byte totalValueField;
private string aliasField;
private bool stackableField;
public string PromoCode
{
get
{
return this.promoCodeField;
}
set
{
this.promoCodeField = value;
}
}
I notice a few things:
I do not see this in the refactor options:

I do not see it in the refactor options.

I do not see the property indicated in the docs for a keyboard shortcut.

I did a product update to make sure I had latest.
When I do a code cleanup, I get the property in question set to

a different body style. A format specified elsewhere is the body style. But my code clean up says use auto property when possible.
I am doing something very wrong. Does anyone know what? Thanks
Please sign in to leave a comment.
Hello Vthomeschoolmom, thank you for your question.
ReSharper_Property2Auto
command?Thank you!
Vthomeschoolmom it looks like you're using a
SerializableAttribute
for the class. In this case, this is the correct behavior for types marked withSerializableAttribute
. Here's an issue in our tracker that describes why converting properties to auto-properties can be dangerous for serializable types: RSRP-453792 Serializable objects SHOULD BE able to convert properties to auto-properties.Thanks!