Skip to content

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

Closed

Description

@AustinWise

.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

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Oct 26, 2022
  2. jkotas commented on Oct 26, 2022

    @jkotas
    Member

    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.

  3. jkotas commented on Oct 26, 2022

    @jkotas
    Member

    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.

  4. lambdageek commented on Oct 26, 2022

    @lambdageek
    Member
  5. AustinWise commented on Nov 6, 2022

    @AustinWise
    ContributorAuthor

    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.

  6. added this to the Future milestone on Nov 13, 2022
  7. AaronRobinsonMSFT commented on Nov 13, 2022

    @AaronRobinsonMSFT
    Member

    @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.

  8. AustinWise commented on Jan 27, 2023

    @AustinWise
    ContributorAuthor

    @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

  9. modified the milestones: Future, 8.0.0 on Jan 27, 2023
  10. ghost locked as resolved and limited conversation to collaborators on Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions