public static string PrintIL(this MethodDefinition self) { try { var textoutput = new ICSharpCode.Decompiler.PlainTextOutput(); var options = new ICSharpCode.ILSpy.DecompilationOptions(); var lang = new ICSharpCode.ILSpy.ILLanguage(true); lang.DecompileMethod(self, textoutput, options); return(textoutput.ToString()); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); Console.ForegroundColor = ConsoleColor.Gray; return(ex.Message); } }
public static string PrintIL(this MethodDefinition self) { try { var textoutput = new ICSharpCode.Decompiler.PlainTextOutput(); var options = new ICSharpCode.ILSpy.DecompilationOptions(); var lang = new ICSharpCode.ILSpy.ILLanguage(true); lang.DecompileMethod(self, textoutput, options); return textoutput.ToString(); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); Console.ForegroundColor = ConsoleColor.Gray; return ex.Message; } }