A Blazor [Parameter] property is not public, so the component cannot receive it

tx0/csharp:component-parameter-not-publicdefaultwarningreliability/logicdepth fastbug

What it finds

Blazor sets component parameters through public properties. A [Parameter] on a private, protected or internal property compiles, but the renderer throws when a parent passes the value.

From the rule's source, component_parameter_not_public.rs.

Example from the rule's tests
using Microsoft.AspNetCore.Components; class Counter : ComponentBase{    [Parameter]    private int Start { get; set; }tx0 reports: the parameter Start is not public     [Parameter]    public int Step { get; set; }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/csharp:component-parameter-not-public" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/csharp:component-parameter-not-public] reason="..."

tx0 explain tx0/csharp:component-parameter-not-public shows the same in the terminal. Found a false positive? Report it.