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)

@nohwnd nohwnd merged commit 5ea14d0 into main Jan 28, 2026
6 checks passed
@nohwnd nohwnd deleted the dev/ygerges/use-equalitycomparer branch January 28, 2026 07:39
nohwnd added a commit to nohwnd/vstest that referenced this pull request Mar 25, 2026
Add 32 new test files covering 30 areas of bug fixes that were merged
without corresponding tests. Each test documents which PR/issue it
prevents from regressing.

Areas covered:
- TestProperty.Equals ID-based equality (microsoft#15370)
- TraitCollection.GetTraits with EqualityComparer (microsoft#15370, microsoft#15249)
- CommandLineUtilities backslash-quote parsing (microsoft#15304)
- ManagedNameParser F# method name unescaping (microsoft#4972)
- ManagedNameParser edge cases (microsoft#15259, microsoft#15255)
- Condition evaluation operations refactor (microsoft#15357)
- Condition parsing and tokenization (microsoft#15357)
- TrackableEvent subscribe/notify/wait (microsoft#4553)
- PathConverter path replacement for UWP (microsoft#3367)
- NullPathConverter singleton pattern (microsoft#3367)
- PathConverter attachment handling (microsoft#3367)
- PathConverter DiscoveryCriteria/TestRunCriteria (microsoft#3367)
- DiscoveryDataAggregator source status tracking (microsoft#3381)
- DiscoveryCompleteEventArgs status properties (microsoft#3381)
- DiscoveryCriteria constructor behavior (microsoft#3381)
- JsonDataSerializer discovery status (microsoft#3381)
- JsonDataSerializer payload serialization (microsoft#3381)
- LengthPrefixCommunicationChannel TrackableEvent (microsoft#4553)
- TrxLogger WarnOnFileOverwrite parameter (microsoft#5141)
- VSTestTask2 message parsing and error codes (microsoft#5115, microsoft#5113)
- VSTestTask2 ANSI escape handling (microsoft#5084)
- VSTestTask2 duration formatting (microsoft#4894)
- TestHostManagerCallbacks error as informational (microsoft#5192)
- ConsoleLogger MinimalTestResult timing fix (microsoft#5143)
- TestResult timing properties (microsoft#5143, microsoft#4894)
- TestCase serialization with traits (microsoft#15370)
- TestObject property storage (microsoft#15370, microsoft#15249)
- Condition ValidForProperties (microsoft#15357)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nohwnd added a commit that referenced this pull request Mar 30, 2026
* Deprecate EnableShutdownAfterTestRun which is no-op

* Add regression tests for untested bug fixes

Add 32 new test files covering 30 areas of bug fixes that were merged
without corresponding tests. Each test documents which PR/issue it
prevents from regressing.

Areas covered:
- TestProperty.Equals ID-based equality (#15370)
- TraitCollection.GetTraits with EqualityComparer (#15370, #15249)
- CommandLineUtilities backslash-quote parsing (#15304)
- ManagedNameParser F# method name unescaping (#4972)
- ManagedNameParser edge cases (#15259, #15255)
- Condition evaluation operations refactor (#15357)
- Condition parsing and tokenization (#15357)
- TrackableEvent subscribe/notify/wait (#4553)
- PathConverter path replacement for UWP (#3367)
- NullPathConverter singleton pattern (#3367)
- PathConverter attachment handling (#3367)
- PathConverter DiscoveryCriteria/TestRunCriteria (#3367)
- DiscoveryDataAggregator source status tracking (#3381)
- DiscoveryCompleteEventArgs status properties (#3381)
- DiscoveryCriteria constructor behavior (#3381)
- JsonDataSerializer discovery status (#3381)
- JsonDataSerializer payload serialization (#3381)
- LengthPrefixCommunicationChannel TrackableEvent (#4553)
- TrxLogger WarnOnFileOverwrite parameter (#5141)
- VSTestTask2 message parsing and error codes (#5115, #5113)
- VSTestTask2 ANSI escape handling (#5084)
- VSTestTask2 duration formatting (#4894)
- TestHostManagerCallbacks error as informational (#5192)
- ConsoleLogger MinimalTestResult timing fix (#5143)
- TestResult timing properties (#5143, #4894)
- TestCase serialization with traits (#15370)
- TestObject property storage (#15370, #15249)
- Condition ValidForProperties (#15357)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Youssef1313 <youssefvictor00@gmail.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 7, 2026
This was referenced Apr 12, 2026
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