Skip to content

Add Roslyn code analyzer for non existent component parameters or VS options #10124

Closed
@ErikApption

Description

@ErikApption

Visual Studio seems to be checking the parameters of blazor components and does highlight in red when a parameter cannot be bound.
image

However, this doesn't get caught by any Roslyn code analyzers and it will fail during execution with

blazor.server.js:1  [2024-03-15T19:55:34.506Z] Error: System.InvalidOperationException: Object of type 'Datahub.Portal.Layout.WorkspaceSidebar' does not have a property matching the name 'BadParameter'.
   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.ThrowForUnknownIncomingParameterName(Type targetType, String parameterName)
   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.SetProperties(ParameterView& parameters, Object target)
   at Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(ParameterView parameters)
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(ParameterView directAndCascadingParameters)

I suspect there might good reasons that this is not possible through Roslyn code analyzers, but any chances for a Visual Studio setting to bump these red things into errors?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-compilerUmbrella for all compiler issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions