[netcore] Don't default to an empty array for a null publicKey
authorRyan Lucia <rylucia@microsoft.com>
Mon, 17 Jun 2019 17:44:44 +0000 (13:44 -0400)
committerMarek Safar <marek.safar@gmail.com>
Tue, 18 Jun 2019 17:44:51 +0000 (19:44 +0200)
Commit migrated from https://github.com/mono/mono/commit/7a1605cb0703095fba9e13dcd2739dd90915f266

src/mono/netcore/CoreFX.issues.rsp
src/mono/netcore/System.Private.CoreLib/src/System.Reflection/AssemblyName.cs

index 67dde67..be1b2d1 100644 (file)
 -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
index 3e3a7d2..5d93f5c 100644 (file)
@@ -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<byte>();
                                
                        var token = new byte [8];