Skip to content

Commit

Permalink
Core: Skip public key tokens for now bc they cause issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Byass committed Jan 4, 2022
1 parent 4ee07d1 commit b0af36f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Cpp2IL.Core/StubAssemblyBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<byte>();

//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<byte>();
// 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<byte>() : Encoding.UTF8.GetBytes(assemblyDefinition.AssemblyName.HashValue);

Expand Down

0 comments on commit b0af36f

Please sign in to comment.