2

いくつかのアイテムを含む MvxListView があります。各アイテムは 2 つのコンポーネントで構成され、1 つは表示され、もう 1 つは非表示 (Gone) です。なくなったコンポーネントの可視性プロパティは、ブール値の可視性値コンバーターを使用して、ビュー モデルのブール値プロパティにバインドされます。

リスト アイテムのクリック時に、boolean プロパティを true に変更します。これにより、なくなったコンポーネントが表示され、その特定のアイテムに対して一種のエキスパンダー効果が得られます。

これは、99% の確率で完全に機能します。

たまに、何らかの理由で、次のスタック トレースで null 参照例外が発生します。

691.32 Problem seen during binding execution for from IsInEditMode to Visibility - problem TargetInvocationException: Exception has been thrown by the target of an invocation.
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) [0x00000] in <filename unknown>:0 
  at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.SetValue (System.Object value) [0x00000] in <filename unknown>:0 
  at Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (Boolean isAvailable, System.Object value) [0x00000] in <filename unknown>:0 
  InnerException was NullReferenceException: Object reference not set to an instance of an object

これが MvvmCross の問題なのか、Android ビューの問題なのかはわかりませんが、なくなったコンポーネントにはボタンがあることに注意することが重要かもしれません。したがって、リスト内のすべてのアイテムが折りたたまれている間、ボタンはありません.1つのアイテムを展開すると、ボタンがあり、リストアイテム全体がクリックできなくなりますが、ボタンはクリック可能です(これは私が修正する予定の無関係なバグですある日、しかし現在は私にとって重要ではありません)。

MvvmCross v3 を使用しています。私は最新のビルド (1 か月前) を使用していないことを認めます。これが新しいビットで発生するかどうかを確認する価値はありますが、問題はまれであり、再現するのは困難です。

より詳細なスタック トレース情報があります。

