Keep ExportProvider self-export off the activation fast path - #799
Merged
Andrew Arnott (AArnott) merged 2 commits intoSep 23, 2026
Merged
Andrew Arnott (AArnott) merged 2 commits into
Andrew Arnott (AArnott) merged 2 commits into
Conversation
GetExportedValue<ExportProvider>() was tracking the synthesized non-owning wrapper as a normal part, so disposing the container tried to dispose that wrapper and threw. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Andrew Arnott (AArnott)
September 23, 2026 03:03
View session
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved review issues remain, and disposal regression coverage is included.
Review effort: Lite
Findings: None
What changed in this PR
Fixes container disposal failures caused by the synthesized ExportProvider wrapper entering the activation fast path.
Changes:
- Falls back to normal export resolution for
ExportProvider. - Adds disposal regression tests for synchronous, asynchronous, and joinable containers.
| File | Description |
|---|---|
test/Microsoft.VisualStudio.Composition.Tests/DisposablePartsTests.cs |
Verifies wrapper and container disposal behavior. |
src/Microsoft.VisualStudio.Composition/RuntimeExportProviderFactory+RuntimeExportProvider.cs |
Excludes the synthesized wrapper from fast-path lifecycle tracking. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Andrew Arnott (AArnott)
enabled auto-merge
September 23, 2026 15:00
Amadeusz Wieczorek (AmadeusW)
approved these changes
Sep 23, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Andrew Arnott (AArnott)
September 23, 2026 15:34
View session
Ryan Toth (RyanToth3)
approved these changes
Sep 23, 2026
Andrew Arnott (AArnott)
deleted the
aarnott-fix-exportprovider-self-export-disposal
branch
September 23, 2026 16:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GetExportedValue<ExportProvider>()started failing container disposal after the export-lookup fast path in #772.That path treated the synthesized
ExportProviderexport as a normal part and tracked its non-owning wrapper. Disposing the container then calledDispose()on the wrapper, which throwsInvalidOperationException("This instance is an import and cannot be directly disposed."). An empty container is enough to reproduce it.The fast path now declines that synthesized export, so the call falls back to the existing
GetExportpath. Callers still receive the non-owning wrapper, and disposing that wrapper directly still throws. Only container disposal is restored to the pre-#772 behavior.