From 2a7e9c1d78eaa87b1cf5d527d8aaba6d803cfdcf Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Thu, 30 Dec 2021 12:41:46 +0100 Subject: [PATCH] #2590: Fix printing of "Invalid MethodBodyBlock" comments. Make them appear between the braces of the block. --- ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs b/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs index b4e814627..a07dd8d39 100644 --- a/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs +++ b/ICSharpCode.Decompiler/CSharp/CSharpDecompiler.cs @@ -1521,6 +1521,8 @@ namespace ICSharpCode.Decompiler.CSharp { body = new BlockStatement(); body.AddChild(new Comment("Invalid MethodBodyBlock: " + ex.Message), Roles.Comment); + // insert explicit rbrace token to make the comment appear within the braces + body.AddChild(new CSharpTokenNode(TextLocation.Empty, Roles.RBrace), Roles.RBrace); entityDecl.AddChild(body, Roles.Body); return; }