Skip to content

[NetTestingE2E][Regression] Error "The library hostfxr.dll was found..." will throw when executing "dotnet test --arch x86 --diag:log1.txt". #49436

Open
@v-yifengmiao

Description

@v-yifengmiao

Notes:

1.This issue doesn't repro on 10.0.100-preview.5.25263.104.
2.Repro VM: 172.16.195.106

Repro steps:

  1. On Win 10 22H2 x64 VM:
    2.Install dotnet-sdk-10.0.100-preview.6.25316.103-win-x64.exe & dotnet-sdk-10.0.100-preview.6.25316.103-win-x86.exe
  2. Launch Powershell and execute below commads:

mkdir c:\hltest\xunit2
dotnet new xunit
dotnet restore
dotnet build
dotnet test --arch x86 --diag:log2.txt

Expected Result:

The command will run successfully.

Actual Result:

Test runs aborted.

Image

Logs:

PS C:\hltest\xunit2> dotnet test --arch x86 --diag:log2.txt
Restore complete (0.8s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
xunit2 succeeded with 1 warning(s) (0.8s) → bin\Debug\net10.0\win-x86\xunit2.dll
C:\hltest\xunit2\UnitTest1.cs(18,21): warning CS8602: Dereference of a possibly null reference.
Logging Vstest Diagnostics in file: C:\hltest\xunit2\log1.txt
Failed to load the dll from [C:\Program Files\dotnet\host\fxr\10.0.0-preview.6.25316.103\hostfxr.dll], HRESULT: 0x800700C1
The library hostfxr.dll was found, but loading it from C:\Program Files\dotnet\host\fxr\10.0.0-preview.6.25316.103\hostfxr.dll failed

  • Installing .NET prerequisites might help resolve this problem.
    https://go.microsoft.com/fwlink/?linkid=798306
    Testhost process for source(s) 'C:\hltest\xunit2\bin\Debug\net10.0\win-x86\xunit2.dll' exited with error: Failed to load the dll from [C:\Program Files\dotnet\host\fxr\10.0.0-preview.6.25316.103\hostfxr.dll], HRESULT: 0x800700C1
    The library hostfxr.dll was found, but loading it from C:\Program Files\dotnet\host\fxr\10.0.0-preview.6.25316.103\hostfxr.dll failed
  • Installing .NET prerequisites might help resolve this problem.
    https://go.microsoft.com/fwlink/?linkid=798306
    . Please check the diagnostic logs for more information.
    xunit2 test failed with 1 error(s) (0.8s)
    C:\hltest\xunit2\bin\Debug\net10.0\win-x86\xunit2.dll : error TESTRUNABORT: Test Run Aborted.

Build failed with 1 error(s) and 1 warning(s) in 3.1s

Log2.txt: Detailed info please refer to attached file:
Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
at System.Reflection.RuntimeModule.GetDefinedTypes()
at System.Reflection.RuntimeModule.GetTypes()
at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginDiscoverer.GetTestExtensionsFromAssembly[TPluginInfo,TExtension](Assembly assembly, Dictionary`2 pluginInfos, String filePath) in D:\a_work\1\s\src\vstest\src\Microsoft.TestPlatform.Common\ExtensionFramework\TestPluginDiscoverer.cs:line 159
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'Microsoft.Bcl.AsyncInterfaces, Culture=neutral, PublicKeyToken=null'
at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginCache.CurrentDomainAssemblyResolve(Object sender, AssemblyResolveEventArgs args) in D:\a_work\1\s\src\vstest\src\Microsoft.TestPlatform.Common\ExtensionFramework\TestPluginCache.cs:line 514
at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
TpTrace Warning: 0 : 15176, 2, 2025/06/17, 02:51:05.822, 56111809314, vstest.console.dll, LoaderExceptions: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Bcl.AsyncInterfaces, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'Microsoft.Bcl.AsyncInterfaces, Culture=neutral, PublicKeyToken=null'
at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginCache.CurrentDomainAssemblyResolve(Object sender, AssemblyResolveEventArgs args) in D:\a_work\1\s\src\vstest\src\Microsoft.TestPlatform.Common\ExtensionFramework\TestPluginCache.cs:line 514
at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)

dotnet --info:

PS C:\Windows\system32> dotnet --info
.NET SDK:
Version: 10.0.100-preview.6.25316.103
Commit: 20343176cf
Workload version: 10.0.100-manifests.dd8061fd
MSBuild version: 17.15.0-preview-25316-103+20343176c

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.100-preview.6.25316.103\

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
Workloads are configured to install and update using workload versions, but none were found. Run "dotnet workload restore" to install a workload version.

Host:
Version: 10.0.0-preview.6.25316.103
Architecture: x64
Commit: 20343176cf

.NET SDKs installed:
10.0.100-preview.6.25316.103 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.0-preview.6.25316.103 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-preview.6.25316.103 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0-preview.6.25316.103 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

&'C:\Program Files (x86)\dotnet\dotnet.exe' --info:

PS C:\Windows\system32> & 'C:\Program Files (x86)\dotnet\dotnet.exe' --info
.NET SDK:
Version: 10.0.100-preview.6.25316.103
Commit: 20343176cf
Workload version: 10.0.100-manifests.dd8061fd
MSBuild version: 17.15.0-preview-25316-103+20343176c

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x86
Base Path: C:\Program Files (x86)\dotnet\sdk\10.0.100-preview.6.25316.103\

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
Workloads are configured to install and update using workload versions, but none were found. Run "dotnet workload restore" to install a workload version.

Host:
Version: 10.0.0-preview.6.25316.103
Architecture: x86
Commit: 20343176cf

.NET SDKs installed:
10.0.100-preview.6.25316.103 [C:\Program Files (x86)\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 10.0.0-preview.6.25316.103 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 10.0.0-preview.6.25316.103 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 10.0.0-preview.6.25316.103 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
x64 [C:\Program Files\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

log2.txt

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions