I have an issue concerning regions in ReSharper 8.0 Beta (Build 126.96.36.1996) that may or may not be a new bug. Before filing a bug report I want to make sure that I haven't caused this myself.
In ReSharper options under Code Editing/C#/Type Members Layout I have "Default layout using regions" selected. Before installing the beta version with this configuration doing a code clean up would cause my class members to be sorted, and regions were added to surround various sections of the code. After installing the beta class members are sorted, but it ends there. If the default regions already exist, members within those regions are sorted, but if a member actually belongs in another region (or if no default region matches the signature), it is not moved out of the region. It will stay in that region. If the default regions are not present, they are not added as they once were.
Is there some other ReSharper setting that I might have changed to cause behavior like this?
This occurs with the following set up:
JetBrains ReSharper 8 Beta Full Edition
Build 188.8.131.526 on 2013-07-04T16:09:28
#1. “InternalsVisibleTo Helper for ReSharper” v0.1.1.0 by “Igal Tabachnik”
#2. “NuGet support for ReSharper” v184.108.40.2065 by JetBrains
#3. ReSpeller v220.127.116.11 by “Ethereal Code”
Visual Studio 11.0.60610.1.
Here is a bit more information on the Code Clean Up problem. I've noticed that not only does clean up not set up regions correctly, but it isn't sorting members either.
Here is how I have the regions configured:
I start the clean up with these settings:
After running the clean up the file structure is unchanged. Here is a before and after snapshot:
I may be doing something wrong that's resulting in this, but I don't think so. Reordering is one of the features I depend on to keep my code in order. If anyone can help me figure this problem out, I would be eternally grateful.
I was able to work this problem out by comparing the two default layouts available under ReSharper's Options dialog box at Code Editing/C#/Type Member Layout. I made a copy of the default "Without Regions" text and the default "Using Regions" text and saved those to xml files within one of my projects, and then used Code Compare Pro to see the differences between them. With the understanding that provided I was able to modify one of the files to sort and group class members like I wanted.
It seemed like both "Default layout without regions" and "Default layout using regions" produced the same results for me, but that might be becauase the "using regions" layout does not put regions around methods and properties, or sort them, which is what I was looking for.
If anyone is interested in modifying these files, you can read what I did to have my methods and properties sorted, and surrounded with regions at my blog, Yoder's Reasons. I have a couple entries about ReSharper 8 that I wrote this weekend.