-
-
Notifications
You must be signed in to change notification settings - Fork 110
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description
The TUNU0001 NUnit migration code fixer corrupts code when a #region directive follows a single-line comment. The comment and #region directive are merged onto the same line, causing CS1028 syntax errors.
Reproduction Steps
- Create a test file with this pattern:
using NUnit.Framework;
[TestFixture]
public class MyTests
{
// Some comment
#region My Region
[Test]
public void TestMethod()
{
}
#endregion
}- Run the TUNU0001 code fixer
Expected Behavior
The code should remain valid with proper formatting:
public class MyTests
{
// Some comment
#region My Region
[Test]
public async Task TestMethod()
{
}
#endregion
}Actual Behavior
The comment and #region are merged into a single line:
public class MyTests
{
// Some comment #region My Region
[Test]
public async Task TestMethod()
{
}
#endregion
}This causes:
error CS1028: Unexpected preprocessor directive
Environment
- TUnit version: 1.11.64
- .NET SDK: 10.0.102
Tests should be added to verify the code fixer correctly handles #region directives near comments.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working