You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changed the second EventToCommand to the controls TextChanged event
Run
As firstName is set when the ViewModel is loaded, it will trigger the TextChanged event when the context is updated. That will cause an exception to be thrown:
09-01 15:16:32.435 I/MonoDroid(29060): UNHANDLED EXCEPTION:
09-01 15:16:32.437 I/MonoDroid(29060): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: No command available, Is Command properly properly set up?
09-01 15:16:32.437 I/MonoDroid(29060): at Corcav.Behaviors.EventToCommand.OnFired () <IL 0x0002d, 0x000db>
09-01 15:16:32.437 I/MonoDroid(29060): at (wrapper dynamic-method) object.lambda_method (System.Runtime.CompilerServices.Closure,object,Xamarin.Forms.TextChangedEventArgs) <IL 0x0000d, 0x0003f>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Entry.OnTextChanged (Xamarin.Forms.BindableObject,object,object) <IL 0x00027, 0x000f2>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty,Xamarin.Forms.BindableObject/BindablePropertyContext,object,bool,Xamarin.Forms.BindableObject/SetValueFlags,bool) <IL 0x00115, 0x004c1>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty,object,Xamarin.Forms.BindableObject/SetValueFlags,Xamarin.Forms.BindableObject/SetValuePrivateFlags) <IL 0x0016d, 0x0066b>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindingExpression.ApplyCore (object,Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty,bool) <IL 0x00213, 0x00ab7>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindingExpression.Apply (object,Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty) <IL 0x0007a, 0x002bf>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Binding.Apply (object,Xamarin.Forms.BindableObject,Xamarin.Forms.BindableProperty) <IL 0x0004b, 0x001ab>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.ApplyBindings (object,bool) <IL 0x00042, 0x0011b>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.ApplyBindings (object) <IL 0x00003, 0x00033>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject,object) <IL 0x00061, 0x001a3>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Element.OnBindingContextChanged () <IL 0x00018, 0x0009b>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.View.OnBindingContextChanged () <IL 0x0003b, 0x0017b>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.BindableObject.SetInheritedBindingContext (Xamarin.Forms.BindableObject,object) <IL 0x00067, 0x001bb>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Element.set_Parent (Xamarin.Forms.Element) <IL 0x0006f, 0x00257>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Element.OnChildAdded (Xamarin.Forms.Element) <IL 0x00002, 0x00033>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Page.OnInternalAdded (Xamarin.Forms.VisualElement) <IL 0x00015, 0x000a6>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Page.InternalChildrenOnCollectionChanged (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs) <IL 0x00061, 0x00247>
09-01 15:16:32.437 I/MonoDroid(29060): at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs) <0x0007b>
09-01 15:16:32.437 I/MonoDroid(29060): at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction,object,int) <0x00083>
09-01 15:16:32.437 I/MonoDroid(29060): at System.Collections.ObjectModel.ObservableCollection`1<Xamarin.Forms.Element>.InsertItem (int,Xamarin.Forms.Element) <0x000cb>
09-01 15:16:32.437 I/MonoDroid(29060): at System.Collections.ObjectModel.Collection`1<Xamarin.Forms.Element>.Add (Xamarin.Forms.Element) <0x000c3>
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.ContentPage.set_Content (Xamarin.Forms.View) <IL 0x0004a, 0x00127>
09-01 15:16:32.437 I/MonoDroid(29060): at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <0x00012>
09-01 15:16:32.437 I/MonoDroid(29060): at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x0004a, 0x0017f>
09-01 15:16:32.437 I/MonoDroid(29060): --- End of inner exception stack trace ---
09-01 15:16:32.437 I/MonoDroid(29060): at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00062] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.SetPropertyValue (System.Object xamlelement, XmlName propertyName, System.Object value, Xamarin.Forms.BindableObject rootElement, INode node, Xamarin.Forms.Xaml.HydratationContext context, IXmlLineInfo lineInfo) [0x003e7] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Xaml.ApplyPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode) [0x00215] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x000b5] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Xaml.RootNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00067] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.String xaml) [0x000cd] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.Type callingType) [0x0002b] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[Settings] (Foo.BasMobile.Client.Views.Login.Settings view, System.Type callingType) [0x00000] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at Foo.BasMobile.Client.Views.Login.Settings.InitializeComponent () [0x00001] in C:\Workspace\Foo-Basmobile-client\Foo.BasMobile.Client\Foo.BasMobile.Client\obj\Debug\Foo.BasMobile.Client.Views.Login.Settings.xaml.g.cs:21
09-01 15:16:32.437 I/MonoDroid(29060): at Foo.BasMobile.Client.Views.Login.Settings..ctor () [0x00014] in C:\Workspace\Foo-Basmobile-client\Foo.BasMobile.Client\Foo.BasMobile.Client\Views\Login\Settings.xaml.cs:11
09-01 15:16:32.437 I/MonoDroid(29060): at (wrapper managed-to-native) System.Reflection.MonoCMethod:InternalInvoke (System.Reflection.MonoCMethod,object,object[],System.Exception&)
09-01 15:16:32.437 I/MonoDroid(29060): at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00002] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): --- End of inner exception stack trace ---
09-01 15:16:32.437 I/MonoDroid(29060): at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x0001c] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x000af] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
09-01 15:16:32.437 I/MonoDroid(29060): at Xamarin.Forms.Xaml.CreateValuesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode) [0x0018b] in <filename unknown>:0
09-01 15:16:32.442 W/art (29060): JNI RegisterNativeMethods: attempt to register 0 native methods for md52ce486a14f4bcd95899665e9d932190b.JavaProxyThrowable
09-01 15:16:32.443 D/AndroidRuntime(29060): Shutting down VM
An unhandled exception occured.
The text was updated successfully, but these errors were encountered:
See https://github.com/oskaremil/Corcav.Behaviors/commit/285e871e65cdce6faaec9dfc61a0e9b660694b2b
I made a small alteration in your Demo project
As firstName is set when the ViewModel is loaded, it will trigger the TextChanged event when the context is updated. That will cause an exception to be thrown:
The text was updated successfully, but these errors were encountered: