You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue arises when pinning the SDK to version 6, as the code fails to compile. However, it works seamlessly with SDK .NET 7, indicating that something was not backported to SDK 6.
Considering that .NET 6 will only be out of support in November 2024, it would be beneficial to address this matter promptly.
The problem lies within the following code snippet:
The Razor SourceGenerator generates incorrect code. As a workaround, you can either use two generics in the MyColumn class, such as MyColumn<T, TProperty> : PropertyColumn<T, TProperty>, or remove the CellTemplate portion, which will allow the code to compile successfully.
This code it generates on .NET6:
__builder.OpenComponent<MudBlazor.MudDataGrid<MyViewModel>>(0);__builder.AddAttribute(1,"Columns",(Microsoft.AspNetCore.Components.RenderFragment)((__builder2)=>{__Blazor.Repro.Shared.MyDataGridExample.TypeInference.CreateMyColumn_0(__builder2,2,3,
x =>x.MyProperty,4,(context)=>(__builder3)=>{__builder3.AddContent(5,"X");});}));
This code it generates on .NET7:
__builder.OpenComponent<global::MudBlazor.MudDataGrid<MyViewModel>>(0);__builder.AddAttribute(1,"Columns",(global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2)=>{global::__Blazor.Repro.Shared.MyDataGridExample.TypeInference.CreateMyColumn_0(__builder2,2,3,
x =>x.MyProperty,4,(context)=>(__builder3)=>{__builder3.AddContent(5,"X");});}));__builder.CloseComponent();
Exceptions (if any)
MudDataGridRepro\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Shared_MyDataGridExample_razor.g.cs(93,348): error CS0234: The type or namespace name 'CellContext<>' does not exist in the namespace '__Blazor.MudBlazor' (are you missing an assembly reference?)
MudDataGridRepro\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Shared_MyDataGridExample_razor.g.cs(93,366): error CS0234: The type or namespace name 'Data' does not exist in the namespace '__Blazor.Repro' (are you missing an assembly reference?)
I think it's #8247. Can rebase it, but not sure what target branch to use to make it flow into .NET 6. Seems release/dev17.6 doesn't contain that PR, so here's a PR for that: #8815
Is there an existing issue for this?
Describe the bug
Greetings,
I wanted to bring your attention to an issue raised by one of the MudBlazor users: MudBlazor/MudBlazor#6886.
Upon examining the reproduction provided in this GitHub repository: https://github.com/ScarletKuro/RazorRepro
It appears to be a bug related to the Razor SourceGenerator.
The issue arises when pinning the SDK to version 6, as the code fails to compile. However, it works seamlessly with SDK .NET 7, indicating that something was not backported to SDK 6.
Considering that .NET 6 will only be out of support in November 2024, it would be beneficial to address this matter promptly.
The problem lies within the following code snippet:
When a customer attempts to use it as follows:
The Razor SourceGenerator generates incorrect code. As a workaround, you can either use two generics in the
MyColumn
class, such asMyColumn<T, TProperty> : PropertyColumn<T, TProperty>
, or remove theCellTemplate
portion, which will allow the code to compile successfully.This code it generates on .NET6:
This code it generates on .NET7:
Exceptions (if any)
.NET Version
6.0.311: build errors
6.0.408: build errors
7.0.203; build succeeded
7.0.302: build succeeded
The text was updated successfully, but these errors were encountered: