-
-
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 sometimes removes #if preprocessor directives but leaves the corresponding #endif orphaned, causing CS1028 syntax errors.
Reproduction Steps
- Create a test file with conditional compilation:
using NUnit.Framework;
#if FEATURE_ASSEMBLYBUILDER_SAVE
[TestFixture]
public class PersistentProxyBuilderTestCase
{
[SetUp]
public void SetupProxyBuilder()
{
// setup code
}
[Test]
public void SavesOneAssemblyPerProxiedType()
{
Assert.AreEqual(1, 1);
}
}
#endif- Run the TUNU0001 code fixer
Expected Behavior
Either:
- Both
#ifand#endifshould be preserved - Both
#ifand#endifshould be removed
Actual Behavior
The #if directive is removed but #endif remains:
public class PersistentProxyBuilderTestCase
{
[Before(HookType.Test)]
public void SetupProxyBuilder()
{
// setup code
}
[Test]
public async Task SavesOneAssemblyPerProxiedType()
{
await Assert.That(1).IsEqualTo(1);
}
}
#endifThis 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 #if/#endif pairs.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working