Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] "Go to Definition" stops responding after vscode is open for a while #1472

Closed
decevy opened this issue Sep 16, 2024 · 1 comment
Closed
Labels
area-roslyn bug Something isn't working fixed

Comments

@decevy
Copy link

decevy commented Sep 16, 2024

Describe the Issue

When I F12 on a class, method, property, whatever and vscode has been open for a while, I get the response No definition found for '[item]'.

Here's the stack trace:

[Error - 16:39:30] [LanguageServerHost] System.ArgumentException: An element with the same key but a different value already exists. Key: '(DocumentId, #3a1261c3-9cff-4375-8d1b-eb4458193fdf - )'
   at System.Collections.Immutable.ImmutableSortedDictionary`2.Node.SetOrAdd(TKey key, TValue value, IComparer`1 keyComparer, IEqualityComparer`1 valueComparer, Boolean overwriteExistingValue, Boolean& replacedExistingValue, Boolean& mutated)
   at System.Collections.Immutable.ImmutableSortedDictionary`2.Node.Add(TKey key, TValue value, IComparer`1 keyComparer, IEqualityComparer`1 valueComparer, Boolean& mutated)
   at System.Collections.Immutable.ImmutableSortedDictionary`2.AddRange(IEnumerable`1 items, Boolean overwriteOnCollision, Boolean avoidToSortedMap)
   at Microsoft.CodeAnalysis.TextDocumentStates`1.AddRange(ImmutableArray`1 states) in /_/src/Workspaces/Core/Portable/Workspace/Solution/TextDocumentStates.cs:line 141
   at Microsoft.CodeAnalysis.ProjectState.AddDocuments(ImmutableArray`1 documents) in /_/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs:line 758
   at Microsoft.CodeAnalysis.SolutionCompilationState.GetAddDocumentsTranslationAction[TDocumentState](ProjectState oldProject, ImmutableArray`1 states) in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.cs:line 1727
   at Microsoft.CodeAnalysis.SolutionCompilationState.WithDocumentStatesOfMultipleProjects[TDocumentState](IEnumerable`1 updatedDocumentStatesPerProject, Func`3 getTranslationAction) in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.cs:line 856
   at Microsoft.CodeAnalysis.SolutionCompilationState.AddDocumentsToMultipleProjects[TDocumentState](ImmutableArray`1 documentInfos) in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionCompilationState.cs:line 1653
   at Microsoft.CodeAnalysis.Solution.AddDocuments(ImmutableArray`1 documentInfos) in /_/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs:line 1003
   at Microsoft.CodeAnalysis.PdbSourceDocument.PdbSourceDocumentMetadataAsSourceFileProvider.GetGeneratedFileAsync(MetadataAsSourceWorkspace metadataWorkspace, Workspace sourceWorkspace, Project sourceProject, ISymbol symbol, Boolean signaturesOnly, MetadataAsSourceOptions options, String tempPath, TelemetryMessage telemetryMessage, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/PdbSourceDocument/PdbSourceDocumentMetadataAsSourceFileProvider.cs:line 246
   at Microsoft.CodeAnalysis.MetadataAsSource.MetadataAsSourceFileService.GetGeneratedFileAsync(Workspace sourceWorkspace, Project sourceProject, ISymbol symbol, Boolean signaturesOnly, MetadataAsSourceOptions options, CancellationToken cancellationToken) in /_/src/Features/Core/Portable/MetadataAsSource/MetadataAsSourceFileService.cs:line 108
   at Microsoft.CodeAnalysis.LanguageServer.Handler.AbstractGoToDefinitionHandler.GetDefinitionsAsync(IGlobalOptionService globalOptions, IMetadataAsSourceFileService metadataAsSourceFileService, Workspace workspace, Document document, Boolean typeOnly, LinePosition linePosition, CancellationToken cancellationToken) in /_/src/LanguageServer/Protocol/Handler/Definitions/AbstractGoToDefinitionHandler.cs:line 84
   at Microsoft.CommonLanguageServerProtocol.Framework.QueueItem`1.StartRequestAsync[TRequest,TResponse](TRequest request, TRequestContext context, IMethodHandler handler, String language, CancellationToken cancellationToken)
[Error - 16:39:30] Request textDocument/definition failed.
  Message: An element with the same key but a different value already exists. Key: '(DocumentId, #3a1261c3-9cff-4375-8d1b-eb4458193fdf - )'
  Code: -32000 
[object Object]

Steps To Reproduce

No response

Expected Behavior

I don't wanna restart vscode every time this happens, you know :)

Environment Information

code --version

1.93.1
38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
arm64

code --list-extensions --show-versions
aakashp.adb-qr@0.2.0
akamud.vscode-theme-onelight@2.3.0
aliasadidev.nugetpackagemanagergui@2.1.1
azurite.azurite@3.32.0
batisteo.vscode-django@1.15.0
dart-code.dart-code@3.96.0
dart-code.flutter@3.96.0
davidbwaters.macos-modern-theme@2.3.19
diemasmichiels.emulate@1.6.0
donjayamanne.python-environment-manager@1.2.4
donjayamanne.python-extension-pack@1.7.0
durablefunctionsmonitor.durablefunctionsmonitor@6.5.0
editorconfig.editorconfig@0.16.4
ehabhelaly.summer-night@1.0.1
equinusocio.vsc-community-material-theme@1.4.7
equinusocio.vsc-material-theme@34.5.2
equinusocio.vsc-material-theme-icons@3.8.8
eridem.vscode-nupkg@1.0.1
george-alisson.html-preview-vscode@0.2.5
github.copilot@1.229.1104
github.copilot-chat@0.21.2024090602
github.copilot-labs@0.17.1121
jashoo.dotnetinsights@1.4.7
karyfoundation.theme-karyfoundation-themes@35.0.0
kevinrose.vsc-python-indent@1.18.0
liviuschera.noctis@10.43.3
mariomatheu.syntax-project-pbxproj@0.1.3
mechatroner.rainbow-csv@3.12.0
minas-giannekas.dartcula-theme@1.3.0
moshfeu.compare-folders@0.24.3
mrworkman.papercolor-vscode-redux@1.1.0
ms-azuretools.vscode-azurefunctions@1.15.4
ms-azuretools.vscode-azureresourcegroups@0.9.5
ms-azuretools.vscode-docker@1.29.2
ms-dotnettools.csdevkit@1.11.6
ms-dotnettools.csharp@2.46.32
ms-dotnettools.vscode-dotnet-runtime@2.1.5
ms-dotnettools.vscodeintellicode-csharp@2.1.11
ms-graph.kiota@1.18.100000001
ms-python.black-formatter@2024.2.0
ms-python.debugpy@2024.11.2024082901
ms-python.isort@2023.10.1
ms-python.python@2024.14.1
ms-python.vscode-pylance@2024.9.1
ms-toolsai.jupyter@2024.8.1
ms-toolsai.jupyter-keymap@1.1.2
ms-toolsai.jupyter-renderers@1.0.19
ms-toolsai.vscode-jupyter-cell-tags@0.1.9
ms-toolsai.vscode-jupyter-slideshow@0.1.6
ms-vscode-remote.remote-containers@0.384.0
ms-vscode.azure-account@0.12.0
ms-vscode.cmake-tools@1.19.51
ms-vscode.cpptools@1.21.6
ms-vscode.cpptools-extension-pack@1.3.0
ms-vscode.cpptools-themes@2.0.0
ms-vscode.live-server@0.4.15
ms-vscode.powershell@2024.2.2
ms-vscode.vscode-speech@0.10.0
ms-vscode.vscode-typescript-next@5.7.20240915
nisargjhaveri.ios-debug@0.4.0
njpwerner.autodocstring@0.6.1
ryanluker.vscode-coverage-gutters@2.11.1
sswg.swift-lang@1.11.0
twxs.cmake@0.0.17
uloco.theme-bluloco-light@3.7.3
vadimcn.vscode-lldb@1.10.0
vinicioslc.adb-interface-vscode@0.22.4
visualstudioexptteam.intellicode-api-usage-examples@0.2.8
visualstudioexptteam.vscodeintellicode@1.3.1
wholroyd.jinja@0.0.8

I have a MacBook Pro M2 Max
32 GB Memory
macOS Sonoma 14.6.1

@decevy decevy added the bug Something isn't working label Sep 16, 2024
@dibarbet
Copy link
Member

dibarbet commented Sep 24, 2024

I believe this is resolved in either the 2.48.31 (prerelease) or 2.45.25 (release) of the C# extension. If you hit it in either of those versions, please re-open.

See dotnet/vscode-csharp#7514 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-roslyn bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

3 participants