CallgraphClosure.MustNotBlock
0.1.0-preview2
dotnet add package CallgraphClosure.MustNotBlock --version 0.1.0-preview2
NuGet\Install-Package CallgraphClosure.MustNotBlock -Version 0.1.0-preview2
<PackageReference Include="CallgraphClosure.MustNotBlock" Version="0.1.0-preview2" />
<PackageVersion Include="CallgraphClosure.MustNotBlock" Version="0.1.0-preview2" />
<PackageReference Include="CallgraphClosure.MustNotBlock" />
paket add CallgraphClosure.MustNotBlock --version 0.1.0-preview2
#r "nuget: CallgraphClosure.MustNotBlock, 0.1.0-preview2"
#:package CallgraphClosure.MustNotBlock@0.1.0-preview2
#addin nuget:?package=CallgraphClosure.MustNotBlock&version=0.1.0-preview2&prerelease
#tool nuget:?package=CallgraphClosure.MustNotBlock&version=0.1.0-preview2&prerelease
CallgraphClosure.MustNotBlock
A Roslyn analyzer (plus optional Cecil IL post-pass) that enforces a [MustNotBlock] contract on annotated methods. Flags Thread.Sleep, Task.Wait/.Result, sync-over-async patterns, 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.MustNotBlock --prerelease
Use
using CallgraphClosure.Attributes;
internal sealed class Ticker
{
[MustNotBlock]
public int Tick()
{
Thread.Sleep(10); // CGC003: synchronous block
return ComputeAsync().Result; // CGC003: sync-over-async + CGC001: unannotated callee
}
private async Task<int> ComputeAsync() => await Task.FromResult(42);
}
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 blocking operation |
Repo
github.com/pawlos/covenant — full design notes, IL post-pass details, and sibling property analyzers (MustNotAllocate, MustNotThrow, MustNotRecurse).
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.MustNotBlock:
| 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 | 60 | 5/25/2026 |
| 0.1.0-preview1 | 64 | 5/18/2026 |