Describe the Issue
When running individual tests or test suites from the Test Explorer in C# Dev Kit, the .runsettings file configured via dotnet.unitTests.runSettingsPath is not passed to the test runner. As a result, TestContext.Parameters is empty and any test that reads parameters from fails with System.InvalidOperationException.
The same project works correctly in:
- Full Visual Studio — runsettings are passed and TestContext.Parameters is populated
- dotnet test via terminal with explicit --settings flag — works as expected
Steps To Reproduce
Steps to Reproduce
- Configure dotnet.unitTests.runSettingsPath in VS Code user settings (or workspace settings) pointing to a valid .runsettings file
- The .runsettings file contains a section, e.g.:
<TestRunParameters>
<Parameter name="Url" value="https://my-app.example.com" />
</TestRunParameters>
-
In test code, read the parameter:
private readonly string _url = TestContext.Parameters["Url"] ?? throw new InvalidOperationException("Required test parameter 'Url' is missing.");
-
Run the test from Test Explorer (click the run button next to the test)
Expected Behavior
The test runner receives the runsettings file. TestContext.Parameters["Url"] returns "https://my-app.example.com".
Environment Information
VS Code | 1.122.1
-- | --
C# Dev Kit | 3.20.199
C# extension | 2.140.8
.NET SDK | 10.0.300
OS | Windows 11
Test framework | NUnit 4.1.0 + NUnit3TestAdapter 4.5.0
Describe the Issue
When running individual tests or test suites from the Test Explorer in C# Dev Kit, the .runsettings file configured via dotnet.unitTests.runSettingsPath is not passed to the test runner. As a result, TestContext.Parameters is empty and any test that reads parameters from fails with System.InvalidOperationException.
The same project works correctly in:
Steps To Reproduce
Steps to Reproduce
In test code, read the parameter:
private readonly string _url = TestContext.Parameters["Url"] ?? throw new InvalidOperationException("Required test parameter 'Url' is missing.");Run the test from Test Explorer (click the run button next to the test)
Expected Behavior
The test runner receives the runsettings file. TestContext.Parameters["Url"] returns "https://my-app.example.com".
Environment Information
VS Code | 1.122.1 -- | -- C# Dev Kit | 3.20.199 C# extension | 2.140.8 .NET SDK | 10.0.300 OS | Windows 11 Test framework | NUnit 4.1.0 + NUnit3TestAdapter 4.5.0