From b0af36f33fd8be302585d4c5e5eb57c99d723675 Mon Sep 17 00:00:00 2001 From: Sam Byass Date: Tue, 4 Jan 2022 20:16:50 +0000 Subject: [PATCH] Core: Skip public key tokens for now bc they cause issues --- Cpp2IL.Core/StubAssemblyBuilder.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Cpp2IL.Core/StubAssemblyBuilder.cs b/Cpp2IL.Core/StubAssemblyBuilder.cs index 9942e563..d0fe9272 100644 --- a/Cpp2IL.Core/StubAssemblyBuilder.cs +++ b/Cpp2IL.Core/StubAssemblyBuilder.cs @@ -48,9 +48,11 @@ private static AssemblyDefinition BuildStubAssembly(ModuleParameters moduleParam asmName.HashAlgorithm = (AssemblyHashAlgorithm) assemblyDefinition.AssemblyName.hash_alg; asmName.Attributes = (AssemblyAttributes) assemblyDefinition.AssemblyName.flags; asmName.Culture = assemblyDefinition.AssemblyName.Culture; - asmName.PublicKeyToken = BitConverter.GetBytes(assemblyDefinition.AssemblyName.publicKeyToken); - if (assemblyDefinition.AssemblyName.publicKeyToken == 0) - asmName.PublicKeyToken = Array.Empty(); + + //This just causes more pain than it's worth, so we comment it out + // asmName.PublicKeyToken = BitConverter.GetBytes(assemblyDefinition.AssemblyName.publicKeyToken); + // if (assemblyDefinition.AssemblyName.publicKeyToken == 0) + asmName.PublicKeyToken = Array.Empty(); // asmName.PublicKey = Encoding.UTF8.GetBytes(assemblyDefinition.AssemblyName.PublicKey); //This seems to be garbage data, e.g. "\x0\x0\x0\x0\x0\x0\x0\x0\x4\x0\x0\x0\x0\x0\x0\x0", so we skip asmName.Hash = assemblyDefinition.AssemblyName.hash_len == 0 ? Array.Empty() : Encoding.UTF8.GetBytes(assemblyDefinition.AssemblyName.HashValue);