Skip to content

Add 'CsWinRTEnableIDynamicInterfaceCastableSupport' feature switch - #1583

Merged
Sergio Pedri (Sergio0694) merged 4 commits into
staging/AOTfrom
user/sergiopedri/idic-feature-switch2
Apr 24, 2024
Merged

Sergio Pedri (Sergio0694) merged 4 commits into
staging/AOTfrom
user/sergiopedri/idic-feature-switch2

Conversation

@Sergio0694

Copy link
Copy Markdown
Member

This PR adds the 'CsWinRTEnableIDynamicInterfaceCastableSupport' feature switch to allow trimming of all IDIC-related code. This would also include fixing the size regression introduced by #1566 (which can't be fixed without making the code non trim-safe).

Note

Opening as draft until I get a sizoscope diff.

@dongle-the-gadget

Copy link
Copy Markdown
Contributor

This would break As<T> right?

@Sergio0694

Copy link
Copy Markdown
Member Author

Only if it gets to the fallback IDIC cast from IInspectable to the interface type, otherwise it'll still work.

@manodasanW

Copy link
Copy Markdown
Member

Note that this is just a feature switch for size improvements if you do not need the IDIC functionality. If you do need it, you would have the feature switch on which is also the default.

@dongle-the-gadget

Dongle (dongle-the-gadget) commented Apr 23, 2024 •

Copy link
Copy Markdown
Contributor

Only if it gets to the fallback IDIC cast from IInspectable to the interface type, otherwise it'll still work

The only case it won't fallback IDIC is if the interface is using built-in COM Interop, which already doesn't support NativeAOT anyway.

@Sergio0694

Copy link
Copy Markdown
Member Author

Saves 52 KB in the minimal sample, plus more incremental savings as you have more enumerable types ๐Ÿš€

image

@Sergio0694
Sergio Pedri (Sergio0694) marked this pull request as ready for review April 23, 2024 17:51
@Sergio0694
Sergio Pedri (Sergio0694) force-pushed the user/sergiopedri/idic-feature-switch2 branch from d3ffb5c to 6e7ec4b Compare April 23, 2024 21:59
@Sergio0694
Sergio Pedri (Sergio0694) force-pushed the user/sergiopedri/idic-feature-switch2 branch from 6e7ec4b to 61f22e0 Compare April 24, 2024 01:07
@Sergio0694
Sergio Pedri (Sergio0694) merged commit 5f9bd31 into staging/AOT Apr 24, 2024
@Sergio0694
Sergio Pedri (Sergio0694) deleted the user/sergiopedri/idic-feature-switch2 branch April 24, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants