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

VS UI analysis is sensitive to type parameter ordering #9592

Closed
mmesdag opened this issue Nov 17, 2023 · 0 comments · Fixed by #9621
Closed

VS UI analysis is sensitive to type parameter ordering #9592

mmesdag opened this issue Nov 17, 2023 · 0 comments · Fixed by #9621
Labels
area-compiler Umbrella for all compiler issues
Milestone

Comments

@mmesdag
Copy link

mmesdag commented Nov 17, 2023

I have a component that takes two type parameters, one of which is constrained using the second as a type parameter of the constraint. If, in the component usage on a razor component, the type parameters are specified in the opposite order that they are on the component where they are used, VS shows an error in the UI, but builds correctly. I see no warnings or errors in the build, Rider doesn't complain, and the code works correctly, so seems to me like a VS tooling issue.

image

Changing the order of the type params so that they match what is defined in the component fixes the error
image

This only happens if the component has an @bind applied as well (as far as I can tell). A minimal repro (based on the .net 8 blazor web app template) is available here: https://github.com/mmesdag/RazorTypeParameterOrderingError.

Component with type params:

@typeparam TService where TService : IInterfaceConstraint<TKey>
@typeparam TKey

@code {
    [Parameter]
    public required TKey? Value { get; set; }

    [Parameter]
    public EventCallback<TKey> ValueChanged { get; set; }
}

Type param constraint:

public interface IInterfaceConstraint<T>
{
}

Type used in component usage

public interface IComposedInterface : IInterfaceConstraint<string>
{
}
@ghost ghost added the untriaged label Nov 17, 2023
@davidwengier davidwengier added the area-compiler Umbrella for all compiler issues label Nov 17, 2023
@chsienki chsienki added this to the 17.9 P3 milestone Nov 28, 2023
@ghost ghost removed the untriaged label Nov 28, 2023
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

Successfully merging a pull request may close this issue.

3 participants