Custom file layout ignores public properties

I have an issue in ReSharper 2017.2.2 and same issue in ReSharper 2017.3 EAP 7. I customized the file layout to be more compliant with the StyleCop rules. One of these rules is to put the private properties after the public properties. So what I did was add the following to the XAML in the File Layout:

 <Entry DisplayName="Public non-static properties">
<Entry.Match>
<And>
<Kind Is="Property" />
<Access Is="Public" />
<Not>
<Static />
</Not>
</And>
</Entry.Match>
<Entry.SortBy>
<Name />
</Entry.SortBy>
</Entry>

And then for the private properties:

 <Entry DisplayName="Private non-static properties">
<Entry.Match>
<And>
<Kind Is="Property" />
<Access Is="Private" />
<Not>
<Static />
</Not>
</And>
</Entry.Match>
<Entry.SortBy>
<Name />
</Entry.SortBy>
</Entry>

But when I reformat the code the private properties are placed before the public properties. The strange thing is that when I add to a class the following code:

private string Foo { get; set; }
public string Foo2 { get; }
public string Name { get; }

And then reformat the layout is semi-ok:

public string Foo2 { get; }
private string Foo { get; set; }
public string Name { get; }

I then noticed that the formatting works correctly for the unused public properties. The keyword here is UNUSED. Like in my example I added the public property Foo2 but this property is not being referenced anywhere in the code base. The property Name in contrary is being used outside my class.

So it seems that the file layout for public/private properties is okay but only for the unused properties. Is there something wrong in my XML?

1 comment

I stand corrected. The issue was with the entry "Interface implementations" which I did not require so I have removed it from the File Layout XAML and now it works perfectly!

0

Please sign in to leave a comment.