From 37709866b84b9eb3cac0e65e1d759ef128c208cd Mon Sep 17 00:00:00 2001 From: Ryan Lucia Date: Mon, 17 Jun 2019 13:44:44 -0400 Subject: [PATCH] [netcore] Don't default to an empty array for a null publicKey Commit migrated from https://github.com/mono/mono/commit/7a1605cb0703095fba9e13dcd2739dd90915f266 --- src/mono/netcore/CoreFX.issues.rsp | 2 -- .../System.Private.CoreLib/src/System.Reflection/AssemblyName.cs | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mono/netcore/CoreFX.issues.rsp b/src/mono/netcore/CoreFX.issues.rsp index 67dde67..be1b2d1 100644 --- a/src/mono/netcore/CoreFX.issues.rsp +++ b/src/mono/netcore/CoreFX.issues.rsp @@ -407,8 +407,6 @@ -nomethod System.Reflection.Tests.MemberInfoNetCoreAppTests.HasSameMetadataDefinitionAs__CornerCase_HasElementTypes -nomethod System.Reflection.Tests.MemberInfoNetCoreAppTests.HasSameMetadataDefinitionAs_GenericTypeParameters -nomethod System.Reflection.Tests.MemberInfoTests.GenericMethodsInheritTheReflectedTypeOfTheirTemplate --nomethod System.Reflection.Tests.AssemblyNameTests.SetPublicKeyToken_GetPublicKeyToken --nomethod System.Reflection.Tests.AssemblyNameTests.FullName -nomethod System.Reflection.Tests.AssemblyTests.LoadFile -nomethod System.Reflection.Tests.AssemblyTests.GetType_DoesntSearchMscorlib -nomethod System.Reflection.Tests.AssemblyTests.LoadFrom_SameIdentityAsAssemblyWithDifferentPath_ReturnsEqualAssemblies diff --git a/src/mono/netcore/System.Private.CoreLib/src/System.Reflection/AssemblyName.cs b/src/mono/netcore/System.Private.CoreLib/src/System.Reflection/AssemblyName.cs index 3e3a7d2..5d93f5c 100644 --- a/src/mono/netcore/System.Private.CoreLib/src/System.Reflection/AssemblyName.cs +++ b/src/mono/netcore/System.Private.CoreLib/src/System.Reflection/AssemblyName.cs @@ -38,7 +38,9 @@ namespace System.Reflection unsafe byte [] ComputePublicKeyToken () { - if (_publicKey == null || _publicKey.Length == 0) + if (_publicKey == null) + return null; + if (_publicKey.Length == 0) return Array.Empty(); var token = new byte [8]; -- 2.7.4