重复访问屏幕后,出现下一个错误:
System.ObjectDisposedException:无法访问已处置的对象。在 Java.Interop.JniPeerMembers.AssertSelf(Java.Interop.IJavaPeerable self)[0x00029] in <286213b9e14c442ba8d8d94cc9dbec8e>:0 07-03 11:29:51.230 I / MonoDroid(20631):在 Java.Interop.JniPeerMembers + JniInstanceMethods.InvokeVirtualVoidMethod (System.String编码的成员,Java.Interop.IJavaPeerable自我, Java.Interop.JniArgumentValue *参数)[0x00000]在 <286213b9e14c442ba8d8d94cc9dbec8e>:0 07-03 11:29:51.230 I / MonoDroid(20631):位于Android.Views.View.set_Enabled (System.Boolean值)在[0x00022]中 :0 07-03 11:29:51.230 I / MonoDroid(20631):位于 MvvmCross.Platforms.Android.Binding.Target.MvxViewClickBinding.RefreshEnabledState ()[0x00022] in C:\ projects \ mvvmcross \ MvvmCross \ Platforms \ Android \ Binding \ Target \ MvxViewClickBinding.cs:64 07-03 11:29:51.230 I / MonoDroid(20631):在 MvvmCross.Platforms.Android.Binding.Target.MvxViewClickBinding.OnCanExecuteChanged (System.Object发件人,System.EventArgs e)在[0x00000]中 C:\ projects \ mvvmcross \ MvvmCross \ Platforms \ Android \ Binding \ Target \ MvxViewClickBinding.cs:69 07-03 11:29:51.230 I / MonoDroid(20631):at(包装 本地管理) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object [],System.Exception&) 07-03 11:29:51.230 I / MonoDroid(20631):在 System.Reflection.MonoMethod.Invoke(System.Object obj, System.Reflection.BindingFlags invokeAttr,System.Reflection.Binder 活页夹,System.Object []参数,System.Globalization.CultureInfo 文化)[0x0003b] :: 0 07-03 11:29:51.230 I / MonoDroid(20631):-内部异常堆栈结束 跟踪--07-03 11:29:51.230 I / MonoDroid(20631):at System.Reflection.MonoMethod.Invoke(System.Object obj, System.Reflection.BindingFlags invokeAttr,System.Reflection.Binder 活页夹,System.Object []参数,System.Globalization.CultureInfo 文化)[0x00054] :: 0 07-03 11:29:51.230 I / MonoDroid(20631):在 System.Reflection.MethodBase.Invoke(System.Object obj, System.Object []参数)在[0x00000]中 :0 07-03 11:29:51.230 I / MonoDroid(20631):位于 MvvmCross.WeakSubscription.MvxWeakEventSubscription`2 [TSource,TEventArgs] .OnSourceEvent (System.Object发送者,TEventArgs e)在[0x0000a]中 C:\ projects \ mvvmcross \ MvvmCross \ WeakSubscription \ MvxWeakEventSubscription.cs:74 07-03 11:29:51.230 I / MonoDroid(20631):在 MvvmCross.Commands.MvxWeakCommandHelper.RaiseCanExecuteChanged (系统对象发送方)[0x00014]在 C:\ projects \ mvvmcross \ MvvmCross \ Commands \ MvxCommand.cs:96 07-03 11:29:51.230 I / MonoDroid(20631):在 MvvmCross.Commands.MvxCommandBase.b__9_0() [0x00000]在 C:\ projects \ mvvmcross \ MvvmCross \ Commands \ MvxCommand.cs:135
不确定,如果这是android或mvvmcross问题。如果可以,我是否可以避免在MvxViewClickBinding中调用视图?
答案 0 :(得分:0)
我想您可以为Java.Lang.Object
编写一个静态扩展方法,如下所示:
public static class ObjectExtensions
{
public static bool IsDisposedOrNull(this Object objectValue)
{
return objectValue?.Handle == IntPtr.Zero;
}
}