radzenhq / radzen-blazor

Radzen Blazor is a set of 90+ free native Blazor UI components packed with DataGrid, Scheduler, Charts and robust theming including Material design and FluentUI.
https://www.radzen.com
MIT License
3.52k stars 786 forks source link

Radzen.Blazor build failures and components not rendering in Visual Studio 17.6 #981

Closed blake-fm closed 1 year ago

blake-fm commented 1 year ago

Describe the bug Radzen.Blazor fails build, and has other real cute silent failures, when using Visual Studio 17.6 (Release -- the old preview worked just fine). Releated to razor issue #8718.

To Reproduce Steps to reproduce the behavior:

  1. Download source
  2. Build source with VS 17.6

Expected behavior Source builds.

Workaround I've added some comments on #8718 with my workarounds. Additionally, any components like tick.razor that have neither a .razor.cs file, nor anything other than a @code{} block, would simply not be called. No errors, no warnings - the code was simply never called.

I resolved the Tick part by turning tick.razor into tick.cs; something like:

public partial class Tick : ComponentBase {
    // Insert copy/pasta from tick.razor
}

Hope this helps.

akorchev commented 1 year ago

Hi @blake-fm,

This definitely looks as a regression in the .NET SDK. It seems the Microsoft team is fixing this issue with https://github.com/dotnet/razor/pull/8721

This change caused all kinds of problems though so we will closely monitor the progress and act accordingly.

blake-fm commented 1 year ago

It sure is. Though, with the suggested structure, I have zero build issues on a fairly large project. For now, it also includes the entire build for /Radzen.Blazor, with modifications.

akorchev commented 1 year ago

This would solve the build errors indeed. We have bigger issues with our other products though :( Hopefully we find a workaround.

blake-fm commented 1 year ago

Very sorry to hear! I've not seen the other products personally, but I do hope you guys are not forced to rollback and wait for too long.

akorchev commented 1 year ago

Hi again @blake-fm,

Would you mind opening a PR with the changes you have made? Or at least tell us what files you have changed.

I've made the project build by adding two .cs files - one for RadzenDataGridRow and one for RadzenGrid - but I may have missed something.

blake-fm commented 1 year ago

Sadly I was forced into a temporary hard fork (time constraints), and had to stop planning PRs from my local branch. Reconciling back is not something I could achieve in a timely manner.

I saw you posted another @code{} only file, that had similar issues - those are the scary ones, what with the potential for almost entirely silent failures. Good thing nobody does access control in components.. I hope? But should be easy enough to regex find that one.

Beyond that, I haven't noticed any other types of silent failures - so if you're compiling, hopefully that's that. FYI I did also submit the Tick issue, as a separate issue (https://github.com/dotnet/razor/issues/8737).

blake-fm commented 1 year ago

That felt like too much of a cop-out. So, here's some actual effort:

^(?<![\s\S\r])((\s|\n|\r)*@(using|typeparam|page|inherits|inplements).*)*(\s|\n|\r)*@code

Results: image

Will put up an at least partial PR asap.

akorchev commented 1 year ago

Thank you @blake-fm but you have done enough to help us already! I think I am done with the changes and will push a fix soon.

akorchev commented 1 year ago

The commit was pushed: https://github.com/radzenhq/radzen-blazor/commit/edf381c9142e136acaa337ed42a7a7e8f8be8e22

A Microsoft developer confirmed a new version of the .NET SDK would fix the regressions.

blake-fm commented 1 year ago

I'm sure you've tested thoroughly already, but I did a fresh clone and it built and ran just fine for me (very quick test though!).

akorchev commented 1 year ago

Seems to be fine with the latest tree. May need the latest Visual Studio version in order to build with .NET 7.0.302.

Varin6 commented 1 year ago

Potentially related. My Pipelines on Azure failed today on 7.0.302 (for a project using Radzen.Blazor) with those errors:

##[error]C:\devOpsAgent\_work\1\s\Libraries\Radzen.Blazor\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\RadzenDataGridCell_razor.g.cs(566,162): Error CS0307: The namespace '__Blazor.Radzen.Blazor.RadzenDataGridRow' cannot be used with type arguments
C:\devOpsAgent\_work\1\s\Libraries\Radzen.Blazor\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\RadzenDataGridCell_razor.g.cs(566,162): error CS0307: The namespace '__Blazor.Radzen.Blazor.RadzenDataGridRow' cannot be used with type arguments [C:\devOpsAgent\_work\1\s\Libraries\Radzen.Blazor\Radzen.Blazor.csproj]
##[error]C:\devOpsAgent\_work\1\s\Libraries\Radzen.Blazor\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\RadzenGrid_razor.g.cs(3323,158): Error CS0307: The namespace '__Blazor.Radzen.Blazor.RadzenGrid' cannot be used with type arguments
C:\devOpsAgent\_work\1\s\Libraries\Radzen.Blazor\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\RadzenGrid_razor.g.cs(3323,158): error CS0307: The namespace '__Blazor.Radzen.Blazor.RadzenGrid' cannot be used with type arguments [C:\devOpsAgent\_work\1\s\Libraries\Radzen.Blazor\Radzen.Blazor.csproj]
##[error]C:\devOpsAgent\_work\1\s\Libraries\Radzen.Blazor\Microsoft.NET.Sdk.Razor.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\RadzenDataGridRow_razor.g.cs(491,162): Error CS0307: The namespace '__Blazor.Radzen.Blazor.RadzenDataGridRow' cannot be used with type arguments

It was first time running it on this SDK version. I updated my SDK locally to 7.0.302 - builds on my machine.

akorchev commented 1 year ago

Yes, it is the same error. Make sure to update the Radzen.Blazor source in your repo. It should be the latest one.