Skip to content
This repository was archived by the owner on Aug 27, 2026. It is now read-only.

[Java.Interop] Make Java.Interop.Export use optional - #401

Merged
grendello merged 1 commit into
dotnet:masterfrom
jonpryor:jonp-optional-MarshalMemberBuilder
Dec 7, 2018
Merged

grendello merged 1 commit into
dotnet:masterfrom
jonpryor:jonp-optional-MarshalMemberBuilder

Conversation

@jonpryor

@jonpryor jonpryor commented Dec 6, 2018

Copy link
Copy Markdown
Contributor

The probing for Java.Interop.Export.dll performed within
JniRuntime.SetMarshalMemberBuilder() can be costly if the
Java.Interop.Export.dll assembly isn't present or cannot be found,
which is always the case (currently) in Xamarin.Android, adding --
depending on device and profiler in use -- ~100ms to app startup (!).

Add a new JniRuntime.CreationOptions.UseMarshalMemberBuilder
property which controls whether Java.Interop.Export.dll is loaded
at all. If true -- the default -- then JniRuntime will attempt
to load Java.Interop.Export.dll, allowing the
JniRuntime.MarshalMemberBuilder property to not throw a
NotSupportedException.

If JniRuntime.CreationOptions.UseMarshalMemberBuilder is false --
which will become the default in Xamarin.Android -- then
JniRuntime.SetMarshalMemberBuilder() will do nothing.

The probing for `Java.Interop.Export.dll` performed within
`JniRuntime.SetMarshalMemberBuilder()` can be costly if the
`Java.Interop.Export.dll` assembly isn't present or cannot be found,
which is *always* the case (currently) in Xamarin.Android, adding --
depending on device and profiler in use -- ~100ms to app startup (!).

Add a new `JniRuntime.CreationOptions.UseMarshalMemberBuilder`
property which controls whether `Java.Interop.Export.dll` is loaded
*at all*.  If true -- the default -- then `JniRuntime` *will* attempt
to load `Java.Interop.Export.dll`, allowing the
`JniRuntime.MarshalMemberBuilder` property to not throw a
`NotSupportedException`.

If `JniRuntime.CreationOptions.UseMarshalMemberBuilder` is false --
which will become the default in Xamarin.Android -- then
`JniRuntime.SetMarshalMemberBuilder()` will do nothing.
@grendello
grendello merged commit 706e4cc into dotnet:master Dec 7, 2018
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 14, 2024
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.

2 participants