Make sure to read this post before raising a thread here:
Then tell us:
When using Blazor @ref to assign the reference of property in a code behind csharpsquid:S3459 is generated.
- What language is this for? C#/Razor
- Which rule? csharpsquid:S3459
- Why do you believe it’s a false-positive/false-negative?
The variable is assigned in the generated razor code.
- Are you using
- SonarQube Cloud? Yes
- SonarQube Server / Community Build - which version?
- SonarQube for IDE - which IDE/version? Rider 10.27.0.81781
- in connected mode with SonarQube Server / Community Build or SonarQube Cloud? No
- How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
MyComponent.razor
<div @ref="RootElement">Some Content</div>
MyComponent.razor.cs
public sealed partial class MyComponent: ComponentBase
{
private ElementReference RootElement { get; set; }
}