ReSharper ignoring/reading wrong runsettings file
After installing Visual Studio 2022 and updating our automation framework to .NET 6. I am finding that ReSharper is ignoring the runsettings file selected from the VS menu ( Test > Configure Run Settings > Select Solution Wide runsettings File):
TestContext.Properties collection when debugging test from VS TestExplorer (MSTest Runner):
TestContext.Properties collection when debugging test from ReSharper Test Runner:
In my case, because the values are not read from the runsettings file, the test fails with a 'System.ArgumentNullException: Value cannot be null.' error before completing test initialization. As a workaround, I can change the option to 'Use specific test settings file' but this causes a slight different issue because if you change the option back to 'User .runsettings/.testsettings selected in VS UI' then despite any seleciton from VS UI, ReSharper continues to use the file specifically selected. Finally, this issue does not occur when running the same test/code in VS 2019.
.runsettings file:
<?xml version="1.0" encoding="utf-8" ?>
<RunSettings>
<RunConfiguration>
<ResultsDirectory>.\TestResults</ResultsDirectory>
<TreatNoTestsAsError>true</TreatNoTestsAsError>
</RunConfiguration>
<TestRunParameters>
<Parameter name="archiveResults" value="false" />
<Parameter name="environment" value="tst" />
<Parameter name="platform" value="2" />
</TestRunParameters>
</RunSettings>
Versions:
• Microsoft Visual Studio Professional 2022 (64-bit) v 17.1.2
• NET 6.0.3
• ReSharper 2021.3.4 Build 213.0.20220322.123539 built on 2022-03-22
• MSTest.TestAdapter v 2.2.8
• MSTest.TestFramework v 2.2.8
Please sign in to leave a comment.
Hello @Mes6073,
The behavior you described looks like RSRP-487544.
The fix should be included in the RC build available in terms of EAP.
Please let us know if the issue still reproduces. Have a nice day!
Thanks for the update Alexander. By chance would ths fix be available in v2022.1 which appears to have been released today?
For the history: the fix of RSRP-487544 is available in 2022.1.1
Alexander Nikolaenko This fix does not work if the IDE is set to Auto Detect runsettings Files
Thank you for reporting the issue, I have created a corresponding record on our bug tracker: https://youtrack.jetbrains.com/issue/RSRP-491424/No-runsettings-file-is-used-by-R-test-runner-when-Auto-Detect-runsettings-files-is-set-in-VS. The issue is handled by a dedicated developer there. Please upvote it and click on Watch to monitor the progress of the issue.
Let me know if you have other questions. Have a good day!