Prepare for xunit.v3.assert migration: forward-compatibility changes#125413
Prepare for xunit.v3.assert migration: forward-compatibility changes#125413
Conversation
…sert Replace all references to Microsoft.DotNet.XUnitAssert and xunit.assert with xunit.v3.assert (v3.2.2 via $(XUnitV3Version) from Arcade SDK). This removes the conditional split between .NETCoreApp and non-.NETCoreApp targets since xunit.v3.assert supports both via netstandard2.0 and net8.0. Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
|
This is to test for xunit3-specific breaking changes. |
…Values calls - Suppress xUnit1051 (TestContext.Current.CancellationToken) in xunit.props since only the assert package is migrated, not the full v3 test patterns. - Update all EqualException.ForMismatchedValues(object, object, string) calls to use the new string-based overload ForMismatchedValues(string, string, string) as the object overload is obsolete in xunit.v3.assert. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… TestUtils - Add xUnit1051 suppression to .editorconfig (dotnet_diagnostic severity=none) for robustness against projects that reset NoWarn - Add xUnit1051 to src/tests/Directory.Build.props for CoreCLR tests - Fix CS0618 in TestUtils.cs: use string interpolation for non-nullable args Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t.v3.assert The ILLinker descriptor referenced the old assembly name, causing NativeAOT and trimming builds to fail with IL2007/MSB3073 errors. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
….v3.assert The rd.xml was using the type name as the assembly name. The actual .NET assembly name for xunit.v3.assert is 'xunit.v3.assert' (lowercase). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Update 3 IL test files to reference xunit.v3.assert (v3.2.2.0) instead of the old xunit.assert (v2.4.2.0) assembly - Fix GroupCollectionTests2.DebuggerAttributeTests: use Cast<Group>() to ensure both sides enumerate as IEnumerable<Group> for xunit v3 collection comparison Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These files reference assembly names used by the ILLinker and NativeAOT trimmer. The xunit.v3.assert assembly needs to be recompiled with AOT support enabled separately; updating these names without that causes more failures than it fixes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
90a9241 to
0293950
Compare
|
@copilot please revert the actual switch to the xunit.v3.assert package, but keep the changes needed to provide compatibility (except where they were made solely to adapt to assembly name). |
Reverts all package reference changes back to the original Microsoft.DotNet.XUnitAssert/xunit.assert packages. Also reverts IL assembly extern name changes. Keeps forward-compatibility changes: - EqualException.ForMismatchedValues string conversions - xUnit1051 analyzer suppression - GroupCollection comparison fix Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Reverted in 9af3b69. All package references are back to the original |
Description
Prepares the codebase for a future migration to
xunit.v3.assertby making forward-compatible changes that work with the currentMicrosoft.DotNet.XUnitAssert/xunit.assertpackages. No actual package switch is made.EqualException.ForMismatchedValuesstring conversions: Updated allForMismatchedValues(object, object)call sites across test files to pass string arguments instead, which is compatible with both the current packages and futurexunit.v3.assert(which only accepts strings). Affected files include test code inSystem.Runtime,System.Numerics.Tensors,System.Runtime.Numerics,System.Runtime.InteropServices,System.Globalization,Microsoft.Extensions.Logging,ICollectionTest, andWasm.Build.Tests.xUnit1051 analyzer suppression: Added suppression for
xUnit1051(which recommendsTestContext.Current.CancellationToken, a v3 pattern not yet adopted) in.editorconfig,eng/testing/xunit/xunit.props, andsrc/tests/Directory.Build.props.GroupCollectionTests2.cscollection comparison fix: ChangedAssert.Equal(col, items)toAssert.Equal(col.Cast<Group>(), items)for forward-compatible collection comparison behavior with xunit v3.🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.