我目前正在使用Xamarin.Android(C#)开发Android应用程序。
我开发了一个拖放式自动滚动列表视图,如gist所示。
它的效果非常好,但有时,有时,它崩溃并且不知道为什么。在“非托管代码”中抛出异常,调试器显示的唯一有用信息是此堆栈跟踪:
--- End of managed Java.Lang.NullPointerException stack trace ---
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.ViewRootImpl.setDragFocus(android.view.View)' on a null object reference
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1454)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewGroup.dispatchDragEvent(ViewGroup.java:1482)
at android.view.ViewRootImpl.handleDragEvent(ViewRootImpl.java:5337)
at android.view.ViewRootImpl.access$600(ViewRootImpl.java:108)
at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:3464)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:152)
at android.app.ActivityThread.main(ActivityThread.java:5497)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
我真的不怀疑你能告诉我为什么会这样,但也许,有没有办法至少正确调试这个?
没有任何地方,即使在日志中,它没有说明我的应用程序中的错误,它只是崩溃。繁荣而消失。