Skip to content

Generator 'RazorSourceGenerator' failed to generate source #8193

@RobertOstermann

Description

@RobertOstermann

Type: Bug

Issue Description

There is an error in the .csproj file in the new pre-release version of the extension.

Generator 'RazorSourceGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'FileNotFoundException' with message 'Could not load file or assembly 'Microsoft.AspNetCore.Razor.Utilities.Shared, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
'.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Razor.Utilities.Shared, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

File name: 'Microsoft.AspNetCore.Razor.Utilities.Shared, Version=10.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
at Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator.<>c.b__6_19(HostOutputProductionContext context, ValueTuple2 pair) at Microsoft.CodeAnalysis.UserFunctionExtensions.<>c__DisplayClass3_02.b__0(TInput1 input1, TInput2 input2, CancellationToken token) in /_/src/Compilers/Core/Portable/SourceGeneration/UserFunction.cs:line 103

(CS8785)

Steps to Reproduce

Go to a .csproj file and the error is shown at the top.

Expected Behavior

No error

Actual Behavior

Error

Logs

C# log

Post the output from Output-->C# here

C# LSP Trace Logs

Post the output from Output-->C# LSP Trace Logs here. Requires the `C#` output window log level to be set to `Trace`

Environment information

VSCode version: 1.100.0-insider
C# Extension: 2.74.24
Using OmniSharp: false

Dotnet Information .NET SDK: Version: 9.0.202 Commit: 3a53853c30 Workload version: 9.0.200-manifests.21502d11 MSBuild version: 17.13.13+1c2026462

Runtime Environment:
OS Name: Mac OS X
OS Version: 15.4
OS Platform: Darwin
RID: osx-arm64
Base Path: /usr/local/share/dotnet/sdk/9.0.202/

.NET workloads installed:
There are no installed workloads to display.
Configured to use loose manifests when installing new manifests.

Host:
Version: 9.0.3
Architecture: arm64
Commit: 831d23e561

.NET SDKs installed:
8.0.404 [/usr/local/share/dotnet/sdk]
8.0.407 [/usr/local/share/dotnet/sdk]
9.0.202 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Visual Studio Code Extensions
Extension Author Version Folder Name
csdevkit ms-dotnettools 1.18.25 ms-dotnettools.csdevkit-1.18.25-darwin-arm64
csharp ms-dotnettools 2.74.24 ms-dotnettools.csharp-2.74.24-darwin-arm64
dotnetwatchattach Trottero 0.2.7 trottero.dotnetwatchattach-0.2.7
vscode-dotnet-runtime ms-dotnettools 2.3.3 ms-dotnettools.vscode-dotnet-runtime-2.3.3

Extension version: 2.74.24
VS Code version: Code - Insiders 1.100.0-insider (1b000ef82b3c3082833f6b04e050bc0e4e12ae3b, 2025-04-18T05:31:28.011Z)
OS version: Darwin arm64 24.4.0
Modes:

System Info
Item Value
CPUs Apple M1 Max (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 4, 4, 4
Memory (System) 64.00GB (2.62GB free)
Process Argv --crash-reporter-id 428aa8ae-40f2-4aca-ab14-277ccfa15f06
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt551:31249597
vscod805:30301674
c4g48928:30535728
962ge761:30841072
dsvsc014:30777825
dsvsc015:30821418
h48ei257:31000450
pythontbext0:30879054
cppperfnew:30980852
dwnewjupytercf:31046870
pythonrstrctxt:31093868
nativeloc1:31118317
e80f6927:31120813
dwcopilot:31158714
5b1c1929:31184661
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
9064b325:31222308
copilot_t_ci:31222730
g012b348:31231168
pythoneinst12:31251391
treesitterini:31278752
bgtreat:31252123
c7cif404:31283753
31787653:31262186
3e8i5726:31271747
pythonpulldiag:31287486
6gi0g917:31259950
editoredits36407:31282444
996jf627:31264550
pythonrdcb7:31268811
usemplatestapi:31288272
gh9da704:31280609
747dc170:31275146
g20af354:31278749
pylancecolor:31288664
generatesymbolt:31280541
convertfstringf:31280702
gendocf:31280703

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions