Skip to content

Conversation

@simonrozsival
Copy link
Member

This is a follow-up to #9805 and #9900

The goal of this PR is to enable marshal methods in CoreCLR. This involves these changes:

  • The xamarin_app_init method is added to the pinvoke overrides
  • managedMarshalMethodsLookupEnabled is set before calling JNIEnvInit.Initialize in the CoreCLR host.cc
  • Prevent generating a _mm_wrapper method for methods which already have [UnmanagedCallersOnly] attributes in MarshalMethodsAssemblyRewriter. There was a bug in [Experimental] Add alternative way of resolving UCO function pointers for Marshal Methods #9805 which created a n_Activate_mm_mm_wrapper UCO which called the hand-written n_Activate_mm UCO. This wasn't caught earlier because Mono does not throw when a managed function calls an UCO. On CoreCLR, this codepath failed with Invalid Program: attempted to call a UnmanagedCallersOnly method from managed code..

@simonrozsival simonrozsival changed the title [CoreCLR] Enable marshal methods [CoreCLR] Support marshal methods Mar 10, 2025
Base automatically changed from dev/grendel/clr-host-really-enable to main March 12, 2025 12:24
"kind": "framework",
"version": "@WORKLOAD_VERSION@"
},
"Microsoft.Android.Runtime.CoreCLR.35.android-arm": {
Copy link
Contributor

Choose a reason for hiding this comment

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

This and similar changes looks to be "duplicative" of #9900; this branch should probably merge with main…

Copy link
Member Author

Choose a reason for hiding this comment

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

This PR was based on @grendello's #9900. I need to rebase it now that the other PR has been merged.

@simonrozsival simonrozsival force-pushed the dev/simonrozsival/enable-marshal-methods-on-coreclr branch from 1cf6994 to cc1ad00 Compare March 12, 2025 16:43
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/enable-marshal-methods-on-coreclr branch from d0835d2 to 6574f2e Compare March 12, 2025 17:03
@simonrozsival simonrozsival reopened this Mar 12, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2025
@akoeplinger akoeplinger deleted the dev/simonrozsival/enable-marshal-methods-on-coreclr branch June 2, 2025 14:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants