Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Components/Analyzers/src/DiagnosticDescriptors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ internal static class DiagnosticDescriptors
CreateLocalizableResourceString(nameof(Resources.ComponentParametersShouldBeAutoProperties_Message)),
Usage,
DiagnosticSeverity.Warning,
isEnabledByDefault: true);
isEnabledByDefault: true,
description: CreateLocalizableResourceString(nameof(Resources.ComponentParametersShouldBeAutoProperties_Description)));

public static readonly DiagnosticDescriptor SupplyParameterFromFormShouldNotHavePropertyInitializer = new(
"BL0008",
Expand Down
5 changes: 4 additions & 1 deletion src/Components/Analyzers/src/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,14 @@
<value>Do not use RenderTree types</value>
</data>
<data name="ComponentParametersShouldBeAutoProperties_Message" xml:space="preserve">
<value>Component parameter '{0}' should be auto property</value>
<value>Component parameter '{0}' should be auto property. Manipulating component parameters can result in infinite loops and unintended side effects.</value>
</data>
<data name="ComponentParametersShouldBeAutoProperties_Title" xml:space="preserve">
<value>Component parameters should be auto properties</value>
</data>
<data name="ComponentParametersShouldBeAutoProperties_Description" xml:space="preserve">
<value>Component parameters should be auto properties. Manipulating component parameters can result in infinite loops and unintended side effects. Use @bind:after or @bind:set instead to adjust values or trigger additional callbacks.</value>
</data>
<data name="SupplyParameterFromFormShouldNotHavePropertyInitializer_Description" xml:space="preserve">
<value>The value of a property decorated with [SupplyParameterFromForm] and initialized with a property initializer can be overwritten with null when the component receives parameters. To ensure the initialized value is not overwritten, move the initialization to a component lifecycle method like OnInitialized or OnInitializedAsync</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private void DoSomething() { }
VerifyCSharpDiagnostic(source, new DiagnosticResult
{
Id = DiagnosticDescriptors.ComponentParametersShouldBeAutoProperties.Id,
Message = "Component parameter 'C.MyProp' should be auto property",
Message = "Component parameter 'C.MyProp' should be auto property. Manipulating component parameters can result in infinite loops and unintended side effects.",
Locations = new[]
{
new DiagnosticResultLocation("Test0.cs", 9, 15),
Expand Down Expand Up @@ -139,7 +139,7 @@ private void DoSomething() { }
VerifyCSharpDiagnostic(source, new DiagnosticResult
{
Id = DiagnosticDescriptors.ComponentParametersShouldBeAutoProperties.Id,
Message = "Component parameter 'C.MyProp' should be auto property",
Message = "Component parameter 'C.MyProp' should be auto property. Manipulating component parameters can result in infinite loops and unintended side effects.",
Locations = new[]
{
new DiagnosticResultLocation("Test0.cs", 9, 15),
Expand Down
Loading