Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
I have just updated SDK and packages to the new Preview 3 versions and I can no longer compile a Razor Class Library. Possibly also other projects that depend on it, but I'm blocked so far at the RCL.
I get two errors that appear to be directly related to the net10 build:
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..
and
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.IncrementalValueProvider`1<System.Collections.Immutable.ImmutableArray`1<!!0>> Microsoft.CodeAnalysis.IncrementalValueProviderExtensions.Collect(Microsoft.CodeAnalysis.IncrementalValuesProvider`1<!!0>)'.'.
I can't find a workaround for now and there does not appear to be any way to update the RazorSourceGenerator from 9.0.0.0 to anything higher using nuGet or VS update.
We can repro this error using just the template RCL with no code changes.
The screen shot shows that, while the library compiles with the warnings, the types that should have been included from the Razor files are missing from the output, as you'd expect from these warnings.
Expected Behavior
Project should build as normal. RazorSourceGenerator needs an update if there are breaking changes in dependent libraries.
While the RCL library does build, without the RazorSourceGenerator the Razor types inside the library are not included in the output, so it is not possible to refer to these in other projects.
Steps To Reproduce
My project hierarchy is big and convoluted.
I created a new, entirely blank Razor Class Library from the Visual Studio templates, based on Net10 Preview. Did nothing at all to the code.
Build. Got the same warnings from the compiler.
So, this is pretty easily reproducible.
Attempting to reference Razor types or namespaces from other libraries causes build failures (obviously).
Exceptions (if any)
No response
.NET Version
10.0.100-preview.3.25201.16
Anything else?
I am using Visual Studio Enterprise 17.14.0 Preview 2.0
Windows 11 Enterprise 24H2 (26100.3624)
This is my installed workload list:
Installed Workload Id Manifest Version Installation Source
------------------------------------------------------------------------------------------------------------------------------------------
android 36.0.0-preview.3.22/10.0.100-preview.3 SDK 10.0.100-preview.3, VS 17.14.35906.104, VS 17.12.35707.178
aspire 8.2.2/8.0.100 SDK 10.0.100-preview.3, VS 17.12.35707.178
ios 18.2.10695-net10-p3/10.0.100-preview.3 SDK 10.0.100-preview.3, VS 17.14.35906.104, VS 17.12.35707.178
maccatalyst 18.2.10695-net10-p3/10.0.100-preview.3 SDK 10.0.100-preview.3, VS 17.14.35906.104, VS 17.12.35707.178
macos 15.2.10695-net10-p3/10.0.100-preview.3 SDK 10.0.100-preview.3, VS 17.14.35906.104
maui 10.0.0-preview.3.25208.1/10.0.100-preview.3 SDK 10.0.100-preview.3
maui-windows 10.0.0-preview.3.25208.1/10.0.100-preview.3 SDK 10.0.100-preview.3, VS 17.14.35906.104, VS 17.12.35707.178
wasm-tools 10.0.0-preview.3.25171.5/10.0.100-preview.3 SDK 10.0.100-preview.3, VS 17.14.35906.104, VS 17.12.35707.178
wasm-tools-net6 10.0.0-preview.3.25171.5/10.0.100-preview.3 SDK 10.0.100-preview.3, VS 17.14.35906.104
wasm-tools-net8 10.0.0-preview.3.25171.5/10.0.100-preview.3 SDK 10.0.100-preview.3, VS 17.14.35906.104
This is my SDK list
9.0.102 [C:\Program Files\dotnet\sdk]
9.0.104 [C:\Program Files\dotnet\sdk]
9.0.200 [C:\Program Files\dotnet\sdk]
10.0.100-preview.2.25164.34 [C:\Program Files\dotnet\sdk]
10.0.100-preview.3.25201.16 [C:\Program Files\dotnet\sdk]
Output from dotnet --info
.NET SDK:
Version: 10.0.100-preview.3.25201.16
Commit: 9dee3cf508
Workload version: 10.0.100-preview.3.25208.1
MSBuild version: 17.14.0-preview-25177-05+903614e16
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.100-preview.3.25201.16\
.NET workloads installed:
[android]
Installation Source: SDK 10.0.100-preview.3, VS 17.14.35906.104, VS 17.12.35707.178
Manifest Version: 36.0.0-preview.3.22/10.0.100-preview.3
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.3\microsoft.net.sdk.android\36.0.0-preview.3.22\WorkloadManifest.json
Install Type: Msi
[aspire]
Installation Source: SDK 10.0.100-preview.3, VS 17.12.35707.178
Manifest Version: 8.2.2/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Install Type: Msi
[ios]
Installation Source: SDK 10.0.100-preview.3, VS 17.14.35906.104, VS 17.12.35707.178
Manifest Version: 18.2.10695-net10-p3/10.0.100-preview.3
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.3\microsoft.net.sdk.ios\18.2.10695-net10-p3\WorkloadManifest.json
Install Type: Msi
[maccatalyst]
Installation Source: SDK 10.0.100-preview.3, VS 17.14.35906.104, VS 17.12.35707.178
Manifest Version: 18.2.10695-net10-p3/10.0.100-preview.3
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.3\microsoft.net.sdk.maccatalyst\18.2.10695-net10-p3\WorkloadManifest.json
Install Type: Msi
[macos]
Installation Source: SDK 10.0.100-preview.3, VS 17.14.35906.104
Manifest Version: 15.2.10695-net10-p3/10.0.100-preview.3
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.3\microsoft.net.sdk.macos\15.2.10695-net10-p3\WorkloadManifest.json
Install Type: Msi
[maui]
Installation Source: SDK 10.0.100-preview.3
Manifest Version: 10.0.0-preview.3.25208.1/10.0.100-preview.3
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.3\microsoft.net.sdk.maui\10.0.0-preview.3.25208.1\WorkloadManifest.json
Install Type: Msi
[maui-windows]
Installation Source: SDK 10.0.100-preview.3, VS 17.14.35906.104, VS 17.12.35707.178
Manifest Version: 10.0.0-preview.3.25208.1/10.0.100-preview.3
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.3\microsoft.net.sdk.maui\10.0.0-preview.3.25208.1\WorkloadManifest.json
Install Type: Msi
[wasm-tools]
Installation Source: SDK 10.0.100-preview.3, VS 17.14.35906.104, VS 17.12.35707.178
Manifest Version: 10.0.0-preview.3.25171.5/10.0.100-preview.3
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.3\microsoft.net.workload.mono.toolchain.current\10.0.0-preview.3.25171.5\WorkloadManifest.json
Install Type: Msi
[wasm-tools-net6]
Installation Source: SDK 10.0.100-preview.3, VS 17.14.35906.104
Manifest Version: 10.0.0-preview.3.25171.5/10.0.100-preview.3
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.3\microsoft.net.workload.mono.toolchain.net6\10.0.0-preview.3.25171.5\WorkloadManifest.json
Install Type: Msi
[wasm-tools-net8]
Installation Source: SDK 10.0.100-preview.3, VS 17.14.35906.104
Manifest Version: 10.0.0-preview.3.25171.5/10.0.100-preview.3
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100-preview.3\microsoft.net.workload.mono.toolchain.net8\10.0.0-preview.3.25171.5\WorkloadManifest.json
Install Type: Msi
Configured to use workload sets when installing new manifests.
Host:
Version: 10.0.0-preview.3.25171.5
Architecture: x64
Commit: 0a33e18a0b
.NET SDKs installed:
9.0.102 [C:\Program Files\dotnet\sdk]
9.0.104 [C:\Program Files\dotnet\sdk]
9.0.200 [C:\Program Files\dotnet\sdk]
10.0.100-preview.2.25164.34 [C:\Program Files\dotnet\sdk]
10.0.100-preview.3.25201.16 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-preview.2.25164.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.0-preview.3.25172.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-preview.2.25163.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.0-preview.3.25171.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0-preview.2.25163.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.0-preview.3.25174.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Not sure what else might be of value. The RCL project is pretty standard - the Project SDK is Microsoft.NET.Sdk.Razor
and the TargetFramework is set to net10.0
with Nullable also set to enable