如何使用 XAMARIN 为 android 应用程序输出完整的全局参考日志

How to output full global reference log for android app with XAMARIN

我正在尝试检测泄漏以在我的 android 应用程序中发布全局引用。
我在 XAMARIN 的故障排除指南中看到它显示了有关全局引用日志的非常详细信息。
URL: https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Global_Reference_Messages
它显示了哪个对象创建了全局引用,例如:

I/monodroid-gref(12405): +g+ grefc 108 gwrefc 0 obj-handle 0x40517468/L -> new-handle 0x40517468/L from    at Java.Lang.Object.RegisterInstance(IJavaObject instance, IntPtr value, JniHandleOwnership transfer)
I/monodroid-gref(12405):    at Java.Lang.Object.SetHandle(IntPtr value, JniHandleOwnership transfer)
I/monodroid-gref(12405):    at Java.Lang.Object..ctor(IntPtr handle, JniHandleOwnership transfer)
I/monodroid-gref(12405):    at Java.Lang.Thread+RunnableImplementor..ctor(System.Action handler, Boolean removable)
I/monodroid-gref(12405):    at Java.Lang.Thread+RunnableImplementor..ctor(System.Action handler)
I/monodroid-gref(12405):    at Android.App.Activity.RunOnUiThread(System.Action action)
I/monodroid-gref(12405):    at Mono.Samples.Hello.HelloActivity.UseLotsOfMemory(Android.Widget.TextView textview)
I/monodroid-gref(12405):    at Mono.Samples.Hello.HelloActivity.m__3(System.Object o)

--> 我们可以看到 "at Java.Lang.Object.RegisterInstance" 创建了全局引用。
但实际上我只看到 logcat 中的 count ,handle address 信息如下:

06-10 14:55:06.225 I/monodroid-gref(19580): +g+ grefc 926 gwrefc 0 obj-handle 0x19/I -> new-handle 0x101682/G from thread '(null)'(1)
06-10 14:55:06.238 I/monodroid-gref(19580): +g+ grefc 927 gwrefc 0 obj-handle 0x5/I -> new-handle 0x10167e/G from thread 'Threadpool worker'(57)
06-10 14:55:06.261 I/monodroid-gref(19580): -g- grefc 927 gwrefc 0 handle 0x10167e/G from thread 'Threadpool worker'(57)
06-10 14:55:06.286 I/monodroid-gref(19580): +g+ grefc 927 gwrefc 0 obj-handle 0x19/I -> new-handle 0x201686/G from thread '(null)'(1)
06-10 14:55:06.288 I/monodroid-gref(19580): +g+ grefc 928 gwrefc 0 obj-handle 0x1/I -> new-handle 0x20167e/G from thread 'Threadpool worker'(57)
06-10 14:55:06.295 I/monodroid-gref(19580): +g+ grefc 929 gwrefc 0 obj-handle 0x200019/I -> new-handle 0x10168a/G from thread '(null)'(1)
06-10 14:55:06.306 I/monodroid-gref(19580): -g- grefc 929 gwrefc 0 handle 0x1676/G from thread 'Threadpool worker'(57)
06-10 14:55:06.351 I/monodroid-gref(19580): +g+ grefc 929 gwrefc 0 obj-handle 0x200019/I -> new-handle 0x101676/G from thread '(null)'(1)
06-10 14:55:06.357 I/monodroid-gref(19580): +g+ grefc 930 gwrefc 0 obj-handle 0x100019/I -> new-handle 0x10168e/G from thread '(null)'(1)

我是否遗漏了任何设置? 请帮忙!

我在这里找到了解决方案: https://developer.xamarin.com/releases/android/xamarin.android_5/xamarin.android_5.1/#GREF_Logging_Changes

(但我使用的是三星 S6,所以 运行-as 命令不起作用 :()