Share via


BL0003: El parámetro componente con CaptureUnmatchedValues tiene el tipo incorrecto

Valor
Identificador de la regla BL0003
Categoría Uso
La corrección es problemática o no problemática Problemático

Causa

Un parámetro de un tipo derivado de ComponentBase anotado con CaptureUnmatchedValues= true no se puede asignar desde Dictionary<string, object>.

Descripción de la regla

Los parámetros anotados con CaptureUnmatchedValues = true deben poder recibir un valor Dictionary<string, object>.

@code
{
    [Parameter(CaptureUnmatchedValues = true)] public IDictionary<string, string> Attributes { get; set; }
}

Cómo corregir infracciones

Cambiar el tipo del parámetro a IDictionary<string, object> o Dictionary<string, object>.

@code
{
    [Parameter(CaptureUnmatchedValues = true)] public IDictionary<string, object> Attributes { get; set; }
}

Cuándo suprimir las advertencias

No suprima las advertencias de esta regla.