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

[NativeAOT] Low level API support for Objective-C scenarios #77472

Closed
5 of 7 tasks
Tracked by #80905 ...
AustinWise opened this issue Oct 26, 2022 · 6 comments
Closed
5 of 7 tasks
Tracked by #80905 ...

[NativeAOT] Low level API support for Objective-C scenarios #77472

AustinWise opened this issue Oct 26, 2022 · 6 comments

Comments

@AustinWise
Copy link
Contributor

AustinWise commented Oct 26, 2022

.NET 6 added some APIs to CoreCLR to support running the macOS version of Xamarin-macios. Reference:

High level questions about how to approach implementing this

  • Is it desired to support this API in NativeAOT?
  • Can the work to support the ObjectiveCMarshal API be split over multiple PRs. If so, is there a recommended way to turn off the feature for release builds, but still have the CI system test the feature?

Outline of work

Unimplemented parts of the API

Since the Xamarin side does not use the lastMethod parameter of the UnhandledExceptionPropagationHandler delegate, implmenting that is tracked in a separate issue: #80985

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Oct 26, 2022
@jkotas
Copy link
Member

jkotas commented Oct 26, 2022

Is it desired to support this API in NativeAOT?

Yes, we are happy to merge contributions that fill in missing functionality in NativeAOT.

Xamarin-macios uses the CoreCLR hosting functions coreclr_initialize, coreclr_create_delegate, and coreclr_execute_assembly to execute some managed code before the application-defined main method starts running.

These CoreCLR hosting APIs do not make a lot of sense in NativeAOT world. The basic NativeAOT hosting primitive is UnmanagedCallersOnly method exported as C entrypoint. https://github.com/dotnet/samples/tree/main/core/nativeaot/NativeLibrary is a sample that shows how to it.

@jkotas jkotas added the os-mac-os-x macOS aka OSX label Oct 26, 2022
@jkotas
Copy link
Member

jkotas commented Oct 26, 2022

Can the work to support the ObjectiveCMarshal API be split over multiple PRs

Yes, that's fine. Smaller PRs are typically reviewed and merged faster that makes it easier to make progress.

@lambdageek
Copy link
Member

/cc @ivanpovazan

@AustinWise
Copy link
Contributor Author

Xamarin-macios uses the CoreCLR hosting functions coreclr_initialize, coreclr_create_delegate, and coreclr_execute_assembly to execute some managed code before the application-defined main method starts running.

These CoreCLR hosting APIs do not make a lot of sense in NativeAOT world. The basic NativeAOT hosting primitive is UnmanagedCallersOnly method exported as C entrypoint. https://github.com/dotnet/samples/tree/main/core/nativeaot/NativeLibrary is a sample that shows how to it.

I agree that the full set of CoreCLR hosting APIs does not make sense for NativeAOT. The only feature that Xamarin-macios needs from a "hosting" API is the ability to call UnmanagedCallersOnly functions and before the application's main method. I have filed #77957 for this feature.

@AaronRobinsonMSFT AaronRobinsonMSFT removed the untriaged New issue has not been triaged by the area owner label Nov 13, 2022
@AaronRobinsonMSFT AaronRobinsonMSFT added this to the Future milestone Nov 13, 2022
@AaronRobinsonMSFT
Copy link
Member

AaronRobinsonMSFT commented Nov 13, 2022

@AustinWise Marking this as future since there is no rush and no expectation all of it will be done in .NET 8. If you are able to make it happen hooray, just don't want to put undue pressure on you.

@AustinWise
Copy link
Contributor Author

@AaronRobinsonMSFT This API is now implemented to a sufficient degree to unblock #80905. The milestone can be updated to .NET 8.

One small piece of the API in unimplemented. Since Xamarin does not currently use it, I have separated it out to its own tracking ticket: #80985

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants