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

Skip interfaces not publicly accessible in authoring scenarios #1394

Merged

Conversation

Sergio0694
Copy link
Member

Closes #1369

Overview

This PR updates the WinRT authoring generator to skip interfaces that are not publicly accessible.

@Sergio0694 Sergio0694 added bug Something isn't working authoring Related to authoring feature work labels Nov 20, 2023
symbol is IEventSymbol @event && !@event.ExplicitInterfaceImplementations.IsDefaultOrEmpty)
{
// If we have a containing type, we also check that it's publicly accessible
return symbol.ContainingType is not { } containingType || containingType.IsPubliclyAccessible();
Copy link
Member

@manodasanW manodasanW Nov 22, 2023

Choose a reason for hiding this comment

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

I am trying to understand this, should this have been an && rather than a || or am I misunderstanding what is not {} does.

Copy link
Member Author

Choose a reason for hiding this comment

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

So, is not { } matches if the expression is not an instance (it's like is null, but also declares a local). So:

  • If containingType is null, return true
  • Otherwise (ie. containingType != null), return true if it's publicly accessible

If we used &&, we'd be trying to access containingType when the first expression already matched, but if that's the case, then containingType is not defined (because the expression matches on is not). In fact, if you changed it to &&, the code would just not compile, as containingType would be uninitialized in that case 🙂

@Sergio0694 Sergio0694 merged commit 38a732b into staging/AOT Nov 22, 2023
9 checks passed
@Sergio0694 Sergio0694 deleted the user/sergiopedri/skip-authored-internal-interfaces branch November 22, 2023 15:24
@Sergio0694 Sergio0694 linked an issue Dec 1, 2023 that may be closed by this pull request
manodasanW pushed a commit that referenced this pull request Jul 1, 2024
* Add internal COM interfaces to authoring test

* Add MixedWinRTClassicCOM authoring tests

* Skip interface types not publicly accessible

* Minor code refactoring

* Suppress diagnostics for not publicly accessible types

* Use fully qualified name for [Guid] to avoid conflicts

* Remmove collection expressions in projection attributes

* Skip processing explicit members of internal interfaces

* Skip processing symbols nested in internal types

* Add ABI types for AOT generator

* Restore original order/filtering to gather interfaces

* Fix build errors in AuthoringConsumptionTest

* Add TestMixedWinRTCOMWrapper to activation manifest

* Fix unit test

* Fix typos in ABI method names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authoring Related to authoring feature work bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WinRTTypeWriter generator fails with NullReferenceException
2 participants