All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.plugins.csharp.S6803.html Maven / Gradle / Ivy

There is a newer version: 10.2.0.105762
Show newest version

This rule is deprecated, and will eventually be removed.

Component parameters can only receive query parameter values in routable components with an @page directive.

Why is this an issue?

SupplyParameterFromQuery attribute is used to specify that a component parameter of a routable component comes from the query string.

In the case of non-routable components, the SupplyParameterFromQuery does not contribute to the functionality, and removing it will not affect the behavior.

How to fix it

Either make the component routable or remove the SupplyParameterFromQuery attribute.

Code examples

Noncompliant code example

<h3>Component</h3>

@code {
    [Parameter]
    [SupplyParameterFromQuery]  // Noncompliant
    public bool Param { get; set; }
}

Compliant solution

@page "/component"

<h3>Component</h3>

@code {
    [Parameter]
    [SupplyParameterFromQuery]  // Compliant
    public bool Param { get; set; }
}

Resources

Documentation





© 2015 - 2024 Weber Informatics LLC | Privacy Policy