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 potential type incompatibility for in-proc WinRT components #1610

Merged
merged 4 commits into from
May 14, 2024

Conversation

hez2010
Copy link
Contributor

@hez2010 hez2010 commented May 12, 2024

We need to treat the object as unmanaged object and create an RCW for this case.

Fixes #1510.

@hez2010 hez2010 marked this pull request as draft May 12, 2024 13:59
@hez2010 hez2010 marked this pull request as ready for review May 12, 2024 14:10
@hez2010
Copy link
Contributor Author

hez2010 commented May 12, 2024

Can confirm the issue has been fixed:
image

@hez2010
Copy link
Contributor Author

hez2010 commented May 13, 2024

PTAL.

@manodasanW
Copy link
Member

I can see this being a feasible solution to this problem with different projections. Going to run the CI pipelines to make sure everything continues to pass.

@hez2010

This comment was marked as resolved.

@manodasanW
Copy link
Member

Do you think we should handle this in the projection as well? i.e. turning all global::WinRT.ComWrappersSupport.FindObject<T>(thisPtr) into global::WinRT.ComWrappersSupport.FindObject<object>(thisPtr) is T __obj__ ? __obj__ : global::WinRT.ComWrappersSupport.CreateRcwForComObject<T>(thisPtr)

All of the FindObject calls in the generated projections are part of the Do_ABI_ implementations of the various interfaces. I feel like if we are ending up there, we have already decided that is the right interface for the call. If it was for another projection, I feel like it would end up on the helper type for that interface from that projection. Until we find a scenario that impacts those, I would hold off on updating those.

@manodasanW
Copy link
Member

CI passed, thanks for this change.

@manodasanW manodasanW merged commit 1a8e726 into microsoft:master May 14, 2024
1 check passed
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.

Unable to cast object of type 'TaskToAsyncOperationAdapter' to type 'IAsyncOperation'
3 participants