Browse Source

#2295: Avoid using `GetPEFileOrNull` if we can't actually handle a `null` return value

This improves the exception message shown when trying to disassemble a .nupkg as IL.
pull/2308/head
Daniel Grunwald 4 years ago
parent
commit
7c9f1dc8ef
  1. 2
      ILSpy.ReadyToRun/ReadyToRunLanguage.cs
  2. 2
      ILSpy/Languages/ILLanguage.cs

2
ILSpy.ReadyToRun/ReadyToRunLanguage.cs

@ -106,7 +106,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun @@ -106,7 +106,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun
public override ProjectId DecompileAssembly(LoadedAssembly assembly, ITextOutput output, DecompilationOptions options)
{
PEFile module = assembly.GetPEFileOrNull();
PEFile module = assembly.GetPEFileAsync().GetAwaiter().GetResult();
ReadyToRunReaderCacheEntry cacheEntry = GetReader(assembly, module);
if (cacheEntry.readyToRunReader == null)
{

2
ILSpy/Languages/ILLanguage.cs

@ -162,7 +162,7 @@ namespace ICSharpCode.ILSpy @@ -162,7 +162,7 @@ namespace ICSharpCode.ILSpy
{
output.WriteLine("// " + assembly.FileName);
output.WriteLine();
var module = assembly.GetPEFileOrNull();
var module = assembly.GetPEFileAsync().GetAwaiter().GetResult();
var metadata = module.Metadata;
var dis = CreateDisassembler(output, options);

Loading…
Cancel
Save