突然,我的TextInputEditText的绑定开始失败,并且它与链接器有关。如果我将链接器设置为"无",一切都按预期工作。很多其他绑定使用仍然可以正常工作。
Stack im getting:
视图绑定期间抛出异常ArgumentNullException:MvxWeakEventSubscription中缺少源事件信息参数名称:sourceEventInfo 在MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription
2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler
1 [TEventArgs] targetEventHandler)[0x00017]在D:\ git \ MvvmCross \ MvvmCross \ Platform \ Platform \ WeakSubscription \ MvxWeakEventSubscription.cs:47 在MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.String sourceEventName, System.EventHandler
1 [TEventArgs] targetEventHandler)[0x00000]在D:\ git \ MvvmCross \ MvvmCross \ Platform \ Platform \ WeakSubscription \ MvxWeakEventSubscription.cs:34 在MvvmCross.Platform.WeakSubscription.MvxWeakSubscriptionExtensionMethods.WeakSubscribe [TSource,TEventArgs](TSource source,System.String eventName,System.EventHandler1[TEventArgs] eventHandler) [0x00000] in D:\git\MvvmCross\MvvmCross\Platform\Platform\WeakSubscription\MvxWeakSubscriptionExtensionMethods.cs:81 at MvvmCross.Binding.Droid.Target.MvxTextViewTextTargetBinding.SubscribeToEvents () [0x0000b] in <6a0c851a22864d0993089d65320a630c>:0 at MvvmCross.Binding.Bindings.MvxFullBinding.CreateTargetBinding (System.Object target) [0x00057] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\MvxFullBinding.cs:157 at MvvmCross.Binding.Bindings.MvxFullBinding..ctor (MvvmCross.Binding.MvxBindingRequest bindingRequest) [0x00028] in D:\git\MvvmCross\MvvmCross\Core\Binding\Bindings\MvxFullBinding.cs:64 at MvvmCross.Binding.Binders.MvxFromTextBinder.BindSingle (MvvmCross.Binding.MvxBindingRequest bindingRequest) [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Binders\MvxFromTextBinder.cs:56 at MvvmCross.Binding.Binders.MvxFromTextBinder+<>c__DisplayClass2_0.<Bind>b__0 (MvvmCross.Binding.Bindings.MvxBindingDescription description) [0x00000] in D:\git\MvvmCross\MvvmCross\Core\Binding\Binders\MvxFromTextBinder.cs:38 at System.Linq.Enumerable+<CombineSelectors>c__AnonStorey1D
3 [TSource,TMiddle,TResult]。&lt;&gt; m__0(TSource x) [0x00012] in:0 在System.Linq.Enumerable + c__AnonStorey1D3[TSource,TMiddle,TResult].<>m__0 (TSource x) [0x00000] in <fcebdd9506364c04ba70cbb6c51ded52>:0 at System.Linq.Enumerable+WhereSelectEnumerableIterator
2 [TSource,TResult] .MoveNext()[0x00064] in:0 at System.Collections.Generic.List1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable
1 [T] collection)[0x000ff] in&lt; 2f8f5c28c7474bed8a8f35ed56258fb1&gt;:0 at System.Collections.Generic.List1[T].AddRange (System.Collections.Generic.IEnumerable
1 [T] collection)[0x00000] in&lt; 2f8f5c28c7474bed8a8f35ed56258fb1&gt ;:0 在MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder.StoreBindings(Android.Views.View视图,System.Collections.Generic.IEnumerable`1 [T] newBindings)[0x00028] in&lt; 6a0c851a22864d0993089d65320a630c&gt;:0 在MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder.ApplyBindingsFromAttribute(Android.Views.View视图,Android.Content.Res.TypedArray typedArray,System.Int32 attributeId)[0x0001c] in&lt; 6a0c851a22864d0993089d65320a630c&gt;:0
我已经将以下内容添加到&#34; LinkerPleaseInclude&#34;,但它没有帮助。
public void Include(TextInputEditText text)
{
text.TextChanged += (sender, args) => text.Text = "" + text.Text;
text.Hint = "" + text.Hint;
text.Background = (Drawable)Android.Resource.Color.Black;
text.Text = "Text" + text.Text;
}
public void Include(TextInputLayout text)
{
text.Hint = "" + text.Hint;
text.Background = (Drawable)Android.Resource.Color.Black;
}
将TextInputEditText更改为简单的EditText,也没有帮助,并抛出相同的异常。
我错过了什么?我没有通过查看堆栈来更接近解决方案。
答案 0 :(得分:4)
经过一番挖掘,我发现这个answer表明MvvmCross的新版本(v4.4.0)发生了变化,需要对项目的LinkViewPleaseInclude中的TextView部分进行调整。 CS