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

Blazor typeparam constraints causing compilation error CS0449 #7162

Closed
1 task done
xiety opened this issue Jul 13, 2022 · 4 comments
Closed
1 task done

Blazor typeparam constraints causing compilation error CS0449 #7162

xiety opened this issue Jul 13, 2022 · 4 comments

Comments

@xiety
Copy link

xiety commented Jul 13, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Problem looks like the closed dotnet/aspnetcore#38479, dotnet/aspnetcore#38041 and dotnet/razor-compiler#272, but dotnet/razor-compiler#44 doesn't fix it in the latest 7.0.100-rc.1.22363.3

Generated code with constraints in wrong order:

where T : global::System.IComparable, class

Produces compilation error:

CS0449	The 'class', 'struct', 'unmanaged', 'notnull', and 'default' constraints cannot be combined or duplicated, and must be specified first in the constraints list.

Expected Behavior

Code is generated without errors:

where T : class, global::System.IComparable

Steps To Reproduce

App.razor

<MyComponent Parameter="1" />

MyComponent.razor

@typeparam T where T : class, IComparable

@code
{
    [Parameter]
    public T Parameter { get; set; } = default!;
}

Exceptions (if any)

No response

.NET Version

7.0.100-rc.1.22363.3

Anything else?

No response

@ghost ghost added the untriaged label Oct 28, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Nov 30, 2022
This issue is being transferred. Timeline may not be complete until it finishes.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants