CallgraphClosure.MustNotRecurse
0.1.0-preview2
dotnet add package CallgraphClosure.MustNotRecurse --version 0.1.0-preview2
NuGet\Install-Package CallgraphClosure.MustNotRecurse -Version 0.1.0-preview2
<PackageReference Include="CallgraphClosure.MustNotRecurse" Version="0.1.0-preview2" />
<PackageVersion Include="CallgraphClosure.MustNotRecurse" Version="0.1.0-preview2" />
<PackageReference Include="CallgraphClosure.MustNotRecurse" />
paket add CallgraphClosure.MustNotRecurse --version 0.1.0-preview2
#r "nuget: CallgraphClosure.MustNotRecurse, 0.1.0-preview2"
#:package CallgraphClosure.MustNotRecurse@0.1.0-preview2
#addin nuget:?package=CallgraphClosure.MustNotRecurse&version=0.1.0-preview2&prerelease
#tool nuget:?package=CallgraphClosure.MustNotRecurse&version=0.1.0-preview2&prerelease
CallgraphClosure.MustNotRecurse
A Roslyn analyzer (plus optional Cecil IL post-pass) that enforces a [MustNotRecurse] contract on annotated methods. Flags direct recursion plus any cycle 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.MustNotRecurse --prerelease
Use
using CallgraphClosure.Attributes;
internal sealed class Demo
{
[MustNotRecurse]
public int Compute(int n) => n <= 1 ? 1 : n * Helper(n); // CGC001: unannotated callee
// IL post-pass detects the transitive cycle: Compute -> Helper -> Compute (CGC003 "recursion")
private int Helper(int n) => Compute(n - 1);
}
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 participates in a cycle (direct or transitive) |
Repo
github.com/pawlos/covenant — full design notes, IL post-pass details, and sibling property analyzers (MustNotAllocate, MustNotThrow, MustNotBlock).
MIT licensed.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- CallgraphClosure.Attributes (>= 0.1.0-preview2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CallgraphClosure.MustNotRecurse:
| 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 | 64 | 5/25/2026 |
| 0.1.0-preview1 | 61 | 5/18/2026 |