Skip to content

RazorSourceGenerator fails with net10.0 Preview 3 #11735

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

Closed
vasquezjames opened this issue Apr 13, 2025 · 5 comments
Closed

RazorSourceGenerator fails with net10.0 Preview 3 #11735

vasquezjames opened this issue Apr 13, 2025 · 5 comments
Labels
area-compiler Umbrella for all compiler issues

Comments

@vasquezjames
Copy link

In VS2022 17.14 Preview 2, I create a new Blazor Web application:

Image

The solution have 2 projects, Server and client:/

Image

I bluid the solution and recive this error:

Build started at 20:52...
1>------ Build started: Project: BlazorApp5.Client, Configuration: Debug Any CPU ------
1>C:\Program Files\dotnet\sdk\10.0.100-preview.3.25201.16\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(326,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
1>CSC : warning CS8032: An instance of analyzer Microsoft.CodeAnalysis.Razor.Compiler.Analyzers.ComponentParameterNullableWarningSuppressor cannot be created from C:\Program Files\dotnet\sdk\10.0.100-preview.3.25201.16\Sdks\Microsoft.NET.Sdk.Razor\source-generators\Microsoft.CodeAnalysis.Razor.Compiler.dll : Method 'get_SupportedSuppressions' in type 'Microsoft.CodeAnalysis.Razor.Compiler.Analyzers.ComponentParameterNullableWarningSuppressor' from assembly 'Microsoft.CodeAnalysis.Razor.Compiler, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation..
1>CSC : warning CS8784: Generator 'RazorSourceGenerator' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'MissingMethodException' with message 'Method not found: 'Microsoft.CodeAnalysis.IncrementalValueProvider1<System.Collections.Immutable.ImmutableArray1<!!0>> Microsoft.CodeAnalysis.IncrementalValueProviderExtensions.Collect(Microsoft.CodeAnalysis.IncrementalValuesProvider1<!!0>)'.'. 1>BlazorApp5.Client -> C:\Users\jvasquez\source\repos\BlazorApp5\BlazorApp5\BlazorApp5.Client\bin\Debug\net10.0\BlazorApp5.Client.dll 1>BlazorApp5.Client (Blazor output) -> C:\Users\jvasquez\source\repos\BlazorApp5\BlazorApp5\BlazorApp5.Client\bin\Debug\net10.0\wwwroot 1>Done building project "BlazorApp5.Client.csproj". 2>------ Build started: Project: BlazorApp5, Configuration: Debug Any CPU ------ 2>CSC : warning CS8032: An instance of analyzer Microsoft.CodeAnalysis.Razor.Compiler.Analyzers.ComponentParameterNullableWarningSuppressor cannot be created from C:\Program Files\dotnet\sdk\10.0.100-preview.3.25201.16\Sdks\Microsoft.NET.Sdk.Razor\source-generators\Microsoft.CodeAnalysis.Razor.Compiler.dll : Method 'get_SupportedSuppressions' in type 'Microsoft.CodeAnalysis.Razor.Compiler.Analyzers.ComponentParameterNullableWarningSuppressor' from assembly 'Microsoft.CodeAnalysis.Razor.Compiler, Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' does not have an implementation.. **2>CSC : warning CS8784: Generator 'RazorSourceGenerator' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'MissingMethodException' with message 'Method not found: 'Microsoft.CodeAnalysis.IncrementalValueProvider1<System.Collections.Immutable.ImmutableArray1<!!0>> Microsoft.CodeAnalysis.IncrementalValueProviderExtensions.Collect(Microsoft.CodeAnalysis.IncrementalValuesProvider1<!!0>)'.'.**
2>C:\Users\jvasquez\source\repos\BlazorApp5\BlazorApp5\BlazorApp5\Program.cs(1,7,1,17): error CS0246: The type or namespace name 'BlazorApp5' could not be found (are you missing a using directive or an assembly reference?)
2>C:\Users\jvasquez\source\repos\BlazorApp5\BlazorApp5\BlazorApp5\Program.cs(2,7,2,17): error CS0246: The type or namespace name 'BlazorApp5' could not be found (are you missing a using directive or an assembly reference?)
2>Done building project "BlazorApp5.csproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 20:52 and took 05,963 seconds ==========

There is some fix for this bug? Or I have to unistall .net10 preview 3, install .net preview 2,
or wait for .net10 preview 4? 🧐🤨🤔

@davidwengier davidwengier added the area-compiler Umbrella for all compiler issues label Apr 13, 2025
@YourYoungerBrothersPug
Copy link

Also seen here: dotnet/aspnetcore#61439

@EngstromJimmy
Copy link

I am seeing this as well =(
Uninstalling .NET 10 P3 makes the problem go away, but also makes it a bit harder to test .NET 10 P3 ;)

@danroth27
Copy link
Member

Unfortunately, there is an incompatibility with the Razor compiler in .NET 10 Preview 3 and Visual Studio 2022 17.14 Preview 2. This should be fixed shortly with the next VS preview release. In the meantime, you should be able to still build using the .NET command-line interface or you can downgrade to .NET 10 Preview 2 until the VS preview update is available.

@danroth27
Copy link
Member

Visual Studio 17.14 Preview 3 is now available and addresses this issue. Please update to the latest Visual Studio Preview release.

@vasquezjames
Copy link
Author

With the new Visual Studio 17.14 Preview 3 release, the issue has been resolved. The same solution now works. Thanks to the VS and dotnet team.

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

No branches or pull requests

5 participants