Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextInputEditText: ArgumentNullException: missing source event info in MvxWeakEventSubscription

All of a sudden the binding for my TextInputEditText started failing, and it has something to do with the Linker. If I set the linker to "None", everything works as intended. Alot of other bindings im using still works just fine.

Stack im getting:

Exception thrown during the view binding ArgumentNullException: missing source event info in MvxWeakEventSubscription Parameter name: sourceEventInfo at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.Reflection.EventInfo sourceEventInfo, System.EventHandler1[TEventArgs] targetEventHandler) [0x00017] in D:\git\MvvmCross\MvvmCross\Platform\Platform\WeakSubscription\MvxWeakEventSubscription.cs:47 at MvvmCross.Platform.WeakSubscription.MvxWeakEventSubscription2[TSource,TEventArgs]..ctor (Android.Widget.TextView source, System.String sourceEventName, System.EventHandler1[TEventArgs] targetEventHandler) [0x00000] in D:\git\MvvmCross\MvvmCross\Platform\Platform\WeakSubscription\MvxWeakEventSubscription.cs:34 at 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 at 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 at System.Collections.Generic.List1[T].InsertRange (System.Int32 index, System.Collections.Generic.IEnumerable1[T] collection) [0x000ff] in <2f8f5c28c7474bed8a8f35ed56258fb1>:0 at System.Collections.Generic.List1[T].AddRange (System.Collections.Generic.IEnumerable1[T] collection) [0x00000] in <2f8f5c28c7474bed8a8f35ed56258fb1>:0 at MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder.StoreBindings (Android.Views.View view, System.Collections.Generic.IEnumerable`1[T] newBindings) [0x00028] in <6a0c851a22864d0993089d65320a630c>:0 at MvvmCross.Binding.Droid.Binders.MvxAndroidViewBinder.ApplyBindingsFromAttribute (Android.Views.View view, Android.Content.Res.TypedArray typedArray, System.Int32 attributeId) [0x0001c] in <6a0c851a22864d0993089d65320a630c>:0

I've already added the following to "LinkerPleaseInclude", but it didnt help.

    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;
    }

Changing the TextInputEditText to a simple EditText, doesnt help either and throws the same exception.

What am I missing? Im not getting any closer to a solution by looking at the stack.

like image 942
Stupidus Avatar asked Dec 14 '16 09:12

Stupidus


1 Answers

After some digging around I found this answer that shows there was a change in the new version (v4.4.0) of MvvmCross that requires a tweak to the section for TextView in your project's LinkerPleaseInclude.cs

like image 161
CodexNZ Avatar answered Nov 03 '22 12:11

CodexNZ