Suppress custom inspection pattern when it occurs inside try-catch block

I want to write a pattern for a custom inspection that warns me if I use something like


in my C# code if it is not wrapped inside a try-catch block.

I.e. no warning should occur for

      int val = int.Parse(text);
   catch (FormatException ex)

Is that possible using ReSharper?

- Frank

1 comment
Comment actions Permalink

     Such scenario is not possible with custom search and replace patterns. However, you can still write a small ReSharper plug-in that will have the necessary logic. Thank you!

Andrey Serebryansky

Software Developer

JetBrains, Inc

"Develop with pleasure!"


Please sign in to leave a comment.