Skip to content

Reapply "Migrate test infrastructure from xUnit v2 to xUnit v3 (#52930)"#53809

Merged
MichaelSimons merged 5 commits intomainfrom
re-apply-xunit.v3
Apr 13, 2026
Merged

Reapply "Migrate test infrastructure from xUnit v2 to xUnit v3 (#52930)"#53809
MichaelSimons merged 5 commits intomainfrom
re-apply-xunit.v3

Conversation

@MichaelSimons
Copy link
Copy Markdown
Member

@MichaelSimons MichaelSimons commented Apr 10, 2026

Turns out dotnet/arcade#16704 is the fix needed that triggered the revert. This was pulled in explicitly until the fix flows in.

Reverted the changes to ‎test/Microsoft.NET.Sdk.Razor.Tool.Tests/DefaultRequestDispatcherTest.cs made in #53424 as it was causing a regular test failure.

@MichaelSimons MichaelSimons changed the title Re apply xunit.v3 Reapply "Migrate test infrastructure from xUnit v2 to xUnit v3 (#52930)" Apr 10, 2026
Reverts the changes made to DefaultRequestDispatcherTest.cs in
commit 96683a0, restoring the
original Task.Run, SetResult, and simple await patterns.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The dotnet run - (stdin) feature creates a virtual .csproj in a
platform-specific temp directory (~/.local/share/dotnet/runfile/ on
Linux). NuGet walks up from that location to find NuGet.config, but
the test's NuGet.config (with internal feeds like dotnet11-transport)
was only placed in /tmp/dotnetSdkTests/ — a completely different
directory tree. This caused NuGet restore to only find nuget.org,
which doesn't have preview SDK packages.

