FineCodeCoverage icon indicating copy to clipboard operation
FineCodeCoverage copied to clipboard

Build crash when FCC try to load RunSettings

Open RemiCELLARD opened this issue 6 months ago • 3 comments

Hi,

Installed product versions

  • Visual Studio: 2022 Enterprise (v17.14.8)
  • This extension: 1.1.244
  • Windows 11

Description When a path to a project directory exceeds the 260 character limit on Windows (see : https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry ), the extension is unable to create the folders and files in the solution that are used by Fine Code Coverage. https://stackoverflow.com/questions/79499871/fine-code-coveragefcc-throwing-issue-while-generating-the-report

Steps to recreate

  • Create test unit projet here C:\Projets\MyProj2\src\Libraries\Tools\ArchitectureTools\Tests\Architecture.InfrastructureTools.IntegrationTests
  • Enable RunMsCodeCoverage and do not fill FCCSolutionOutputDirectoryName
  • Run it and see the error at the building step

Current behavior

  • Build crash

Expected behavior

  • Build and execution without error

Side Notes

Building Test Projects
Using automatically detected runsettings file(s). To learn more visit https://aka.ms/vs-runsettings.
System.InvalidOperationException: Failed to load RunSettings file: 'C:\Projets\MyProj2\src\Libraries\Tools\ArchitectureTools\Tests\Architecture.InfrastructureTools.IntegrationTests\bin\Debug\net9.0\fine-code-coverage\coverage-tool-output\Architecture.InfrastructureTools.IntegrationTests-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, ITestWindowVSTelemetry telemetryService)
   at Microsoft.VisualStudio.TestWindow.Core.Client.ContainerRunSettingsProvider.<GetRunAllSettingsMapAsync>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.Controller.DiscoveryOperation.<GetSessionRunsettingsMapAsync>d__19.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.RunOperation.<RunTestsAsync>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.TestWindow.Controller.RunOperation.<RunTestsAsync>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.TestWindow.Controller.RunOperation.<RunTestsAsync>d__22.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.RunOperation.<ExecuteInternalAsync>d__23.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.Operation.<<ExecuteAsync>b__43_0>d.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__14`1.MoveNext()

RemiCELLARD avatar Jul 16 '25 08:07 RemiCELLARD

I'm facing this issue too, hopefully a fix can be found soon.

@tonyhallett

danspyer avatar Aug 18 '25 14:08 danspyer

Found a similar problem as well. Resolved in VS 2022 and VS2026 (insiders) via the following changes.

  1. Enabled Long file support on Windows 11 + Reboot
  2. Added <LongPathsEnabled>true</LongPathsEnabled> to the *.csproj
  3. Removed any RunSettingsFilePath from the *.csproj
  4. Changed the Visual Studio Options -> Fine Code Coverage -> Run MS Code Coverage = NO

I also had my own default.runsettings file that I was using to try and remove Test.csproj code from coverage calculations when executing on Azure DevOps pipelines. It wasn't clear if that was interfering (rabbit hole/time sink).

# Run PowerShell as Administrator to enable long file path support on windows 11.
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
    -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
# Rebooted Windows
<PropertyGroup>
  <TargetFramework>net8.0</TargetFramework>
  <Nullable>enable</Nullable>
  <ImplicitUsings>enable</ImplicitUsings>
  <LongPathsEnabled>true</LongPathsEnabled>
</PropertyGroup>

Jamie-Clayton avatar Sep 30 '25 20:09 Jamie-Clayton

Visual Studio Code Coverage is now available in 2026 Community and Professional editions although I don't know the behaviour of long paths.

tonyhallett avatar Nov 12 '25 15:11 tonyhallett