Bug: "Reorder type members" is broken by "Update file header"

I am using a slightly modified StyleCopy reordering pattern (see below).

Reordering of type member works without "Update file header" checked in the profile. Once "Update file header" is checked, reordering is broken.

Can anyone confirm this???

JetBrains ReSharper 5.1 Full Edition
Build 5.1.3000.12 on 2011-01-28T05:05:56
Plugins: 1
#1. “StyleCop for ReSharper 5.1” v5.1.14810.3 by “StyleCop for ReSharper Development Team - http://StyleCop.ForReSharper.org”
Visual Studio 10.0.30319.1.




<?xml version="1.0" encoding="utf-8"?>
<Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns">

    <!-- Do not reorder COM interfaces -->
    <Pattern>
        <Match>
            <And Weight="2000">
                <Kind Is="interface"/>
                <HasAttribute CLRName="System.Runtime.InteropServices.InterfaceTypeAttribute"
                              Inherit="true"/>
            </And>
        </Match>
    </Pattern>

    <!-- Do not reorder P/Invoke structs -->
    <Pattern>
        <Match>
            <And Weight="2000">
                <Or>
                    <Kind Is="struct"/>
                    <Kind Is="class"/>
                </Or>
                <HasAttribute CLRName="System.Runtime.InteropServices.StructLayoutAttribute"
                              Inherit="true"/>
            </And>
        </Match>
    </Pattern>

    <!-- Do not reorder P/Invoke classes (called xxxNativeMethods) -->
    <Pattern>
        <Match>
            <And Weight="2000">
                <Kind Is="class"/>
                <Name Is=".*NativeMethods" />
            </And>
        </Match>
    </Pattern>

    <!-- StyleCop pattern -->
    <Pattern RemoveAllRegions="true">
        <Match>
            <Or Weight="1000" >
                <Kind Is="class" />
                <Kind Is="struct" />
                <Kind Is="interface"/>
            </Or>
        </Match>

        <!-- constants and fields -->
        <Entry>
            <Match>
                <Or>
                    <Kind Is="constant"/>
                    <Kind Is="field"/>
                </Or>
            </Match>
            <Sort>
                <Access Order="public internal protected-internal protected private"/>
                <Kind Order="constant field"/>
                <Readonly/>
                <Static/>
                <Name/>
            </Sort>
        </Entry>

        <!-- constructors -->
        <Entry>
            <Match>
                <Or Weight="200">
                    <Kind Is="constructor"/>
                    <Kind Is="destructor"/>
                </Or>
            </Match>
            <Sort>
                <Static/>
                <Kind Order="constructor destructor"/>
                <Access Order="public internal protected-internal protected private"/>
            </Sort>
        </Entry>

        <!-- TestInitialize -->
        <Entry>
            <Match>
                <And Weight="2000">
                    <Kind Is="method"/>
                    <HasAttribute CLRName="Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute"
                                  Inherit="true"/>
                </And>
            </Match>
        </Entry>

        <!-- delegates -->
        <Entry>
            <Match>
                <Kind Is="delegate"/>
            </Match>
            <Sort>
                <Access Order="public internal protected-internal protected private" />
                <Static />
                <Name/>
            </Sort>
        </Entry>

        <!-- events -->
        <Entry>
            <Match>
                <Kind Is="event"/>
            </Match>
            <Sort>
                <Access Order="public internal protected-internal protected private" />
                <Static />
                <Name/>
            </Sort>
        </Entry>

        <!-- enum -->
        <Entry>
            <Match>
                <Kind Is="enum"/>
            </Match>
            <Sort>
                <Access Order="public internal protected-internal protected private" />
                <Name/>
            </Sort>
        </Entry>

        <!-- interfaces -->
        <Entry>
            <Match>
                <Kind Is="interface" />
            </Match>
            <Sort>
                <Access Order="public internal protected-internal protected private" />
                <Name/>
            </Sort>
        </Entry>

        <!-- properties -->
        <Entry>
            <Match>
                <Kind Is="property"/>
            </Match>
            <Sort>
                <Access Order="public internal protected-internal protected private"/>
                <Static/>
                <Name/>
            </Sort>
        </Entry>

        <!-- indexers -->
        <Entry>
            <Match>
                <Kind Is="indexer"
                      Weight="300" />
            </Match>
            <Sort>
                <Access Order="public internal protected-internal protected private" />
                <Static/>
                <Name/>
            </Sort>
        </Entry>

        <!-- operator -->
        <Entry>
            <Match>
                <Kind Is="operator"/>
            </Match>
            <Sort>
                <Access Order="public internal protected-internal protected private" />
                <Static/>
                <Name/>
            </Sort>
        </Entry>

        <!-- public methods -->
        <Entry>
            <Match>
                <And>
                    <Kind Is="method"/>
                    <Access Is="public"/>
                </And>
            </Match>
            <Sort>
                <Access Order="public"/>
                <Static/>
                <Name/>
            </Sort>
        </Entry>

        <!-- Implemented Interfaces -->
        <Entry>
            <Match>
                <And Weight="500">
                    <Kind Is="method"/>
                    <ImplementsInterface CLRName=".*"/>
                </And>
            </Match>
            <Sort>
                <ImplementsInterface />
                <Access Order="public internal protected-internal protected private"/>
                <Static/>
                <Name/>
            </Sort>
        </Entry>

        <!-- other methods -->
        <Entry>
            <Match>
                <Kind Is="method"/>
            </Match>
            <Sort>
                <Access Order="public internal protected-internal protected private"/>
                <Static/>
                <Name/>
            </Sort>
        </Entry>

        <!-- Nested structs -->
        <Entry>
            <Match>
                <Kind Is="struct"
                      Weight="600" />
            </Match>
            <Sort>
                <Static />
                <Access Order="public internal protected-internal protected private" />
                <Name/>
            </Sort>
        </Entry>

        <!-- Nested classes -->
        <Entry>
            <Match>
                <Kind Is="class"
                      Weight="700" />
            </Match>
            <Sort>
                <Static />
                <Access Order="public internal protected-internal protected private" />
                <Name/>
            </Sort>
        </Entry>

        <!-- all other members -->
        <Entry/>

    </Pattern>
