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 recurisve issue with covariant interfaces and fix IID being wrong for built-in interfaces used as generics #1297

Merged
merged 1 commit into from
Mar 14, 2023

Conversation

manodasanW
Copy link
Member

When an CCW is created for an object, we also add the vtables for covariant interfaces. If one of the generics of a covariant interface was to the type that the CCW is being created for, this can end up in a recursive loop. This can also happen with base types too. Looking at the behavior of .NET Core and .NET native, both of them seem to differ with respect to which covariant interfaces got created, but both don't create them for the recursive instances. Based on that, putting in a stack to keep track of the types we are recursively trying to get all the covariant interfaces for to avoid getting into a recursive loop.

As part of this, also found out that when we have a generic of a custom mapped interface like System.IDisposable, we are generating the wrong IID. Resolving that by using the helper type when available.

Fixes #1291

@manodasanW manodasanW requested a review from ujjwalchadha March 13, 2023 19:10
@manodasanW manodasanW merged commit 8d8f1e1 into master Mar 14, 2023
@manodasanW manodasanW deleted the manodasanw/fixcovarianceccw branch March 14, 2023 05:53
dongle-the-gadget pushed a commit to dongle-the-gadget/CsWinRT that referenced this pull request Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting DataContext to a self-referential instance throws StackOverflowException
2 participants