Skip to content

Errors any time a .razor file is in a non-building state #9211

@rally25rs

Description

@rally25rs

Type: Bug

Issue Description

Steps to Reproduce

Open a Blazor .razor file.

Edit anything, especially letting copilot partially autocomplete, or paste a chunk of code that isn't 100% correct.

C# extension errors any time a .razor file is in a state where there are edits that don't compile.

Expected Behavior

Don't error. Or at least don't bubble up a notification toast message in VSCode every time.
Every time you tab complete a copilot completion, or paste a chunk of code, I don't need a popup error to let me know the file doesn't compile.

Actual Behavior

  Code: -32000 
[object Object]

Extension version: 2.130.5
VS Code version: Code 1.116.0 (Universal) (560a9dba96f961efea7b1612916f89e5d5d4d679, 2026-04-15T00:28:13Z)
OS version: Darwin arm64 25.3.0
Modes:

Logs

C# log

Details
-----

  Code: -32000 
[object Object]
2026-04-20 13:24:08.271 [error] Request textDocument/documentSymbol failed.
  Message: Razor source generator did not produce a host output for project 'App.Web.Client': warning CS8785: 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 'ArgumentException' with message 'The hintName 'Components/ConfirmDialog_razor.g.cs' of the added source file must be unique within a generator. (Parameter 'hintName')'.
System.ArgumentException: The hintName 'Components/ConfirmDialog_razor.g.cs' of the added source file must be unique within a generator. (Parameter 'hintName')
   at Microsoft.CodeAnalysis.AdditionalSourcesCollection.Add(String hintName, SourceText source) in /_/src/Compilers/Core/Portable/SourceGeneration/AdditionalSourcesCollection.cs:line 78
   at Microsoft.CodeAnalysis.SourceOutputNode`1.AppendOutputs(IncrementalExecutionContext context, CancellationToken cancellationToken) in /_/src/Compilers/Core/Portable/SourceGeneration/Nodes/SourceOutputNode.cs:line 109
-----

  Code: -32000 
[object Object]
2026-04-20 13:24:28.401 [error] Request textDocument/formatting failed.
  Message: Razor source generator did not produce a host output for project 'App.Web.Client': warning CS8785: 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 'ArgumentException' with message 'The hintName 'Components/ConfirmDialog_razor.g.cs' of the added source file must be unique within a generator. (Parameter 'hintName')'.
System.ArgumentException: The hintName 'Components/ConfirmDialog_razor.g.cs' of the added source file must be unique within a generator. (Parameter 'hintName')
   at Microsoft.CodeAnalysis.AdditionalSourcesCollection.Add(String hintName, SourceText source) in /_/src/Compilers/Core/Portable/SourceGeneration/AdditionalSourcesCollection.cs:line 78
   at Microsoft.CodeAnalysis.SourceOutputNode`1.AppendOutputs(IncrementalExecutionContext context, CancellationToken cancellationToken) in /_/src/Compilers/Core/Portable/SourceGeneration/Nodes/SourceOutputNode.cs:line 109
-----

  Code: -32000 
[object Object]
2026-04-20 13:28:31.288 [error] Request textDocument/completion failed.
  Message: Razor source generator did not produce a host output for project 'App.Web.Client': warning CS8785: 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 'ArgumentException' with message 'The hintName 'Components/ConfirmDialog_razor.g.cs' of the added source file must be unique within a generator. (Parameter 'hintName')'.
System.ArgumentException: The hintName 'Components/ConfirmDialog_razor.g.cs' of the added source file must be unique within a generator. (Parameter 'hintName')
   at Microsoft.CodeAnalysis.AdditionalSourcesCollection.Add(String hintName, SourceText source) in /_/src/Compilers/Core/Portable/SourceGeneration/AdditionalSourcesCollection.cs:line 78
   at Microsoft.CodeAnalysis.SourceOutputNode`1.AppendOutputs(IncrementalExecutionContext context, CancellationToken cancellationToken) in /_/src/Compilers/Core/Portable/SourceGeneration/Nodes/SourceOutputNode.cs:line 109
-----

  Code: -32000 
[object Object]
2026-04-20 19:44:12.900 [error] Request textDocument/codeLens failed.
  Message: Razor source generator did not produce a host output for project 'App.Web.Client': warning CS8785: 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 'ArgumentException' with message 'The hintName 'Components/ConfirmDialog_razor.g.cs' of the added source file must be unique within a generator. (Parameter 'hintName')'.
System.ArgumentException: The hintName 'Components/ConfirmDialog_razor.g.cs' of the added source file must be unique within a generator. (Parameter 'hintName')
   at Microsoft.CodeAnalysis.AdditionalSourcesCollection.Add(String hintName, SourceText source) in /_/src/Compilers/Core/Portable/SourceGeneration/AdditionalSourcesCollection.cs:line 78
   at Microsoft.CodeAnalysis.SourceOutputNode`1.AppendOutputs(IncrementalExecutionContext context, CancellationToken cancellationToken) in /_/src/Compilers/Core/Portable/SourceGeneration/Nodes/SourceOutputNode.cs:line 109
-----

C# LSP Trace Logs log

Details

Environment Information

VSCode version: 1.116.0
C# Extension: 2.130.5
Using OmniSharp: false

Dotnet Information .NET SDK: Version: 10.0.201 Commit: 4d3023de60 Workload version: 10.0.200-manifests.0793c108 MSBuild version: 18.3.0-release-26153-122+4d3023de6

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

.NET workloads installed:
There are no installed workloads to display.
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.

Host:
Version: 10.0.5
Architecture: arm64
Commit: a612c2a105

