Commit de004d7
[TrimmableTypeMap] Always wire registerJniNativesFn, fail loudly if called
Always set the registerJniNativesFn function pointer during runtime
initialization, even in trimmable mode. This ensures that if a JCW
incorrectly calls Runtime.register(typeName, klass, methods) instead
of Runtime.registerNatives(klass), the call flows through to C# where
TrimmableTypeMapTypeManager.RegisterNativeMembers throws
UnreachableException with a clear diagnostic message.
Previously, the function pointer was set to nullptr for trimmable mode,
causing the C++ side to silently drop the call — making JCW generation
bugs invisible at runtime.
Also adds a unit test verifying that trimmable JCWs never emit
Runtime.register().
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent c2bdc5b commit de004d7
File tree
3 files changed
+12
-5
lines changed- src/Mono.Android
- Android.Runtime
- Microsoft.Android.Runtime
- tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Generator
3 files changed
+12
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
182 | | - | |
183 | | - | |
| 181 | + | |
184 | 182 | | |
185 | 183 | | |
186 | 184 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
| 70 | + | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
137 | 146 | | |
138 | 147 | | |
139 | 148 | | |
| |||
0 commit comments