[Experimental Agent] Fix COM ownership and HTML subscription lifetimes/Alternative fix attempt - #15087
Draft
KlausLoeffelmann wants to merge 1 commit into
Draft
[Experimental Agent] Fix COM ownership and HTML subscription lifetimes/Alternative fix attempt#15087KlausLoeffelmann wants to merge 1 commit into
KlausLoeffelmann wants to merge 1 commit into
Conversation
Balance caller-owned conversion, activation, and connection-point references so native teardown does not leave a site or event sink rooting its managed host. Adapt the necessary browser/HTML prerequisites from Jeremy Kuhne's dotnet#15059 without importing unrelated changes. Observe HTML window unload independently of application subscriptions, preserve actual delegate/proxy multiplicity, and tear down the correct window's subscriptions while allowing other frames to remain active. Keep ordinary event disconnection separate from final attached-event cleanup, and complete owned-resource cleanup on reentrant/error paths. Keep removal non-creating after teardown, reject revoked registrations before native-identity dictionary comparisons, and preserve nonthrowing subscription behavior for windows that lack the optional event connection point. Honor successful SetData ownership transfer without reading or releasing a medium the recipient may already have freed. Cover native reference balance, continued usability, event delivery, navigation, and failure paths. Explain the ownership invariants and failure mechanisms at the changes. Leave the generated-COM GIT strategy/cache redesign for separate work. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e87f9293-79ef-46bf-b22b-a6eee74d2a2c
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #15087 +/- ##
===================================================
- Coverage 37.24166% 37.18459% -0.05708%
===================================================
Files 246 246
Lines 9774 9789 +15
Branches 1029 1031 +2
===================================================
Hits 3640 3640
- Misses 5970 5985 +15
Partials 164 164
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
JeremyKuhne
added a commit
to JeremyKuhne/winforms
that referenced
this pull request
Sep 15, 2026
Integrate the ownership and lifecycle design from dotnet#15087, authored by Klaus Loffelmann with Copilot. Observe unload independently of application subscriptions, preserve native registration multiplicity, make teardown reentrant, and honor successful STGMEDIUM ownership transfer. Preserve this PR's accessibility, COM factory, VB6 shutdown, bitmap, and additional ownership coverage. Add direct SetData transfer tests for both current .NET and .NET Framework. Co-authored-by: Klaus Loffelmann <klloeffe@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
This is a fix-attempt based on a different, experimental Agent-approach to evaluate quality/plausibility of bug-fixes in an actual, real-world scenario.
Alternative to ** #15059 **
Executing Agent's description:
Balance caller-owned conversion, activation, and connection-point references so native teardown does not leave a site or event sink rooting its managed host. Adapt the necessary browser/HTML prerequisites from Jeremy Kuhne's #15059 without importing unrelated changes.
Observe HTML window unload independently of application subscriptions, preserve actual delegate/proxy multiplicity, and tear down the correct window's subscriptions while allowing other frames to remain active. Keep ordinary event disconnection separate from final attached-event cleanup, and complete owned-resource cleanup on reentrant/error paths. Keep removal non-creating after teardown, reject revoked registrations before native-identity dictionary comparisons, and preserve nonthrowing subscription behavior for windows that lack the optional event connection point.
Honor successful SetData ownership transfer without reading or releasing a medium the recipient may already have freed. Cover native reference balance, continued usability, event delivery, navigation, and failure paths. Explain the ownership invariants and failure mechanisms at the changes.
Leave the generated-COM GIT strategy/cache redesign for separate work.
Microsoft Reviewers: Open in CodeFlow