.NET SDKs installed:
9.0.303 [/usr/local/share/dotnet/sdk]
10.0.103 [/usr/local/share/dotnet/sdk]
10.0.201 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 9.0.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 9.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
DOTNET_CLI_UI_LANGUAGE [en-US]

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
aspire-vscode microsoft-aspire 1.0.7 microsoft-aspire.aspire-vscode-1.0.7
blazorwasm-companion ms-dotnettools 1.1.4 ms-dotnettools.blazorwasm-companion-1.1.4
code-spell-checker streetsidesoftware 4.5.6 streetsidesoftware.code-spell-checker-4.5.6
cortex-debug marus25 1.12.1 marus25.cortex-debug-1.12.1
cpptools ms-vscode 1.31.4 ms-vscode.cpptools-1.31.4-darwin-arm64
csdevkit ms-dotnettools 3.10.14 ms-dotnettools.csdevkit-3.10.14-darwin-arm64
csharp ms-dotnettools 2.130.5 ms-dotnettools.csharp-2.130.5-darwin-arm64
dbclient-jdbc cweijan 1.4.6 cweijan.dbclient-jdbc-1.4.6
debug-tracker-vscode mcu-debug 0.0.15 mcu-debug.debug-tracker-vscode-0.0.15
debugpy ms-python 2025.18.0 ms-python.debugpy-2025.18.0-darwin-arm64
docker docker 0.18.0 docker.docker-0.18.0-darwin-arm64
EditorConfig EditorConfig 0.18.2 editorconfig.editorconfig-0.18.2
gitlens eamodio 17.12.0 eamodio.gitlens-17.12.0
hexeditor ms-vscode 1.11.1 ms-vscode.hexeditor-1.11.1
lit-html bierner 1.11.1 bierner.lit-html-1.11.1
markdown-all-in-one yzhang 3.6.3 yzhang.markdown-all-in-one-3.6.3
memory-view mcu-debug 0.0.29 mcu-debug.memory-view-0.0.29
particle-vscode-core particle 1.16.47 particle.particle-vscode-core-1.16.47
particle-vscode-pack particle 1.16.47 particle.particle-vscode-pack-1.16.47
particle-vscode-snippets particle 1.16.47 particle.particle-vscode-snippets-1.16.47
particle-vscode-theme particle 1.16.47 particle.particle-vscode-theme-1.16.47
peripheral-viewer mcu-debug 1.6.1 mcu-debug.peripheral-viewer-1.6.1
prettier-vscode esbenp 12.4.0 esbenp.prettier-vscode-12.4.0
python ms-python 2026.4.0 ms-python.python-2026.4.0-darwin-arm64
remote-containers ms-vscode-remote 0.447.0 ms-vscode-remote.remote-containers-0.447.0
remote-explorer ms-vscode 0.5.0 ms-vscode.remote-explorer-0.5.0
remote-ssh ms-vscode-remote 0.122.0 ms-vscode-remote.remote-ssh-0.122.0
remote-ssh-edit ms-vscode-remote 0.87.0 ms-vscode-remote.remote-ssh-edit-0.87.0
rest-client humao 0.25.1 humao.rest-client-0.25.1
rtos-views mcu-debug 0.0.15 mcu-debug.rtos-views-0.0.15
ruby-lsp Shopify 0.10.2 shopify.ruby-lsp-0.10.2
terraform hashicorp 2.39.2 hashicorp.terraform-2.39.2-darwin-arm64
vscode-containers ms-azuretools 2.4.1 ms-azuretools.vscode-containers-2.4.1
vscode-deno denoland 3.52.0 denoland.vscode-deno-3.52.0
vscode-docker ms-azuretools 2.0.0 ms-azuretools.vscode-docker-2.0.0
vscode-dotnet-runtime ms-dotnettools 3.0.0 ms-dotnettools.vscode-dotnet-runtime-3.0.0
vscode-eslint dbaeumer 3.0.24 dbaeumer.vscode-eslint-3.0.24
vscode-github-actions github 0.31.3 github.vscode-github-actions-0.31.3
vscode-mdx unifiedjs 1.8.17 unifiedjs.vscode-mdx-1.8.17
vscode-postgresql-client2 cweijan 8.4.5 cweijan.vscode-postgresql-client2-8.4.5
vscode-pull-request-github GitHub 0.136.0 github.vscode-pull-request-github-0.136.0
vscode-pylance ms-python 2026.2.1 ms-python.vscode-pylance-2026.2.1
vscode-python-envs ms-python 1.28.0 ms-python.vscode-python-envs-1.28.0-darwin-arm64
vscode-xml redhat 0.29.0 redhat.vscode-xml-0.29.0-darwin-arm64
vscode-zipfs arcanis 3.0.0 arcanis.vscode-zipfs-3.0.0
webnative WebNative 2.2.2 webnative.webnative-2.2.2
C# Settings
Setting Value
preferCSharpExtension false
compilerDiagnosticScope openFiles
analyzerDiagnosticScope openFiles
enableXamlTools true
useServerGC true
System Info
Item Value
CPUs Apple M3 Pro (12 x 2400)
GPU Status 2d_canvas: enabled
GPU0: VENDOR= 0x106b [Google Inc. (Apple)], DEVICE=0x0000 [ANGLE (Apple, ANGLE Metal Renderer: Apple M3 Pro, Version 26.3.1 (Build 25D2128))], DRIVER_VENDOR=Apple, DRIVER_VERSION=26.3.1 ACTIVE
Machine model name: Mac
Machine model version: 15.7
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: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 9, 6, 5
Memory (System) 18.00GB (0.06GB free)
Process Argv --crash-reporter-id 785e3aa8-3965-496a-95fb-77f8e39cef19
Screen Reader no
VM 0%

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions