Tetractic.CodeAnalysis.ExceptionAnalyzers 1.1.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Tetractic.CodeAnalysis.ExceptionAnalyzers --version 1.1.0
                    
NuGet\Install-Package Tetractic.CodeAnalysis.ExceptionAnalyzers -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tetractic.CodeAnalysis.ExceptionAnalyzers" Version="1.1.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tetractic.CodeAnalysis.ExceptionAnalyzers" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Tetractic.CodeAnalysis.ExceptionAnalyzers">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Tetractic.CodeAnalysis.ExceptionAnalyzers --version 1.1.0
                    
#r "nuget: Tetractic.CodeAnalysis.ExceptionAnalyzers, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Tetractic.CodeAnalysis.ExceptionAnalyzers@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Tetractic.CodeAnalysis.ExceptionAnalyzers&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Tetractic.CodeAnalysis.ExceptionAnalyzers&version=1.1.0
                    
Install as a Cake Tool

Exception Analyzers helps you check that exceptions are caught or documented in C#.

How It Works

An analyzer examines throw statements, try/catch blocks, and the <exception> elements in documentation comment XML for symbols referenced by your code to determine what exception types could escape your code. Diagnostics are reported for any of those exception types that do not appear in the <exception> elements in the documentation comment XML for your code.

Example

void Demo1() => throw new NotSupportedException();
//              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//              Ex0100: 'Demo1()' may throw undocumented exception: NotSupportedException

/// <exception cref="NotSupportedException"/>
void Demo2() => throw new NotSupportedException();  // No diagnostic; exception is documented.

void Demo3() => Demo2();
//              ~~~~~
//              Ex0100: 'Demo3()' may throw undocumented exception: NotSupportedException

void Demo4(bool b)
{
    try
    {
        if (b)
            throw new NotSupportedException();  // No diagnostic; Exception is caught.
        else
            throw new Exception();
        //  ~~~~~~~~~~~~~~~~~~~~~~
        //  Ex0100: 'Demo4(bool)' may throw undocumented exception: Exception
    }
    catch (NotSupportedException)
    {
        throw;
    //  ~~~~~~
    //  Ex0100: 'Demo4(bool)' may throw undocumented exception: NotSupportedException
    }
}

Configuration

.editorconfig

dotnet_ignored_exceptions

Provides a list of exception types that will be ignored by exception analysis.

Setting name: dotnet_ignored_exceptions
Value: A comma-separated list of fully-qualified type names.
Default value: System.NullReferenceException, System.UnreachableException

dotnet_intransitive_exceptions

Provides a list of exception types that will be ignored by exception analysis when not thrown directly. This is useful for exception types that generally indicate incorrect code when thrown. The conditions under which these exception types are thrown should be documented, but those conditions should be avoidable and avoided in correctly-written code.

For example, it should be possible to avoid providing unacceptable arguments that would cause an ArgumentException to be thrown. ArgumentException and its subtypes, in particular, are so pervasive that reporting a diagnostic for every method invocation that might throw one of them would be unhelpful.

Setting name: dotnet_intransitive_exceptions
Value: A comma-separated list of fully-qualified type names.
Default value: System.ArgumentException, System.IndexOutOfRangeException, System.InvalidOperationException, System.Collections.Generic.KeyNotFoundException

Exception Adjustments

TODO

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.4.8 3,243 6/26/2025
1.4.7 2,757 4/10/2025
1.4.6 50,067 10/28/2024
1.4.5 2,005 5/11/2024
1.4.4 1,131 3/7/2024
1.4.3 350 3/1/2024
1.4.2 1,001 12/1/2023
1.4.1 2,709 11/22/2022
1.4.0 597 10/8/2022
1.3.2 511 9/6/2022
1.3.1 2,089 5/28/2022
1.3.0 663 12/23/2021
1.2.2 435 10/22/2021
1.2.1 397 10/21/2021
1.2.0 435 10/19/2021
1.1.2 512 10/15/2021
1.1.1 463 10/13/2021
1.1.0 462 10/11/2021
1.0.1 593 10/9/2021