【问题标题】:TextInputEditText: ArgumentNullException: missing source event info in MvxWeakEventSubscriptionTextInputEditText:ArgumentNullException:MvxWeakEventSubscription 中缺少源事件信息
【发布时间】:2016-12-14 09:53:36
【问题描述】:

突然之间,我的 TextInputEditText 的绑定开始失败,这与链接器有关。如果我将链接器设置为“无”,一切都会按预期工作。我使用的许多其他绑定仍然可以正常工作。

我正在获取堆栈:

视图绑定期间抛出异常 ArgumentNullException:MvxWeakEventSubscription 中缺少源事件信息 参数名称:sourceEventInfo 在 MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler1[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.EventHandler1[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__AnonStorey1D3[TSource,TMiddle,TResult].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+WhereSelectEnumerableIterator2[TSource,TResult].MoveNext () [0x00064] in :0 在 System.Collections.Generic.List1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable1[T] 集合)[0x000ff] 在 :0 在 System.Collections.Generic.List1[T].AddRange (System.Collections.Generic.IEnumerable1[T] 集合)[0x00000] 在 :0 在 MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder.StoreBindings (Android.Views.View 视图,System.Collections.Generic.IEnumerable`1[T] newBindings) [0x00028] 在 :0 在 MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder.ApplyBindingsFromAttribute (Android.Views.View view, Android.Content.Res.TypedArray typedArray, System.Int32 attributeId) [0x0001c] in :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,也无济于事,并引发相同的异常。

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

【问题讨论】:

  • 我遇到了同样的问题。在我的调试版本中,提示文本似乎可以正常工作,但在发布版本中我得到了这个异常并且提示文本没有显示。您的问题只是提示文本还是一般的文本绑定?

标签: c# xamarin.android mvvmcross


【解决方案1】:

经过一番挖掘,我发现了这个answer,它表明 MvvmCross 的新版本 (v4.4.0) 发生了变化,需要对项目的 LinkerPleaseInclude.cs 中的 TextView 部分进行调整

【讨论】:

    猜你喜欢
    • 2013-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-21
    • 1970-01-01
    • 1970-01-01
    • 2017-05-19
    • 2010-10-11
    相关资源
    最近更新 更多