Browse Source

Fix #2090: ignore mscorlib references without public key token, when trying to resolve mscorlib. This will automatically fallback to .NET 4.0's mscorlib.dll.

pull/2113/head
Siegfried Pammer 6 years ago
parent
commit
1c563a62a9
  1. 3
      ICSharpCode.Decompiler/Metadata/MetadataExtensions.cs
  2. 3
      ICSharpCode.Decompiler/Metadata/UniversalAssemblyResolver.cs

3
ICSharpCode.Decompiler/Metadata/MetadataExtensions.cs

@ -95,6 +95,9 @@ namespace ICSharpCode.Decompiler.Metadata
public static string ToHexString(this IEnumerable<byte> bytes, int estimatedLength) public static string ToHexString(this IEnumerable<byte> bytes, int estimatedLength)
{ {
if (bytes == null)
throw new ArgumentNullException(nameof(bytes));
StringBuilder sb = new StringBuilder(estimatedLength * 2); StringBuilder sb = new StringBuilder(estimatedLength * 2);
foreach (var b in bytes) foreach (var b in bytes)
sb.AppendFormat("{0:x2}", b); sb.AppendFormat("{0:x2}", b);

3
ICSharpCode.Decompiler/Metadata/UniversalAssemblyResolver.cs

@ -398,6 +398,9 @@ namespace ICSharpCode.Decompiler.Metadata
return typeof(object).Module.FullyQualifiedName; return typeof(object).Module.FullyQualifiedName;
} }
if (reference.PublicKeyToken == null)
return null;
string path; string path;
if (decompilerRuntime == DecompilerRuntime.Mono) { if (decompilerRuntime == DecompilerRuntime.Mono) {
path = GetMonoMscorlibBasePath(version); path = GetMonoMscorlibBasePath(version);

Loading…
Cancel
Save