Skip to content

Fix .NET 10 regression for traits#15370

Merged
nohwnd merged 3 commits intomainfrom
dev/ygerges/use-equalitycomparer
Jan 28, 2026
Merged

Fix .NET 10 regression for traits#15370
nohwnd merged 3 commits intomainfrom
dev/ygerges/use-equalitycomparer

Conversation

@Youssef1313
Copy link
Copy Markdown
Member

@Youssef1313 Youssef1313 commented Jan 23, 2026

Fixes #15369

This is a regression from .NET runtime. It impacts users updating to .NET 10 SDK as vstest.console.exe is run under .NET 10. It still impacts users even if their test projects don't target net10.0.

This is already covered by some tests, just that we need to run those tests on net10.0.

Without the change, the following tests fail:

failed CloneShouldCloneTestCaseObject (179ms)
  Assert.AreEqual failed. Expected:<1>. Actual:<0>.
    at Microsoft.TestPlatform.CommunicationUtilities.UnitTests.JsonDataSerializerTests.VerifyTestCaseClone(TestCase clonedTestCase, TestCase testCase, Trait expectedTrait) in \test\Microsoft.TestPlatform.CommunicationUtilities.UnitTests\JsonDataSerializerTests.cs:244
    at Microsoft.TestPlatform.CommunicationUtilities.UnitTests.JsonDataSerializerTests.CloneShouldCloneTestCaseObject() in \test\Microsoft.TestPlatform.CommunicationUtilities.UnitTests\JsonDataSerializerTests.cs:199
    at InvokeStub_JsonDataSerializerTests.CloneShouldCloneTestCaseObject(Object, Object, IntPtr*)
    at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

failed TestCaseObjectShouldContainAllPropertiesOnDeserializationV2 (4ms)
  Test method Microsoft.TestPlatform.CommunicationUtilities.UnitTests.Serialization.TestCaseSerializationTests.TestCaseObjectShouldContainAllPropertiesOnDeserializationV2 threw exception:
  System.InvalidOperationException: Sequence contains no elements
    at System.Linq.ThrowHelper.ThrowNoElementsException()
    at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)
    at Microsoft.TestPlatform.CommunicationUtilities.UnitTests.Serialization.TestCaseSerializationTests.TestCaseObjectShouldContainAllPropertiesOnDeserializationV2() in \test\Microsoft.TestPlatform.CommunicationUtilities.UnitTests\Serialization\TestCaseSerializationTests.cs:180
    at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
    at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

failed TestCaseObjectShouldDeserializeTraitsWithSpecialCharacters (2) (0ms)
  Assert.AreEqual failed. Expected:<1>. Actual:<0>.
    at Microsoft.TestPlatform.CommunicationUtilities.UnitTests.Serialization.TestCaseSerializationTests.TestCaseObjectShouldDeserializeTraitsWithSpecialCharacters(Int32 version) in \test\Microsoft.TestPlatform.CommunicationUtilities.UnitTests\Serialization\TestCaseSerializationTests.cs:250
    at InvokeStub_TestCaseSerializationTests.TestCaseObjectShouldDeserializeTraitsWithSpecialCharacters(Object, Span`1)
    at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Regression] TRX files missing traits (TestCase.Traits empty) in .NET 10 SDK

2 participants