xUnit in VS 2026, .NET 10
I migrated a small project to .NET 10 and I am using VS 2026 Pro. However, the behavior is quite erratic:
- If I run the tests in a CLI with
dotnet testordotnet run-- all looks good. - If I debug individual tests, again - all green.
- If I try to run some or all tests - the tests are skipped and in the output pane I see something like this:
========== Starting test run ========== [xUnit.net 00:00:00.01] xUnit.net VSTest Adapter v3.1.5+1b188a7b0a (64-bit .NET 10.0.0) [xUnit.net 00:00:00.20] Glob.Api.Tests: Catastrophic failure: System.InvalidOperationException: Test process did not return valid JSON (non-object). at Xunit.v3.TestProcessLauncherAdapter.GetAssemblyInfo(ITestProcessLauncher launcher, XunitProjectAssembly projectAssembly) at Xunit.v3.TestProcessLauncherAdapter.GetAssemblyInfo(XunitProjectAssembly projectAssembly) at Xunit.Runner.v3.Xunit3..ctor(XunitProjectAssembly projectAssembly, ISourceInformationProvider sourceInformationProvider, IMessageSink diagnosticMessageSink, ITestProcessLauncher testProcessLauncher) at Xunit.Runner.v3.Xunit3.ForDiscoveryAndExecution(XunitProjectAssembly projectAssembly, ISourceInformationProvider sourceInformationProvider, IMessageSink diagnosticMessageSink, ITestProcessLauncher testProcessLauncher) at Xunit.XunitFrontController.Create(XunitProjectAssembly projectAssembly, ISourceInformationProvider sourceInformationProvider, IMessageSink diagnosticMessageSink, ITestProcessLauncher testProcessLauncher) at Xunit.Runner.VisualStudio.VsTestRunner.RunTestsInAssembly(IRunContext runContext, IFrameworkHandle frameworkHandle, LoggerHelper logger, TestPlatformContext testPlatformContext, RunSettings runSettings, IMessageSink reporterMessageHandler, AssemblyRunInfo runInfo) at Xunit.Runner.VisualStudio.VsTestRunner.RunTestsInAssembly(IRunContext runContext, IFrameworkHandle frameworkHandle, LoggerHelper logger, TestPlatformContext testPlatformContext, RunSettings runSettings, IMessageSink reporterMessageHandler, AssemblyRunInfo runInfo) ========== Test run finished: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in 217 ms ========== - I use central package management and the relevant parts look like this:
-
Directory.Packages.props:<Project> <PropertyGroup> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> <CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled> </PropertyGroup> <ItemGroup> <PackageVersion Include="System.Memory" Version="4.6.3" /> <PackageVersion Include="System.CommandLine" Version="2.0.0" /> <PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" /> <PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.0" /> <PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.0" /> <PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" /> <PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="10.0.0" /> <PackageVersion Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="10.0.0" /> <PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" /> <PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="10.0.0" /> <PackageVersion Include="Markdig" Version="0.43.0" /> <PackageVersion Include="MinVer" Version="6.0.0" /> <!-- The test stack: --> <!--<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.1.0" />--> <PackageVersion Include="FluentAssertions" Version="8.8.0" /> <PackageVersion Include="xunit.v3" Version="3.2.0" /> <!-- These should be redundant for the test platform --> <PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" /> <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" /> <!-- These should be redundant for the test platform --> <!--<PackageVersion Include="xunit.v3.extensibility.core" Version="3.1.0" />--> <PackageVersion Include="coverlet.msbuild" Version="6.0.4" /> <PackageVersion Include="BenchmarkDotNet" Version="0.15.4" /> <PackageVersion Include="BenchmarkDotNet.Annotations" Version="0.15.4" /> </ItemGroup> </Project> -
Directory.Build.props:<Project> <PropertyGroup Label="Packages"> <TargetFramework>net10.0</TargetFramework> <LangVersion>latest</LangVersion> <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> ... </PropertyGroup> <ItemGroup> <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" /> ... <PackageReference Include="MinVer"> <PrivateAssets>all</PrivateAssets> </PackageReference> </ItemGroup> <PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), '[/\\]test[/\\]'))"> <!-- Test projects settings --> <OutputType>Exe</OutputType> <IsTestProject>true</IsTestProject> <IsPackable>false</IsPackable> <RunSettingsFilePath>$(MSBuildProjectDirectory)\..\..\test.runsettings</RunSettingsFilePath> <GenerateDocumentationFile>false</GenerateDocumentationFile> <TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport> <UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner> <NoWarn> $(NoWarn);CA1031;CA1701;CA1702;CA1707;CA1806;CA2211;CS0618;CS1572;CS1573;CS1574;CS1591;CS1711;IDE0021;IDE0022;IDE0039;IDE0065;IDE1006;IDE2000;IDE2002;IDE0058;IDE0290 </NoWarn> </PropertyGroup> <ItemGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), '[/\\]test[/\\]')) and $([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectName), '^*.Tests$'))"> <PackageReference Include="FluentAssertions" /> <PackageReference Include="xunit.v3" /> <!-- These should be redundant for the test platform --> <PackageReference Include="Microsoft.NET.Test.Sdk" /> <PackageReference Include="xunit.runner.visualstudio"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> <!-- These should be redundant for the test platform --> <PackageReference Include="coverlet.msbuild"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> </ItemGroup> <!-- for test utility/library projects in the ./test folder: --> <ItemGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), '[/\\]test[/\\]')) and !$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectName), '^*.Tests$'))"> <PackageReference Include="xunit.v3.extensibility.core" /> </ItemGroup> <!-- Common usings for test projects in the ./test folder: --> <ItemGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(MSBuildProjectDirectory), '[/\\]test[/\\]'))"> <Using Include="Xunit" /> <Using Include="FluentAssertions" /> <Using Include="FluentAssertions.Formatting" /> <Using Include="FluentAssertions.Extensibility" /> </ItemGroup> ... </Project> -
test.runsettings:<?xml version="1.0" encoding="utf-8"?> <RunSettings> <RunConfiguration> <CollectSourceInformation>true</CollectSourceInformation> <MaxCpuCount>0</MaxCpuCount> <TargetPlatform>x64</TargetPlatform> <TestSessionTimeout>600000</TestSessionTimeout> </RunConfiguration> <xUnit> <AppDomain>denied</AppDomain> <Culture>en-US</Culture> <DiagnosticMessages>true</DiagnosticMessages> <InternalDiagnostics>true</InternalDiagnostics> <LongRunningTestSeconds>10</LongRunningTestSeconds> <MaxParallelThreads>-1</MaxParallelThreads> <AssertEquivalentMaxDepth>50</AssertEquivalentMaxDepth> <MethodDisplay>classAndMethod</MethodDisplay> <MethodDisplayOptions>none</MethodDisplayOptions> <NoAutoReporters>false</NoAutoReporters> <ParallelAlgorithm>conservative</ParallelAlgorithm> <ParallelizeAssembly>true</ParallelizeAssembly> <ParallelizeTestCollections>true</ParallelizeTestCollections> <PreEnumerateTheories>true</PreEnumerateTheories> <PrintMaxEnumerableLength>5</PrintMaxEnumerableLength> <PrintMaxObjectDepth>3</PrintMaxObjectDepth> <PrintMaxObjectMemberCount>5</PrintMaxObjectMemberCount> <PrintMaxStringLength>50</PrintMaxStringLength> <ReporterSwitch>json</ReporterSwitch> <ShadowCopy>true</ShadowCopy> <ShowLiveOutput>true</ShowLiveOutput> <Explicit>off</Explicit> <FailSkips>false</FailSkips> <FailWarns>false</FailWarns> <StopOnFail>false</StopOnFail> </xUnit> ...
-
- Lastly. The documentation suggests that adding
xunit.runner.visualstudioandMicrosoft.NET.Test.Sdkwould be redundant, but if I remove them the behavior gets really weird: the icon of the test project start flickering (like some UI infinite loop) and if you try to do some work in VS - it just gets grey and you have to kill the process.
Sory for the huge message (I just tried to include all relevant information) and if you have any questions please do not hesitate to ask.
I really hope that I have something improperly configured or I am doing something wrong, otherwise I would be very disappointed with VS 2026 and the Testing Platform. Like I said, looks like xUnit works from the CLI.
Thank you Val
I can say that based on your settings, you're trying to use Microsoft.Testing.Platform mode exclusively, so:
-
It is correct that
xunit.runner.visualstudioandMicrosoft.NET.Test.Sdkare not needed -
coverlet.msbuildis not going to work, because coverlet is designed to work with VSTest, not Microsoft.Testing.Platform. You should be usingMicrosoft.Testing.Extensions.CodeCoverageinstead, as documented here: https://learn.microsoft.com/dotnet/core/testing/microsoft-testing-platform-extensions-code-coverage#microsoft-code-coverage
the icon of the test project start flickering (like some UI infinite loop) and if you try to do some work in VS - it just gets grey and you have to kill the process.
How does it behave in VS2022? This feels like a bug that should be reported to the Visual Studio team. FWIW, we have not seen any issues with VS2026 yet, but our usage is still fairly limited since it just came out last week.
Test process did not return valid JSON (non-object).
This means your test project crashed on startup, perhaps because of missing dependencies or because you have some custom startup code that's crashing. You can simulate what's being done here by running your test project with the command line arguments -automated -assemblyInfo and see what happens.
Example on Windows:
Example on Linux:
(In these examples, I piped the output through jq just to make it easier to read for you; that part is not done during automation.)
Note that we run the apphost (i.e., the .exe file on Windows, or the extension-less entrypoint on Linux/macOS). We do not use dotnet run for our automation. To simulate what's being done during automation, therefore, I would recommend you do the same, like I did in the example above.
Short of having an actual repro project, it's impossible for us to know what's causing the crash, and whether it's our code or your code.
Thank you, Brad! See my responses below:
Val
From: Brad Wilson @.> Sent: Tuesday, November 18, 2025 10:51 PM To: xunit/visualstudio.xunit @.> Cc: Val @.>; Author @.> Subject: Re: [xunit/visualstudio.xunit] xUnit in VS 2026, .NET 10 (Issue #449)
[https://outlook.office.com/mail/AAMkADRiYmIxMjNiLThkY2EtNGExOC1iMjZkLWJhNjc3YTg3MzA3OAAuAAAAAACV1CeZFqqUTbnqfvkNbZhnAQCbqgSn%2FK2sSrH74i17QoOxAAAEsbkGAAA%3D/id/AAkALgAAAAAAHYQDEapmEc2byACqAC%2FEWg0Am6oEp%2FytrEqx%2B%2BIte0KDsQAIkKp0ggAA?nativeVersion=1.2025.1104.200]bradwilson left a comment (xunit/visualstudio.xunit#449)https://github.com/xunit/visualstudio.xunit/issues/449#issuecomment-3550586277
I can say that based on your settings, you're trying to use Microsoft.Testing.Platform
[Val] Yup!
mode exclusively, so:
- It is correct that xunit.runner.visualstudio and Microsoft.NET.Test.Sdk are not needed
[Val] 👍
- coverlet.msbuild is not going to work, because coverlet is designed to work with VSTest, not Microsoft.Testing.Platform. You should be using Microsoft.Testing.Extensions.CodeCoveragehttps://nuget.org/packages/Microsoft.Testing.Extensions.CodeCoverage instead, as documented here: https://learn.microsoft.com/dotnet/core/testing/microsoft-testing-platform-extensions-code-coverage#microsoft-code-coverage
[Val] Oh, thank you, will try it today, but I don't think this is the problem yet... I might be wrong.
the icon of the test project start flickering (like some UI infinite loop) and if you try to do some work in VS - it just gets grey and you have to kill the process.
How does it behave in VS2022?
[Val] Well, everything was working fine...
This feels like a bug that should be reported to the Visual Studio team. FWIW, we have not seen any issues with VS2026 yet, but our usage is still fairly limited since it just came out last week.
[Val] 👍
Test process did not return valid JSON (non-object).
This means your test project crashed on startup, perhaps because of missing dependencies or because you have some custom startup code that's crashing. You can simulate what's being done here by running your test project with the command line arguments -automated -assemblyInfo and see what happens.
[Val] Like I said - it works fine in CLI both dotnet run and earlier with dotnet test... Also, if I debug test by test, again all works. The startup code is still run, right? So, how come it doesn't crash? Never mind - banging my head like that made me make that post.
Example on Windows:
image.png (view on web)https://github.com/user-attachments/assets/96036bea-2765-4704-bdf7-31d3a34f7612
Example on Linux:
image.png (view on web)https://github.com/user-attachments/assets/d65e3dc4-e425-4675-bdc2-c86465aed15c
(In these examples, I piped the output through jq just to make it easier to read for you; that part is not done during automation.)
Note that we run the apphost (i.e., the .exe file on Windows, or the extension-less entrypoint on Linux/macOS). We do not use dotnet run for our automation. To simulate what's being done during automation, therefore, I would recommend you do the same, like I did in the example above.
Short of having an actual repro project, it's impossible for us to know what's causing the crash, and whether it's our code or your code.
[Val] If you're curious, feel free to look at the source code here: vmelamed/vm2.DevOps at initial-port-from-vm2.Ulidhttps://github.com/vmelamed/vm2.DevOps/tree/initial-port-from-vm2.Ulid, just don't pay too much attention to the README-s and the integration tests - these are WIP after Claude... Man, if I always have to clean-up that much after AI... 🙂
— Reply to this email directly, view it on GitHubhttps://github.com/xunit/visualstudio.xunit/issues/449#issuecomment-3550586277, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAF6LJ4P57FP6RQC2AKGGLL35PSNHAVCNFSM6AAAAACMQNJGUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKNJQGU4DMMRXG4. You are receiving this because you authored the thread.Message ID: @.***>
P.S. I see that you're still targeting .NET 8, and I am trying .NET 10. Can this be a problem?
Val
From: Brad Wilson @.> Sent: Tuesday, November 18, 2025 10:51 PM To: xunit/visualstudio.xunit @.> Cc: Val @.>; Author @.> Subject: Re: [xunit/visualstudio.xunit] xUnit in VS 2026, .NET 10 (Issue #449)
[https://avatars.githubusercontent.com/u/16944?s=20&v=4]bradwilson left a comment (xunit/visualstudio.xunit#449)https://github.com/xunit/visualstudio.xunit/issues/449#issuecomment-3550586277
I can say that based on your settings, you're trying to use Microsoft.Testing.Platform mode exclusively, so:
-
It is correct that xunit.runner.visualstudio and Microsoft.NET.Test.Sdk are not needed
-
coverlet.msbuild is not going to work, because coverlet is designed to work with VSTest, not Microsoft.Testing.Platform. You should be using Microsoft.Testing.Extensions.CodeCoveragehttps://nuget.org/packages/Microsoft.Testing.Extensions.CodeCoverage instead, as documented here: https://learn.microsoft.com/dotnet/core/testing/microsoft-testing-platform-extensions-code-coverage#microsoft-code-coverage
the icon of the test project start flickering (like some UI infinite loop) and if you try to do some work in VS - it just gets grey and you have to kill the process.
How does it behave in VS2022? This feels like a bug that should be reported to the Visual Studio team. FWIW, we have not seen any issues with VS2026 yet, but our usage is still fairly limited since it just came out last week.
Test process did not return valid JSON (non-object).
This means your test project crashed on startup, perhaps because of missing dependencies or because you have some custom startup code that's crashing. You can simulate what's being done here by running your test project with the command line arguments -automated -assemblyInfo and see what happens.
Example on Windows:
image.png (view on web)https://github.com/user-attachments/assets/96036bea-2765-4704-bdf7-31d3a34f7612
Example on Linux:
image.png (view on web)https://github.com/user-attachments/assets/d65e3dc4-e425-4675-bdc2-c86465aed15c
(In these examples, I piped the output through jq just to make it easier to read for you; that part is not done during automation.)
Note that we run the apphost (i.e., the .exe file on Windows, or the extension-less entrypoint on Linux/macOS). We do not use dotnet run for our automation. To simulate what's being done during automation, therefore, I would recommend you do the same, like I did in the example above.
Short of having an actual repro project, it's impossible for us to know what's causing the crash, and whether it's our code or your code.
— Reply to this email directly, view it on GitHubhttps://github.com/xunit/visualstudio.xunit/issues/449#issuecomment-3550586277, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAF6LJ4P57FP6RQC2AKGGLL35PSNHAVCNFSM6AAAAACMQNJGUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTKNJQGU4DMMRXG4. You are receiving this because you authored the thread.Message ID: @.***>
I tested with net10.0, no change in behavior.
We're also seeing crashes in our CI pipelines TBH after moving to .net10 and vs2026 (we're not on MTP and using dotnet test)
[xUnit.net 00:04:17.79] [FATAL ERROR] Xunit.Sdk.TestPipelineException
[xUnit.net 00:04:17.80] Catastrophic failure: Test process crashed with exit code 57005.
@olstakh Please open a new issue with a repro project. Thanks!