From 04e80763fe072ced03c3d6f2006db6e2588a345a Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Wed, 19 Jun 2024 06:39:02 -0700 Subject: [PATCH 1/3] Revert "Add System.IO.Hashing dependency to windowsdesktop transport pack (#103695)" This reverts commit 153296b162f6db9f66e850432569977d74a3e867. --- src/libraries/NetCoreAppLibrary.props | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/NetCoreAppLibrary.props b/src/libraries/NetCoreAppLibrary.props index a4c9e537977cd4..a3f63978bf92da 100644 --- a/src/libraries/NetCoreAppLibrary.props +++ b/src/libraries/NetCoreAppLibrary.props @@ -233,7 +233,6 @@ System.Diagnostics.PerformanceCounter; System.DirectoryServices; System.Formats.Nrbf; - System.IO.Hashing; System.IO.Packaging; System.Resources.Extensions; System.Security.Cryptography.Pkcs; From 3b68b70abb0854cf025c89080c4a88c21f4f3aa2 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Wed, 19 Jun 2024 06:42:12 -0700 Subject: [PATCH 2/3] Remove System.IO.Hashing dependency from Nrbf --- .../ref/System.Formats.Nrbf.csproj | 1 - .../src/System.Formats.Nrbf.csproj | 1 - .../src/System/Formats/Nrbf/SerializationRecordId.cs | 12 +----------- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/libraries/System.Formats.Nrbf/ref/System.Formats.Nrbf.csproj b/src/libraries/System.Formats.Nrbf/ref/System.Formats.Nrbf.csproj index ce25b66a4473ce..0d64bbf0a72d7d 100644 --- a/src/libraries/System.Formats.Nrbf/ref/System.Formats.Nrbf.csproj +++ b/src/libraries/System.Formats.Nrbf/ref/System.Formats.Nrbf.csproj @@ -9,7 +9,6 @@ - diff --git a/src/libraries/System.Formats.Nrbf/src/System.Formats.Nrbf.csproj b/src/libraries/System.Formats.Nrbf/src/System.Formats.Nrbf.csproj index 53475dec19f233..a5f7a704c0076a 100644 --- a/src/libraries/System.Formats.Nrbf/src/System.Formats.Nrbf.csproj +++ b/src/libraries/System.Formats.Nrbf/src/System.Formats.Nrbf.csproj @@ -17,7 +17,6 @@ System.Formats.Nrbf.NrbfDecoder true - diff --git a/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/SerializationRecordId.cs b/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/SerializationRecordId.cs index 5df884c2d6c564..120b4e37510cd5 100644 --- a/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/SerializationRecordId.cs +++ b/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/SerializationRecordId.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Formats.Nrbf.Utils; using System.IO; -using System.IO.Hashing; using System.Linq; using System.Runtime.InteropServices; using System.Text; @@ -45,14 +44,5 @@ internal static SerializationRecordId Decode(BinaryReader reader) public override bool Equals(object? obj) => obj is SerializationRecordId other && Equals(other); /// - public override int GetHashCode() - { - int id = _id; -#if NET - Span integers = new(ref id); -#else - Span integers = stackalloc int[1] { id }; -#endif - return (int)XxHash32.HashToUInt32(MemoryMarshal.AsBytes(integers)); - } + public override int GetHashCode() => _id; } From 2c5d4acffaf9c5f7457862e1f68a8ab1a8e94991 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Wed, 19 Jun 2024 07:52:35 -0700 Subject: [PATCH 3/3] Use HashCode --- .../System.Formats.Nrbf/src/System.Formats.Nrbf.csproj | 1 + .../src/System/Formats/Nrbf/SerializationRecordId.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Formats.Nrbf/src/System.Formats.Nrbf.csproj b/src/libraries/System.Formats.Nrbf/src/System.Formats.Nrbf.csproj index a5f7a704c0076a..6f63aa92581d33 100644 --- a/src/libraries/System.Formats.Nrbf/src/System.Formats.Nrbf.csproj +++ b/src/libraries/System.Formats.Nrbf/src/System.Formats.Nrbf.csproj @@ -25,5 +25,6 @@ System.Formats.Nrbf.NrbfDecoder + diff --git a/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/SerializationRecordId.cs b/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/SerializationRecordId.cs index 120b4e37510cd5..7f51525e6e1139 100644 --- a/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/SerializationRecordId.cs +++ b/src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/SerializationRecordId.cs @@ -44,5 +44,5 @@ internal static SerializationRecordId Decode(BinaryReader reader) public override bool Equals(object? obj) => obj is SerializationRecordId other && Equals(other); /// - public override int GetHashCode() => _id; + public override int GetHashCode() => HashCode.Combine(_id); }