</Patterns>

1 comment

Hello Anthony,

Thank you for reporting this problem. I can confirm that this is a bug and
you're welcome to monitor its status at http://youtrack.jetbrains.net/issue/RSRP-220566.

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

I am using a slightly modified StyleCopy reordering pattern (see
below).

Reordering of type member works without "Update file header" checked
in the profile. Once "Update file header" is checked, reordering is
broken.

Can anyone confirm this???

JetBrains ReSharper 5.1 Full Edition

Build 5.1.3000.12 on 2011-01-28T05:05:56

Plugins: 1

#1. “StyleCop for ReSharper 5.1” v5.1.14810.3 by “StyleCop for
ReSharper Development Team - http://StyleCop.ForReSharper.org”

Visual Studio 10.0.30319.1.

<?xml version="1.0" encoding="utf-8"?>
<Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns">
<!-- Do not reorder COM interfaces -->
<Pattern>
<Match>
<And Weight="2000">
<Kind Is="interface"/>
<HasAttribute
CLRName="System.Runtime.InteropServices.InterfaceTypeAttribute"
Inherit="true"/>
</And>
</Match>
</Pattern>
<!-- Do not reorder P/Invoke structs -->
<Pattern>
<Match>
<And Weight="2000">
<Or>
<Kind Is="struct"/>
<Kind Is="class"/>
</Or>
<HasAttribute
CLRName="System.Runtime.InteropServices.StructLayoutAttribute"
Inherit="true"/>
</And>
</Match>
</Pattern>
<!-- Do not reorder P/Invoke classes (called xxxNativeMethods) -->
<Pattern>
<Match>
<And Weight="2000">
<Kind Is="class"/>
<Name Is=".*NativeMethods" />
</And>
</Match>
</Pattern>
<!-- StyleCop pattern -->
<Pattern RemoveAllRegions="true">
<Match>
<Or Weight="1000" >
<Kind Is="class" />
<Kind Is="struct" />
<Kind Is="interface"/>
</Or>
</Match>
<!-- constants and fields -->
<Entry>
<Match>
<Or>
<Kind Is="constant"/>
<Kind Is="field"/>
</Or>
</Match>
<Sort>
<Access Order="public internal protected-internal
protected private"/>
<Kind Order="constant field"/>
<Readonly/>
<Static/>
<Name/>
</Sort>
</Entry>
<!-- constructors -->
<Entry>
<Match>
<Or Weight="200">
<Kind Is="constructor"/>
<Kind Is="destructor"/>
</Or>
</Match>
<Sort>
<Static/>
<Kind Order="constructor destructor"/>
<Access Order="public internal protected-internal
protected private"/>
</Sort>
</Entry>
<!-- TestInitialize -->
<Entry>
<Match>
<And Weight="2000">
<Kind Is="method"/>
<HasAttribute
CLRName="Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAt
tribute"
Inherit="true"/>
</And>
</Match>
</Entry>
<!-- delegates -->
<Entry>
<Match>
<Kind Is="delegate"/>
</Match>
<Sort>
<Access Order="public internal protected-internal
protected private" />
<Static />
<Name/>
</Sort>
</Entry>
<!-- events -->
<Entry>
<Match>
<Kind Is="event"/>
</Match>
<Sort>
<Access Order="public internal protected-internal
protected private" />
<Static />
<Name/>
</Sort>
</Entry>
<!-- enum -->
<Entry>
<Match>
<Kind Is="enum"/>
</Match>
<Sort>
<Access Order="public internal protected-internal
protected private" />
<Name/>
</Sort>
</Entry>
<!-- interfaces -->
<Entry>
<Match>
<Kind Is="interface" />
</Match>
<Sort>
<Access Order="public internal protected-internal
protected private" />
<Name/>
</Sort>
</Entry>
<!-- properties -->
<Entry>
<Match>
<Kind Is="property"/>
</Match>
<Sort>
<Access Order="public internal protected-internal
protected private"/>
<Static/>
<Name/>
</Sort>
</Entry>
<!-- indexers -->
<Entry>
<Match>
<Kind Is="indexer"
Weight="300" />
</Match>
<Sort>
<Access Order="public internal protected-internal
protected private" />
<Static/>
<Name/>
</Sort>
</Entry>
<!-- operator -->
<Entry>
<Match>
<Kind Is="operator"/>
</Match>
<Sort>
<Access Order="public internal protected-internal
protected private" />
<Static/>
<Name/>
</Sort>
</Entry>
<!-- public methods -->
<Entry>
<Match>
<And>
<Kind Is="method"/>
<Access Is="public"/>
</And>
</Match>
<Sort>
<Access Order="public"/>
<Static/>
<Name/>
</Sort>
</Entry>
<!-- Implemented Interfaces -->
<Entry>
<Match>
<And Weight="500">
<Kind Is="method"/>
<ImplementsInterface CLRName=".*"/>
</And>
</Match>
<Sort>
<ImplementsInterface />
<Access Order="public internal protected-internal
protected private"/>
<Static/>
<Name/>
</Sort>
</Entry>
<!-- other methods -->
<Entry>
<Match>
<Kind Is="method"/>
</Match>
<Sort>
<Access Order="public internal protected-internal
protected private"/>
<Static/>
<Name/>
</Sort>
</Entry>
<!-- Nested structs -->
<Entry>
<Match>
<Kind Is="struct"
Weight="600" />
</Match>
<Sort>
<Static />
<Access Order="public internal protected-internal
protected private" />
<Name/>
</Sort>
</Entry>
<!-- Nested classes -->
<Entry>
<Match>
<Kind Is="class"
Weight="700" />
</Match>
<Sort>
<Static />
<Access Order="public internal protected-internal
protected private" />
<Name/>
</Sort>
</Entry>
<!-- all other members -->
<Entry/>
</Pattern>
</Patterns>
---
Original message URL:
http://devnet.jetbrains.net/message/5290335#5290335



0

Please sign in to leave a comment.