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

Remove generated 'As<I>()' methods for static types #1609

Draft
wants to merge 3 commits into
base: staging/AOT
Choose a base branch
from

Conversation

Sergio0694
Copy link
Member

This PR removes the generated As<I>() methods on static RCW types. This method is:

  • Unnecessary, now that ActivationFactory is public
  • Only works with either [ComImport] types, or via IDIC
  • It doesn't exist on non-static RCW types, which is not consistent (eg. Win2D uses that)

Devs should just use ActivationFactory directly, which also exposes new high perf methods.

@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/remove-static-as branch from af15817 to 67350cf Compare May 10, 2024 10:04
@hez2010
Copy link
Contributor

hez2010 commented May 10, 2024

Isn't it an ABI breaking change? I don't think it's acceptable though as all existing apps including WinRT component libraries will stop working.
Maybe you can put this under yet another feature flag to make it an opt-in feature. Keeping the As<I>() is also good for developer experience (string cannot be replaced automatically when doing refactor on namespace/type names).

@@ -2513,43 +2511,6 @@ Marshal.Release(inner);
{
write_composable_constructors(w, factory.type, type, factory.visible ? "public"sv : "protected"sv);
}
else if (factory.statics)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably can't stop generating these functions due to back compat. When we generate the Windows SDK projection for instance, the backcompat check there will break.

@Sergio0694 Sergio0694 marked this pull request as draft June 3, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants