CallgraphClosure.MustNotThrow
0.1.0-preview1
See the version list below for details.
dotnet add package CallgraphClosure.MustNotThrow --version 0.1.0-preview1
NuGet\Install-Package CallgraphClosure.MustNotThrow -Version 0.1.0-preview1
<PackageReference Include="CallgraphClosure.MustNotThrow" Version="0.1.0-preview1" />
<PackageVersion Include="CallgraphClosure.MustNotThrow" Version="0.1.0-preview1" />
<PackageReference Include="CallgraphClosure.MustNotThrow" />
paket add CallgraphClosure.MustNotThrow --version 0.1.0-preview1
#r "nuget: CallgraphClosure.MustNotThrow, 0.1.0-preview1"
#:package CallgraphClosure.MustNotThrow@0.1.0-preview1
#addin nuget:?package=CallgraphClosure.MustNotThrow&version=0.1.0-preview1&prerelease
#tool nuget:?package=CallgraphClosure.MustNotThrow&version=0.1.0-preview1&prerelease
CallgraphClosure.MustNotThrow
A Roslyn analyzer (plus optional Cecil IL post-pass) that enforces a [MustNotThrow] contract on annotated methods. Flags throw statements and unannotated calls reachable through the transitive call closure.
Pre-release. Early-stage package; APIs may change. See the repo's
docs/ROADMAP.mdfor known limits.
Install
dotnet add package CallgraphClosure.MustNotThrow --prerelease
Use
using CallgraphClosure.Attributes;
internal static class Validator
{
[MustNotThrow]
public static bool TryValidate(string input, out string error)
{
if (input is null) throw new ArgumentNullException(nameof(input)); // CGC003: throw in annotated method
error = "";
return true;
}
}
Diagnostics:
| ID | Meaning |
|---|---|
CGC001 |
Annotated method calls an unannotated method — annotate the callee or stop calling it |
CGC002 |
Annotated method calls an external method whose status the analyzer can't verify; resolved by the IL post-pass |
CGC003 |
Annotated method directly performs a throw |
Repo
github.com/pawlos/covenant — full design notes, IL post-pass details, and sibling property analyzers (MustNotAllocate, MustNotBlock, MustNotRecurse).
MIT licensed.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- CallgraphClosure.Attributes (>= 0.1.0-preview1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CallgraphClosure.MustNotThrow:
| Package | Downloads |
|---|---|
|
CallgraphClosure
Meta-package for the CallgraphClosure family of property analyzers. Installing this pulls in all four current properties (MustNotAllocate, MustNotThrow, MustNotBlock, MustNotRecurse). Pre-release. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-preview2 | 57 | 5/25/2026 |
| 0.1.0-preview1 | 65 | 5/18/2026 |