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

Fix issue where closing sourcelink document threw if not opened #75046

Merged
merged 2 commits into from
Sep 10, 2024

Conversation

dibarbet
Copy link
Member

Resolves dotnet/vscode-csharp#7514

Essentially it is possible in LSP that TryRemoveDocumentFromWorkspace gets called without TryAddDocumentToWorkspace getting called first. This commonly happens if a sourcelink document is opened, but immediately closed - LSP will not attempt to call TryAddDocumentToWorkspace until a feature requiring a Solution is requested. If the document is immediately closed this never happens, but we would still attempt to close the document in the MAS workspace.

This matches what the decompilation provider does as well
https://github.com/dotnet/roslyn/blob/main/src/Features/Core/Portable/MetadataAsSource/DecompilationMetadataAsSourceFileProvider.cs#L321

@dibarbet dibarbet requested a review from a team as a code owner September 10, 2024 18:41
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Sep 10, 2024
@dibarbet dibarbet merged commit 3aa6e3b into dotnet:main Sep 10, 2024
25 checks passed
@dibarbet dibarbet deleted the fix_sourcelink_not_opened branch September 10, 2024 22:34
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Sep 10, 2024
dibarbet added a commit to dibarbet/roslyn that referenced this pull request Sep 10, 2024
Fix issue where closing sourcelink document threw if not opened
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Language server randomly error and shutdown
2 participants