Fix by copying NuGet.config into the runfile base directory so
NuGet's upward config search finds the test feeds.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MichaelSimons MichaelSimons marked this pull request as ready for review April 13, 2026 15:18
@MichaelSimons MichaelSimons requested a review from a team as a code owner April 13, 2026 15:18
Copilot AI review requested due to automatic review settings April 13, 2026 15:18
@MichaelSimons MichaelSimons requested review from a team and tmat as code owners April 13, 2026 15:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reapplies the previously reverted xUnit v2 → v3 test infrastructure migration (originally #52930), now that the Arcade fix is available, and adjusts Helix/test execution plumbing to accommodate xUnit v3’s out-of-process execution model.

Changes:

  • Switch test infrastructure and package references from xUnit v2 to xUnit v3 (including Verify + TemplateEngine test helpers).
  • Update Helix work item creation/publish to handle RID-specific AppHost execution and macOS crash-dump enablement.
  • Refine a few tests/utilities for xUnit v3 APIs (output helpers, async lifetime patterns) and reduce cross-test interference.

Reviewed changes

Copilot reviewed 86 out of 86 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
test/xunit.runner.json Updates runner schema reference for xUnit v3 runner settings.
test/xunit-runner/XUnitRunner.targets Updates xUnit runner versioning and adds RID-aware restore/publish + passes TargetRid.
test/UnitTests.proj Adds Helix payload file + adjusts POSIX hangdump collection command.
test/System.CommandLine.StaticCompletions.Tests/System.CommandLine.StaticCompletions.Tests.csproj Switches Verify integration to xUnit v3 package.
test/Msbuild.Tests.Utilities/Msbuild.Tests.Utilities.csproj Removes direct xUnit v2 package reference.
test/Microsoft.Win32.Msi.Manual.Tests/Microsoft.Win32.Msi.Manual.Tests.csproj Cleans up xUnit abstraction using removal.
test/Microsoft.TemplateEngine.Cli.UnitTests/Microsoft.TemplateEngine.Cli.UnitTests.csproj Moves Verify + TemplateEngine test helper refs to xUnit v3 variants.
test/Microsoft.NET.TestFramework/TestLoggerFactory.cs Updates logger factory to support v3 message sink scenarios.
test/Microsoft.NET.TestFramework/StringTestLogger.cs Expands ITestOutputHelper implementation with v3-friendly members.
test/Microsoft.NET.TestFramework/SharedTestOutputHelper.cs Updates shared output helper to emit diagnostic messages and capture output.
test/Microsoft.NET.TestFramework/Microsoft.NET.TestFramework.csproj Switches to xUnit v3 extension/assert/extensibility packages.
test/Microsoft.NET.TestFramework/Commands/TestCommand.cs Adds process-group option + makes StdOut logging null-safe.
test/Microsoft.NET.TestFramework/Commands/SdkCommandSpec.cs Implements CreateNewProcessGroup mapping to ProcessStartInfo on Windows.
test/Microsoft.NET.TestFramework/Attributes/WindowsOnlyRequiresMSBuildVersionTheoryAttribute.cs Updates attribute constructors for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/WindowsOnlyRequiresMSBuildVersionFactAttribute.cs Updates attribute constructors for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/RequiresSpecificFrameworkTheoryAttribute.cs Updates attribute constructors for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/RequiresSpecificFrameworkFactAttribute.cs Updates attribute constructors for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionTheoryAttribute.cs Updates attribute constructors for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/RequiresMSBuildVersionFactAttribute.cs Updates attribute constructors for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/PlatformSpecificTheory.cs Converts to parameter-based filtering aligned with updated PlatformSpecificFact usage.
test/Microsoft.NET.TestFramework/Attributes/PlatformSpecificFact.cs Converts to parameter-based filtering aligned with xUnit v3 attribute patterns.
test/Microsoft.NET.TestFramework/Attributes/MacOsOnlyFactAttribute.cs Updates constructor for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/FullMSBuildOnlyTheoryAttribute.cs Updates constructor for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/FullMSBuildOnlyFactAttribute.cs Updates constructor for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildOnlyTheoryAttribute.cs Updates constructor for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildOnlyFactAttribute.cs Updates constructor for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildAndWindowsOnlyTheoryAttribute.cs Updates constructor for v3 source-info patterns.
test/Microsoft.NET.TestFramework/Attributes/CoreMSBuildAndWindowsOnlyFactAttribute.cs Updates constructor for v3 source-info patterns.
test/Microsoft.NET.Sdk.Razor.Tool.Tests/DefaultRequestDispatcherTest.cs Reverts prior timing/threading changes related to dispatcher execution.
test/Microsoft.NET.Publish.Tests/GivenThatAPublishedDepsJsonShouldContainVersionInformation.cs Removes unused test platform object model using.
test/Microsoft.NET.Build.Containers.UnitTests/DockerAvailableUtils.cs Updates custom Fact/Theory attributes for v3 source-info constructors.
test/Microsoft.NET.Build.Containers.IntegrationTests/DockerTestsFixture.cs Adds xUnit SDK using for v3 test plumbing.
test/Microsoft.NET.Build.Containers.IntegrationTests/DockerSupportsArchInlineData.cs Ports inline data attribute to xUnit v3 discovery/data-row APIs.
test/Microsoft.NET.Build.Containers.IntegrationTests/DockerRegistryManager.cs Removes unused Xunit.Sdk import.
test/Microsoft.NET.Build.Containers.IntegrationTests/DockerIsAvailableAndSupportsArchTheory.cs Updates theory attribute ctor for v3 source-info patterns.
test/Microsoft.NET.Build.Containers.IntegrationTests/DockerIsAvailableAndSupportsArchFact.cs Updates fact attribute ctor for v3 source-info patterns.
test/Microsoft.DotNet.HotReload.Test.Utilities/WatchSdkTest.cs Updates xUnit abstraction usage to xUnit v3-compatible namespace.
test/Microsoft.DotNet.HotReload.Test.Utilities/WatchableApp.cs Removes unnecessary xUnit abstractions import.
test/Microsoft.DotNet.HotReload.Test.Utilities/TestLogger.cs Updates output helper namespace usage for v3.
test/Microsoft.DotNet.HotReload.Test.Utilities/Microsoft.DotNet.HotReload.Test.Utilities.csproj Adds xUnit v3 extensibility core dependency.
test/Microsoft.DotNet.HotReload.Test.Utilities/DebugTestOutputLogger.cs Implements v3 ITestOutputHelper members and captures output.
test/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs Adds RID-aware chmod/codesign steps for v3 AppHost execution on Helix.
test/dotnet.Tests/dotnet.Tests.csproj Switches Verify + TemplateEngine test helper deps to xUnit v3 variants.
test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs Avoids output-path conflicts between theory rows.
test/dotnet.Tests/CommandTests/Run/RunFileTests_General.cs Ensures NuGet.config is present for stdin dotnet run - scenarios.
test/dotnet.Tests/CommandTests/Run/RunFileTestBase.cs Adds helper to copy NuGet.config into virtual-project base directory.
test/dotnet.Tests/CommandTests/Run/GivenDotnetRunIsInterrupted.cs Uses new-process-group execution to prevent Ctrl+C propagation to host.
test/dotnet.Tests/CommandTests/Package/Add/GivenDotnetPackageAdd.cs Updates file-based directive property to RestoreAdditionalProjectSources.
test/dotnet-watch.Tests/TestUtilities/MSBuildFixture.cs Replaces module initializer with an assembly fixture for MSBuild registration.
test/dotnet-watch.Tests/TestUtilities/DotNetWatchTestBase.cs Updates async lifetime signature to ValueTask-based pattern.
test/dotnet-new.IntegrationTests/WebProjectsTests.cs Adds Xunit.Sdk using (v3 migration support).
test/dotnet-new.IntegrationTests/TemplateDiscoveryTool.cs Updates imports for v3 diagnostics/logging integration.
test/dotnet-new.IntegrationTests/TemplateDiscoveryTests.cs Updates PlatformSpecificFact usage to new ctor parameter form.
test/dotnet-new.IntegrationTests/SharedHomeDirectory.cs Updates imports for v3 diagnostics/logging integration.
test/dotnet-new.IntegrationTests/DotnetNewTestTemplatesTests.cs Updates null output helper implementation for v3 interface members.
test/dotnet-new.IntegrationTests/DotnetNewInstallTests.cs Uses v3 DiagnosticMessage type and related xUnit SDK integration.
test/dotnet-new.IntegrationTests/DotnetNewHelpTests.Approval.cs Uses isolated home directories to avoid template install collisions.
test/dotnet-new.IntegrationTests/DotnetNewDetailsTest.cs Adds Xunit.Sdk using (v3 migration support).
test/dotnet-new.IntegrationTests/dotnet-new.IntegrationTests.csproj Switches Verify + TemplateEngine deps to xUnit v3 variants.
test/dotnet-new.IntegrationTests/Diagnostic/XunitNuGetLogger.cs Uses v3 DiagnosticMessage type for sink logging.
test/dotnet-new.IntegrationTests/Diagnostic/DiagnosticFixture.cs Adds Xunit.Sdk using (v3 migration support).
test/dotnet-format.UnitTests/XUnit/MSBuildTheoryDiscoverer.cs Removes xUnit v2 discoverer implementation.
test/dotnet-format.UnitTests/XUnit/MSBuildTheoryAttribute.cs Reworks MSBuild theory gating to v3 before/after hooks.
test/dotnet-format.UnitTests/XUnit/MSBuildTestCase.cs Removes xUnit v2 custom test case wrapper.
test/dotnet-format.UnitTests/XUnit/MSBuildFactDiscoverer.cs Removes xUnit v2 discoverer implementation.
test/dotnet-format.UnitTests/XUnit/MSBuildFactAttribute.cs Reworks MSBuild fact gating to v3 before/after hooks.
test/dotnet-format.UnitTests/XUnit/ConditionalFactAttribute.cs Updates conditional fact/theory attributes for v3 source-info support and nullable Skip.
test/dotnet-format.UnitTests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs Updates IAsyncLifetime signatures to ValueTask-based pattern.
test/Directory.Build.targets Sets xUnit v3 runner name + OutputType=Exe for test projects; removes custom Program.cs injection.
test/Directory.Build.props Adds xUnit analyzer suppression + disables MTP runner for now (incremental migration).
test/Common/Program.cs Removes legacy xUnit console-entrypoint program used for Exe test projects.
src/Microsoft.CodeAnalysis.NetAnalyzers/tests/Test.Utilities/Test.Utilities.csproj Updates analyzer test utilities to xUnit v3 assert package.
src/Microsoft.CodeAnalysis.NetAnalyzers/tests/Microsoft.CodeAnalysis.NetAnalyzers.UnitTests/Microsoft.NetCore.Analyzers/Performance/DoNotUseCountWhenAnyCanBeUsedTests.Data.cs Adjusts theory-data enumeration to xUnit v3 data-row APIs.
eng/XUnitV3/XUnitV3.targets Adds central MSBuild targets to wire up xUnit v3 (MTP or VSTest).
eng/XUnitV3/XUnitV3.Runner.targets Adds xUnit v3 runner execution target + results file wiring.
eng/XUnitV3/xunit.runner.json Adds default xUnit v3 runner settings file.
eng/Versions.props Updates Xunit.Combinatorial version for v3 migration compatibility.
eng/Version.Details.xml Renames TemplateEngine + XUnit extensions dependencies to xUnit v3 variants.
eng/Version.Details.props Renames corresponding version properties to xUnit v3 variants.
eng/Packages.props Updates Verify package name to Verify.XunitV3.
eng/dependabot/Packages.props Updates Verify package name to Verify.XunitV3 for dependency updates.
Directory.Packages.props Switches central package versions to xUnit v3 packages and removes xunit v2 package version.
Directory.Build.targets Removes xunit.console packaging/copy logic for test Exe projects.
build/SetupHelixEnvironment.sh Enables .NET crash dump collection environment variables for Helix.
build/SetupHelixEnvironment.cmd Enables .NET crash dump collection environment variables for Helix.
build/helix-debug-entitlements.plist Adds macOS entitlement plist used for ad-hoc signing to enable crash dumps.

Comment thread test/dotnet-format.UnitTests/XUnit/MSBuildFactAttribute.cs
Comment thread test/dotnet-format.UnitTests/XUnit/MSBuildTheoryAttribute.cs
Comment thread test/xunit-runner/XUnitRunner.targets
Comment thread test/Microsoft.NET.TestFramework/SharedTestOutputHelper.cs
@MichaelSimons
Copy link
Copy Markdown
Member Author

/ba-g intermittent failures.

@MichaelSimons MichaelSimons merged commit 7aa1db6 into main Apr 13, 2026
27 of 29 checks passed
@MichaelSimons MichaelSimons deleted the re-apply-xunit.v3 branch April 13, 2026 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants