Alex Rivera | Logout

C#: Find all empty catch blocks

Asked 2009-09-28T10:49:29.227
20

I am reviewing some code.

I have notice some empty catch blocks. Not a good idea since somethings do not work and you cannot see why.

Is there an easy way to find all empty try catch blocks in a solution?

Edit
Report

1 Answer

2

Here is a regular expression that finds also catch blocks with only comments inside :

catch:b*\([^)]*\)[:b\n]*\{([:b\n]|(\/\*[^*]*\*\/)|(//[^\n]*))*\}
answered 2010-10-19T14:27:56.817

Your Answer