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

.NET 7 regression generic array parameters 35980 #48526

Closed
1 task done
Bouke opened this issue May 30, 2023 · 0 comments · Fixed by dotnet/razor#9115
Closed
1 task done

.NET 7 regression generic array parameters 35980 #48526

Bouke opened this issue May 30, 2023 · 0 comments · Fixed by dotnet/razor#9115
Labels
area-razor.compiler This issue is related to the Razor compiler (now external)

Comments

@Bouke
Copy link
Contributor

Bouke commented May 30, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have a component like this:

@* SelectMultiple.razor *@
@typeparam TItem
@inherits InputBase<TItem[]>
@code {
    [Parameter, EditorRequired]
    public TItem[] Options { get; set; } = null!;
    protected override bool TryParseValueFromString(string? value, out TItem[] result, out string validationErrorMessage) => throw new NotImplementedException();
}

Which is used like this:

<SelectMultiple @bind-Value="Selected" Options="Options" />
@code {
    string[] Selected { get; set; } = Array.Empty<string>();
    string[] Options { get; }
}

With .NET 6 SDK this builds and runs just fine, I believe as a result of #35980. With the .NET 7 SDK this fails with the following error:

0>/private/tmp/BlazorGeneric/BlazorGeneric/Microsoft.NET.Sdk.Razor.SourceGenerators/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Counter_razor.g.cs(138,96): Error CS0400 : The type or namespace name 'TItem' could not be found in the global namespace (are you missing an assembly reference?)
0>/private/tmp/BlazorGeneric/BlazorGeneric/Microsoft.NET.Sdk.Razor.SourceGenerators/Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator/Counter_razor.g.cs(138,111): Error CS1503 : Argument 2: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback<string[]>' to 'Microsoft.AspNetCore.Components.EventCallback'

Expected Behavior

With .NET 6 SDK this builds and runs just fine. I expect the .NET 7 SDK to not introduce regressions.

Steps To Reproduce

repro

Exceptions (if any)

No response

.NET Version

7.0.203

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-razor.compiler This issue is related to the Razor compiler (now external) label May 30, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Oct 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-razor.compiler This issue is related to the Razor compiler (now external)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
@Bouke and others