Skip to content

Commit 47450cf

Browse files
Throw unreachable from trimmable native registration
Make both TrimmableTypeMapTypeManager RegisterNativeMembers overloads throw UnreachableException directly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8a0989a commit 47450cf

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/Mono.Android/Microsoft.Android.Runtime/TrimmableTypeMapTypeManager.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ public override void RegisterNativeMembers (
223223
Type type,
224224
string? methods)
225225
{
226-
RegisterNativeMembers (nativeClass, type, methods.AsSpan ());
226+
throw new UnreachableException (
227+
$"RegisterNativeMembers should not be called in the trimmable typemap path. " +
228+
$"Native methods for '{type.FullName}' should be registered by JCW static initializer blocks.");
227229
}
228230

229231
static bool TryGetBuiltInTypeSignature (Type type, out JniTypeSignature signature)

0 commit comments

Comments
 (0)