-
Notifications
You must be signed in to change notification settings - Fork 11
Uncatchable Exceptions
Michael Damatov edited this page Jan 17, 2024
·
6 revisions
The analyzer discourages catching of some .NET Framework exceptions.
System.Security.HostProtectionException
System.AccessViolationException
System.AppDomainUnloadedException
System.ArgumentException
System.ArgumentNullException
System.ArgumentOutOfRangeException
System.ArrayTypeMismatchException
System.Collections.Generic.KeyNotFoundException
System.ComponentModel.InvalidEnumArgumentException
System.Configuration.SettingsPropertyIsReadOnlyException
System.Configuration.SettingsPropertyNotFoundException
System.Configuration.SettingsPropertyWrongTypeException
System.Data.DeletedRowInaccessibleException
System.Data.EvaluateException
System.Data.InRowChangingEventException
System.Data.InvalidConstraintException
System.Data.InvalidExpressionException
System.Data.MissingPrimaryKeyException
System.Data.NoNullAllowedException
System.Data.ReadOnlyException
System.Data.RowNotInTableException
System.Data.StrongTypingException
System.Data.SyntaxErrorException
System.Data.VersionNotFoundException
System.Diagnostics.Contracts.ContractException
System.Diagnostics.UnreachableException
System.DuplicateWaitObjectException
System.FieldAccessException
System.IndexOutOfRangeException
System.InvalidCastException
System.MemberAccessException
System.MethodAccessException
System.MissingFieldException
System.MissingMemberException
System.MissingMethodException
System.MulticastNotSupportedException
System.NotImplementedException
System.NotSupportedException
System.NullReferenceException
System.ObjectDisposedException
System.PlatformNotSupportedException
System.RankException
System.Runtime.AmbiguousImplementationException
System.Runtime.CompilerServices.SwitchExpressionException
System.Runtime.InteropServices.InvalidComObjectException
System.Runtime.InteropServices.InvalidOleVariantTypeException
System.Runtime.InteropServices.MarshalDirectiveException
System.Runtime.InteropServices.SafeArrayRankMismatchException
System.Threading.ThreadAbortException
System.Windows.Automation.ElementNotEnabledException
System.Windows.ResourceReferenceKeyNotFoundException
System.OutOfMemoryException
System.StackOverflowException
Microsoft.JScript.BreakOutOfFinally
Microsoft.JScript.CmdLineException
Microsoft.JScript.ContinueOutOfFinally
Microsoft.JScript.EndOfFile
Microsoft.JScript.JScriptException
Microsoft.JScript.NoContextException
Microsoft.JScript.ParserException
Microsoft.JScript.ReturnOutOfFinally
Microsoft.VisualBasic.CompilerServices.IncompleteInitialization
Microsoft.VisualBasic.CompilerServices.InternalErrorException
System.Net.Mail.SmtpFailedRecipientsException
Note: Not all .NET APIs are made consistently. For example, the Process.GetProcessById
method throws an ArgumentException
, which cannot be avoided in any way. In such a case the warning should just be suppressed.
Note: Please feel free to raise an issue if you mean that some exceptions are missing or were incorrectly put in the list.
💡 The analyzer can be deactivated in the ReSharper Options dialog.