-
Notifications
You must be signed in to change notification settings - Fork 107
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 checking COM objects on AOT #1662
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much does this really save?
!IsDynamicCodeCompiled ==> built-in COM is not supported
is a pretty major leap that might burn you in the future. What you'd want isMarshal.IsBuiltInComInteropSupported
but such API doesn't exist.This is basically assuming that
IsDynamicCodeCompiled
approximatesIsNativeAot
and that native AOT will never have built-in COM interop.This approximation might be broken today if you put
<PublishAot>true</PublishAot>
and<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
to the project file and F5 launch the app (not Publish). In this configuration,RuntimeFeature.IsDynamicCodeCompiled
is false, but built-in COM works. It is a terrible configuration to set, but it's possible.Cc @jkoritzinsky @AaronRobinsonMSFT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would agree. I think adding some public check is possible. I also tend to agree with @MichalStrehovsky here, what is this actually saving in practice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wasn't so much to save binary size per se, but rather to make the AOT-safe version of CsWinRT "stricter" and simpler. We have several parts of the code that we kept for backwards-compatibility (including built-in COM support), like being able to use old generated projections that are not fully trim-safe, etc.
Starting from .NET 8, we're saying that all that only applies to non-AOT scenarios. If you enable AOT, you also opt-in into the stricter mode, where we require you to only use updated projections everywhere (old projections wouldn't work with AOT anyway), and disable some more leftover features. Dropping built-in COM support entirely is part of that. We've added support for interop with generated COM interfaces starting with the .NET 8 TFM instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .NET 8 WinRT.Runtime (which implements generated COM interfaces) hasn't shipped though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember that AOT support hasn't shipped at all either, it's all experimental. We'll get there 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as we're in agreement that
!RuntimeFeature.IsDynamicCodeCompiled
doesn't imply built-in COM is disabled (neither today, nor in the future), consider this resolved.