covrun64.dll was not found
ℹ️
Summary and workarounds for the issue are below: https://github.com/dotnet/sdk/issues/50950#issuecomment-3410388878
Describe the bug
When I run my .net Framework 4.8 NUnit tests with codecoverage on the commandline with .net 10 rc1 SDK Windows x64 installed, I get two times a message box with the title "dotnet.exe - System Error" and message "The code execution cannot proceed because covrun64.dll was not found. Reinstalling the program may fix this problem.
PS D:\Projects\CovRun64Repro\CovRun64Repro> dotnet test --collect:"Code Coverage"
Restore complete (0.2s)
info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
CovRun64Repro succeeded (0.1s) → bin\Debug\net48\CovRun64Repro.dll
NUnit Adapter 5.1.0.0: Test execution started
CovRun64Repro Testing (39.7s)
The command does not continue until I press OK on the message box.
PS D:\Projects\CovRun64Repro\CovRun64Repro> dotnet test --collect:"Code Coverage"
Restore complete (0.2s)
info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
CovRun64Repro succeeded (0.1s) → bin\Debug\net48\CovRun64Repro.dll
NUnit Adapter 5.1.0.0: Test execution started
Running all tests in D:\Projects\CovRun64Repro\CovRun64Repro\bin\Debug\net48\CovRun64Repro.dll
NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
NUnit Adapter 5.1.0.0: Test execution complete
CovRun64Repro test succeeded (143.3s)
Test summary: total: 1; failed: 0; succeeded: 1; skipped: 0; duration: 143.3s
Build succeeded in 143.9s
Attachments:
D:\Projects\CovRun64Repro\CovRun64Repro\TestResults\042aee28-3b04-4bc3-a9eb-fc430830c1ef\xxxxxx_xxxxxxxxx_2025-09-21.18_39_19.coverage
Expected Bahavior
The test should run with code coverage enabled without any system error or message box interruptions.
Regression
This issue does not occur when using the .NET 9.0.305 SDK. It only appears after installing the .NET 10.0.100-rc.1.25451.107 SDK. After installation of .net 10 rc1 the problem also appears when I try to use 9.0.305 explicitly with a global.json.
{
"sdk": {
"version": "9.0.305"
}
}
To Reproduce
Run dotnet test --collect:"Code Coverage" for the following test project:
CovRun64Repro.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="NUnit" Version="4.4.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.10.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter" Version="5.1.0" />
</ItemGroup>
</Project>
Tests.cs:
using NUnit.Framework;
public class Tests
{
[Test]
public void Test1()
{
Assert.Pass();
}
}
Further technical details
details of dotnet --info
.NET SDK:
Version: 10.0.100-rc.1.25451.107
Commit: 2db1f5ee2b
Workload version: 10.0.100-manifests.0e2d47c4
MSBuild version: 17.15.0-preview-25451-107+2db1f5ee2
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.100-rc.1.25451.107\
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.0-rc.1.25451.107
Architecture: x64
Commit: 2db1f5ee2b
.NET SDKs installed:
9.0.305 [C:\Program Files\dotnet\sdk]
10.0.100-rc.1.25451.107 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-rc.1.25451.107 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-rc.1.25451.107 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 9.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0-rc.1.25451.107 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
- I run from command line
- I first discovered the problem after I had installed VisualStudio 2026 Insider Pro (first the release that had no version number in the installer, then updated to version 11012.119). I then uninstalled VisualStudio 2026 and .net 10 rc1. Did not solve the Problem and left me with a broken dotnet setup.
- Because of this I removed also Visual Studio 2022 pro (17.14.15), .net 9.0.305 SDK and all dotnet runtime I had installed.
- reboot
- After the reboot I just installed .net 9.0.305 SDK. With this SDK the command runs without the message box.
- I then installed .net 10.0.100-rc.1.25451.107 SDK again and the message box appeared again.
FYI @nohwnd and @fhnaseer
I found a workaround.
Today I wondered where dotnet test is looking for the covrun64.dll.
I used sysinternals procmon and it listed three occurrences of covrun64.dll. One successful Load Image of the dll from the nuget package and two attempts of CreateFile in C:\Windows\System32\covrun64.dll.
| Time of Day | Process Name | PID | Operation | Path | Result | Detail |
|---|---|---|---|---|---|---|
| 11:55:31.9855039 | testhost.net48.exe | 20924 | Load Image | D:\.nuget\packages\microsoft.codecoverage\17.14.1\build\netstandard2.0\CodeCoverage\amd64\covrun64.dll | SUCCESS | Image Base: 0x7ffd941f0000, Image Size: 0x176000 |
| 11:55:32.5613482 | dotnet.exe | 21120 | CreateFile | C:\Windows\System32\covrun64.dll | NAME NOT FOUND | Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a |
| 11:55:33.2528692 | dotnet.exe | 6276 | CreateFile | C:\Windows\System32\covrun64.dll | NAME NOT FOUND | Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a |
If I change the <TargetFramework> from net48 to net9.0 or net10.0 procmon only lists the Load Image Operations.
As a workaround I copied the covrun64.dll from the nuget to c:\windows\system32. With a copy of the DLL in the systm32 folder the dotnet test --collect:"Code Coverage" runs without the message box popping up.
Tested again today with .net 10 rc2 SDK (10.0.100-rc.2.25502.107) and still have the message boxes popping up. Also updated to Windows 11 25H2, .net 9 SDK 9.0.306 and updated the packages Microsoft.NET.Test.Sdk to 18.0.0 and NUnit3TestAdapter to 5.2.0.
Test procedure:
- removed all .net sdks and runtimes
- deleted remaining dotnet folders in C:\Program Files\ and C:\Program Files (x86)\
- removed remaining registry branches HKLM:\SOFTWARE\dotnet and HKLM:\SOFTWARE\WOW6432Node\dotnet
- installed .net 9.0.306 SDK again
- run
dotnet test --collect:"Code Coverage"and it worked without the message boxes - installed . net 10.0.100-rc.2.25502.107 SDK
- run
dotnet test --collect:"Code Coverage"and the message boxes appear again.
FYI @engyebrahim as well.
Yesterday I cloned the SDK and built the commit b55224f3933be4502524281bcb30729b67030d39 Mon Oct 13 09:12:46 2025 +0800
run the eng\dogfood.cmd
Within the dogfood session the message boxes do not appear. Even after I installed rc2.
(dogfood) PS D:\Projects\CovRun64Repro> dotnet --info
.NET SDK:
Version: 10.0.100-rc.1.25420.111
Commit: 6218c7cdc7
Workload version: 10.0.100-manifests.789081f9
MSBuild version: 17.15.0-preview-25420-111+6218c7cdc
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: D:\Projects\sdk\.dotnet\sdk\10.0.100-rc.1.25420.111\
.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.0-rc.1.25479.108
Architecture: x64
Commit: 6befeceeae
.NET SDKs installed:
10.0.100-rc.1.25420.111 [D:\Projects\sdk\.dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.0-rc.1.25420.111 [D:\Projects\sdk\.dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-rc.1.25479.108 [D:\Projects\sdk\.dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0 [D:\Projects\sdk\.dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [D:\Projects\sdk\.dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0 [D:\Projects\sdk\.dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [D:\Projects\sdk\.dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-rc.1.25420.111 [D:\Projects\sdk\.dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-rc.1.25479.108 [D:\Projects\sdk\.dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 10.0.0-rc.1.25420.111 [D:\Projects\sdk\.dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
None
Environment variables:
DOTNET_ADD_GLOBAL_TOOLS_TO_PATH [0]
DOTNET_INSTALL_DIR [D:\Projects\sdk\.dotnet]
DOTNET_MSBUILD_SDK_RESOLVER_SDKS_DIR [D:\Projects\sdk\artifacts\bin\redist\Debug\dotnet\sdk\10.0.100-dev\Sdks]
DOTNET_MULTILEVEL_LOOKUP [0]
DOTNET_NOLOGO [1]
DOTNET_ROOT [D:\Projects\sdk\artifacts\bin\redist\Debug\dotnet]
DOTNET_SYSTEM_NET_SECURITY_NOREVOCATIONCHECKBYDEFAULT [True]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
I've grabbed procmon and procexp, and saw that there is process called by NUnit that does
dotnet.exe "dotnet" --list-runtimes
This is happening under .NET Framework testhost and I have no idea about the purpose.
But my best guess is that CodeCoverage does not expect a .NET process to startup under .NET Framework and some assumption that was correct before is broken.
This is the stack trace in nunit:
This is what is being called:
This is stack trace from procmon on the entry that looks for covrun, I am assuming this means that we are trying to load a profiler (as instructed by env variables), and covrun is that profiler.
the env variables set on the process look something like this (not complete) :
_MSBUILDTLENABLED 1
ALLUSERSPROFILE C:\ProgramData
APPDATA C:\Users\jajares\AppData\Roaming
ChocolateyInstall C:\ProgramData\chocolatey
ChocolateyLastPathUpdate 133105821120512246
ChocolateyToolsLocation C:\tools
CODE_COVERAGE_DATA_PREFIX CodeCoverage.0adbc574-f191-437e-8ced-e92ae2ea7112.
CODE_COVERAGE_FLAGS 5
CODE_COVERAGE_PIPE_COUNT 1
CODE_COVERAGE_SESSION_NAME 0adbc574-f191-437e-8ced-e92ae2ea7112
COLUMNS 120
CommonProgramFiles C:\Program Files\Common Files
CommonProgramFiles(x86) C:\Program Files (x86)\Common Files
CommonProgramW6432 C:\Program Files\Common Files
COMPUTERNAME RDESKTOP
ComSpec C:\WINDOWS\system32\cmd.exe
COR_ENABLE_PROFILING 1
COR_PROFILER {324F817A-7420-4E6D-B3C1-143FBED6D855}
COR_PROFILER_PATH_32 C:\Users\jajares\.nuget\packages\microsoft.codecoverage\17.13.0\build\netstandard2.0\x86\MicrosoftInstrumentationEngine_x86.dll
COR_PROFILER_PATH_64 C:\Users\jajares\.nuget\packages\microsoft.codecoverage\17.13.0\build\netstandard2.0\x64\MicrosoftInstrumentationEngine_x64.dll
COR_PROFILER_PATH_ARM64 C:\Users\jajares\.nuget\packages\microsoft.codecoverage\17.13.0\build\netstandard2.0\arm64\MicrosoftInstrumentationEngine_arm64.dll
CORECLR_ENABLE_PROFILING 1
CORECLR_PROFILER {324F817A-7420-4E6D-B3C1-143FBED6D855}
CORECLR_PROFILER_PATH_32 C:\Users\jajares\.nuget\packages\microsoft.codecoverage\17.13.0\build\netstandard2.0\x86\MicrosoftInstrumentationEngine_x86.dll
CORECLR_PROFILER_PATH_64 C:\Users\jajares\.nuget\packages\microsoft.codecoverage\17.13.0\build\netstandard2.0\x64\MicrosoftInstrumentationEngine_x64.dll
CORECLR_PROFILER_PATH_ARM64 C:\Users\jajares\.nuget\packages\microsoft.codecoverage\17.13.0\build\netstandard2.0\arm64\MicrosoftInstrumentationEngine_arm64.dll
DOTNET_CLI_TELEMETRY_SESSIONID 3bf2d414-77da-4728-8962-d021793ebea1
DOTNET_HOST_PATH S:\p\vstest\.dotnet\dotnet.exe
DOTNET_MULTILEVEL_LOOKUP 0
DOTNET_ROLL_FORWARD_TO_PRERELEASE 1
DOTNET_ROOT S:\p\vstest\.dotnet
DriverData C:\Windows\System32\Drivers\DriverData
I did not find any explicit place where we would set C:\windows\system32, so I just assume it is some default. Also running with the same environment did not crash the process.
I was able to repro this with much older versions of nunit and much older version of microsoft.net.test.sdk:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="NUnit" Version="4.3.2" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
</ItemGroup>
</Project>
dotnet test --collect:"Code Coverage"
Tagging @OsirisTerje in case there is something in nunit that should not be happening in .NET Framework.
and @jakubch1 to possibly provide some hints before we go digging into code coverage source.
So far we did not find the root cause, but it is not limited to nunit, I can see it with xunit as well.
We are able to repro with different tfms as long as the latest net10 sdk is used to run.
When build with net10 (targetting net9), and run with net9 it does not reproduce.
Potentially regressed by https://github.com/dotnet/runtime/pull/112359 cc @jkotas @AustinWise
Workaround 1: Use runsettings that disable the dynamic native instrumentation that injects covrun64 to child process.
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Configuration>
<CodeCoverage>
<EnableDynamicNativeInstrumentation>false</EnableDynamicNativeInstrumentation>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
dotnet test --collect:"Code Coverage" --no-build --settings settings.runsettings
Workaround 2: Use dotnet-coverage tool to collect coverage (this tool disables the native instrumentation by default, unless your project has C++ components you should not need it anyway):
dotnet tool install -g dotnet-coverage
dotnet-coverage collect "dotnet test"
Summary of the root cause:
Root cause:
DynamicNativeInstrumentation injects covrun64.dll into process, by creating a process startup detour. Starting the process as suspended, and injecting covrun64.dll. It also sets PATH to point at the locations in which covrun64.dll is present.
Change in runtime https://github.com/dotnet/runtime/pull/112359 prevents loading from any other place than C:\Windows\System32. So that is the only place where we look and we fail to load the dll. Resulting in process crash.
Who it affects:
Affects all users that use dotnet test --collect:"Code Coverage" and that don't disable <EnableDynamicNativeInstrumentation> via runsettings.
The bug is most easily observed in:
- xunit3 - because it starts new process to run the tests in isolation - this child process crashes
- nunit4 - for some reason
dotnet --list-runtimesis called - this child process crashes
But any test that starts a net10 child process is affected. The injection of covrun64 will fail for that child process and it will crash, even when running under mstest.
Any such process (marked in red) running under testhost (or dotnet.exe that acts as testhost), will crash:
Next steps:
We will investigate with runtime, to see if we can work around the issue in any way, or revert the change.
We are considering setting EnableDynamicNativeInstrumentation to false by default, because it is already false in dotnet-coverage, and it is recommended to be set to false, unless users have real need to instrument c++ code (which is rarely the case).
Change in runtime https://github.com/dotnet/runtime/pull/112359 prevents loading from any other place than C:\Windows\System32.
This change affects .NET runtime binaries only (coreclr.dll, etc.). It does not affect other binaries in the process.
I do not understand how this change breaks covrun64.dll.
@jkotas What I did was:
dotnet clean; dotnet build -p:AppHostSourcePath="C:\Users\ygerges\.nuget\packages\microsoft.netcore.app.host.win-x64\10.0.0-preview.2.25111.16\runtimes\win-x64\native\apphost.exe"; dotnet test --no-build --collect "Code Coverage"
dotnet clean; dotnet build -p:AppHostSourcePath="C:\Users\ygerges\.nuget\packages\microsoft.netcore.app.host.win-x64\10.0.0-preview.2.25111.19\runtimes\win-x64\native\apphost.exe"; dotnet test --no-build --collect "Code Coverage"
This was the closest range of available apphosts to demonstrate where the regression is from. These two versions pointed out to this commit range https://github.com/dotnet/runtime/compare/93dd79997031a32e4034825bd671990dbc1e4ceb...4008de1af1ca0cd6f7e949278b172ff1752a1652
I do believe you that this change broke covrun64.dll somehow.
I do not understand the mechanics of the break. It sounds like covrun64.dll is somehow hacking into binaries that it has no control over and that it has no business of hacking into, and some of the assumptions that the hack is based on were broken.
For search engines: When the process crashes it exits with -1073741515 exit code.
@nohwnd I'm unable to repro this issue for Nunit Test project for both VS18.0 Insider 5(11121.172) and VS18.0 Insiders 6 builds (11123.170) which contains 10.0.100-rc.2.25502.107. VS Installer: VS Enterprise, VS Professional
Test Screenshot:
VS18.0 I5 (VS Enterprise)
VS18.0 I5 (VS Professional):
VS18.0 I5 (VS Enterprise):
VS18.0 I6 (VS Professional):
The pop-up does not show up in developer command prompt for VS (not sure why), but if you use normal cmd, or powershell in windows terminal you should be able to see the error.
Depending on which version of dotnet you are running you might also need these runsettings:
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage" >
<Configuration>
<CodeCoverage>
<EnableDynamicNativeInstrumentation>true</EnableDynamicNativeInstrumentation>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
We've inserted fix into dotnet to disable the dynamic native instrumentation by default just before the final version, and these settings re-enable it.
We have a fix for the underlying issue as well, which we were able to put into VS (so it won't fail when you do vstest.console.exe), and we will ship a fixed package for users of dotnet test as well.
Here is a better repro that will check the exit code of the child process and will report error when it is not 0.
dotnet build ; dotnet test --no-build --settings .\r.runsettings --collect:"Code Coverage"
@nohwnd Thanks. I can repro this issue now by using normal cmd for both VS18.0 Insider 5(11121.172) and VS18.0 Insiders 6 build (11123.170) which contains 10.0.100-rc.2.25502.107.
Repro on VS18.0 Insider 5(11121.172)
Repro on VS18.0 Insiders 6 build (11123.170) which contains 10.0.100-rc.2.25502.107.
For ProfilerCrash.zip, we get the below errors “System.ComponentModel.Win32Exception: An error occurred trying to start process...” when executing below command lines:
dotnet build ; dotnet test --no-build --settings .\r.runsettings --collect:"Code Coverage"
C:\Users\v-hozha1>cd C:\Users\v-hozha1\Downloads\ProfilerCrash
C:\Users\v-hozha1\Downloads\ProfilerCrash>dotnet build Restore complete (3.6s) info NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy TestProject1 net48 succeeded (4.8s) → TestProject1\bin\Debug\net48\TestProject1.dll TestProject1 net10.0 succeeded with 1 warning(s) (5.0s) → TestProject1\bin\Debug\net10.0\TestProject1.dll C:\Users\v-hozha1\Downloads\ProfilerCrash\TestProject1\Test1.cs(18,13): warning CS8602: Dereference of a possibly null reference. ConsoleApp1 net10.0 succeeded (6.1s) → ConsoleApp1\bin\Debug\net10.0\ConsoleApp1.dll
Build succeeded with 1 warning(s) in 10.0s
C:\Users\v-hozha1\Downloads\ProfilerCrash>dotnet test --no-build --settings .\r.runsettings --collect:"Code Coverage"
Test Parallelization enabled for C:\Users\v-hozha1\Downloads\ProfilerCrash\TestProject1\bin\Debug\net10.0\TestProject1.dll (Workers: 16, Scope: MethodLevel)
TestProject1 test net10.0 failed with 1 error(s) (2.0s)
C:\Users\v-hozha1\Downloads\ProfilerCrash\TestProject1\Test1.cs(17): error TESTERROR:
TestMethod1 (36ms): Error Message: Test method TestProject1.Test1.TestMethod1 threw exception:
System.ComponentModel.Win32Exception: An error occurred trying to start process 'S:\t\profiler-crash\ProfilerCrash
\ConsoleApp1\bin\Debug\net10.0\ConsoleApp1.exe' with working directory 'C:\Users\v-hozha1\Downloads\ProfilerCrash
TestProject1\bin\Debug\net10.0'. The system cannot find the file specified.
Stack Trace:
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at TestProject1.Test1.TestMethod1() in C:\Users\v-hozha1\Downloads\ProfilerCrash\TestProject1\Test1.cs:line 17
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Test Parallelization enabled for C:\Users\v-hozha1\Downloads\ProfilerCrash\TestProject1\bin\Debug\net48\TestProject1.dll (Workers: 16, Scope: MethodLevel)
TestProject1 test net48 failed with 1 error(s) (2.9s)
C:\Users\v-hozha1\Downloads\ProfilerCrash\TestProject1\Test1.cs(17): error TESTERROR:
TestMethod1 (100ms): Error Message: Test method TestProject1.Test1.TestMethod1 threw exception:
System.ComponentModel.Win32Exception: The system cannot find the file specified
Stack Trace:
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at TestProject1.Test1.TestMethod1() in C:\Users\v-hozha1\Downloads\ProfilerCrash\TestProject1\Test1.cs:line 17
Test summary: total: 2, failed: 2, succeeded: 0, skipped: 0, duration: 2.9s Build failed with 2 error(s) in 3.3s
Attachments: C:\Users\v-hozha1\Downloads\ProfilerCrash\TestProject1\TestResults\5f71f24b-0faa-479f-8607-2ffed9b5c290\v-hozha1_CPC-vhozh-UE8Z2_2025-10-24.17_53_42.coverage
C:\Users\v-hozha1\Downloads\ProfilerCrash>
The repro I've sent you did not use relative paths bethween the projects, that is why it says it cannot find the file specified: Here a fixed repro.
Using it with the runsettings that force dynamic native instrumentation will repro the issue on dotnet test, using it without runsettings should not repro the issue on dotnet test (becasue we disabled dynamic instrumentation by default).
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<DataCollectionRunSettings>
<DataCollectors>
<DataCollector friendlyName="Code Coverage" >
<Configuration>
<CodeCoverage>
<EnableDynamicNativeInstrumentation>true</EnableDynamicNativeInstrumentation>
</CodeCoverage>
</Configuration>
</DataCollector>
</DataCollectors>
</DataCollectionRunSettings>
</RunSettings>
Checking the issue for dotnet test:
That said, the fix is in recent RTM, and is not in RC2, so until dotnet SDK is updated in VS you will not be able to validate the fix through the dotnet installation that comes with VS.
You should however be able to validate the fix using the staging candidate of dotnet.
I see you successfully validated here (in the xunit issue): https://github.com/xunit/xunit/issues/3413#issuecomment-3441134733
The same issue was fixed in VS insiders 6, when vstest.console is used. In the screenshot below, insiders 5 has error (red highlight). Then I updated to latest on 18.0 and the error is fixed (green highlight):
dotnet build ; vstest.console TestProject1\bin\Debug\net48\TestProject1.dll --settings:r.runsettings
One thing to note: in VS we were able to inject a completely fixed version of code coverage, so there we can collect dynamic native code coverage (runsettings are used), and not see any crash.
The dynamic instrumentation remains still disabled by default, so if you don't use runsettings you will not get instrumentation for native modules.
If you do use runsettings you will get instrumentation for native modules, and will not see the crash.
We will release updated version of Code Coverage soon to get the same behavior on dotnet test.
@nohwnd Thanks. When run "vstest.console" in normal cmd and PowerShell, we need manually add "C:\Program Files\Microsoft Visual Studio\18\Insiders\Common7\IDE\Extensions\TestPlatform" in Environment Variables. Is it expected?
Now, it works fine with "dotnet build ; vstest.console TestProject1\bin\Debug\net48\TestProject1.dll --settings:r.runsettings" on VS18.0 I6 build. Thanks.
Yes, expected.
My bad for making it confusing. "Normal cmd" was referring to vstest.console, as opposed to "dotnet test". The commandline I've run the code in was the Developer console for the specific version of visual studio that I was testing.
So running either vstest.console ... in the developer console for the given VS
OR
Running