Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 923832 - dev-dotnet/dotnet-sdk-8.0.100-r2 missing testhost.exe
Summary: dev-dotnet/dotnet-sdk-8.0.100-r2 missing testhost.exe
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: dotnet project
Depends on:
Reported: 2024-02-05 14:23 UTC by Davyd McColl
Modified: 2024-03-12 15:51 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Davyd McColl 2024-02-05 14:23:47 UTC
As per the title: testhost.exe is missing from disk when installing dev-dotnet/dotnet-sdk-8.0.100-r2 (or having it pulled in via installing dev-dotnet/dotnet-sdk). Many people are likely not to notice, but unfortunately, for a dev, this becomes a blocker. Output from `dotnet test`:

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Testhost process for source(s) '/home/daf/code/codeo/codeo.core/Tests.NetFX/bin/Debug/net462/Tests.NetFX.dll' exited with error: Cannot open assembly '/usr/lib64/dotnet-sdk-8.0/sdk/8.0.100/Extensions/../TestHostNetFramework/testhost.exe': No such file or directory

Reproducible: Always

Steps to Reproduce:
1. Install dev-dotnet/dotnet-sdk-8.0.100-r4
2. Attempt to run tests with `dotnet test`
3. Fail.
Actual Results:  
`dotnet test` throws an error and exits, without running any tests`

Expected Results:  
tests should run, as they do with dev-dotnet/dotnet-sdk-bin-8.0.100-r4

I see that there's an `~amd64` dotnet-sdk-8.0.101, which I haven't tested, so I'm not sure if this issue is present there. When I get a chance, I'll re-merge with ~amd64 and try again. For now, I need to work, so I've installed dotnet-sdk-bin instead.
Comment 1 Maciej Barć gentoo-dev 2024-02-05 15:22:21 UTC
Hello David!

I can confirm those files are missing from source-built dotnet-sdk (both stable and unstable).
But I have been running tests with source-built SDK successfully.

Stracing the dotnet test call shows that only this DLL from lib64 is used:

> /usr/lib64/dotnet-sdk-8.0/sdk/8.0.101/Extensions/Microsoft.TestPlatform.TestHostRuntimeProvider.dll

I see that you are building for net462, so maybe that is the issue + the test framework that you use. I know for a fact this works with nunit and xunit under net8.0 runtime target.

If you are building with nunit or xunit can you check if building for net6.0 and then net8.0 works?

> -p:TargetFramework=net8.0 -p:TargetFrameworks=net8.0

Either way I do not yet know why testhost.exe might be missing from source-built.
Comment 2 Maciej Barć gentoo-dev 2024-02-05 15:37:48 UTC
If I try to craft a net462 project on 8.0.1 source to reproduce this is what I get:

>   Determining projects to restore...
>   All projects are up-to-date for restore.
>   Zzz -> /tmp/tmp.8axCGSKU.tmpsh/Zzz/bin/Debug/net462/Zzz.dll
> Test run for /tmp/tmp.8axCGSKU.tmpsh/Zzz/bin/Debug/net462/Zzz.dll (.NETFramework,Version=v4.6.2)
> Microsoft (R) Test Execution Command Line Tool Version 17.8.0 (x64)
> Copyright (c) Microsoft Corporation.  All rights reserved.
> Starting test execution, please wait...
> A total of 1 test files matched the specified pattern.
> System.IO.FileNotFoundException: Could not find 'mono' host. Make sure that 'mono' is installed on the machine and is available in PATH environment variable.
>    at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Helpers.DotnetHostHelper.GetMonoPath() in /var/notmp/portage/dev-dotnet/dotnet-sdk-8.0.101/work/dotnet-sdk-8.0.1/src/vstest/artifacts/source-build/self/src/src/Microsoft.TestPlatform.CoreUtilities/Helpers/DotnetHostHelper.cs:line 93
>    at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Hosting.DefaultTestHostManager.GetTestHostProcessStartInfo(IEnumerable`1 sources, IDictionary`2 environmentVariables, TestRunnerConnectionInfo connectionInfo) in /var/notmp/portage/dev-dotnet/dotnet-sdk-8.0.101/work/dotnet-sdk-8.0.1/src/vstest/artifacts/source-build/self/src/src/Microsoft.TestPlatform.TestHostProvider/Hosting/DefaultTestHostManager.cs:line 217
>    at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyOperationManager.SetupChannel(IEnumerable`1 sources, String runSettings) in /var/notmp/portage/dev-dotnet/dotnet-sdk-8.0.101/work/dotnet-sdk-8.0.1/src/vstest/artifacts/source-build/self/src/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyOperationManager.cs:line 226
>    at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Client.ProxyExecutionManager.InitializeTestRun(TestRunCriteria testRunCriteria, IInternalTestRunEventsHandler eventHandler) in /var/notmp/portage/dev-dotnet/dotnet-sdk-8.0.101/work/dotnet-sdk-8.0.1/src/vstest/artifacts/source-build/self/src/src/Microsoft.TestPlatform.CrossPlatEngine/Client/ProxyExecutionManager.cs:line 182
> Test Run Aborted.

I dont think we should support this use case since net462 is from before .NET Core but upstream distributes it ... :/
Comment 3 Maciej Barć gentoo-dev 2024-02-05 15:53:55 UTC
(In reply to Maciej Barć from comment #2)
> If I try to craft a net462 project on 8.0.1 source to reproduce this is what
> I get:
> >   Determining projects to restore...
> >   All projects are up-to-date for restore.
> >   Zzz -> /tmp/tmp.8axCGSKU.tmpsh/Zzz/bin/Debug/net462/Zzz.dll

This also happens on binary 8.0.1 and binary 8.0., so it is really a test framework issue - it wants mono and mono wants testhost.exe.
Comment 4 Davyd McColl 2024-02-05 16:30:28 UTC
Hi, thanks for getting back to me (:

You can easily build net462 targets with dotnet by providing dotnet the information as to where it should find an SDK api to compile against - which I do in NExpect ( and in other projects - check out

Note that this is _not_ "mono building" or "mono testing" - this is dotnet being instructed to find apis for system stuff in another location. The produced assebmlies aren't specifically linked to mono either. I've used this process to cross-build net5.0+ and net462 for some time now (: It 100% should be a supported workflow because, as I say, this isn't mono building the app - it's dotnet building the app and using mono assemblies for a reference for core runtime apis. You can take the produced assemblies and use 'em anywhere there's a net462-compatible host (so, .NET Framework 4.6.2+ on windows, or mono on linux or osx).

In this same solution, I have a test host for netcore stuff (with a lot of cross-linking: most of what's in this library should work fine on net5.0+ or netfx - it doesn't matter). That project builds and tests just fine. The net462 one builds fine but only tests when using dotnet-sdk-bin packages. The missing testhost.exe, although it's just a wrapper around testhost.dll, is required.

To reiterate: mono doesn't want anything - this is dotnet packaging failure. I could reproduce the same issue by breaking my dotnet-sdk-bin installations by deleting testhost.exe in each.
Comment 5 Maciej Barć gentoo-dev 2024-02-06 15:28:49 UTC
See also: