BL0002: 구성 요소에 여러 CaptureUnmatchedValues 매개 변수가 있습니다

규칙 ID BL0002
범주 사용
수정 사항이 주요 변경인지 여부 주요 변경 아님

원인

ComponentBase에서 파생되는 형식에 대해 둘 이상의 매개 변수가 CaptureUnmatchedValues = true로 주석 처리됩니다.

규칙 설명

구성 요소의 경우 정확히 하나의 매개 변수에 CaptureUnmatchedValuestrue로 설정되어 있어야 합니다.

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

    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object> Parameter2 { get; set; }
}

위반 문제를 해결하는 방법

단일 매개 변수를 CaptureUnmatchedValues 설정하도록 제한합니다.

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

    [Parameter] public Dictionary<string, object> Parameter2 { get; set; }
}

경고를 표시하지 않는 경우

이 규칙에서는 경고를 표시해야 합니다.