Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-287916: #pragma around field prevents members from being reordered during code cleanup.

$
0
0
Reporter Werner Strydom (bloudraak) Werner Strydom (bloudraak)
Created Jan 21, 2012 4:22:25 AM
Updated Jan 21, 2012 4:22:25 AM
Priority Normal
Type Bug
Fix versions No Fix versions
State Submitted
Assignee Evgeny Pasynkov (pasynkov)
Subsystem Code Cleanup
Affected versions 6.1
Fixed in build No Fixed in build
Consider the following code:

    internal class Class1
    {
        public void Method1()
        {
        }

        public string Property2
        {
            get;
            set;
        }

#pragma warning disable 649
        private int _field1;
#pragma warning restore 649

        public void Method2()
        {
        }

        public string Property1
        {
            get;
            set;
        }
    }


Now select to "cleanup code". Notice that fields are not reordered. Remove the #pgrama statements from field1, so that the class looks as follows:

 internal class Class1
    {
        public void Method1()
        {
        }

        public string Property2
        {
            get;
            set;
        }

        private int _field1;

        public void Method2()
        {
        }

        public string Property1
        {
            get;
            set;
        }
    }


Select to cleanup the code. Notice that the members are correctly reordered as follows:

internal class Class1
    {
        private int _field1;

        public string Property2
        {
            get;
            set;
        }

        public string Property1
        {
            get;
            set;
        }

        public void Method1()
        {
        }

        public void Method2()
        {
        }
    }


It seems that the pragma statements prevent code from being reordered. I would expect ReSharper to still reorder members and keep the pragma statements around the respective methods.

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>