Given a method that looks like this:
C#namespace MyNamespace
{
public class TestClass
{
public void DoWork()
{
}
public TestClass()
{
}
private Lazy<Guid> _id = new Lazy<Guid>(() => Guid.NewGuid());
}
}
And the Organize Members settings are set to "StyleCop"
When you execute Organize Members the Lazy<Guid> _id field should get moved to the top of the class but instead it stays at the bottom. Even if you manually put it at the top, after Organize Members runs it gets put back at the bottom incorrectly.
It appears the field is getting sorted like a private method rather than a private field.
This also seems to affect static readonly fields. For example, this field will get sorted to the bottom of the class, too:
public static readonly string SomeName = "SomeValue";
Hi Travis,
Thank you for letting us know about this problem. I have reproduced this behavior locally and will pass this ticket to our developers for further research.