Skip to content

Commit 063255a

Browse files
authoredJun 19, 2024··
Remove System.IO.Hashing dependency from Nrbf (#103700)
* Revert "Add System.IO.Hashing dependency to windowsdesktop transport pack (#103695)" This reverts commit 153296b. * Remove System.IO.Hashing dependency from Nrbf * Use HashCode
1 parent 7934e64 commit 063255a

File tree

4 files changed

+2
-14
lines changed

4 files changed

+2
-14
lines changed
 

‎src/libraries/NetCoreAppLibrary.props

-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,6 @@
233233
System.Diagnostics.PerformanceCounter;
234234
System.DirectoryServices;
235235
System.Formats.Nrbf;
236-
System.IO.Hashing;
237236
System.IO.Packaging;
238237
System.Resources.Extensions;
239238
System.Security.Cryptography.Pkcs;

‎src/libraries/System.Formats.Nrbf/ref/System.Formats.Nrbf.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
</ItemGroup>
1010

1111
<ItemGroup>
12-
<ProjectReference Include="$(LibrariesProjectRoot)System.IO.Hashing\ref\System.IO.Hashing.csproj" />
1312
<ProjectReference Include="$(LibrariesProjectRoot)System.Reflection.Metadata\ref\System.Reflection.Metadata.csproj" />
1413
</ItemGroup>
1514

‎src/libraries/System.Formats.Nrbf/src/System.Formats.Nrbf.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ System.Formats.Nrbf.NrbfDecoder</PackageDescription>
1717
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
1818
</PropertyGroup>
1919
<ItemGroup>
20-
<ProjectReference Include="$(LibrariesProjectRoot)\System.IO.Hashing\src\System.IO.Hashing.csproj" />
2120
<ProjectReference Include="$(LibrariesProjectRoot)\System.Reflection.Metadata\src\System.Reflection.Metadata.csproj" />
2221
</ItemGroup>
2322
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
@@ -26,5 +25,6 @@ System.Formats.Nrbf.NrbfDecoder</PackageDescription>
2625
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
2726
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\RequiresDynamicCodeAttribute.cs"
2827
Link="System\Diagnostics\CodeAnalysis\RequiresDynamicCodeAttribute.cs" />
28+
<PackageReference Include="Microsoft.Bcl.HashCode" Version="$(MicrosoftBclHashCodeVersion)" />
2929
</ItemGroup>
3030
</Project>

‎src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/SerializationRecordId.cs

+1-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using System.Collections.Generic;
66
using System.Formats.Nrbf.Utils;
77
using System.IO;
8-
using System.IO.Hashing;
98
using System.Linq;
109
using System.Runtime.InteropServices;
1110
using System.Text;
@@ -45,14 +44,5 @@ internal static SerializationRecordId Decode(BinaryReader reader)
4544
public override bool Equals(object? obj) => obj is SerializationRecordId other && Equals(other);
4645

4746
/// <inheritdoc />
48-
public override int GetHashCode()
49-
{
50-
int id = _id;
51-
#if NET
52-
Span<int> integers = new(ref id);
53-
#else
54-
Span<int> integers = stackalloc int[1] { id };
55-
#endif
56-
return (int)XxHash32.HashToUInt32(MemoryMarshal.AsBytes(integers));
57-
}
47+
public override int GetHashCode() => HashCode.Combine(_id);
5848
}

0 commit comments

Comments
 (0)
Please sign in to comment.