question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Testhost.exe does not find '7.0.0-preview.6.22324.4' runtime when running tests

See original GitHub issue

Describe the bug

When running xunit tests using dotnet test the building of the product code and test code completes with the correct SDK version - 7.0.0-preview.6.22324.4.

/cc @marcpopMSFT @mmitche

But when test execution begins, an error is reported:

Testhost processId: 27132 exited with exitcode: -2147450730 error: 'It was not possible to find any compatible framework version The framework ‘Microsoft.NETCore.App’, version ‘7.0.0-preview.6.22324.4’ (x64) was not found.

  • The following frameworks were found: 3.1.20 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 3.1.24 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 3.1.26 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 5.0.11 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 5.0.16 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 5.0.17 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 6.0.5 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 6.0.6 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] You can resolve the problem by installing the specified framework and/or SDK. The specified framework can be found at:
  • https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.0-preview.6.22324.4&arch=x64&rid=win10-x64

I have attached the debug log from the run: diag2.txt

Workaround: Setting DOTNET_ROOT to point to 'C:\Users\adity\AppData\Local\Microsoft\dotnet' fixes the issue.

This has started happening with .NET 7 Preview 6.

To Reproduce

  1. Clone this branch: https://github.com/PowerShell/PowerShell/tree/dotnet_update
  2. From PowerShell -> Import-Module build.psm1 Start-PSBootstrap cd test\xUnit dotnet test

Exceptions (if any)

esthost process exited with error: It was not possible to find any compatible framework version The framework ‘Microsoft.NETCore.App’, version ‘7.0.0-preview.6.22324.4’ (x64) was not found.

  • The following frameworks were found: 3.1.20 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 3.1.24 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 3.1.26 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 5.0.11 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 5.0.16 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 5.0.17 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 6.0.5 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] 6.0.6 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] You can resolve the problem by installing the specified framework and/or SDK. The specified framework can be found at:
  • https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.0-preview.6.22324.4&arch=x64&rid=win10-x64 . Please check the diagnostic logs for more information.

Test Run Aborted.

Further technical details

  • Include the output of dotnet --info .NET SDK: Version: 7.0.100-preview.6.22352.1 Commit: 492644e08e

Runtime Environment: OS Name: Windows OS Version: 10.0.22000 OS Platform: Windows RID: win10-x64 Base Path: C:\Users\adity\AppData\Local\Microsoft\dotnet\sdk\7.0.100-preview.6.22352.1\

Host: Version: 7.0.0-preview.6.22324.4 Architecture: x64 Commit: d3fa592f6d

.NET SDKs installed: 7.0.100-preview.6.22352.1 [C:\Users\adity\AppData\Local\Microsoft\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 7.0.0-preview.6.22330.3 [C:\Users\adity\AppData\Local\Microsoft\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 7.0.0-preview.6.22324.4 [C:\Users\adity\AppData\Local\Microsoft\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 7.0.0-preview.6.22351.3 [C:\Users\adity\AppData\Local\Microsoft\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: D:\PSGit\PowerShell\global.json

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

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

  • The IDE (VS / VS Code/ VS4Mac) you’re running on, and its version

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
vitek-karascommented, Jul 7, 2022

@iSazonov that is because 7.0 disabled multi-level lookup. So if you run dotnet.exe from C:\privatepath\dotnet then it will not try to look into program files or anywhere else. See this design doc for reasoning and exact behavior: https://github.com/dotnet/designs/blob/main/accepted/2022/disable-multi-level-lookup-by-default.md

1reaction
pavelhorakcommented, Jul 7, 2022

@MarcoRossignoli can you look at this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found