Current filter:
                                You should refresh the page.
                                  • Hi again, thanks for the previous fixes!!!

                                    I've just noticed what I think is a new section in the options -- C# \ Formatting \ Wrapping.

                                    I've been playing around with the numbers in there and the ARRAY Initializer seems to not work 100% . The values I set, it seems to work correctly when the array is initialized within a method, but when it's initialized in the class - e.g. static array, the formatting is wrong.

                                    I have the following settings on:

                                    Open Brace, Wrap, Before, Align Declaration, Indent 0
                                    Close Brace, Wrap, -----, Align Declaration, Indent 0
                                    Wrap seperator, Wrap, After, Align Declaration, Indent ONE

                                    When it's set like this the lines are wrapped as expected but they are all the way to the left - right against the line numbers. When I have the align by set to "Declaration Name " then they are about 100+ characters to the right.

                                    I've tried this with both Tabs & spaces set for the 4 spaces. Same result!

                                    As I say, within a method the formatting appears correct at first -- see later.

                                    NOTE - I've not checked the Collection / Object initializers - but I guess they might be the same as the options are the same and I guess they will use the same code. (will check after this post).

                                    Below are the before & after with the above settings.

                                    [C#]
                                    namespace MyNameSpace { internal class MyClass { private static readonly string[] _acceptedToolKeys = { "&Unselect All", "Consolidate", "Single", "Select A&ll", "Show A&ll", "Snapshot", "&Summary", "Where Used", "Apply Filter", "Add To Order" }; private MyClass() { } private void MethodNameHere() { string[] moreToolKeys = { "Select A&ll", "Show A&ll", "Snapshot", "&Summary", "Where Used", "Apply Filter", "Add To Order" }; } } }

                                    AFTER CODE CLEAN UP:

                                    [C#]
                                    namespace MyNameSpace { internal class MyClass { private static readonly string[] _acceptedToolKeys = { "&Unselect All", "Consolidate", "Single", "Select A&ll", "Show A&ll", "Snapshot", "&Summary", "Where Used", "Apply Filter", "Add To Order" }; private MyClass() { } private void MethodNameHere() { string[] moreToolKeys = { "Select A&ll", "Show A&ll", "Snapshot", "&Summary", "Where Used", "Apply Filter", "Add To Order" }; } } }

                                    WITH Align By set to Declaration Name - this seemed to work OK in the above test --- but worked out why...

                                    If I have some long XML comment above the static string... the text is all the way to the right! e.g. (beware of wrapping in post)

                                    [C#]
                                    /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> private static readonly string[] _acceptedToolKeys = { "&Unselect All", "Consolidate", "Single", "Select A&ll", "Show A&ll", "Snapshot", "&Summary", "Where Used", "Apply Filter", "Add To Order" };

                                    OH, I've just noticed - If I paste the same above XML comment above the string[] line WITHIN the method, the text is all the way to the right as well (no matter what the align by is set to.)

                                    Here is the new unformatted class, with comments in:

                                    [C#]
                                    namespace MyNameSpace { internal class MyClass { /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> private static readonly string[] _acceptedToolKeys = { "&Unselect All", "Consolidate", "Single", "Select A&ll", "Show A&ll", "Snapshot", "&Summary", "Where Used", "Apply Filter", "Add To Order" }; private MyClass() { } /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> private void MethodNameHere() { /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> string[] moreToolKeys = { "Select A&ll", "Show A&ll", "Snapshot", "&Summary", "Where Used", "Apply Filter", "Add To Order" }; } } }

                                    Hope this all makes sense. I'll check the collection & Object initializers as well.

                                    Thanks
                                    Alan

                                Show all comments
                                • Alan Middleton999 06.29.2017

                                  Hi again... Here is the final class with all 3 types in:

                                  [C#]
                                  namespace MyNameSpace { internal class MyClass { /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> private static readonly string[] _acceptedToolKeys = { "&Unselect All", "Consolidate", "Single", "Select A&ll", "Show A&ll", "Snapshot", "&Summary", "Where Used", "Apply Filter", "Add To Order" }; /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> private static List<int> _digits = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> private static Country country = new Country() { Name = "Iceland", Area = 102775, Population = 332529 }; private MyClass() { } /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> private void MethodNameHere() { /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> string[] moreToolKeys = { "Select A&ll", "Show A&ll", "Snapshot", "&Summary", "Where Used", "Apply Filter", "Add To Order" }; /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> List<int> digits = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> var country = new Country() { Name = "Iceland", Area = 102775, Population = 332529 }; } } class Country { public string Name { get; set; } public int Area { get; set; } public int Population { get; set; } } }

                                  Here is what it looks like after Code Clean up - the COUNTRY object one looks correct, the other two are wrong. (again the text in the methods is way over to the right, just wrapped in this post).

                                  [C#]
                                  namespace MyNameSpace { internal class Country { public int Area { get; set; } public string Name { get; set; } public int Population { get; set; } } internal class MyClass { /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> private static readonly string[] _acceptedToolKeys = { "&Unselect All", "Consolidate", "Single", "Select A&ll", "Show A&ll", "Snapshot", "&Summary", "Where Used", "Apply Filter", "Add To Order" }; /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> private static List<int> _digits = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> private static Country country = new Country() { Name = "Iceland", Area = 102775, Population = 332529 }; private MyClass() { } /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> private void MethodNameHere() { /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> string[] moreToolKeys = { "Select A&ll", "Show A&ll", "Snapshot", "&Summary", "Where Used", "Apply Filter", "Add To Order" }; /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> var digits = new List<int> { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; /// <summary> /// This should be moved to check a flag within ascforms, as the use of the names here restricts internationalisation and is clumsy /// </summary> var country = new Country() { Name = "Iceland", Area = 102775, Population = 332529 }; } } }

                                  Hope this helps.
                                  Alan

                                • Alan Middleton999 06.29.2017

                                  Another quick update, I've noticed on the Object Initializer (the country example above) no matter what the AlignBy is set to, its always in the same location when wrapped, it also seems to ignore the Indent by values and looks like the above examples.

                                  Hope this helps, for now, I'll have to turn these 3 options off.

                                • Alex Eg (DevExpress) 06.30.2017

                                  Hi Alan,
                                  Thank you for testing the Formatting feature. Your feedback is very valuable. I have reproduced the described issues and we are working on them.

                                • Alan Middleton999 06.30.2017

                                  Hi Alex,

                                  Excellent news, glad you could reproduce the issue :)

                                • Alan Middleton999 06.30.2017

                                  Wow, fixed already!!! You guys are super quick! Thanks.

                                • Alex Z (DevExpress) 07.03.2017

                                  Alan,

                                  Please download the attached hotfix and let us know how it works for you.

                                • Alan Middleton999 07.03.2017

                                  Excellent, thanks, will check later today for you.

                                • Alan Middleton999 07.04.2017

                                  Hi Alex.

                                  Apologies for the delay in replying, I've not had the time to test this until now.

                                  The Array & Collection formatting seems to work as it should, can't see anything wrong with them, however there is still an issue with the Object Initialiser formatting. The "Align By" field doesn't make any difference to the object format - it's always formatted by Declaration - when set to Declaration name the code is not indented as it is on the other 2 types (array/collection).

                                  Also for the Object Formatting - If I put the Wrap Separation to wrap BEFORE it looks like this: It seems to be putting a New line after the comma

                                  Looking at the example you have on the options it looks like this (align by Declaration Name, wrap before separator):

                                  [C#]
                                  var country = new Country() { Name = "Iceland" , Area = 102775 , Population = 332529 };

                                  but it actually formats like this:

                                  [C#]
                                  private static Country country = new Country() { Name = "Iceland" , Area = 102775 , Population = 332529 };

                                  Still left aligned (declaration), but the commas in this case seem to be indented. Something still strange on the Object formatting... However for me - the default formatting is fine (declaration and comma after the text).

                                  Hope this helps.

                                • Alan Middleton999 07.04.2017

                                  Hi Alex,

                                  Just spotted something else with the formatting, but not sure if you want to split this off into a different ticket or not.

                                  I have the following bit of code:

                                  [C#]
                                  FormUtils.ControlInvokeActionAsync(textBoxBlendHeaderID, () => { textBoxBlendHeaderID.Focus(); });

                                  Every time I press the code clean up button the bottom 3 lines of the above code gets indented by ONE SPACE

                                  After one press:

                                  [C#]
                                  FormUtils.ControlInvokeActionAsync(textBoxBlendHeaderID, () => { textBoxBlendHeaderID.Focus(); });

                                  After pressing 15 times:

                                  [C#]
                                  FormUtils.ControlInvokeActionAsync(textBoxBlendHeaderID, () => { textBoxBlendHeaderID.Focus(); });

                                  I have found that this issue stops and doesn't happen if I UNTICK the "Parameters" formatting wrapping option. So only when this is ticked it does the above.

                                  My settings for Parameters are currently;

                                  Tolerance : 0  and No wrap at all

                                  Further testing shows if I set Wrap Open Paren to NO Wrap or "Wrap if long/multiline) then the problem happens, if set to wrap then it doesn't happen.

                                  (Please move this to a new ticket if you wish).

                                • Alex Z (DevExpress) 07.04.2017

                                  Alan,

                                  Thank you, I have managed to replicate this issue and we are going to work on fixing it.
                                  Please give us some time.
                                  I have created separate ticket on your behalf: Formatting - lambda expression is incorrectly indented

                                1 Solution

                                Creation Date Importance Sort by

                                Fixed: