Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to Load RunSettings File #284

Open
kakins opened this issue Aug 17, 2022 · 3 comments
Open

Failed to Load RunSettings File #284

kakins opened this issue Aug 17, 2022 · 3 comments

Comments

@kakins
Copy link

kakins commented Aug 17, 2022

Installed product versions

  • Visual Studio: 2022 Professional
  • This extension: 1.1.180

Description

I noticed that occasionally unit tests would just fail to run, even after executing via the VS UI. I then noticed an exception being thrown in the output window...

System.InvalidOperationException: Failed to load RunSettings file: 'my-test-project-path\bin\Debug\net6.0\fine-code-coverage\coverage-tool-output\KitchenIntegrations.Configuration.IntegrationStatus.UnitTests-fcc-mscodecoverage-generated.runsettings'. Please check if the file exists and is valid.
   at Microsoft.VisualStudio.TestWindow.Controller.RunsettingsProvider.GenerateTestRunSettings(RunSettingConfigurationInfoState infoState, String runSettingsFilePath, IUserRunSettings runsettings, IEnumerable`1 runSettingsServices, IEnumerable`1 customSettingsImporters, RequestConfiguration requestConfiguration, ITestWindowTelemetry telemetryService)
   at Microsoft.VisualStudio.TestWindow.Core.Client.ContainerRunSettingsProvider.<GetRunConfigSettingsMapAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.TestWindow.Core.Client.ContainerRunSettingsProvider.<GetRunSelectedSettingsMapAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.TestWindow.Controller.TestRunRequest.<PerformRunAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.TestWindow.Logging.ILoggerExtensions.<CallWithCatchAsync>d__11`1.MoveNext()

Steps to recreate

image

Current behavior

Will sometimes cause test to fail to run in visual studio

Expected behavior

Allow tests to run in visual studio

@tonyhallett
Copy link
Collaborator

For Ms code coverage FCC will generate a runsettings file and add an msbuild property to the test proj file.
When completed it attempts to delete this build property.

Please can you check your proj file to see if the RunSettingsFilePath property is present or not.

@kakins
Copy link
Author

kakins commented Dec 6, 2022

@tonyhallett Sorry for the severely delayed response on this. Yes I see where the entry is made in the csproj file, and it attempts to do this with every test run it seems. However, the problem is still intermittent.

Before the failure, it actually creates the csproj entry, and doesn't delete it because an exception is thrown. Then the next time I run my tests, they execute and afterwards the csproj entry is deleted. So every other test run fails for me.

It's almost like the tests initially try to run before the csproj is updated.

Also, I should note this appears to be happening with some projects and not others, which is very strange. Both unit tests projects are .NET 6 with the same packages installed.

@bb-avi
Copy link

bb-avi commented Oct 5, 2023

FYI: I've found this can occur when the file path to the generated *.runsettings file is longer than 260 characters. This isn't too difficult to make happen since FCC requires at least 96? characters for its naming scheme:
bin\debug\net7.0\fine-code-coverage\coverage-tool-output\<assembly-name>-fcc-mscodecoverage-generated.runsettings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants