C# Language Server Crashes

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Regression that was solved before; almost identical to C# is almost unusable

Logs:

2026-05-12 22:54:46.867 [info] [Info  - 10:54:46 PM] [Program] Language server initialized
2026-05-12 22:54:47.096 [info] [Info  - 10:54:47 PM] [solution/open] [LanguageServerProjectSystem] Loading f:\sbox\morbus\morbus.sln...
2026-05-12 22:54:47.238 [info] [Error - 10:54:47 PM] [textDocument/didOpen] [LanguageServerHost] System.InvalidOperationException: didOpen received for file:///f:/sbox/morbus/code/Weapons/Components/Shootinfo/ShootInfo.cs which is already open. - file LspWorkspaceManager.cs line 159
   at Microsoft.CodeAnalysis.Contract.Fail(String message, Int32 lineNumber, String filePath) in /_/src/Dependencies/Contracts/Contract.cs:line 159
   at Microsoft.CodeAnalysis.LanguageServer.LspWorkspaceManager.StartTrackingAsync(Uri uri, SourceText documentText, String languageId, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs:line 159
   at Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges.DidOpenHandler.HandleNotificationAsync(DidOpenTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/DocumentChanges/DidOpenHandler.cs:line 41
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 203
2026-05-12 22:54:47.240 [info] [Error - 10:54:47 PM] [LanguageServerHost] System.InvalidOperationException: didOpen received for file:///f:/sbox/morbus/code/Weapons/Components/Shootinfo/ShootInfo.cs which is already open. - file LspWorkspaceManager.cs line 159
   at Microsoft.CodeAnalysis.Contract.Fail(String message, Int32 lineNumber, String filePath) in /_/src/Dependencies/Contracts/Contract.cs:line 159
   at Microsoft.CodeAnalysis.LanguageServer.LspWorkspaceManager.StartTrackingAsync(Uri uri, SourceText documentText, String languageId, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs:line 159
   at Microsoft.CodeAnalysis.LanguageServer.Handler.DocumentChanges.DidOpenHandler.HandleNotificationAsync(DidOpenTextDocumentParams request, RequestContext context, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/DocumentChanges/DidOpenHandler.cs:line 41
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 203
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/QueueItem.cs:line 246
   at Microsoft.CodeAnalysis.LanguageServer.RoslynRequestExecutionQueue.WrapStartRequestTaskAsync(Task requestTask, Boolean rethrowExceptions) in /_/src/LanguageServer/Protocol/RoslynRequestExecutionQueue.cs:line 32
   at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.ProcessQueueCoreAsync[TRequest,TResponse](IQueueItem`1 work, IMethodHandler handler, RequestHandlerMetadata metadata, ConcurrentDictionary`2 concurrentlyExecutingTasks, CancellationTokenSource currentWorkCts, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs:line 367
   at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.InvokeProcessCoreAsync(IQueueItem`1 work, RequestHandlerMetadata metadata, IMethodHandler handler, MethodInfo methodInfo, ConcurrentDictionary`2 concurrentlyExecutingTasks, CancellationTokenSource currentWorkCts, CancellationToken cancellationToken) in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs:line 320
   at Microsoft.CommonLanguageServerProtocol.Framework.RequestExecutionQueue`1.ProcessQueueAsync() in /_/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs:line 272
2026-05-12 22:54:47.241 [info] [Info  - 10:54:47 PM] Error processing queue, shutting down
2026-05-12 22:54:47.243 [info] [Error - 10:54:47 PM] Workspace diagnostic pull failed.
2026-05-12 22:54:47.243 [info] Canceled: Canceled
	at l4.handleFailedRequest (c:\Users\remsc\.cursor\extensions\anysphere.csharp-1.0.1-win32-x64\dist\extension.js:89:9256)
	at l4.handleFailedRequest (c:\Users\remsc\.cursor\extensions\anysphere.csharp-1.0.1-win32-x64\dist\extension.js:1227:870)
	at c:\Users\remsc\.cursor\extensions\anysphere.csharp-1.0.1-win32-x64\dist\extension.js:83:12419
	at runNextTicks (node:internal/process/task_queues:64:5)
	at process.processImmediate (node:internal/timers:452:9)
	at process.callbackTrampoline (node:internal/async_hooks:130:17)
	at async Object.z$ [as provideWorkspaceDiagnostics] (c:\Users\remsc\.cursor\extensions\anysphere.csharp-1.0.1-win32-x64\dist\extension.js:1221:5524)
	at async kJ.pullWorkspaceAsync (c:\Users\remsc\.cursor\extensions\anysphere.csharp-1.0.1-win32-x64\dist\extension.js:83:9721)
2026-05-12 22:54:47.246 [info] [Error - 10:54:47 PM] Client Microsoft.CodeAnalysis.LanguageServer: connection to server is erroring.
write EOF
Shutting down server.
2026-05-12 22:54:47.246 [info] [Error - 10:54:47 PM] Client Microsoft.CodeAnalysis.LanguageServer: connection to server is erroring.
write EOF
Shutting down server.
2026-05-12 22:54:47.246 [info] [Error - 10:54:47 PM] Client Microsoft.CodeAnalysis.LanguageServer: connection to server is erroring.
write EOF
2026-05-12 22:54:47.246 [info] [Error - 10:54:47 PM] Request textDocument/diagnostic failed.
2026-05-12 22:54:47.246 [info]   Message: write EOF
  Code: -32099 
2026-05-12 22:54:47.246 [info] [Error - 10:54:47 PM] Document pull failed for text document file:///f%3A/sbox/morbus/code/Weapons/Components/Firearm/Firearm.Var.cs
2026-05-12 22:54:47.246 [info]   Message: write EOF
  Code: -32099 
2026-05-12 22:54:47.246 [info] [Error - 10:54:47 PM] Client Microsoft.CodeAnalysis.LanguageServer: connection to server is erroring.
Cannot call write after a stream was destroyed
2026-05-12 22:54:47.246 [info] [Error - 10:54:47 PM] Request textDocument/diagnostic failed.
2026-05-12 22:54:47.246 [info]   Message: Cannot call write after a stream was destroyed
  Code: -32099 
2026-05-12 22:54:47.246 [info] [Error - 10:54:47 PM] Document pull failed for text document file:///f%3A/sbox/morbus/code/weapons/components/firearm/Firearm.Getters.cs
2026-05-12 22:54:47.246 [info]   Message: Cannot call write after a stream was destroyed

Steps to Reproduce

Have the agent work on C# code

Operating System

Windows 10/11

Version Information

Version: 3.3.30 (user setup)
VSCode Version: 1.105.1
Commit: 3dc559280adc5f931ade8e25c7b85393842acf30
Date: 2026-05-09T18:28:42.332Z
Layout: editor
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.22631

Does this stop you from using Cursor

Yes - Cursor is unusable

Hey, this is the same bug with duplicate textDocument/didOpen notifications that you reported in March. We’re tracking it and the status hasn’t changed since then, so there’s no ETA yet.

Thanks for flagging this as a regression. If it was more stable for you on some build between March and now, that’s really useful info. I’ll attach the latest logs and your note to the existing issue so the team sees the crash is still fully blocking the C# workflow.

A couple quick questions if you can:

  • What was the last version where it worked fine, even roughly a build number or range?
  • Does it reproduce on the very first agent edit, or only after N edits in the same session?

One workaround that sometimes helps for a bit is reloading the window after the LSP crash. Run Cmd+Shift+P then Developer: Reload Window. I know that’s not a real solution if you’re actively using the agent. I’ll post back here as soon as we have an update on a fix.

I don’t know the version numbers but it was working a lot better for the past couple weeks. It was up until yesterday or the day before yesterday (I don’t always update right away) that it started to not work again.

It doesn’t reproduce on the first agent edit, it’s after a random N number edits. I will try to keep an eye out to see if I can determine a pattern.

I’ve been using the reload window command you suggested to get around this; as a note, restarting the language server alone doesn’t work, only reloading the window.

Got it, that’s useful. It confirms the regression window is somewhere around the recent 3.3.x builds, and it’s not a first edit issue. The fact that only Developer: Reload Window clears it, and restarting the language server doesn’t, is useful too. It points to state on the extension or client side, not just the server. I’ll add both notes to the existing tracking.

If you notice a clearer pattern around the N edits, like it happens every time after a multi file edit, or only when the agent touches a file that’s also open in a tab, drop it here and I’ll attach it. No ETA on the fix yet, but we’ll post back in this thread as soon as the status changes.

I swear this is getting worse, or maybe it got better for a moment and then worse again. I’m having to reload the window like every single time a give the agent a prompt, this is really bad!

Hey, thanks for getting back with an update. The fact that reload is now needed after basically every prompt is an important signal, and it’s worse than it was a week ago.

If you can catch a couple details, it’d really help:

  • When it crashes now, is the file the agent is touching open in an editor tab, or does it also happen with files you haven’t opened yourself?
  • What’s the latest 3.3.x version where this wasn’t happening? Even a rough date range is useful.
  • Does this happen on other C# projects too, or only on morbus.sln?

There’s still no ETA for a fix. I don’t want to promise timelines we don’t control. But I’ll add to the ticket that the symptom is getting worse and fully blocking your workflow, since that affects prioritization. As soon as the status changes, I’ll post an update here.