2016-12-14 66 views
5

突然间,我的TextInputEditText的绑定开始失败,它与链接器有关。如果我将链接器设置为“无”,则一切按预期工作。很多其他绑定使用仍然工作得很好。TextInputEditText:ArgumentNullException:MvxWeakEventSubscription中缺少源事件信息

堆栈即时得到:

异常视图结合ArgumentNullException期间抛出:缺少源事件信息在MvxWeakEventSubscription参数名称:在MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription 2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler sourceEventInfo 1 [TEventArgs] targetEventHandler)[0x00017 ] D:\ git \ MvvmCross \ MvvmCross \ Platform \ Platform \ WeakSubscription \ MvxWeakEventSubscription.cs:47 at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription 2[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[TSource,TEventArgs](TSource,System.String eventName,System.EventHandler 1[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]。 <> m__0(TSource X)[0x00012]在:0 在System.Linq.Enumerable + c__AnonStorey1D 3[TSource,TMiddle,TResult].<>m__0 (TSource x) [0x00000] in <fcebdd9506364c04ba70cbb6c51ded52>:0 at System.Linq.Enumerable+WhereSelectEnumerableIterator 2 [TSource,TResult] .MoveNext()[0x00064]在:0 在System.Collections.Generic.List 1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable 1 [T]的集合)[0x000ff]在< 2f8f5c28c7474bed8a8f35ed56258fb1>:0 在System.Collections.Generic.List 1[T].AddRange (System.Collections.Generic.IEnumerable 1 [T]的集合)[0x00000]在< 2f8f5c28c7474bed8a8f35ed56258fb1>:0 在MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder .StoreBindings(Android.Views.View视图,System.Collections.Generic.IEnumerable`1 [T] newBindings)[0x00028] < 6a0c851a22864d0993089d65320a630c>:0 at MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder.ApplyBindingsFromAttribute(Android.Views .View视图,Android.C ontent.Res.TypedArray typedArray,System.Int32属性Id)0x0001c在< 6a0c851a22864d0993089d65320a630c>:0

我已经添加了以下为 “LinkerPleaseInclude”,但它没有帮助。

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,并没有帮助,并引发同样的异常。

我错过了什么?通过查看堆栈,我没有更接近解决方案。

+1

我来了在同一个问题上。在我的调试版本中,提示文本似乎可以正常工作,但在发布版本中,我得到此异常并且提示文本不显示。你的问题只是提示文本或文本绑定? – CodexNZ

回答

4

经过一番周围挖我发现这个answer,显示有在MvvmCross的新版本(V4.4.0),需要一个调整到项目的LinkerPleaseInclude.cs为TextView的部分变化