|
|
|
@ -251,14 +251,28 @@ namespace ICSharpCode.ILSpy.TreeNodes
@@ -251,14 +251,28 @@ namespace ICSharpCode.ILSpy.TreeNodes
|
|
|
|
|
|
|
|
|
|
public override void Decompile(Language language, ITextOutput output, DecompilationOptions options) |
|
|
|
|
{ |
|
|
|
|
void HandleException(Exception ex, string message) |
|
|
|
|
{ |
|
|
|
|
language.WriteCommentLine(output, message); |
|
|
|
|
|
|
|
|
|
output.WriteLine(); |
|
|
|
|
output.MarkFoldStart("Exception details", true); |
|
|
|
|
output.Write(ex.ToString()); |
|
|
|
|
output.MarkFoldEnd(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
assembly.WaitUntilLoaded(); // necessary so that load errors are passed on to the caller
|
|
|
|
|
} catch (AggregateException ex) { |
|
|
|
|
language.WriteCommentLine(output, assembly.FileName); |
|
|
|
|
if (ex.InnerException is BadImageFormatException) { |
|
|
|
|
language.WriteCommentLine(output, "This file does not contain a managed assembly."); |
|
|
|
|
switch (ex.InnerException) { |
|
|
|
|
case BadImageFormatException badImage: |
|
|
|
|
HandleException(badImage, "This file does not contain a managed assembly."); |
|
|
|
|
return; |
|
|
|
|
} else { |
|
|
|
|
case FileNotFoundException fileNotFound: |
|
|
|
|
HandleException(fileNotFound, "The file was not found."); |
|
|
|
|
return; |
|
|
|
|
default: |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|