diff --git a/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs b/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs index 4819f8bb2..452b90ec1 100644 --- a/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs +++ b/ICSharpCode.Decompiler/Ast/AstMethodBodyBuilder.cs @@ -160,12 +160,18 @@ namespace ICSharpCode.Decompiler.Ast var tryCatchStmt = new Ast.TryCatchStatement(); tryCatchStmt.TryBlock = TransformBlock(tryCatchNode.TryBlock); foreach (var catchClause in tryCatchNode.CatchBlocks) { - tryCatchStmt.CatchClauses.Add( - new Ast.CatchClause { - Type = AstBuilder.ConvertType(catchClause.ExceptionType), - VariableName = catchClause.ExceptionVariable == null ? null : catchClause.ExceptionVariable.Name, - Body = TransformBlock(catchClause) - }); + if (catchClause.ExceptionVariable == null + && (catchClause.ExceptionType == null || catchClause.ExceptionType.MetadataType == MetadataType.Object)) + { + tryCatchStmt.CatchClauses.Add(new Ast.CatchClause { Body = TransformBlock(catchClause) }); + } else { + tryCatchStmt.CatchClauses.Add( + new Ast.CatchClause { + Type = AstBuilder.ConvertType(catchClause.ExceptionType), + VariableName = catchClause.ExceptionVariable == null ? null : catchClause.ExceptionVariable.Name, + Body = TransformBlock(catchClause) + }); + } } if (tryCatchNode.FinallyBlock != null) tryCatchStmt.FinallyBlock = TransformBlock(tryCatchNode.FinallyBlock);