at (wrapper delegate-invoke) <Module>.invoke_void__this___intptr_intptr_intptr_JValue[]   (intptr,intptr,intptr,Android.Runtime.JValue[]) <IL 0x00062, 0xffffffff>
at Android.Runtime.JNIEnv.CallVoidMethod (intptr,intptr,Android.Runtime.JValue[]) [0x00000] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:364
at Android.Views.View.set_Visibility (Android.Views.ViewStates) [0x0003e] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.Views.View.cs:4498
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___int (object,intptr,intptr,intptr) <IL 0x00054, 0xffffffff>
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x000c6, 0x00553>
at System.Reflection.MonoProperty.SetValue (object,object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x0006c, 0x00353>
at System.Reflection.PropertyInfo.SetValue (object,object,object[]) <IL 0x00007, 0x000a3>
at Cirrious.MvvmCross.Binding.Bindings.Target.MvxPropertyInfoTargetBinding.SetValue (object) <IL 0x0007b, 0x0033f>
at Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.UpdateTargetFromSource (bool,object) <IL 0x00054, 0x001f3>
at Cirrious.MvvmCross.Binding.Bindings.MvxFullBinding.<CreateSourceBinding>b__0 (object,Cirrious.MvvmCross.Binding.Bindings.Source.MvxSourcePropertyBindingEventArgs) <IL 0x0000d, 0x00083>
at Cirrious.MvvmCross.Binding.Bindings.Source.MvxSourceBinding.FireChanged (Cirrious.MvvmCross.Binding.Bindings.Source.MvxSourcePropertyBindingEventArgs) <IL 0x0000d, 0x000bf>
at Cirrious.MvvmCross.Binding.Bindings.Source.Leaf.MvxLeafPropertyInfoSourceBinding.OnBoundPropertyChanged () <IL 0x00007, 0x00073>
at Cirrious.MvvmCross.Binding.Bindings.Source.MvxPropertyInfoSourceBinding.SourcePropertyChanged (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00014, 0x000ab>
at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_object (object,intptr,intptr,intptr) <IL 0x0005a, 0xffffffff>
at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x000c6, 0x00553>
at System.Reflection.MethodBase.Invoke (object,object[]) <IL 0x00006, 0x0008f>
at Cirrious.MvvmCross.Binding.WeakSubscription.MvxWeakEventSubscription`2.OnSourceEvent (object,TEventArgs) <IL 0x0002b, 0x00137>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00027, 0x00073>
at (wrapper delegate-invoke) <Module>.invoke_void__this___object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs) <IL 0x00059, 0xffffffff>
at Cirrious.MvvmCross.ViewModels.MvxNotifyPropertyChanged/<>c__DisplayClass1.<RaisePropertyChanged>b__0 () <IL 0x00021, 0x000f7>
at Cirrious.MvvmCross.Droid.Views.MvxAndroidMainThreadDispatcher/<>c__DisplayClass1.<RequestMainThreadAction>b__0 (object) <IL 0x00006, 0x0005b>
at Android.App.SyncContext.Post (System.Threading.SendOrPostCallback,object) [0x00025] in /Users/builder/data/lanes/monodroid-lion-bs1/03814ac5/source/monodroid/src/Mono.Android/src/Android.App/SyncContext.cs:19
at Cirrious.MvvmCross.Droid.Views.MvxAndroidMainThreadDispatcher.RequestMainThreadAction (System.Action) <IL 0x0001f, 0x00173>
at Cirrious.CrossCore.Core.MvxMainThreadDispatchingObject.InvokeOnMainThread (System.Action) <IL 0x0000f, 0x00097>
at Cirrious.MvvmCross.ViewModels.MvxNotifyPropertyChanged.RaisePropertyChanged (string) <IL 0x0002a, 0x001ff>
at Cirrious.MvvmCross.ViewModels.MvxNotifyPropertyChanged.RaisePropertyChanged<bool> (System.Linq.Expressions.Expression`1<System.Func`1<bool>>) <IL 0x0000a, 0x00087>
at Game.GamePlayerViewModel.set_IsInEditMode (bool) [0x00008] in c:\Users\Roman\Documents\Projects\Games\Game\ViewModels\Players\GamePlayerViewModel.cs:74
at Game.GamePlayersViewModel.HandleSelectPlayer (Game.GamePlayerViewModel) [0x0000f] in c:\Users\Roman\Documents\Projects\Game\Game\ViewModels\Players\GamePlayersViewModel.cs:117
at Cirrious.MvvmCross.ViewModels.MvxCommand`1.Execute (object) <IL 0x00015, 0x000bb>
at Cirrious.MvvmCross.Binding.Droid.Views.MvxListView.ExecuteCommandOnItem (System.Windows.Input.ICommand,int) <IL 0x00021, 0x001b7>
at Cirrious.MvvmCross.Binding.Droid.Views.MvxListView.<SetupItemClickListeners>b__0 (object,Android.Widget.AdapterView/ItemClickEventArgs) <IL 0x0000d, 0x00087>
at Android.Widget.AdapterView/IOnItemClickListenerImplementor.OnItemClick (Android.Widget.AdapterView,Android.Views.View,int,long) [0x0000b] in /Users/builder/data/lanes/monodroid-lion-    bs1/03814ac5/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.Widget.AdapterView.cs:233
at Android.Widget.AdapterView/IOnItemClickListenerInvoker.n_OnItemClick_Landroid_widget_AdapterView_Landroid_view_View_IJ (intptr,intptr,intptr,intptr,int,long) [0x00018] in /Users/builder/data/lanes/monodroid-lion-   bs1/03814ac5/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.Widget.AdapterView.cs:170
at (wrapper dynamic-method) object.5e36d7c3-b7bd-4ceb-af22-a12ff6cf17a9 (intptr,intptr,intptr,intptr,int,long) <IL 0x00029, 0x0009b>
at (wrapper native-to-managed) object.5e36d7c3-b7bd-4ceb-af22-a12ff6cf17a9 (intptr,intptr,intptr,intptr,int,long) <IL 0x00024, 0xffffffff>

また、可視性がプロパティにバインドされているコンポーネントは LinearLayout です。

何か案は?

前もって感謝します

4

1 に答える 1