You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then, we'd need to update the App Build process to scan all included assemblies, and if all included assemblies contain [assembly:DisableRuntimeMarshallingAttribute], then the marshal-ilgen component can be removed from the .apk.
So is the plan for users to add this attribute to their own assemblies? I assume this will only need to check on assemblies which reference Mono.Android? or does it apply to every single assembly ?
is the plan for users to add this attribute to their own assemblies?
My interpretation is that yes, any/every assembly which contains P/Invokes would need to opt-in to this new mechanism by adding [assembly:DisableRuntimeMarshallingAttribute]. This would not be restricted to just assemblies which reference Mono.Android.dll.
Which possibly raises as many questions as that answers. How does one efficiently tell if an assembly contains no P/Invokes?
Automated bot note: closing this issue as obsolete for .NET 11. .NET for Android supports CoreCLR in .NET 11, and the Mono marshal-ilgen component is not packaged in CoreCLR applications (it appears only in MonoVM APK baselines). Consequently, adding [DisableRuntimeMarshalling] to Mono.Android.dll or Java.Interop.dll would not provide the APK-size/component-removal benefit described by this issue for the supported runtime.
Activity
[Xamarin.Android.Build.Tasks] Use marshal-ilgen component (dotnet#7260)
dellis1972 commentedon Aug 18, 2022
So is the plan for users to add this attribute to their own assemblies? I assume this will only need to check on assemblies which reference Mono.Android? or does it apply to every single assembly ?
jonpryor commentedon Aug 18, 2022
@dellis1972 asked:
My interpretation is that yes, any/every assembly which contains P/Invokes would need to opt-in to this new mechanism by adding
[assembly:DisableRuntimeMarshallingAttribute]. This would not be restricted to just assemblies which referenceMono.Android.dll.Which possibly raises as many questions as that answers. How does one efficiently tell if an assembly contains no P/Invokes?
[Java.Interop] Add JniMemberInfoLookup
[Java.Interop] Add JniMemberInfoLookup
jonathanpeppers commentedon Aug 7, 2026
Automated bot note: closing this issue as obsolete for .NET 11. .NET for Android supports CoreCLR in .NET 11, and the Mono marshal-ilgen component is not packaged in CoreCLR applications (it appears only in MonoVM APK baselines). Consequently, adding [DisableRuntimeMarshalling] to Mono.Android.dll or Java.Interop.dll would not provide the APK-size/component-removal benefit described by this issue for the supported runtime.