Skip to content

Document Uri length crashing the language server #8223

@jaredpar

Description

@jaredpar

Type: Bug

Issue Description

When editting the dotnet/sdk repository in C# DevKit the language server is crashing with the following error:

2025-04-29 17:59:47.008 [info] [Error - 5:59:47 PM] [LanguageServerHost] System.UriFormatException: Invalid URI: The Uri string is too long.
   at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
   at System.Uri..ctor(String uriString)
   at Roslyn.LanguageServer.Protocol.DocumentUriConverter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) in /_/src/LanguageServer/Protocol/Protocol/Converters/DocumentUriConverter.cs:line 17
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Deserialize(Utf8JsonReader& reader, ReadStack& state)
   at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo`1 jsonTypeInfo, Nullable`1 actualByteCount)
   at System.Text.Json.JsonSerializer.Deserialize[TValue](JsonElement element, JsonSerializerOptions options)
   at Microsoft.CommonLanguageServerProtocol.Framework.SystemTextJsonLanguageServer`1.DeserializeRequest[TRequest](Object serializedRequest, RequestHandlerMetadata metadata) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/SystemTextJsonLanguageServer.cs:line 49
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.TryDeserializeRequest[TRequest](AbstractLanguageServer`1 languageServer, RequestHandlerMetadata requestHandlerMetadata, Boolean isMutating, TRequest& request) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 120

Steps to Reproduce

  1. Create a GitHub Codespace for https://github.com/dotnet/sdk
  2. Open the Codespace in VS Code and edit both .csproj and .cs files
  3. VS Code will eventually popup that the language server crashed too many times and it will no longer be restarted.

Expected Behavior

No crash

Actual Behavior

Logs

exthost.zip

Environment information

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

Dotnet Information

Host:
Version: 9.0.4
Architecture: x64
Commit: f57e6dc747
RID: linux-x64

.NET SDKs installed:
No SDKs were found.

.NET runtimes installed:
Microsoft.NETCore.App 9.0.4 [/home/vscode/.vscode-remote/data/User/globalStorage/ms-dotnettools.vscode-dotnet-runtime/.dotnet/9.0.4~x64/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
DOTNET_ROOT [/workspaces/sdk/.dotnet]

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
azure-pipelines ms-azure-devops 1.249.0 ms-azure-devops.azure-pipelines-1.249.0
claude-dev saoudrizwan 3.13.3 saoudrizwan.claude-dev-3.13.3
copilot GitHub 1.309.0 github.copilot-1.309.0
csdevkit ms-dotnettools 1.18.25 ms-dotnettools.csdevkit-1.18.25-linux-x64
csharp ms-dotnettools 2.72.34 ms-dotnettools.csharp-2.72.34-linux-x64
docker docker 0.4.10 docker.docker-0.4.10-linux-x64
EditorConfig EditorConfig 0.17.2 editorconfig.editorconfig-0.17.2
hexeditor ms-vscode 1.11.1 ms-vscode.hexeditor-1.11.1
powershell ms-vscode 2025.0.0 ms-vscode.powershell-2025.0.0
vscode-azureappservice ms-azuretools 0.26.0 ms-azuretools.vscode-azureappservice-0.26.0
vscode-azureresourcegroups ms-azuretools 0.10.9 ms-azuretools.vscode-azureresourcegroups-0.10.9
vscode-azurestaticwebapps ms-azuretools 0.13.1 ms-azuretools.vscode-azurestaticwebapps-0.13.1
vscode-docker ms-azuretools 1.29.5 ms-azuretools.vscode-docker-1.29.5
vscode-dotnet-runtime ms-dotnettools 2.3.3 ms-dotnettools.vscode-dotnet-runtime-2.3.3
vscode-github-actions github 0.27.1 github.vscode-github-actions-0.27.1
vscode-markdownlint DavidAnson 0.59.0 davidanson.vscode-markdownlint-0.59.0
vscode-pull-request-github GitHub 0.108.0 github.vscode-pull-request-github-0.108.0
vscode-versionlens pflannery 1.20.1 pflannery.vscode-versionlens-1.20.1
vscodeintellicode-csharp ms-dotnettools 2.2.3 ms-dotnettools.vscodeintellicode-csharp-2.2.3-linux-x64
vsliveshare ms-vsliveshare 1.0.5948 ms-vsliveshare.vsliveshare-1.0.5948

Extension version: 2.74.24
VS Code version: Code - Insiders 1.100.0-insider (7dbf25d8427b59f519d04587e71a9d3dfb77224c, 2025-04-10T05:04:51.401Z)
OS version: Windows_NT x64 10.0.26100
Modes:
Remote OS version: Linux x64 6.8.0-1026-azure

System Info
Item Value
CPUs 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 2995)
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
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.85GB (2.08GB free)
Process Argv --crash-reporter-id 49d07ddb-004f-4a1d-ae93-bbce6fadd469
Screen Reader no
VM 0%
Item Value
Remote Codespaces: studious space spork
OS Linux x64 6.8.0-1026-azure
CPUs AMD EPYC 7763 64-Core Processor (16 x 0)
Memory (System) 62.79GB (58.34GB free)
VM 0%
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vsc_aa:30263845
pythonvspyt551:31249597
vscod805cf:30301675
c4g48928:30535728
2i9eh265:30646982
962ge761:30841072
dsvsc014:30777825
dsvsc015:30821418
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:30980852
dwnewjupytercf:31046870
pythonrstrctxt:31093868
nativeloc1:31118317
e80f6927:31120813
dwcopilot:31158714
c3hdf307:31184662
471b6256:31240254
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
g012b348:31231168
pythoneinst12:31251391
bgtreat:31252123
c7cif404:31294349
5b33h341:31251110
31787653:31262186
3e8i5726:31271747
pythonpulldiag:31287486
6gi0g917:31259950
61ibe868:31282443
996jf627:31264550
pythonrdcb7:31268811
usemplatestapi:31297334
i53e4855:31295464
747dc170:31275146
pythoncompactctx:31296835
g20af354:31278749
6518g693:31296556
pylancecolor:31288664
generatesymbolt:31280541
convertfstringf:31280702
gendocf:31280703
3g1ci329:31285109
pylancequickfixf:31296867

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions