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

WinRT Server fixes #40

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

jevansaks
Copy link
Contributor

@jevansaks jevansaks commented Jan 23, 2025

We ran into two problems trying to use WinRT server in .NET9. I'm not sure what changed/broke this but it seems obvious what's wrong:

  1. WinRTServer was blindly casting the result of GetOrCreateComInterfaceForObject to IActivationFactory* but in NAOT the result was actually an IUnknown and we need to QI for IActivationFactory instead.
  2. ActivateInstance was QI'ing the instance for IActivationFactory but instances will never implement this, so we should instead just return the interface out as-is.

I was able to reproduce the problem by publishing the test package and running the C++ app -- the background WinRT server crashes calling GetTrustLevel on what it thinks is an IActivationFactory but is actually an IUnknown. And once that is fixed (1), then the IActivationFactory QI in ActivateInstance failed. With these fixes, the NAOT compiled version succeeds.

@shmuelie shmuelie merged commit 5f52447 into shmuelie:main Jan 24, 2025
4 checks 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.

2 participants