NT.BlazorAnalyzer 3.0.0

dotnet add package NT.BlazorAnalyzer --version 3.0.0
                    
NuGet\Install-Package NT.BlazorAnalyzer -Version 3.0.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="NT.BlazorAnalyzer" Version="3.0.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="NT.BlazorAnalyzer" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NT.BlazorAnalyzer">
  <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 NT.BlazorAnalyzer --version 3.0.0
                    
#r "nuget: NT.BlazorAnalyzer, 3.0.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 NT.BlazorAnalyzer@3.0.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=NT.BlazorAnalyzer&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NT.BlazorAnalyzer&version=3.0.0
                    
Install as a Cake Tool

NT.BlazorAnalyzer

NT.BlazorAnalyzer is a Roslyn analyzer for Blazor component error-handling rules.

Current focus:

  • interactive .razor components
  • the generated BuildRenderTree shape from Razor
  • component methods in .razor and .razor.cs partials

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

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 BuildRenderTree semantic analysis is the source of truth for component interactivity
  • Razor parsing is used for HTML @on... / @bind-..., boundary detection, and .razor location 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 / generated ValueChanged callback 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 PageTitle and HeadContent

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/catch when 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 NTBA0003 through NTBA0006

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:

  • OnInitialized
  • OnInitializedAsync
  • OnParametersSet
  • OnParametersSetAsync
  • OnAfterRender
  • OnAfterRenderAsync
  • SetParametersAsync

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 ErrorBoundary does 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 lifecycle try/catch is not required
  • root-boundary coverage can flow through local RenderTreeBuilder helper methods, protected concrete derived component usages, and DynamicComponent dialog hosts whose type slot is inside a known ErrorBoundary
  • 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 on Dispose or DisposeAsync
  • 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 JSDisconnectedException is accepted in Dispose/DisposeAsync and in DisposeCore/DisposeAsyncCore helpers when the JS call is directly inside the try, and in any try that disposes an IJSObjectReference, following Microsoft's documented pattern
  • built-in browser functions such as confirm and history.back are 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}, and SetParametersAsync
  • direct checks such as if (RendererInfo.IsInteractive) and if (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 Task or ValueTask from 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 (catch or catch (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, and when filters that check IsCancellationRequested

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 ErrorContent is 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, and NTBA0005: wrap the body of a void or async Task/ValueTask method in try/catch that logs the exception through the component's ILogger, adding an injected Logger property and using Microsoft.Extensions.Logging; when needed
  • NTBA0006: add a RendererInfo.IsInteractive guard
  • NTBA0007: change an eligible async void method to return Task
  • NTBA0008: log the caught exception, naming the catch variable when needed
  • NTBA0009: add Razor ErrorContent markup 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
  • IncrementCount is an uncovered interactive entry method and performs failure-prone work without try/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:

  • HandleUnsafe is an uncovered interactive entry method
  • the reachable helper path is failure-prone
  • IncrementCore does not get its own NTBA0002; 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:

  • IncrementCore has no try/catch
  • every reachable caller path into IncrementCore is 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:

  • HandleClick delegates entirely to HandleClickCore
  • HandleClickCore already 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
  • NTBA0002 is 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 to main, and manual runs; after a successful main validation, it tags release-worthy builds with a semantic-release preview version, then verifies and publishes that tagged version's .nupkg and .snupkg to NuGet
  • release.yml: manually tags a stable semantic release from main, 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/github to create GitHub releases with generated release notes

Commit analysis and release notes use the Conventional Commits preset.

The release flow is:

  1. A push to main validates the repository.
  2. Semantic-release evaluates the Conventional Commits history on the preview release branch and, when warranted, tags the validated commit as v${version}-preview.${number}.
  3. Only after that preview tag is resolved does the same workflow rebuild with the tagged version, pack and verify the analyzer, and publish the .nupkg and .snupkg to NuGet. A push with no new preview tag skips package publication.
  4. A stable release is created only by manually dispatching release.yml. Semantic-release tags main as v${version}, after which the workflow rebuilds, verifies, and publishes the full version.
  5. The stable workflow unlists prerelease versions at or below the released core version.
  6. After a stable release, promote-analyzer-release.ps1 moves 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 for ci.yml and release.yml; both workflows use NuGet/login to exchange the GitHub OIDC token for a one-hour API key that pushes packages and, in release.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; only NT.BlazorAnalyzer.* files ship under analyzers/dotnet/cs
  • no assemblies are published under lib, so the package does not add a compile-time or runtime API
  • build/NT.BlazorAnalyzer.targets and build/NT.BlazorAnalyzer.strict.globalconfig implement the NTBlazorAnalyzerMode=strict preset
  • the .nupkg includes README.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
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
3.0.0 82 11/11/2026
3.0.0-preview.1 46 11/11/2026
2.1.1 1,687 8/5/2026
2.1.0 2,438 7/30/2026
2.0.0 264 7/22/2026
1.2.2 1,242 4/27/2026
1.2.1 141 4/25/2026
1.2.0 149 4/23/2026
1.1.0 129 4/16/2026
1.0.1 139 4/16/2026
1.0.0 127 4/15/2026

See the GitHub Releases page for version-specific release notes.