Skip to content

Commit

Permalink
Remove System.IO.Hashing dependency from Nrbf (#103700)
Browse files Browse the repository at this point in the history
* Revert "Add System.IO.Hashing dependency to windowsdesktop transport pack (#103695)"

This reverts commit 153296b.

* Remove System.IO.Hashing dependency from Nrbf

* Use HashCode
  • Loading branch information
stephentoub authored Jun 19, 2024
1 parent 7934e64 commit 063255a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/libraries/NetCoreAppLibrary.props
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)System.IO.Hashing\ref\System.IO.Hashing.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.Reflection.Metadata\ref\System.Reflection.Metadata.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ System.Formats.Nrbf.NrbfDecoder</PackageDescription>
<DisablePackageBaselineValidation>true</DisablePackageBaselineValidation>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)\System.IO.Hashing\src\System.IO.Hashing.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)\System.Reflection.Metadata\src\System.Reflection.Metadata.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
Expand All @@ -26,5 +25,6 @@ System.Formats.Nrbf.NrbfDecoder</PackageDescription>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<Compile Include="$(CoreLibSharedDir)System\Diagnostics\CodeAnalysis\RequiresDynamicCodeAttribute.cs"
Link="System\Diagnostics\CodeAnalysis\RequiresDynamicCodeAttribute.cs" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="$(MicrosoftBclHashCodeVersion)" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -45,14 +44,5 @@ internal static SerializationRecordId Decode(BinaryReader reader)
public override bool Equals(object? obj) => obj is SerializationRecordId other && Equals(other);

/// <inheritdoc />
public override int GetHashCode()
{
int id = _id;
#if NET
Span<int> integers = new(ref id);
#else
Span<int> integers = stackalloc int[1] { id };
#endif
return (int)XxHash32.HashToUInt32(MemoryMarshal.AsBytes(integers));
}
public override int GetHashCode() => HashCode.Combine(_id);
}

0 comments on commit 063255a

Please sign in to comment.