Bug Report T433234
Visible to All Users

Organize Members - A field with an initializer is not moved to the 'fields' group

created 8 years ago

Hi!
"Organize Members" doesn't seems to recognize a field with an initializer as a "field".

I have to following example:

C#
namespace ClassLibrary1 { using System; using System.Collections.Generic; using System.Linq; public class Class1 { private List<string> test1; private List<string> test2 = new List<string>(); public void Call1() { } public void Call2() { } } }

If I reorganize this with "StyleCop" Settings, I receive this as a result:

C#
namespace ClassLibrary1 { using System; using System.Collections.Generic; using System.Linq; public class Class1 { private List<string> test1; public void Call1() { } public void Call2() { } private List<string> test2 = new List<string>(); } }

I can move the field up and down in the configuration and the field changes his position. Only test2 is always put at the end.

Thanks
Silvio

Comments (1)
DevExpress Support Team 8 years ago

    Hello Silvio,

    Thank you for providing the code sample.

    We have an option to skip initialized fields. It is enabled by default and initialized fields are not moved into the 'fields' group.
    I have attached a screencast that illustrates how to disable this option. In this case, you will get the required behavior.

    The reason of adding this option - a field initializer can contain references to other fields. In this case, we should not change the order of fields.
    However, in your case, the field initializer is object creation, so we think that we should move such initialized fields into the 'fields' group ever if the 'Skip initialized fields' option is enabled.
    We will research this issue and let you know as soon as we make any progress.

    Answers approved by DevExpress Support

    created 8 years ago

    We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

    Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

      Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

      Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.