aspnetcore/diagnostics/bl0001.md
| Value | |
|---|---|
| Rule ID | BL0001 |
| Category | Usage |
| Fix is breaking or non-breaking | Breaking |
A property on a type deriving from xref:Microsoft.AspNetCore.Components.ComponentBase annotated with [Parameter] has a missing or non-public setters.
Component parameters are required to have publicly accessible setters to allow the framework to assign values. All of the parameter declarations in the following example result in this diagnostic.
@code
{
[Parameter] int Parameter1 { get; set; }
[Parameter] public int Parameter2 { get; }
[Parameter] public int Parameter3 { get; private set; }
}
@code
{
[Parameter] public int Parameter1 { get; set; }
[Parameter] public int Parameter2 { get; set; }
[Parameter] public int Parameter3 { get; set; }
}
SetParametersAsync manually.Do not suppress a warning from this rule.