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 ComWrappers interaction with the IReferenceTracker interface #45624

Merged
merged 3 commits into from
Dec 9, 2020

Conversation

AaronRobinsonMSFT
Copy link
Member

Issues: microsoft/CsWinRT#413, microsoft/microsoft-ui-xaml#3719

A fundamental flaw was discovered during consumption of the ComWrappers API (introduced .NET 5) in WinUI 3.0 scenarios. This was related to COM Aggregation and how C#/WinRT generated interop code.

Additional E2E testing has been added in this PR. The scenario was also manually validated on a local build against the official XAML/Jupiter runtime using hand crafted interop code. A private build of coreclr was then shared with the C#/WinRT team for validation.

.NET 5 servicing: #45622

API Follow-ups: #44446

/cc @davidwrighton @elinor-fung @jkoritzinsky

Convert Managed Object Wrapper (MOW) GC Handle from HNDTYPE_STRONG
    to HNDTYPE_REFCOUNTED.

Add new CreateObjectFlags value to indicate aggregation during
    CreateObject scenario. This isn't reflected in the managed
    .NET 5 API surface area.

In the ReferenceTracker scenario the ref count may never reach 0 so
    the MOW destructor needs to handle that case. The previous expectation
    for a null in the destructor was based on the STRONG handle logic.

During aggregation scenarios involving ReferenceTracker, ownership
    of the inner is now the responsibility of the runtime.
src/coreclr/src/interop/comwrappers.cpp Outdated Show resolved Hide resolved
src/coreclr/src/interop/comwrappers.hpp Outdated Show resolved Hide resolved
@ViktorHofer
Copy link
Member

// Auto-generated message

69e114c which was merged 12/7 removed the intermediate src/coreclr/src/ folder. This PR needs to be updated as it touches files in that directory which causes conflicts.

To update your commits you can use this bash script: https://gist.github.com/ViktorHofer/6d24f62abdcddb518b4966ead5ef3783. Feel free to use the comment section of the gist to improve the script for others.

@AaronRobinsonMSFT AaronRobinsonMSFT merged commit a7c3179 into dotnet:master Dec 9, 2020
@AaronRobinsonMSFT AaronRobinsonMSFT deleted the tracker_bug_net6 branch December 9, 2020 23:17
@ghost ghost locked as resolved and limited conversation to collaborators Jan 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants