Sitelet https://github.com/microsoft/vstest/commit/5ea14d056fb9fd42184f0741481b3812c9ea23ff
Skip to content

Commit 5ea14d0

Browse files
Youssef1313nohwnd
andauthored
Fix .NET 10 regression for traits (#15370)
* Fix .NET 10 regression for traits * Also fix object equality dotnet/runtime#123533 (comment) --------- Co-authored-by: Jakub Jareš <me@jakubjares.com>
1 parent be68683 commit 5ea14d0

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/Microsoft.TestPlatform.ObjectModel/TestProperty/TestProperty.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public override int GetHashCode()
135135
/// <inheritdoc/>
136136
public override bool Equals(object? obj)
137137
{
138-
return base.Equals(obj as TestProperty);
138+
return Equals(obj as TestProperty);
139139
}
140140

141141
/// <inheritdoc/>

‎src/Microsoft.TestPlatform.ObjectModel/TraitCollection.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ IEnumerator IEnumerable.GetEnumerator()
6565

6666
private IEnumerable<Trait> GetTraits()
6767
{
68-
if (!_testObject.Properties.Contains(TraitsProperty))
68+
if (!_testObject.Properties.Contains(TraitsProperty, EqualityComparer<TestProperty>.Default))
6969
{
7070
return Array.Empty<Trait>();
7171
}

‎test/Microsoft.TestPlatform.CommunicationUtilities.UnitTests/Microsoft.TestPlatform.CommunicationUtilities.UnitTests.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<PropertyGroup>
9-
<TargetFrameworks>net9.0;net48</TargetFrameworks>
9+
<TargetFrameworks>net10.0;net9.0;net48</TargetFrameworks>
1010
<OutputType>Exe</OutputType>
1111
<AssemblyName>Microsoft.TestPlatform.CommunicationUtilities.UnitTests</AssemblyName>
1212
</PropertyGroup>

0 commit comments

Comments
 (0)