Bug Report T573424
Visible to All Users

Code Formatting produces an incorrect indent when braces for namespaces and types are set to be on a new line

created 7 years ago

Hi

Given the below example class (Note I use TABS and not spaces, however this issue still happens when set to (insert spaces for tabs)

C#
namespace Testing { /// <summary> /// an example class /// </summary> public class Class1 { /// <summary>Initializes a new instance of the <see cref="Class1"/> class.</summary> /// <remarks>A remark here</remarks> public Class1() { Field1 = string.Empty; Field2 = string.Empty; } /// <summary>Gets or sets the field1.</summary> /// <value>The field1.</value> private string Field1 { get; set; } /// <summary>Gets or sets the field2.</summary> /// <value>The field2.</value> private string Field2 { get; set; } } }

After running the codeclean up it formats it like this:

C#
namespace Testing { /// <summary> /// an example class /// </summary> public class Class1 { /// <summary>Initializes a new instance of the <see cref="Class1"/> class.</summary> /// <remarks>A remark here</remarks> public Class1() { Field1 = string.Empty; Field2 = string.Empty; } /// <summary>Gets or sets the field1.</summary> /// <value>The field1.</value> private string Field1 { get; set; } /// <summary>Gets or sets the field2.</summary> /// <value>The field2.</value> private string Field2 { get; set; } } }

Notice how the lines (hopefully in bold) are all tabbed in as well as the 2nd to last curly bracket.

The above issue are when I have the following TURNED ON:

C#>Formatting>Braces>Namespace
C#>Formatting>Braces>Type

I have both set to Wrap, Before, Wrap

If I turn the options off, the clean up looks like the original.

Side note - There is also an issue with the option:

C#>Formatting>Braces>Method

When this is on the method formats like this:

C#
public Class1() { Field1 = string.Empty; Field2 = string.Empty; }

So using the initial code above, with all 3 options turned on with Wrap/before/wrap options it looks like this:

C#
namespace Testing { /// <summary> /// an example class /// </summary> public class Class1 { /// <summary>Initializes a new instance of the <see cref="Class1"/> class.</summary> /// <remarks>A remark here</remarks> public Class1() { Field1 = string.Empty; Field2 = string.Empty; } /// <summary>Gets or sets the field1.</summary> /// <value>The field1.</value> private string Field1 { get; set; } /// <summary>Gets or sets the field2.</summary> /// <value>The field2.</value> private string Field2 { get; set; } } }

Hope this helps.

Show previous comments (3)
DevExpress Support Team 7 years ago

    Alan,

    17.2.3 is our internal version, which was recently added. Thank you for bringing this to our attention.
    We have changed its state to internal for now, and it will be available soon after the official public release.

    AM AM
    Alan Middleton999 7 years ago

      Alex,

      :) No worries, just wondered if I should be getting that instead of the 17.1.10.

      DevExpress Support Team 7 years ago

        Alan,

        The fix for this issue will be also available in v17.1.10

        Answers approved by DevExpress Support

        created 7 years ago (modified 7 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.