You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Mono.Android] Print type & member remapping info (#7844)
Context: f6f11a5
Context: f99fc81
How do we diagnose type & member remapping issues? If (when) things
don't work as anticipated, what do we do?
If a method is remapped *and* the remapped-to method cannot be found,
then [Java.Interop will write a message to stderr][0]:
warning: For declared method `java/lang/Object.remappedToToString.()Ljava/lang/String;`, could not find requested method `java/lang/Object.toString.()Ljava/lang/String;`!
which is a scenario we think/assume Shouldn't Happen™. If it *does*
happen, we believe that the above message will be sufficient to fix
the problem.
However, in the "happy" path in which the replacement method is found
*or* the "less-happy" path in which *nothing happens*, how do we get
insight to check or verify what's going on?
Update `AndroidTypeManager.GetStaticMethodFallbackTypesCore()` and
`AndroidTypeManager.GetReplacementMethodInfoCore()` so that they
print out *successful* type & member remapping when the
"assembly" log category is enabled:
adb shell setprop debug.mono.log default,assembly
When the assembly log category is enabled, invocations of
`AndroidTypeManager.GetStaticMethodFallbackTypesCore()` will print
messages such as the following to `adb logcat`:
D monodroid-assembly : Remapping type `com/xamarin/interop/RenameClassBase1` to one of { `com/xamarin/interop/DesugarRenameClassBase1`, `com/xamarin/interop/RenameClassBase1$-CC` }
When the assembly log category is enabled, invocations of
`AndroidTypeManager.GetReplacementMethodInfoCore()` will print
messages such as the following to `adb logcat`
*when a replacement method will be attempted*:
D monodroid-assembly : Remapping method `java/lang/Object.remappedToToString()Ljava/lang/String;` to `java/lang/Object.toString.()Ljava/lang/String;`; param-count: 0; instance-to-static? false
This will hopefully provide enough information to reason through
type and member remapping behavior.
[0]: https://github.com/xamarin/java.interop/blob/77800dda83c2db4d90b501c00069abc9880caaeb/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs#L123
0 commit comments