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

Allow dropping native host for NativeAOT WinRT components #1395

Merged
merged 72 commits into from
Jan 10, 2024

Conversation

Sergio0694
Copy link
Member

Closes #1387

Overview

This PR adds a new CsWinRTAotExportsEnabled MSBuild property that can be set in authoring scenarios (and is automatically set if PublishAot is already set). This triggers the generator to emit the native exports for WinRT .dll-s directly into the same binary, with the correct logic, and also skips adding all references and copying all files related to the native host infrastructure.

Keeping as a draft as I'm not entirely sure how to set up unit tests for this just yet 😅

@Sergio0694 Sergio0694 added enhancement New feature or request authoring Related to authoring feature work AOT labels Nov 22, 2023
@@ -1,258 +1,342 @@
using Microsoft.CodeAnalysis;
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: I normalized whitespaces in this file, review with whitespace diff off.
The actual changes are just a few lines of code being added.

@Sergio0694 Sergio0694 marked this pull request as ready for review November 25, 2023 19:49
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/naot-winrt-exports branch from 4d5281b to 38098bf Compare November 30, 2023 22:17
@Sergio0694 Sergio0694 force-pushed the user/sergiopedri/naot-winrt-exports branch from fa62a4c to f02bf33 Compare January 9, 2024 00:27
…-authoringtestfixes2

Fix test issues discovered from enabling AOT for authoring scenarios
@manodasanW
Copy link
Member

Just to note in the PR, there is one remaining authoring test failure for AOT (AuthoringTest.CustomTypes). That would be addressed in a separate PR.

@manodasanW manodasanW merged commit f01956b into staging/AOT Jan 10, 2024
9 checks passed
@hez2010
Copy link
Contributor

hez2010 commented Jan 10, 2024

If you're using CoreCLR and a native host, then you don't need these exports.

We will still need the generated int GetActivationFactory(void*, void**) so that we can pass it to RoRegsiterActivationFactories.

See: https://github.com/hez2010/WinRTServer/blob/master/WinRTServer/InternalModule.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AOT authoring Related to authoring feature work enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop native host when publishing WinRT components with NativeAOT
4 participants