Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ErikApption opened this issue Mar 18, 2024 · 3 comments
Closed
Labels
area-compiler Umbrella for all compiler issues

Comments

@ErikApption
Copy link

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?

@davidwengier davidwengier added the area-compiler Umbrella for all compiler issues label Mar 18, 2024
@davidwengier
Copy link
Contributor

Looks like this might be the same issue that #9144 is proposing to solve. Not sure if there is an issue to dupe it against though?

@jjonescz
Copy link
Member

There's an issue in aspnetcore repo: #11114

@jaredpar
Copy link
Member

Going to close this and let the aspnetcore issue be primary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-compiler Umbrella for all compiler issues
Projects
None yet
Development

No branches or pull requests

4 participants