From 713b88f963b0fe4d95f5adbf67d96b3d65367b25 Mon Sep 17 00:00:00 2001 From: Simon Lindgren Date: Tue, 14 Aug 2012 11:28:00 +0200 Subject: [PATCH] [CodeIssues] Don't consider empty catches redundant. --- .../Refactoring/CodeIssues/RedundantCatchIssue.cs | 2 +- .../CSharp/CodeIssues/RedundantCatchTests.cs | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs index 6d45d160af..5e72022477 100644 --- a/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs +++ b/ICSharpCode.NRefactory.CSharp/Refactoring/CodeIssues/RedundantCatchIssue.cs @@ -125,7 +125,7 @@ namespace ICSharpCode.NRefactory.CSharp.Refactoring { var firstStatement = catchClause.Body.Statements.FirstOrNullObject(); if (firstStatement.IsNull) { - return true; + return false; } var throwStatement = firstStatement as ThrowStatement; if (throwStatement == null) { diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCatchTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCatchTests.cs index 8dacccbb5c..7a67ccb6d7 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCatchTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeIssues/RedundantCatchTests.cs @@ -152,11 +152,7 @@ class A }"; TestRefactoringContext context; var issues = GetIssues(new RedundantCatchIssue(), input, out context); - Assert.AreEqual(1, issues.Count); - - CheckFix(context, issues, BaseInput + @" - } -}"); + Assert.AreEqual(0, issues.Count); } [Test]