FxCop rule to detect swallowed exceptions

587 Views Asked by At

is there a FxCop rule to find swallowed exceptions?

I have found this article http://mystuffisallhere.com/blog/post/2006/01/02/An-FxCop-rule-to-detect-swallowed-exceptions.aspx but I can not find the code or dll which does the job.

thanks almir

1

There are 1 best solutions below

0
On

CA1031 [1] should "catch" the worse offenders, i.e. the "catch-all"

Gendarme [2] has a similar rule [3] and full source code is available if you wish to extend it into detecting every cases where exceptions are swallowed.

[1] http://msdn.microsoft.com/en-us/library/ms182137%28v=VS.100%29.aspx

[2] disclosure: I'm Gendarme maintainer

[3] https://github.com/spouliot/gendarme/wiki/Gendarme.Rules.Exceptions.DoNotSwallowErrorsCatchingNonSpecificExceptionsRule%282.10%29