Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ public JniMarshalMemberBuilder MarshalMemberBuilder {
}
}

[System.Diagnostics.CodeAnalysis.SuppressMessage ("Design", "CA1031:Do not catch general exception types", Justification = "the *.Export assemblies are optional, so we don't care when they cannot be loaded (they are presumably missing)")]
#if NET
[DynamicDependency (DynamicallyAccessedMemberTypes.PublicParameterlessConstructor, "Java.Interop.MarshalMemberBuilder", "Java.Interop.Export")]
[UnconditionalSuppressMessage ("Trimming", "IL2026", Justification = "DynamicDependency should preserve the constructor.")]
[UnconditionalSuppressMessage ("Trimming", "IL2072", Justification = "DynamicDependency should preserve the constructor.")]
[UnconditionalSuppressMessage ("Trimming", "IL2035", Justification = "Java.Interop.Export.dll is not always present.")]
#endif
partial void SetMarshalMemberBuilder (CreationOptions options)
{
if (!options.UseMarshalMemberBuilder) {
Expand All @@ -45,14 +39,7 @@ partial void SetMarshalMemberBuilder (CreationOptions options)
return;
}

Assembly jie;
try {
jie = Assembly.Load (new AssemblyName ("Java.Interop.Export"));
} catch (Exception e) {
System.Diagnostics.Debug.WriteLine ($"Java.Interop.Export assembly was not loaded: {e}");
return;
}
var t = jie.GetType ("Java.Interop.MarshalMemberBuilder");
var t = Type.GetType ("Java.Interop.MarshalMemberBuilder, Java.Interop.Export", throwOnError: false);
if (t == null)
throw new InvalidOperationException ("Could not find Java.Interop.MarshalMemberBuilder from Java.Interop.Export.dll!");
var b = (JniMarshalMemberBuilder) Activator.CreateInstance (t)!;
Expand Down