C#


ROSLYN.DESIGN.CA1031 : Do not catch general exception types (C#)

See Roslyn-Detected C# Warning Classes for more information.

Summary

A general exception such as System.Exception or System.SystemException or a disallowed exception type is caught in a catch statement, or a general catch clause is used. General and disallowed exceptions should not be caught.

This check corresponds to Roslyn rule CA1031. For full rule details, see the Microsoft website: CA1031.

Properties

Class Name Do not catch general exception types (C#)
Significance reliability
Mnemonic ROSLYN.DESIGN.CA1031
Categories None
Availability Available for C# only.
Enabling Checks for this warning class are disabled by default. To enable them, add the following WARNING_FILTER rule to the project configuration file.
WARNING_FILTER += allow class="Do not catch general exception types (C#)"

Relevant Configuration File Parameters

The following configuration file parameters affect checks for this warning class.