Skip to content

Ensure we dispose ITextEdits in case we fail to apply them - #85884

Open
jasonmalinowski wants to merge 1 commit into
dotnet:mainfrom
jasonmalinowski:dispose-text-buffer-edits
Open

jasonmalinowski wants to merge 1 commit into
dotnet:mainfrom
jasonmalinowski:dispose-text-buffer-edits

Conversation

@jasonmalinowski

@jasonmalinowski jasonmalinowski commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

This is just a general cleanup I noticed. The codepaths are unlikely to result in exceptions, but this is good practice nonetheless.

@jasonmalinowski jasonmalinowski self-assigned this Oct 2, 2026
Copilot AI balanced review requested due to automatic review settings October 2, 2026 00:18
@jasonmalinowski
jasonmalinowski requested review from a team as code owners October 2, 2026 00:18
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused lifecycle cleanup follows established patterns without changing behavior or APIs.

Review effort: Balanced
Findings: None

What changed in this PR

Adds deterministic disposal for ITextEdit instances, ensuring failed edits release resources while preserving existing behavior.

Changes:

  • Wraps product-code text edits in using.
  • Applies the same lifecycle pattern to affected tests.
File Description
DefaultLSPDocumentTest.cs Disposes test edits.
DefaultLSPDocumentSynchronizerTest.cs Disposes notification edit.
SymbolCompletionProviderTests_NoInteractive.cs Disposes test edit.
StringCopyPasteCommandHandler.cs Disposes paste edits.
KnownSourcePasteProcessor.cs Disposes cloned-buffer edit.
RawStringLiteralCommandHandler_TypeChar.cs Disposes quote edit.
RawStringLiteralCommandHandler_Return.cs Disposes return-key edit.
ConvertNamespaceCommandHandler.cs Disposes namespace edit.
CompleteStatementCommandHandler.cs Disposes completion edit.
RoslynSpellCheckFixerProvider.cs Disposes spell-check edit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants