Hello DevExpress Support!
I experienced a code duplication if I'm saving a file which has invalid formed statements inside.
All comments appearing after the invalid code part will be duplicated.
example:
namespace ConsoleApp7
{
class Program
{
static void Main(string[] args)
{
invalid_code
// comment
Console.WriteLine("Hello World!");
}
}
}
If you save that with code formatting on save from CodeRush enabled the //comment will be duplicated. If you save it again all two lines of comments will be duplicated and so on.
Steps to reproduce:
- Create a new solution with a project (e.g. a .NET Core Console application)
- Go to CodeRush settings and enable under Editor->C#->Formatting->Code Cleanup the option "Format document"
- Copy the code from above or just write your own code where there are comments below an invalid statement
=> result should be that all comments until the next valid statement is duplicated
Yours sincerely,
Gerald
Hi Gerald,
Thank you for the detailed explanation. Our formatting engine is intended to work with valid code and calling it on the wrong syntax can cause unexpected behavior. Please give us some time to research the issue and see if we can fix the issue in this case.