Hello DevExpress Team.
We use CodeRush in our team and have located a small problem with the code cleanup.
Given we have the following code:
Example 1:
C# /// <summary>
/// Some comment.
/// </summary>
#pragma warning disable CS0618 // Reason: Legacy code
public class AClass : AnObsoleteClass
#pragma warning restore CS0618
Everything is fine here, we want the indentation of the comment to be on the same level as the class it belongs to. Sadly, if we run the cleanup now, the following happens:
Example 2:
C# /// <summary>
/// Some comment.
/// </summary>
#pragma warning disable CS0618 // Reason: Legacy code
public class AClass : AnObsoleteClass
#pragma warning restore CS0618
The second and third line are indented to match the pragma now. New cleanup-runs don't change the code further.
If we remove the indentation on the first line too:
Example 3:
C#/// <summary>
/// Some comment.
/// </summary>
#pragma warning disable CS0618 // Reason: Legacy code
public class AClass : AnObsoleteClass
#pragma warning restore CS0618
And run code cleanup now, it is formatted back to match example 1, before the next run of cleanup formats the code to example 2.
The expected results would be:
- Code cleanup on example 1 doesn't change anything.
- Code cleanup on example 2 changes the code to example 1.
- Code cleanup on example 3 changes the code to example 1. (This is given at the moment)
Could you please look into this?
Thanks a lot and have a nice day,
Michael
Hi Michael,
Thank you for your report. I have reproduced this issue locally. We need to research the possibility of fixing it and will then inform you about our results.
As a workaround I recommend that you change your code like this:
#pragma warning disable CS0618 // Reason: Legacy code /// <summary> /// Some comment. /// </summary> public class AClass : AnObsoleteClass { } #pragma warning restore CS0618
Hi Andrew,
thanks for the fast answer and your help!
I'm looking forward to the result of your research.
Have a nice weekend,
Michael
Hi Michael,
We are here to help you. We will definitely inform you about our results.
Have a nice weekend too.