NT.BlazorAnalyzer
3.0.0
dotnet add package NT.BlazorAnalyzer --version 3.0.0
NuGet\Install-Package NT.BlazorAnalyzer -Version 3.0.0
<PackageReference Include="NT.BlazorAnalyzer" Version="3.0.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="NT.BlazorAnalyzer" Version="3.0.0" />
<PackageReference Include="NT.BlazorAnalyzer"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add NT.BlazorAnalyzer --version 3.0.0
#r "nuget: NT.BlazorAnalyzer, 3.0.0"
#:package NT.BlazorAnalyzer@3.0.0
#addin nuget:?package=NT.BlazorAnalyzer&version=3.0.0
#tool nuget:?package=NT.BlazorAnalyzer&version=3.0.0
NT.BlazorAnalyzer
NT.BlazorAnalyzer is a Roslyn analyzer for Blazor component error-handling rules.
Current focus:
- interactive
.razorcomponents - the generated
BuildRenderTreeshape from Razor - component methods in
.razorand.razor.cspartials
Installation
Install the latest stable package from NuGet:
dotnet add package NT.BlazorAnalyzer
The package is marked as a development dependency and contributes analyzer and code-fix assets without adding a compile-time or runtime library reference. The analyzer assemblies are loaded from analyzers/dotnet/cs.
All diagnostics are enabled by default. The default "recommended" severities report the boundary-coverage rules NTBA0001 and NTBA0002 as Info, so existing apps can adopt the package without breaking builds that treat warnings as errors. Restore Warning for both with:
<PropertyGroup>
<NTBlazorAnalyzerMode>strict</NTBlazorAnalyzerMode>
</PropertyGroup>
Consumer projects can change individual severities in .editorconfig, for example:
[*.cs]
dotnet_diagnostic.NTBA0009.severity = none
The analyzer assembly targets netstandard2.0 and references Roslyn 5.6, so consumers need the .NET SDK 10.0.300 or later (or a matching Visual Studio). Older compilers report CS9057 and skip the analyzer, which is an error in projects that treat warnings as errors. This repository builds and tests with the .NET 10 SDK.
Per-rule documentation, including every setting, lives in docs/rules.
Configuration
Project-wide settings go in a .globalconfig file or the [*.cs] section of .editorconfig:
| Setting | Effect |
|---|---|
ntba.failure_prone_type_suffixes |
Comma list replacing the receiver-type suffixes (Repository, Service, Client, Provider, Manager, Store, Context) that make a synchronous call such as service.GetData() failure-prone. |
ntba.failure_prone_method_prefixes |
Comma list replacing the method prefixes (Get, Load, Save, ...) used for the same decision. |
ntba.safe_types |
Fully qualified types (without type arguments) whose members, and calls returning them, never count as failure-prone. Use it for services that cannot throw, such as a wrapper that turns HTTP failures into a value. |
ntba.failure_handling_methods |
Method names such as OnSuccessAsync, OnFailureAsync that turn failures into values; calls chained into them are safe. |
ntba.assume_owner_error_boundary |
true treats every component as rendered inside an owner ErrorBoundary, suppressing NTBA0001, NTBA0002 and NTBA0003. Defaults to true for component libraries (no routable and no render-mode components) and false otherwise. |
ntba.unknown_awaits_are_failure_prone |
true counts awaited calls with no evidence of failure as failure-prone, trading precision for recall. Strict mode sets it. |
Calls are not failure-prone when they return a Result type (a bool property such as IsSuccess, IsSuccessful, Succeeded, IsFailure, IsFailed, HasFailed or IsError, directly or through Task<T>), invoke an EventCallback, target a toast or snackbar service, or call a built-in browser function such as confirm or history.back through JS interop. Custom boundaries that derive from ErrorBoundaryBase count as error boundaries.
Failure-prone work needs evidence: JS interop, known I/O APIs (HttpClient and its JSON extensions, EF Core, streams and files, JsonSerializer, SignalR client, IBrowserFile), or operational naming (a Get/Load/Save... method on a *Service/*Repository/*Client... type). A call into the project's own code, including an interface with a single implementation in the project, is judged by what that code does, one level deep; a deliberate throw there (validation, an Identity redirect) is not counted. An awaited call with no such evidence, such as an unknown library method, is not failure-prone unless ntba.unknown_awaits_are_failure_prone = true, which strict mode sets.
Projects
- NT.BlazorAnalyzer/NT.BlazorAnalyzer.csproj: analyzer implementation and NuGet package definition
- NT.BlazorAnalyzer.CodeFixes/NT.BlazorAnalyzer.CodeFixes.csproj: IDE code-fix providers packaged with the analyzer
- Tests/NT.BlazorAnalyzer.Tests/NT.BlazorAnalyzer.Tests.csproj: xUnit v3 test suite running on Microsoft Testing Platform v2 with Microsoft Code Coverage
- NT.BlazorAnalyzer.slnx: solution containing all three projects
Rules
NTBA0005, NTBA0007, NTBA0008, NTBA0011 and NTBA0012 apply to components with a declared render mode. NTBA0003, NTBA0004 and NTBA0006 also apply to components without one, because such a component becomes interactive when an interactive owner renders it; static SSR components are excluded from NTBA0003 and NTBA0004, and component libraries from NTBA0001 to NTBA0003 (see Configuration).
| Rule | Default severity | Summary | Code fix |
|---|---|---|---|
NTBA0001 |
Info (Warning in strict mode) | Protect independently interactive render regions with ErrorBoundary |
No |
NTBA0002 |
Info (Warning in strict mode) | Handle failures in uncovered interactive entry methods | No |
NTBA0003 |
Warning | Handle failures in lifecycle methods or provide owner-boundary coverage | Wrap body in try/catch and log |
NTBA0004 |
Warning | Handle failure-prone disposal | Wrap body in try/catch and log |
NTBA0005 |
Warning | Handle JS interop failures | Wrap body in try/catch and log |
NTBA0006 |
Warning | Guard early-lifecycle JS interop with an interactivity check | Guard with RendererInfo.IsInteractive |
NTBA0007 |
Warning | Return Task or ValueTask instead of async void |
Change return type to Task |
NTBA0008 |
Warning | Report the caught exception object or rethrow | Log exception |
NTBA0009 |
Info | Consider custom content for a root ErrorBoundary |
Add ErrorContent |
NTBA0010 |
Warning | Avoid relying on static layout boundaries for interactive failures | No |
NTBA0011 |
Warning | Observe failures of fire-and-forget component tasks | No |
NTBA0012 |
Warning | Handle failures in timer, navigation, and service-event callbacks | No |
What counts as handling
For NTBA0002 through NTBA0005, a catch contains a failure when it does not throw and is not only an expected-swallow catch (OperationCanceledException/TaskCanceledException, JSDisconnectedException, or a when filter on IsCancellationRequested). Whether a containing catch also logs is NTBA0008's concern, so a swallowed exception is reported once, by NTBA0008. NTBA0008 reports only general catches (catch or catch (Exception)) that neither pass the exception object to a call nor rethrow; catching a specific exception type is treated as deliberate.
NTBA0001
Reported (Info by default, Warning in strict mode) when an explicitly interactive component has an unprotected independently interactive render region. The analyzer evaluates each top-level render region independently, ignores PageTitle and HeadContent, allows inert HTML roots, and requires event-callback HTML roots or interactive component roots to be protected by ErrorBoundary or a derived component at an appropriate containment level.
NTBA0001 is region-based, not component-root-based:
- one diagnostic is emitted per uncovered interactive region
- diagnostics are reported at the region root or interactive attribute when source mapping is available
- generated
BuildRenderTreesemantic analysis is the source of truth for component interactivity - Razor parsing is used for HTML
@on.../@bind-..., boundary detection, and.razorlocation mapping
Interactive regions that count:
- HTML event-handler roots such as
@onclick - component callback roots backed by
EventCallback, delegates, method groups, lambdas, or anonymous methods - component binding roots such as
@bind-Value/ generatedValueChangedcallback patterns
Content that does not count by itself:
- inert HTML with no interactive attributes
- plain
RenderFragment/RenderFragment<T>content parameters without callback or binding semantics - ignored roots such as
PageTitleandHeadContent
Diagnostic text:
Interactive render region in component '{ComponentName}' should be protected by ErrorBoundary. Wrapping '{RootName}' in an ErrorBoundary resolves this diagnostic. Suggested scope: '{SuggestedScope}'.
NTBA0002
Reported (Info by default, Warning in strict mode) when an interactive entry method reachable from an independently interactive render region without ErrorBoundary coverage performs failure-prone work without try/catch handling.
This rule is entrypoint-oriented, not helper-oriented:
- only interactive entry methods discovered from uncovered render regions are considered
- helper methods do not need their own
try/catchwhen every reachable caller already has one - a wrapper method does not need a warning if it only delegates to another safe member method
- helper methods do not warn on their own, even when they contain the risky operation
- trivial local state mutation alone does not trigger
NTBA0002 - lifecycle, dispose, and JS interop concerns are still covered by
NTBA0003throughNTBA0006
Diagnostic text:
Method '{MethodName}' in interactive component '{ComponentName}' performs failure-prone work reachable from an uncovered interactive region without try/catch handling
NTBA0003
Warning when an interactive lifecycle method performs failure-prone work without meaningful exception handling or known owner ErrorBoundary coverage.
Covered lifecycle methods:
OnInitializedOnInitializedAsyncOnParametersSetOnParametersSetAsyncOnAfterRenderOnAfterRenderAsyncSetParametersAsync
Notes:
- early lifecycle methods are treated as the highest-risk surface because unhandled failures can break prerendering or circuit initialization
- a component's own root
ErrorBoundarydoes not protect that component's lifecycle method; the component must be rendered by an owner that is already covered - if every known static owner path renders the component inside
ErrorBoundary, local lifecycletry/catchis not required - root-boundary coverage can flow through local
RenderTreeBuilderhelper methods, protected concrete derived component usages, andDynamicComponentdialog hosts whose type slot is inside a knownErrorBoundary - custom boundary tags are trusted only when the component type is known to inherit
ErrorBoundaryBase, including boundaries from referenced assemblies - pure delegation to a safe local helper is accepted
- trivial local state mutation alone does not trigger
NTBA0003 - static SSR components, which have no declared render mode and receive a
[CascadingParameter] HttpContext, are not reported because their failures become HTTP error responses
NTBA0004
Warning when Dispose or DisposeAsync performs failure-prone cleanup without meaningful exception handling.
Notes:
DisposeCore-style helpers are analyzed transitively, but the warning stays onDisposeorDisposeAsync- pure delegation to a safe local cleanup helper is accepted
- trivial local cleanup alone does not trigger
NTBA0004
NTBA0005
Warning when a component method performs JS interop without meaningful exception handling.
Notes:
- a catch that does not rethrow satisfies the rule; a bare rethrow does not
- JS cleanup that catches only
JSDisconnectedExceptionis accepted inDispose/DisposeAsyncand inDisposeCore/DisposeAsyncCorehelpers when the JS call is directly inside thetry, and in anytrythat disposes anIJSObjectReference, following Microsoft's documented pattern - built-in browser functions such as
confirmandhistory.backare not treated as failure-prone - methods that only delegate to a safe local JS helper do not need their own wrapper
NTBA0006
Warning when JS interop is performed in early lifecycle methods before OnAfterRender{Async} without a recognized interactivity check.
Notes:
- the rule is path-aware for early lifecycle methods:
OnInitialized{Async},OnParametersSet{Async}, andSetParametersAsync - direct checks such as
if (RendererInfo.IsInteractive)andif (AssignedRenderMode is not null)suppress the warning - helper wrappers that delegate to those checks are accepted
- interactivity guard-clause patterns such as
if (!RendererInfo.IsInteractive) return;are accepted - guarded helper calls do not warn when the helper performs the JS interop and is only reached through the recognized guard
- unrelated boolean conditions do not suppress the warning
NTBA0007
Warning on async void methods in interactive components.
Notes:
- aligns with Blazor guidance to return
TaskorValueTaskfrom asynchronous component methods - the goal is to keep completion and exception flow observable to the framework
NTBA0008
Warning on catch blocks that neither:
- pass the caught exception object to a call, such as a logger, telemetry, notification, or
DispatchExceptionAsync - nor rethrow
Notes:
- only general catches (
catchorcatch (Exception)) are reported; catching a specific exception type is deliberate - a catch that tells the user, by calling a toast or snackbar service or storing an error message string in component state, is not silent and is not reported
- message-only calls such as
Logger.LogError(ex.Message)do not satisfy the rule - expected swallows are accepted:
OperationCanceledException/TaskCanceledException,JSDisconnectedException, andwhenfilters that checkIsCancellationRequested
NTBA0009
Info when a component opens a boundary first that relies on the default fallback UI: Microsoft.AspNetCore.Components.Web.ErrorBoundary, or a subclass that does not render its own error content, with no ErrorContent. Custom ErrorBoundaryBase implementations render their own UI and are not reported.
Notes:
- custom
ErrorContentis optional in Blazor - this rule is a UX recommendation for root or broadly user-visible boundaries, not a framework requirement
NTBA0010
Warning when a static layout component uses a root ErrorBoundary without globally interactive app routes.
Notes:
- in Blazor Web Apps, a static layout boundary only covers static SSR
- it doesn't catch interactive event-handler failures unless app routes are globally interactive
- narrower page or widget boundaries are usually the safer default
NTBA0011
Warning when an interactive component discards a task (_ = LoadAsync();) or calls a task-returning method as a statement in a non-async method, and that task can fail without being handled. Its failure never reaches the renderer or an ErrorBoundary. Await the task, or catch failures inside it and pass them to DispatchExceptionAsync.
NTBA0012
Warning when a callback subscribed to System.Timers.Timer.Elapsed, passed to System.Threading.Timer, subscribed to NavigationManager.LocationChanged, or subscribed to an application service event performs failure-prone work without handling. These callbacks run outside the renderer's call stack, so ErrorBoundary cannot catch their failures.
Code Fixes
The packaged code-fix provider supports NTBA0003 through NTBA0009, except rules whose fixes require a design or containment decision:
NTBA0003,NTBA0004, andNTBA0005: wrap the body of avoidorasync Task/ValueTaskmethod intry/catchthat logs the exception through the component'sILogger, adding an injectedLoggerproperty andusing Microsoft.Extensions.Logging;when neededNTBA0006: add aRendererInfo.IsInteractiveguardNTBA0007: change an eligibleasync voidmethod to returnTaskNTBA0008: log the caught exception, naming the catch variable when neededNTBA0009: add RazorErrorContentmarkup with a generic message when the boundary shape can be edited safely
Batch Fix All is available through Roslyn's standard batch fixer. NTBA0001, NTBA0002, NTBA0010, NTBA0011, and NTBA0012 intentionally have no automatic fix because the correct boundary placement or error-handling design depends on the component hierarchy.
Examples
Emits NTBA0001 and NTBA0002
@rendermode InteractiveServer
<button @onclick="IncrementCount">Click</button>
@code {
private void IncrementCount()
{
throw new InvalidOperationException();
}
}
Why:
- the button creates an independently interactive region and is not protected by
ErrorBoundary IncrementCountis an uncovered interactive entry method and performs failure-prone work withouttry/catch
Emits NTBA0001 for a component callback root
@rendermode InteractiveServer
<EditorForm OnSave="HandleSave" />
@code {
private void HandleSave()
{
Save();
}
private void Save()
{
}
}
Why:
OnSave="HandleSave"is a semantic component callback root- the component root is independently interactive and is not protected by
ErrorBoundary
Does not emit NTBA0001 for plain templated content alone
@rendermode InteractiveServer
<ShellLayout>
<ChildContent>
<h1>Static title</h1>
</ChildContent>
</ShellLayout>
Why:
- plain
RenderFragment/ templated content is not treated as interactive by itself - without callback or binding semantics, the component root is inert for NTBA0001
Emits one NTBA0001 per uncovered interactive region
@rendermode InteractiveServer
<button @onclick="IncrementCount">Increment</button>
<EditorForm OnSave="HandleSave" />
@code {
private void IncrementCount()
{
CurrentCount++;
}
private void HandleSave()
{
Save();
}
private void Save()
{
}
private int CurrentCount { get; set; }
}
Why:
- the button is one uncovered interactive region
EditorForm OnSave="HandleSave"is a second uncovered interactive region- NTBA0001 reports each region separately at its own source location when available
Emits NTBA0001 and NTBA0002 even if the component type derives from ErrorBoundary
public partial class MyComponent : ErrorBoundary
{
private void HandleClick()
{
throw new InvalidOperationException();
}
}
If the generated BuildRenderTree contains an unprotected independently interactive region, the component still warns. The rule is based on rendered regions, not the component base type.
Emits NTBA0002 only on an uncaught root when a helper path is failure-prone
@rendermode InteractiveServer
<button @onclick="HandleUnsafe">Unsafe</button>
<button @onclick="HandleSafe">Safe</button>
@code {
private void HandleSafe()
{
try
{
IncrementCore();
}
catch (Exception)
{
}
}
private void HandleUnsafe()
{
IncrementCore();
}
private void IncrementCore()
{
ThrowNow();
}
private void ThrowNow() => throw new InvalidOperationException();
}
Why:
HandleUnsafeis an uncovered interactive entry method- the reachable helper path is failure-prone
IncrementCoredoes not get its ownNTBA0002; the warning stays on the entry method
Does not emit NTBA0002 for a helper used only from caught roots
@rendermode InteractiveServer
<button @onclick="HandleClick">Click</button>
@code {
private void HandleClick()
{
try
{
IncrementCore();
}
catch (Exception)
{
}
}
private void IncrementCore()
{
CurrentCount++;
}
private int CurrentCount { get; set; }
}
Why:
IncrementCorehas notry/catch- every reachable caller path into
IncrementCoreis already protected
Does not emit NTBA0002 for a delegating wrapper around a safe method
@rendermode InteractiveServer
<button @onclick="HandleClick">Click</button>
@code {
private void HandleClick() => HandleClickCore();
private void HandleClickCore()
{
try
{
Save();
}
catch (Exception)
{
}
}
private void Save()
{
}
}
Why:
HandleClickdelegates entirely toHandleClickCoreHandleClickCorealready provides the protection
Does not emit when interactive content is protected by ErrorBoundary
@rendermode InteractiveServer
<ErrorBoundary>
<button @onclick="IncrementCount">Click</button>
</ErrorBoundary>
@code {
private void IncrementCount()
{
CurrentCount++;
}
private int CurrentCount { get; set; }
}
Why:
- the interactive region is inside
ErrorBoundary NTBA0002is suppressed because the interactive region is already boundary-protected
Emits NTBA0003 for an uncaught lifecycle method
@rendermode InteractiveServer
@code {
protected override async Task OnInitializedAsync()
{
await LoadAsync();
}
private async Task LoadAsync()
{
await Task.CompletedTask;
throw new InvalidOperationException();
}
}
Emits NTBA0005 for uncaught JS interop
@rendermode InteractiveServer
<button @onclick="HandleClick">Click</button>
@code {
[Inject] private IJSRuntime JS { get; set; } = default!;
private async Task HandleClick()
{
await JS.InvokeVoidAsync("doSomething");
}
}
Emits NTBA0006 for JS interop too early in the lifecycle
@rendermode InteractiveServer
@code {
[Inject] private IJSRuntime JS { get; set; } = default!;
[Inject] private ILogger<Counter> Logger { get; set; } = default!;
protected override async Task OnInitializedAsync()
{
try
{
await JS.InvokeVoidAsync("doSomething");
}
catch (Exception exception)
{
Logger.LogError(exception, "Loading client state failed.");
}
}
}
Does not emit NTBA0006 when interactivity is explicitly checked
@rendermode InteractiveServer
@code {
[Inject] private IJSRuntime JS { get; set; } = default!;
protected override async Task OnInitializedAsync()
{
if (RendererInfo.IsInteractive)
{
await JS.InvokeVoidAsync("doSomething");
}
}
}
Does not emit NTBA0006 when a helper or guard clause proves interactivity
@rendermode InteractiveServer
@code {
[Inject] private IJSRuntime JS { get; set; } = default!;
[Inject] private ILogger<Counter> Logger { get; set; } = default!;
protected override async Task OnInitializedAsync()
{
if (!IsInteractiveRender())
{
return;
}
await LoadClientStateAsync();
}
private bool IsInteractiveRender() => RendererInfo.IsInteractive;
private async Task LoadClientStateAsync()
{
try
{
await JS.InvokeVoidAsync("doSomething");
}
catch (Exception exception)
{
Logger.LogError(exception, "Loading client state failed.");
}
}
}
Emits NTBA0008 for swallowed exceptions
@rendermode InteractiveServer
<button @onclick="HandleClick">Click</button>
@code {
private void HandleClick()
{
try
{
Save();
}
catch (Exception)
{
}
}
}
Emits NTBA0009 as a UX recommendation when root ErrorBoundary has no ErrorContent
@rendermode InteractiveServer
<ErrorBoundary>
<button @onclick="HandleClick">Click</button>
</ErrorBoundary>
Emits NTBA0010 when a static layout uses ErrorBoundary
@inherits LayoutComponentBase
<ErrorBoundary>
@Body
<ErrorContent>
<p>Something went wrong.</p>
</ErrorContent>
</ErrorBoundary>
Why:
- the layout boundary only covers static SSR unless app routes are globally interactive
- interactive event failures below the layout can still bypass the layout boundary in Blazor Web Apps
- narrower page or widget boundaries are usually a better default
Build, Test, And Pack
Prerequisites for local development are the .NET 10 SDK and PowerShell 7 for the package verification and release-tracking scripts.
dotnet restore NT.BlazorAnalyzer.slnx
dotnet build NT.BlazorAnalyzer.slnx -c Release -v minimal
dotnet test --solution NT.BlazorAnalyzer.slnx -c Release --no-build -v minimal
Collect Microsoft Testing Platform coverage with:
dotnet test --solution NT.BlazorAnalyzer.slnx -c Release --no-build -v minimal --coverage --coverage-output-format cobertura --coverage-output ./TestResults/coverage.cobertura.xml
Create and verify a local analyzer package with:
dotnet pack ./NT.BlazorAnalyzer/NT.BlazorAnalyzer.csproj --configuration Release --no-build --output ./artifacts/nuget -p:PackageVersion=0.0.0-local
pwsh ./test-analyzer-package.ps1 -PackagePath ./artifacts/nuget/NT.BlazorAnalyzer.0.0.0-local.nupkg
The package verifier checks the NuGet layout and metadata, rejects compile/runtime assemblies and any host-owned assembly under analyzers/, installs the package into an isolated strict-mode consumer with a real Counter.razor component targeting net8.0, net9.0, net10.0, and net11.0, and requires NTBA0001 and NTBA0002 at the Razor source location for every target framework.
Measure the analyzer against real applications with the corpus script. It builds each project with the locally built analyzer, reports every rule as a warning, and diffs against an earlier run:
pwsh ./corpus/Invoke-CorpusRun.ps1 -Project D:\App\App.WebApp\App.WebApp.csproj -OutputPath ./artifacts/corpus/after.txt -BaselinePath ./artifacts/corpus/before.txt
The repository selects Microsoft Testing Platform through global.json, uses xunit.v3.mtp-v2 as its test runner integration, and collects coverage through Microsoft.Testing.Extensions.CodeCoverage. It does not use Coverlet or the VSTest compatibility runner.
Repository builds enable the .NET SDK analyzers and code-style analysis, treat every warning as an error, and require XML documentation for public APIs through CS1591.
GitHub CI/CD
GitHub Actions files are under .github/workflows:
ci.yml: restores, builds, tests, and collects coverage on pull requests, pushes tomain, and manual runs; after a successfulmainvalidation, it tags release-worthy builds with a semantic-release preview version, then verifies and publishes that tagged version's.nupkgand.snupkgto NuGetrelease.yml: manually tags a stable semantic release frommain, verifies and publishes that full version, unlists superseded previews, and opens a follow-up analyzer release-tracking pull request when unshipped rules need promotion
Dependabot configuration checks NuGet, GitHub Actions, and npm dependencies weekly and groups updates by ecosystem.
Release configuration lives in .releaserc.json. The semantic-release tooling is pinned in package.json and package-lock.json, and both workflows install it with npm ci. Release configuration uses:
@semantic-release/commit-analyzer@semantic-release/release-notes-generator@semantic-release/githubto create GitHub releases with generated release notes
Commit analysis and release notes use the Conventional Commits preset.
The release flow is:
- A push to
mainvalidates the repository. - Semantic-release evaluates the Conventional Commits history on the
previewrelease branch and, when warranted, tags the validated commit asv${version}-preview.${number}. - Only after that preview tag is resolved does the same workflow rebuild with the tagged version, pack and verify the analyzer, and publish the
.nupkgand.snupkgto NuGet. A push with no new preview tag skips package publication. - A stable release is created only by manually dispatching
release.yml. Semantic-release tagsmainasv${version}, after which the workflow rebuilds, verifies, and publishes the full version. - The stable workflow unlists prerelease versions at or below the released core version.
- After a stable release,
promote-analyzer-release.ps1moves unshipped analyzer entries into the shipped file and the workflow opens a pull request when that produces a change.
Both publishing workflows remove a newly created tag if a downstream publication step fails.
Required GitHub secrets:
NUGET_USER: nuget.org profile name (not email) that owns the trusted publishing policies forci.ymlandrelease.yml; both workflows useNuGet/loginto exchange the GitHub OIDC token for a one-hour API key that pushes packages and, inrelease.yml, unlists superseded previews
GitHub release creation, tag management, preview-branch updates, and release-tracking pull requests use the workflow-provided GITHUB_TOKEN; no separate semantic-release token is required.
NuGet Package Layout
The package is a development-only Roslyn analyzer package:
- analyzer and code-fix assemblies are under
analyzers/dotnet/cs - code-fix workspace and composition dependencies are colocated with the code-fix provider
- host-owned assemblies (Roslyn compiler and Workspaces,
System.Composition,Humanizer, and similar) are excluded; onlyNT.BlazorAnalyzer.*files ship underanalyzers/dotnet/cs - no assemblies are published under
lib, so the package does not add a compile-time or runtime API build/NT.BlazorAnalyzer.targetsandbuild/NT.BlazorAnalyzer.strict.globalconfigimplement theNTBlazorAnalyzerMode=strictpreset- the
.nupkgincludesREADME.md,Logo.png, analyzer symbols, and repository metadata; packing also creates a.snupkg - XML documentation is generated beside the analyzer and code-fix build outputs
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.
See the GitHub Releases page for version-specific release notes.