Update ReferenceEqualityComparer.cs (#24728)

We don't support running on mono 4.x anymore
This commit is contained in:
David Fowler 2020-08-10 09:08:45 -07:00 committed by GitHub
parent 369b8a17cb
commit 24f35bc76f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 10 deletions

View File

@ -9,8 +9,6 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
internal class ReferenceEqualityComparer : IEqualityComparer<object>
{
private static readonly bool IsMono = Type.GetType("Mono.Runtime") != null;
public static ReferenceEqualityComparer Instance { get; } = new ReferenceEqualityComparer();
public new bool Equals(object x, object y)
@ -20,14 +18,6 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
public int GetHashCode(object obj)
{
// RuntimeHelpers.GetHashCode sometimes crashes the runtime on Mono 4.0.4
// See: https://github.com/aspnet/External/issues/45
// The workaround here is to just not hash anything, and fall back to an equality check.
if (IsMono)
{
return 0;
}
return RuntimeHelpers.GetHashCode(obj);
}
}