Skip to content

Commit 71ed636

Browse files
Guard GetContainerFactory calls with RuntimeFeature.TrimmableTypeMap
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7348f17 commit 71ed636

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/Mono.Android/Android.Runtime/JNIEnv.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static partial class JNIEnv {
2626

2727
static Array ArrayCreateInstance (Type elementType, int length)
2828
{
29-
var factory = TrimmableTypeMap.Instance?.GetContainerFactory (elementType);
29+
var factory = RuntimeFeature.TrimmableTypeMap ? TrimmableTypeMap.Instance?.GetContainerFactory (elementType) : null;
3030
if (factory != null)
3131
return factory.CreateArray (length, 1);
3232

src/Mono.Android/Java.Interop/JavaConvert.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ params Type [] typeArguments
148148
if (!typeof (IJavaPeerable).IsAssignableFrom (elementType))
149149
return null;
150150

151-
return TrimmableTypeMap.Instance?.GetContainerFactory (elementType);
151+
return RuntimeFeature.TrimmableTypeMap ? TrimmableTypeMap.Instance?.GetContainerFactory (elementType) : null;
152152
}
153153

154154
static Func<IntPtr, JniHandleOwnership, object> GetJniHandleConverterForType ([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type t)

0 commit comments

Comments
 (0)