Repository navigation
Closed
Closed
Unable to treat an assembly that skips all tests as successful with .NET 11 RC1 when using MTP#11145
Bug
Copy link
Labels
Description
Describe the bug
When a test project using MTP v2 with the .NET 11.0-rc.1 SDK skips all tests, the dotnet test fails with an exit code of 8 even when --ignore-exit-code 8 or --zero-tests-policy allow-skipped are used.
Version used
.NET SDK 11.0.100-rc.1.26425.128 with xunit.v3 4.0.0 and Microsoft.NET.Test.Sdk 18.10.0.
Steps To Reproduce
global.json:
{
"sdk": {
"version": "11.0.100-rc.1.26425.128"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}repro.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<TargetFramework>net11.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.10.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="4.0.0" />
<PackageReference Include="xunit.v3.mtp-v2" Version="4.0.0" />
</ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
</ItemGroup>
</Project>UnitTest1.cs:
namespace Repro;
public class UnitTest1
{
[Fact]
public void Test1()
{
Assert.SkipWhen(true, "Forced dynamic skip.");
}
}Expected behavior
dotnet test returns 0 and treats the test run as successful.
Actual behavior
❯ dotnet test --ignore-exit-code 8
Running tests from bin\Debug\net11.0\_repros.dll (net11.0|x64)
skipped Repro.UnitTest1.Test1
Forced dynamic skip.
from bin\Debug\net11.0\_repros.dll (net11.0|x64)
bin\Debug\net11.0\_repros.dll (net11.0|x64) passed [✓0/x0/↓1] (603ms)
Test run summary: Zero tests ran
total: 1
failed: 0
succeeded: 0
skipped: 1
duration: 811ms
Test run completed with non-success exit code: 8 (see: https://aka.ms/testingplatform/exitcodes)
❯ $LASTEXITCODE
8
❯ dotnet test --zero-tests-policy allow-skipped
Running tests from bin\Debug\net11.0\_repros.dll (net11.0|x64)
skipped Repro.UnitTest1.Test1
Forced dynamic skip.
from bin\Debug\net11.0\_repros.dll (net11.0|x64)
bin\Debug\net11.0\_repros.dll (net11.0|x64) passed [✓0/x0/↓1] (670ms)
Test run summary: Zero tests ran
total: 1
failed: 0
succeeded: 0
skipped: 1
duration: 933ms
Test run completed with non-success exit code: 8 (see: https://aka.ms/testingplatform/exitcodes)
❯ $LASTEXITCODE
8
Additional context
Possibly related to #9415.
Activity
Evangelink commentedon Sep 9, 2026
Hey Martin Costello (@martincostello)! As usual thanks for the detailed analysis, it seems that I totally missed part of the validation when I added this handling in SDK. I have created a ticket there (and a PR) that will be backported to NET 11.
Sorry for the inconvenience!
[ci] Fix Deployment E2E tests (#20308)