MTP.MSBuild 2.5 regression: `dotnet build -t:Test` with `--report-trx` (or `--hangdump`/`--crashdump`) fails with "MSBuild extension failed to receive test application information"
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp
- Domain
- build-system, testing
Research direction
Start by reading TestingPlatformBuilderHook.cs and TestHostControllersTestHost.ProcessConfiguration.cs, then trace the MSBuild callbacks that request module information. Reproduce with the provided three-file project and dotnet build -t:Test -p:TestingPlatformCommandLineArguments=--report-trx; compare behavior with and without the controller-backed option. Done when controller-backed runs through the MSBuild target receive test application information and produce the expected results.
Written by the indexing model from the issue text.
Description
Describe the bug
Starting with Microsoft.Testing.Platform.MSBuild 2.5.0 (MSTest.Sdk 4.5.0), running tests through the MSBuild integration fails when the test app runs under a test host controller. This covers dotnet build -t:Test and the InvokeTestingPlatform target. TRX reporting always uses a controller, so --report-trx triggers the failure. --hangdump and --crashdump fail the same way. The build reports:
error : MSBuild extension failed to receive test application information from '<path>/Repro.dll'
The same project passes on MSTest.Sdk 4.4.1 (MTP.MSBuild 2.4.1). On 4.5.1 it also passes when no controller-backed option is used. Running the app directly, or using dotnet test in Microsoft.Testing.Platform mode with --report-trx, works on 4.5.1. Only the MSBuild -t:Test / InvokeTestingPlatform path is affected.
Version used
- MSTest.Sdk 4.5.1, which brings Microsoft.Testing.Platform / Microsoft.Testing.Platform.MSBuild 2.5.1
- Last known good: MSTest.Sdk 4.4.1 (MTP.MSBuild 2.4.1)
- First bad: MTP.MSBuild 2.5.0. I confirmed it with MSTest.Sdk 4.4.1 plus an explicit
PackageReferencetoMicrosoft.Testing.Platform.MSBuild2.5.0. MSTest.Sdk 4.4.1 with Microsoft.Testing.Platform 2.5.0 but MTP.MSBuild 2.4.1 passes. - .NET SDK 10.0.402 (runtime 10.0.13), Linux x64 (Azure Linux 3.0)
Steps To Reproduce
Create the three files below in an empty directory that has no Directory.Build.* files above it.
global.json:
{
"sdk": {
"version": "10.0.402",
"rollForward": "latestFeature"
},
"msbuild-sdks": {
"MSTest.Sdk": "4.5.1"
}
}
Repro.csproj:
<Project Sdk="MSTest.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>
</Project>
Test1.cs:
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Repro;
[TestClass]
public sealed class Test1
{
[TestMethod]
public void Passes()
{
}
}
Then run:
dotnet build -t:Test -p:TestingPlatformCommandLineArguments=--report-trx
Results:
| MSTest.Sdk | Arguments | Result |
|---|---|---|
| 4.5.1 | --report-trx |
fails |
| 4.5.1 | (none) | passes |
| 4.4.1 | --report-trx |
passes |
| 4.5.1 | --hangdump with -p:EnableMicrosoftTestingExtensionsHangDump=true |
fails |
| 4.5.1 | --crashdump with -p:EnableMicrosoftTestingExtensionsCrashDump=true |
fails |
| 4.4.1 | --hangdump / --crashdump (same properties) |
passes |
Expected behavior
The tests run and a TRX file is produced, as on 4.4.1:
Run tests: '<repro>/bin/Debug/net10.0/Repro.dll' [net10.0|x64]
Passed! - Failed: 0, Passed: 1, Skipped: 0, Total: 1, Duration: 155ms - Repro.dll (net10.0|x64)
Tests succeeded: '<repro>/bin/Debug/net10.0/Repro.dll' [net10.0|x64]
Build succeeded.
Actual behavior
Repro -> <repro>/bin/Debug/net10.0/Repro.dll
Run tests: '<repro>/bin/Debug/net10.0/Repro.dll' [net10.0|x64]
~/.nuget/packages/microsoft.testing.platform.msbuild/2.5.1/buildMultiTargeting/Microsoft.Testing.Platform.MSBuild.targets(500,5): error : MSBuild extension failed to receive test application information from '<repro>/bin/Debug/net10.0/Repro.dll' [<repro>/Repro.csproj]
Build FAILED.
0 Warning(s)
1 Error(s)
Additional context
My analysis, based on reading the v4.5.1 sources:
- The regression was introduced by #11484, which added
TestingPlatformBuilderHook.- When the arguments contain
--internal-testhostcontroller-pid, the hook does not callAddMSBuild(). - Instead it registers only the MSBuild command-line provider.
- The apparent intent is that the controller process reports to MSBuild in a packaged/AppContainer scenario.
- When the arguments contain
TestHostControllersTestHostadds--internal-testhostcontroller-pidto every child test host it starts, not only packaged ones.- TRX always runs through a test host controller (#10808), and so do HangDump and CrashDump.
- The resulting sequence:
- The MSBuild task starts
Repro.dll --internal-msbuild-node <pipe> --report-trx. - The controller starts the child host.
- The child skips the MSBuild lifetime callbacks, so it never sends
ModuleInfoRequest. - Nothing relays this information for the non-packaged controller case.
InvokeTestingPlatformTaskends with no module info and logsDidNotReceiveModuleInfo.
- The MSBuild task starts
- To confirm the cause, I used a custom entry point (
GenerateTestingPlatformEntryPoint=false,GenerateSelfRegisteredExtensions=false).Mainregisters MSTest and the TRX provider and callsbuilder.AddMSBuild()unconditionally.- With MSTest.Sdk 4.5.1 and
--report-trx,dotnet build -t:Testthen passes and writes the TRX file.
- The same skip logic is still present on
mainandrel/4.5as of today.
A possible fix: only skip AddMSBuild() in the child when the controller actually relays the MSBuild information, for example only for the packaged/AppContainer path.
- Dominant language
- C#
- Stars
- 1.1k
- Forks
- 312
- Avg merge
- 8h 29m
- Merged PRs (30d)
- 421
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/testfx
-
type/automation type/tech-debt
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
type/automation type/tech-debt
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
agentic-workflows type/automation type/tech-debt
Difficulty 1/5 Under an hour Newbie friendliness 1/100
Maintainers usually reply within 1 day
-
area/mtp-github-actions-report external/dotnet-test needs/triage
Difficulty 4/5 3-5 days Newbie friendliness 56/100
Maintainers usually reply within 1 day
-
area/dump needs/triage
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
microsoft/testfx#11981 · 2 comments ·
Maintainers usually reply within 1 day
All issues in microsoft/testfx
Similar issues
-
[BUG] Still libmicrohttpd dependency is not removed properly from External-Dependency-Info.txt fileOpentype/bug
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
[辞書] かんそうりつ->乾燥率Open辞書
Difficulty 1/5 Under an hour Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
thomhurst/TUnit#7201 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
ArduPilot/MissionPlanner#3826 ·
Maintainers usually reply within 1 day
-
MongoDB integration tests fail on newer GitHub Actions runner kernelsPossibly taken @nmummau claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Eventuous/eventuous#626 · 2 comments ·
Maintainers usually reply within 7 days