xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.63k stars 1.87k forks source link

Forms 3.0: System.Reflection.AmbiguousMatchException #2632

Closed Sebastian1989101 closed 6 years ago

Sebastian1989101 commented 6 years ago

After the update to Xamarin.Forms 3.0 I got AmbiguousMatchException all over the place in my code. I'm not 100% why this happens and what it causes yet. A friend of mine got the same exceptions after the update - he has a complete different coding style and uses complete different libraries. Sadly he dosn't know why this happen and where it comes from.

System.Reflection.AmbiguousMatchException: Ambiguous match found.

05-08 16:01:25.641 D/Mono    ( 5777): DllImport attempting to load: '/system/lib/liblog.so'.
05-08 16:01:25.641 D/Mono    ( 5777): DllImport loaded library '/system/lib/liblog.so'.
05-08 16:01:25.642 D/Mono    ( 5777): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
05-08 16:01:25.642 D/Mono    ( 5777): Searching for '__android_log_print'.
05-08 16:01:25.642 D/Mono    ( 5777): Probing '__android_log_print'.
05-08 16:01:25.642 D/Mono    ( 5777): Found as '__android_log_print'.
05-08 16:01:25.648 I/MonoDroid( 5777): UNHANDLED EXCEPTION:
05-08 16:01:25.662 I/MonoDroid( 5777): System.Reflection.AmbiguousMatchException: Ambiguous match found.
05-08 16:01:25.662 I/MonoDroid( 5777):   at System.RuntimeType.GetPropertyImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00061] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
05-08 16:01:25.662 I/MonoDroid( 5777):   at System.Type.GetProperty (System.String name) [0x0000e] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
05-08 16:01:25.662 I/MonoDroid( 5777):   at Xamarin.Forms.BindingExpression.SetupPart (System.Reflection.TypeInfo sourceType, Xamarin.Forms.BindingExpression+BindingExpressionPart part) [0x00221] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:341 
05-08 16:01:25.662 I/MonoDroid( 5777):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x000d7] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:130 
05-08 16:01:25.662 I/MonoDroid( 5777):   at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:78 
05-08 16:01:25.662 I/MonoDroid( 5777):   at Xamarin.Forms.Binding.Apply (System.Object newContext, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty targetProperty, System.Boolean fromBindingContextChanged) [0x00057] in D:\a\1\s\Xamarin.Forms.Core\Binding.cs:131 
05-08 16:01:25.662 I/MonoDroid( 5777):   at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding, System.Boolean fromStyle) [0x0008b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:316 
05-08 16:01:25.662 I/MonoDroid( 5777):   at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:94 
05-08 16:01:25.662 I/MonoDroid( 5777):   at MHWorldCompanion.Core.Pages.SetSearcherPage+<InitializeComponent>_anonXamlCDataTemplate_58.LoadDataTemplate () [0x00570] in <2bb6b8e8a7094c3ea0df28233dbe1b64>:0 
05-08 16:01:25.662 I/MonoDroid( 5777):   at Xamarin.Forms.ElementTemplate.CreateContent () [0x00026] in D:\a\1\s\Xamarin.Forms.Core\ElementTemplate.cs:82 
05-08 16:01:25.662 I/MonoDroid( 5777):   at MHWorldCompanion.Core.Controls.ItemsStack.GetItemView (System.Object item) [0x00001] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\Controls\ItemsStack.cs:68 
05-08 16:01:25.662 I/MonoDroid( 5777):   at MHWorldCompanion.Core.Controls.ItemsStack.CollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00045] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\Controls\ItemsStack.cs:112 
05-08 16:01:25.662 I/MonoDroid( 5777):   at (wrapper delegate-invoke) <Module>.invoke_void_object_NotifyCollectionChangedEventArgs(object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
05-08 16:01:25.662 I/MonoDroid( 5777):   at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0000f] in <5a97d41d36694fb19855c17429527b10>:0 
05-08 16:01:25.662 I/MonoDroid( 5777):   at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00009] in <5a97d41d36694fb19855c17429527b10>:0 
05-08 16:01:25.662 I/MonoDroid( 5777):   at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x00024] in <5a97d41d36694fb19855c17429527b10>:0 
05-08 16:01:25.662 I/MonoDroid( 5777):   at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
05-08 16:01:25.662 I/MonoDroid( 5777):   at MHWorldCompanion.Core.ViewModels.SetSearcherViewModel.ViewAppeared () [0x00027] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\ViewModels\SetSearcherViewModel.cs:146 
05-08 16:01:25.662 I/MonoDroid( 5777):   at MvvmCross.Forms.Views.MvxContentPage.OnAppearing () [0x00021] in <0afca477417f4241b92e240f7a530ede>:0 
05-08 16:01:25.662 I/MonoDroid( 5777):   at MHWorldCompanion.Core.Pages.SetSearcherPage.OnAppearing () [0x00001] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\Pages\SetSearcherPage.xaml.cs:24 
05-08 16:01:25.662 I/MonoDroid( 5777):   at Xamarin.Forms.Page.SendAppearing () [0x00024] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:313 
05-08 16:01:25.662 I/MonoDroid( 5777):   at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.SendLifecycleEvent (System.Boolean isAppearing) [0x0004f] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:132 
05-08 16:01:25.662 I/MonoDroid( 5777):   at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnResume () [0x00011] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:117 
05-08 16:01:25.662 I/MonoDroid( 5777):   at Android.Support.V4.App.Fragment.n_OnResume (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <3682f8af23a748128467fbf9c57ae876>:0 
05-08 16:01:25.662 I/MonoDroid( 5777):   at (wrapper dynamic-method) System.Object.20042f24-e0c2-475b-ac40-41e0634ae0a6(intptr,intptr)
05-08 16:01:25.683 E/AppCenterCrashes( 5777): Unhandled Exception from source=AndroidEnvironment
05-08 16:01:25.683 E/AppCenterCrashes( 5777): System.Reflection.AmbiguousMatchException: Ambiguous match found.
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at System.RuntimeType.GetPropertyImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00061] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at System.Type.GetProperty (System.String name) [0x0000e] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at Xamarin.Forms.BindingExpression.SetupPart (System.Reflection.TypeInfo sourceType, Xamarin.Forms.BindingExpression+BindingExpressionPart part) [0x00221] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:341 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x000d7] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:130 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:78 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at Xamarin.Forms.Binding.Apply (System.Object newContext, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty targetProperty, System.Boolean fromBindingContextChanged) [0x00057] in D:\a\1\s\Xamarin.Forms.Core\Binding.cs:131 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding, System.Boolean fromStyle) [0x0008b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:316 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:94 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at MHWorldCompanion.Core.Pages.SetSearcherPage+<InitializeComponent>_anonXamlCDataTemplate_58.LoadDataTemplate () [0x00570] in <2bb6b8e8a7094c3ea0df28233dbe1b64>:0 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at Xamarin.Forms.ElementTemplate.CreateContent () [0x00026] in D:\a\1\s\Xamarin.Forms.Core\ElementTemplate.cs:82 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at MHWorldCompanion.Core.Controls.ItemsStack.GetItemView (System.Object item) [0x00001] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\Controls\ItemsStack.cs:68 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at MHWorldCompanion.Core.Controls.ItemsStack.CollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00045] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\Controls\ItemsStack.cs:112 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at (wrapper delegate-invoke) <Module>.invoke_void_object_NotifyCollectionChangedEventArgs(object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0000f] in <5a97d41d36694fb19855c17429527b10>:0 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00009] in <5a97d41d36694fb19855c17429527b10>:0 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x00024] in <5a97d41d36694fb19855c17429527b10>:0 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at MHWorldCompanion.Core.ViewModels.SetSearcherViewModel.ViewAppeared () [0x00027] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\ViewModels\SetSearcherViewModel.cs:146 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at MvvmCross.Forms.Views.MvxContentPage.OnAppearing () [0x00021] in <0afca477417f4241b92e240f7a530ede>:0 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at MHWorldCompanion.Core.Pages.SetSearcherPage.OnAppearing () [0x00001] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\Pages\SetSearcherPage.xaml.cs:24 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at Xamarin.Forms.Page.SendAppearing () [0x00024] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:313 
05-08 16:01:25.683 E/AppCenterCrashes( 5777):   at Xamarin.Forms.
05-08 16:01:25.692 D/Mono    ( 5777): Assembly Ref addref Microsoft.AppCenter.Crashes[0xa474e8e0] -> System.Core[0xa4419020]: 14
[0:] AndroidEnvironment.UnhandledExceptionRaiser: System.Reflection.AmbiguousMatchException: Ambiguous match found.
  at System.RuntimeType.GetPropertyImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00061] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Type.GetProperty (System.String name) [0x0000e] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at Xamarin.Forms.BindingExpression.SetupPart (System.Reflection.TypeInfo sourceType, Xamarin.Forms.BindingExpression+BindingExpressionPart part) [0x00221] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:341 
  at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x000d7] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:130 
  at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:78 
  at Xamarin.Forms.Binding.Apply (System.Object newContext, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty targetProperty, System.Boolean fromBindingContextChanged) [0x00057] in D:\a\1\s\Xamarin.Forms.Core\Binding.cs:131 
  at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding, System.Boolean fromStyle) [0x0008b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:316 
  at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:94 
  at MHWorldCompanion.Core.Pages.SetSearcherPage+<InitializeComponent>_anonXamlCDataTemplate_58.LoadDataTemplate () [0x00570] in <2bb6b8e8a7094c3ea0df28233dbe1b64>:0 
  at Xamarin.Forms.ElementTemplate.CreateContent () [0x00026] in D:\a\1\s\Xamarin.Forms.Core\ElementTemplate.cs:82 
  at MHWorldCompanion.Core.Controls.ItemsStack.GetItemView (System.Object item) [0x00001] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\Controls\ItemsStack.cs:68 
  at MHWorldCompanion.Core.Controls.ItemsStack.CollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00045] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\Controls\ItemsStack.cs:112 
  at (wrapper delegate-invoke) <Module>.invoke_void_object_NotifyCollectionChangedEventArgs(object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x0000f] in <5a97d41d36694fb19855c17429527b10>:0 
  at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00009] in <5a97d41d36694fb19855c17429527b10>:0 
  at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x00024] in <5a97d41d36694fb19855c17429527b10>:0 
  at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at MHWorldCompanion.Core.ViewModels.SetSearcherViewModel.ViewAppeared () [0x00027] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\ViewModels\SetSearcherViewModel.cs:146 
  at MvvmCross.Forms.Views.MvxContentPage.OnAppearing () [0x00021] in <0afca477417f4241b92e240f7a530ede>:0 
  at MHWorldCompanion.Core.Pages.SetSearcherPage.OnAppearing () [0x00001] in C:\Privat\git\MHWorldCompanion\MHWorldCompanion\MHWorldCompanion.Core\Pages\SetSearcherPage.xaml.cs:24 
  at Xamarin.Forms.Page.SendAppearing () [0x00024] in D:\a\1\s\Xamarin.Forms.Core\Page.cs:313 
  at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.SendLifecycleEvent (System.Boolean isAppearing) [0x0004f] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:132 
  at Xamarin.Forms.Platform.Android.AppCompat.FragmentContainer.OnResume () [0x00011] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\FragmentContainer.cs:117 
  at Android.Support.V4.App.Fragment.n_OnResume (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <3682f8af23a748128467fbf9c57ae876>:0 
  at (wrapper dynamic-method) System.Object.20042f24-e0c2-475b-ac40-41e0634ae0a6(intptr,intptr). IsTerminating: False
An unhandled exception occured.

05-08 16:01:37.181 E/mono-rt ( 5777): [ERROR] FATAL UNHANDLED EXCEPTION: System.Reflection.AmbiguousMatchException: Ambiguous match found.
05-08 16:01:37.181 E/mono-rt ( 5777):   at (wrapper dynamic-method) System.Object.20042f24-e0c2-475b-ac40-41e0634ae0a6(intptr,intptr)
05-08 16:01:37.186 D/        ( 5777): HostConnection::get() New Host Connection established 0xa6e1f700, tid 5777
Sebastian1989101 commented 6 years ago

And another one:

System.Reflection.AmbiguousMatchException: Ambiguous match found.

05-08 16:08:52.866 D/Mono    ( 6505): DllImport attempting to load: '/system/lib/liblog.so'.
05-08 16:08:52.894 D/Mono    ( 6505): DllImport loaded library '/system/lib/liblog.so'.
05-08 16:08:52.894 D/Mono    ( 6505): DllImport searching in: '/system/lib/liblog.so' ('/system/lib/liblog.so').
05-08 16:08:52.894 D/Mono    ( 6505): Searching for '__android_log_print'.
05-08 16:08:52.894 D/Mono    ( 6505): Probing '__android_log_print'.
05-08 16:08:52.894 D/Mono    ( 6505): Found as '__android_log_print'.
05-08 16:08:52.898 I/MonoDroid( 6505): UNHANDLED EXCEPTION:
05-08 16:08:52.907 I/MonoDroid( 6505): System.Reflection.AmbiguousMatchException: Ambiguous match found.
05-08 16:08:52.907 I/MonoDroid( 6505):   at System.RuntimeType.GetPropertyImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00061] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
05-08 16:08:52.907 I/MonoDroid( 6505):   at System.Type.GetProperty (System.String name) [0x0000e] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.BindingExpression.SetupPart (System.Reflection.TypeInfo sourceType, Xamarin.Forms.BindingExpression+BindingExpressionPart part) [0x00221] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:341 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x000d7] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:130 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:78 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.Binding.Apply (System.Object newContext, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty targetProperty, System.Boolean fromBindingContextChanged) [0x00057] in D:\a\1\s\Xamarin.Forms.Core\Binding.cs:131 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding, System.Boolean fromStyle) [0x0008b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:316 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:94 
05-08 16:08:52.908 I/MonoDroid( 6505):   at MHWorldCompanion.Core.Pages.WeaponSelectionPage+<InitializeComponent>_anonXamlCDataTemplate_75.LoadDataTemplate () [0x001f2] in <2bb6b8e8a7094c3ea0df28233dbe1b64>:0 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.ElementTemplate.CreateContent () [0x00026] in D:\a\1\s\Xamarin.Forms.Core\ElementTemplate.cs:82 
05-08 16:08:52.908 I/MonoDroid( 6505):   at DLToolkit.Forms.Controls.FlowListViewInternalCell.UpdateData () [0x001b1] in <5d4a24d63abc402db6897eb2bcac9fee>:0 
05-08 16:08:52.908 I/MonoDroid( 6505):   at DLToolkit.Forms.Controls.FlowListViewInternalCell.OnBindingContextChanged () [0x00006] in <5d4a24d63abc402db6897eb2bcac9fee>:0 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.BindableObject.BindingContextPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:477 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00122] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:636 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:426 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0003d] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:583 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:99 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.BindableObject.set_BindingContext (System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:25 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].UpdateContent (TItem content, System.Int32 index, System.Object item) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:614 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].ActivateContent (System.Int32 index, System.Object item) [0x00038] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:536 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].CreateContent (System.Int32 index, System.Object item, System.Boolean insert) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:543 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].GetOrCreateContent (System.Int32 index, System.Object item) [0x00023] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:602 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].get_Item (System.Int32 index) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:337 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.Platform.Android.ListViewAdapter.GetCellsFromPosition (System.Int32 position, System.Int32 take) [0x0003b] in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:516 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.Platform.Android.ListViewAdapter.GetCellForPosition (System.Int32 position) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:438 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (System.Int32 position, Android.Views.View convertView, Android.Views.ViewGroup parent) [0x00081] in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:216 
05-08 16:08:52.908 I/MonoDroid( 6505):   at Android.Widget.BaseAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (System.IntPtr jnienv, System.IntPtr native__this, System.Int32 position, System.IntPtr native_convertView, System.IntPtr native_parent) [0x00018] in <25661073a35344a89f215a4cf81af37c>:0 
05-08 16:08:52.908 I/MonoDroid( 6505):   at (wrapper dynamic-method) System.Object.1a045c58-a8db-46df-873a-24a335f32e3d(intptr,intptr,int,intptr,intptr)
05-08 16:08:52.957 I/zygote  ( 6505): Explicit concurrent copying GC freed 4167(252KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 1721KB/3MB, paused 1.352ms total 14.519ms
05-08 16:08:52.960 D/Mono    ( 6505): GC_TAR_BRIDGE bridges 181 objects 46845 opaque 38136 colors 181 colors-bridged 181 colors-visible 181 xref 19 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.04ms tarjan 11.86ms scc-setup 0.55ms gather-xref 0.02ms xref-setup 0.12ms cleanup 0.50ms
05-08 16:08:52.960 D/Mono    ( 6505): GC_BRIDGE: Complete, was running for 19.18ms
05-08 16:08:52.960 D/Mono    ( 6505): GC_MINOR: (Nursery full) time 20.60ms, stw 25.46ms promoted 1391K major size: 7008K in use: 6269K los size: 5120K in use: 3854K
05-08 16:08:52.964 E/AppCenterCrashes( 6505): Unhandled Exception from source=AndroidEnvironment
05-08 16:08:52.964 E/AppCenterCrashes( 6505): System.Reflection.AmbiguousMatchException: Ambiguous match found.
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at System.RuntimeType.GetPropertyImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00061] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at System.Type.GetProperty (System.String name) [0x0000e] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.BindingExpression.SetupPart (System.Reflection.TypeInfo sourceType, Xamarin.Forms.BindingExpression+BindingExpressionPart part) [0x00221] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:341 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x000d7] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:130 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:78 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.Binding.Apply (System.Object newContext, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty targetProperty, System.Boolean fromBindingContextChanged) [0x00057] in D:\a\1\s\Xamarin.Forms.Core\Binding.cs:131 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding, System.Boolean fromStyle) [0x0008b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:316 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:94 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at MHWorldCompanion.Core.Pages.WeaponSelectionPage+<InitializeComponent>_anonXamlCDataTemplate_75.LoadDataTemplate () [0x001f2] in <2bb6b8e8a7094c3ea0df28233dbe1b64>:0 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.ElementTemplate.CreateContent () [0x00026] in D:\a\1\s\Xamarin.Forms.Core\ElementTemplate.cs:82 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at DLToolkit.Forms.Controls.FlowListViewInternalCell.UpdateData () [0x001b1] in <5d4a24d63abc402db6897eb2bcac9fee>:0 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at DLToolkit.Forms.Controls.FlowListViewInternalCell.OnBindingContextChanged () [0x00006] in <5d4a24d63abc402db6897eb2bcac9fee>:0 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.BindableObject.BindingContextPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:477 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00122] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:636 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:426 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0003d] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:583 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:99 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.BindableObject.set_BindingContext (System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:25 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].UpdateContent (TItem content, System.Int32 index, System.Object item) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:614 
05-08 16:08:52.964 E/AppCenterCrashes( 6505):   at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].ActivateContent (System.Int3
05-08 16:08:52.969 D/Mono    ( 6505): Assembly Ref addref Microsoft.AppCenter.Crashes[0xa474ea00] -> System.Core[0xa4419140]: 14
[0:] AndroidEnvironment.UnhandledExceptionRaiser: System.Reflection.AmbiguousMatchException: Ambiguous match found.
  at System.RuntimeType.GetPropertyImpl (System.String name, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, System.Type returnType, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00061] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at System.Type.GetProperty (System.String name) [0x0000e] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
  at Xamarin.Forms.BindingExpression.SetupPart (System.Reflection.TypeInfo sourceType, Xamarin.Forms.BindingExpression+BindingExpressionPart part) [0x00221] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:341 
  at Xamarin.Forms.BindingExpression.ApplyCore (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property, System.Boolean fromTarget) [0x000d7] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:130 
  at Xamarin.Forms.BindingExpression.Apply (System.Object sourceObject, Xamarin.Forms.BindableObject target, Xamarin.Forms.BindableProperty property) [0x0006b] in D:\a\1\s\Xamarin.Forms.Core\BindingExpression.cs:78 
  at Xamarin.Forms.Binding.Apply (System.Object newContext, Xamarin.Forms.BindableObject bindObj, Xamarin.Forms.BindableProperty targetProperty, System.Boolean fromBindingContextChanged) [0x00057] in D:\a\1\s\Xamarin.Forms.Core\Binding.cs:131 
  at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding, System.Boolean fromStyle) [0x0008b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:316 
  at Xamarin.Forms.BindableObject.SetBinding (Xamarin.Forms.BindableProperty targetProperty, Xamarin.Forms.BindingBase binding) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:94 
  at MHWorldCompanion.Core.Pages.WeaponSelectionPage+<InitializeComponent>_anonXamlCDataTemplate_75.LoadDataTemplate () [0x001f2] in <2bb6b8e8a7094c3ea0df28233dbe1b64>:0 
  at Xamarin.Forms.ElementTemplate.CreateContent () [0x00026] in D:\a\1\s\Xamarin.Forms.Core\ElementTemplate.cs:82 
  at DLToolkit.Forms.Controls.FlowListViewInternalCell.UpdateData () [0x001b1] in <5d4a24d63abc402db6897eb2bcac9fee>:0 
  at DLToolkit.Forms.Controls.FlowListViewInternalCell.OnBindingContextChanged () [0x00006] in <5d4a24d63abc402db6897eb2bcac9fee>:0 
  at Xamarin.Forms.BindableObject.BindingContextPropertyChanged (Xamarin.Forms.BindableObject bindable, System.Object oldvalue, System.Object newvalue) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:477 
  at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00122] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:636 
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:426 
  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0003d] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:583 
  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:99 
  at Xamarin.Forms.BindableObject.set_BindingContext (System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:25 
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].UpdateContent (TItem content, System.Int32 index, System.Object item) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:614 
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].ActivateContent (System.Int32 index, System.Object item) [0x00038] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:536 
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].CreateContent (System.Int32 index, System.Object item, System.Boolean insert) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:543 
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].GetOrCreateContent (System.Int32 index, System.Object item) [0x00023] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:602 
  at Xamarin.Forms.Internals.TemplatedItemsList`2[TView,TItem].get_Item (System.Int32 index) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\TemplatedItemsList.cs:337 
  at Xamarin.Forms.Platform.Android.ListViewAdapter.GetCellsFromPosition (System.Int32 position, System.Int32 take) [0x0003b] in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:516 
  at Xamarin.Forms.Platform.Android.ListViewAdapter.GetCellForPosition (System.Int32 position) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:438 
  at Xamarin.Forms.Platform.Android.ListViewAdapter.GetView (System.Int32 position, Android.Views.View convertView, Android.Views.ViewGroup parent) [0x00081] in D:\a\1\s\Xamarin.Forms.Platform.Android\Renderers\ListViewAdapter.cs:216 
  at Android.Widget.BaseAdapter.n_GetView_ILandroid_view_View_Landroid_view_ViewGroup_ (System.IntPtr jnienv, System.IntPtr native__this, System.Int32 position, System.IntPtr native_convertView, System.IntPtr native_parent) [0x00018] in <25661073a35344a89f215a4cf81af37c>:0 
  at (wrapper dynamic-method) System.Object.1a045c58-a8db-46df-873a-24a335f32e3d(intptr,intptr,int,intptr,intptr). IsTerminating: False
Sebastian1989101 commented 6 years ago

Seems like this is caused by Source={x:Reference Page} within the binding. As soon as I remove this, the page "works" (well my Button does not work because it is within a ListView and I need a Command from the Page DataContext).

Edit: Seems like to work on the other hand if I use the name of the list itself instead of the whole page. Well this will be a lot of work to change this in 19 apps with multiple pages and this is used quit often in my apps. :/

StephaneDelcroix commented 6 years ago

@Sebastian1989101 as you isolated the issue, could you please attach a small sample project triggering the issue ?

This looks serious, we should address this pretty quickly

adamped commented 6 years ago

@StephaneDelcroix I'm getting this on Android and iOS with var content = this.ItemTemplate.CreateContent();

I'm manually calling this, because I am using a bindable repeater, but I notice the same line is called in the StackTrace's above.

at Xamarin.Forms.ElementTemplate.CreateContent () [0x00026] in D:\a\1\s\Xamarin.Forms.Core\ElementTemplate.cs:82

My BindableRepeater has this property

public DataTemplate ItemTemplate
{
    get { return (DataTemplate)this.GetValue(ItemTemplateProperty); }
    set { this.SetValue(ItemTemplateProperty, value); }
}

And the DataTemplate is loaded by defining it in XAML.

Actually this error seems to be trashing most of my ListViews too.

adamped commented 6 years ago

@StephaneDelcroix - can confirm using Source={x:Reference Page} in the DataTemplate is the cause of this issue.

bidy commented 6 years ago

Similar bug here: Sine update to Xamarin.Forms 3.0 I get loads of 'System.Reflection.AmbiguousMatchException: Ambiguous match found.' in this line of the compiler generates g.cs files: private void InitializeComponent() { global::Xamarin.Forms.Xaml.Extensions.LoadFromXaml(this, typeof(LabeledControl)); }

Nerves82 commented 6 years ago

I am getting this as well. Any Xaml that has a bindable property in it throws this exception in its InitializeComponent method - LoadFromXaml.

private void InitializeComponent() { global::Xamarin.Forms.Xaml.Extensions.LoadFromXaml(this, typeof(MainMenuPage)); } screen shot 2018-05-11 at 08 57 14 screen shot 2018-05-11 at 08 56 58

StephaneDelcroix commented 6 years ago

I can't reproduce the issue with the following xaml

<ListView x:Name="xRefToPage">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell><Label Text="{Binding Source={x:Reference Page}}"/></ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

could you please attach a sample project ? or @adamped

Nerves82 commented 6 years ago

Here is a new project that reproduces the exception. This is with a fresh install of VSMac on the stable channel FYI.

crashfix.zip screen shot 2018-05-11 at 09 08 53 screen shot 2018-05-11 at 09 14 54

=== Visual Studio Community 2017 for Mac ===

Version 7.5 (build 1254) Installation UUID: 9043ce4f-9f6a-4727-a2ad-b529b98cc62d Runtime: Mono 5.10.1.47 (2017-12/8eb8f7d5e74) (64-bit) GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 4.4.0.36 (master / 0c7c49a6)

Package version: 510010047

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 2.0.5 2.0.4 2.0.0 SDK: /usr/local/share/dotnet/sdk/2.1.4/Sdks SDK Versions: 2.1.4 2.1.3 2.0.0 MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.10.1/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.2 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Xamarin.Android ===

Version: 8.3.0.19 (Visual Studio Community) Android SDK: /Users/tk421/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 5.0 (API level 21) 5.1 (API level 22) 6.0 (API level 23) 7.0 (API level 24) 7.1 (API level 25) 8.0 (API level 26) 8.1 (API level 27)

SDK Tools Version: 26.1.1 SDK Platform Tools Version: 27.0.1 SDK Build Tools Version: 26.0.3

Java SDK: /usr java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL

=== Apple Developer Tools ===

Xcode 9.3 (14154) Build 9E145

=== Xamarin.Mac ===

Version: 4.4.1.176 (Visual Studio Community)

=== Xamarin.iOS ===

Version: 11.10.1.177 (Visual Studio Community) Hash: 7e782c1e Branch: d15-7 Build date: 2018-04-25 15:27:13-0400

=== Xamarin Inspector ===

Version: 1.4.0 Hash: b3f92f9 Branch: master Build date: Fri, 19 Jan 2018 22:00:34 GMT Client compatibility: 1

=== Build Information ===

Release ID: 705001254 Git revision: 498923ea36d2c7fe440c4e4b8cfb75bd50bbd748 Build date: 2018-05-05 10:35:24-04 Xamarin addins: 219f1c4943b4693b837b4173dd10ea982a47c852 Build lane: monodevelop-lion-d15-7

=== Operating System ===

Mac OS X 10.13.4 Darwin 17.5.0 Darwin Kernel Version 17.5.0 Fri Apr 13 19:32:32 PDT 2018 root:xnu-4570.51.2~1/RELEASE_X86_64 x86_64

adamped commented 6 years ago

@StephaneDelcroix the name needs to be attached to the page not an element in the page.

<ContentPage x:Name="Page" …. >
    <ListView>
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell><Label Text="{Binding Source={x:Reference Page}}"/></ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>
</ContentPage>
StephaneDelcroix commented 6 years ago

@adamped I got that part, but thanks.

I'm about to try @Nerves82 repro

StephaneDelcroix commented 6 years ago

@Nerves82 your repro is incomplete. also, from the screenshot, it looks like an intelisense problem, and not something preventing a build. am i wrong ?

Nerves82 commented 6 years ago

@StephaneDelcroix Yes, another wonderful (and not at all frustrating) bug in VSMac. The files are in the project but the .csprog file does not include them no matter how many times they are added to the project. Just add BasePage.xaml, BasePage.xaml.cs and BasePageViewModel to the project.

StephaneDelcroix commented 6 years ago

@Nerves82 you can be frustrated, or you can fix your .csproj. here's a working version for you

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Xamarin.Forms" Version="3.0.0.446417" />
  </ItemGroup>

</Project>
Nerves82 commented 6 years ago

@StephaneDelcroix Yep. Been there, done that. Many, many, many times. And yet still VSMac does not save the .csproj file and restarting VSMac opens the project with those files missing. But that is another bug for another thread.

StephaneDelcroix commented 6 years ago

@Nerves82 your problem seems like an Ambiguous match in intellisense, not at runtime. could you confirm ?

Also, even with BasePage in, your project throws NRE at multiple places.

StephaneDelcroix commented 6 years ago

@adamped @Sebastian1989101 I still need a valid repro for this.

Nerves82 commented 6 years ago

@StephaneDelcroix It acted like more then intelligence as it would prevent the project from compiling. I just tried to create another new Forms project and pull in those 3 files with the same issue. VSMac seems to keep overriding the .csproj file so the BasePage.xaml never gets included.

Sebastian1989101 commented 6 years ago

@StephaneDelcroix After a few more tests, it might be more a Problem combined with MvvmCross. Because every repository of mine that was affected by this, uses MvvmCross (but it works with XF 2.5). I guess I need a bit more time to find the real source of this. I just thought on first tests that Xamarin.Forms 3.0 was the problem because that was everything I changed.

Nerves82 commented 6 years ago

@Sebastian1989101 I think I can eliminate that possibility. I don't use MVVMCross but was experiencing the issue. My projects are Xamarin Forms with .NETStandard 2.0 for UWP, iOS and Android.

Sebastian1989101 commented 6 years ago

@Nerves82 the issue you describe here and in your repo is the same exception but a different problem. You did not describe the problem from the topic where Source={x:Reference Page}, where Page is the x:Name of the page itself, triggers the exception.

Nerves82 commented 6 years ago

@Sebastian1989101 Ya that is correct. FWIW, the issues I was getting was the error in the build console: "System.Reflection.AmbiguousMatchException: Ambiguous match found", the intellisense error pictured above and a System.Exception breakpoint at

private void InitializeComponent() { global::Xamarin.Forms.Xaml.Extensions.LoadFromXaml(this, typeof(SOMECLASS)); <-- this line }

for any class that contained xaml with a binding (e.g. Text = "{Binding SomeText}").

adamped commented 6 years ago

@StephaneDelcroix its definitely a runtime issue, but I am having trouble isolating it, as a new project doesn't throw the error, but my existing one does all over the place.

StephaneDelcroix commented 6 years ago

@adamped could you email me your project ?

adamped commented 6 years ago

@StephaneDelcroix - sorry, wish I could, but its a high profile client, and I'm bound by an NDA.

ryanharding commented 6 years ago

Hi, I am having the same issue and breaking at the same point as @Nerves82 .

Here's my 10 cents to try help narrow down the issue.

Just upgraded to XF 3.0 my PCL is referencing the following nuget packages "Autofac" Version="4.8.0" "Microsoft.AppCenter.Analytics" Version="1.6.0" "Microsoft.AppCenter.Crashes" Version="1.6.0" "Microsoft.Azure.Mobile.Client" Version="4.0.2" "Microsoft.Azure.Mobile.Client.SQLiteStore" Version="4.0.2" "Plugin.Permissions" Version="3.0.0.8" "Rg.Plugins.Popup" Version="1.0.4" "TK.CustomMap" Version="2.0.1" "WindowsAzure.Storage" Version="9.1.1" "Xam.Plugin.Connectivity" Version="3.1.1" "Xam.Plugin.ExternalMaps" Version="4.0.1" "Xam.Plugin.Geolocator" Version="4.5.0.1" "Xam.Plugin.Media" Version="3.2.1" "Xam.Plugins.Settings" Version="4.0.0.7" "Xamarin.Forms" Version="3.0.0.446417" "Xamarin.Forms.Maps" Version="3.0.0.446417"

Hopefully we can track down a common environment.

flyingxu commented 6 years ago

@StephaneDelcroix I have sent you my code by email (at delcroix.org), please check. or the code is at: https://github.com/flyingxu/xamarin-bluetooth-le/tree/mvvmcross6

Open BLE.sln and set Samples/BLE.Client.Droid as startup project. Run it. On the main screen, swipe down to scan for Bluetooth devices. Hopefully, you have some Bluetooth devices nearby, the item will be added and the app will crash.

The suspicious code is at:

            <ViewCell.ContextActions>
              <MenuItem Command="{Binding Path=BindingContext.DisconnectCommand, Source={x:Reference DevicePage}}"
                        CommandParameter="{Binding .}" IsDestructive="True"
                        Text="Disconnect"/>
            </ViewCell.ContextActions>

If I remove the code, the app runs ok.

StephaneDelcroix commented 6 years ago

@flyingxu I get "Permission denied. Not scanning"

I'm quite sure the issue is not related to bluetooth, could you please try to isolate the problem on a page that doesn't have requirements ? thanks

flyingxu commented 6 years ago

a quick fix is to allow the app for its bluetooth and location permissions. You can go to Android settings to change the permission

StephaneDelcroix commented 6 years ago

@flyingxu not helping

brendanzagaeski commented 6 years ago

@Nerves82, @ryanharding, for the issue with IntelliSense (which seems to be a separate issue from the exception at run-time described in the initial description), I would recommend to vote on and follow the Visual Studio Developer Community item where that behavior is under investigation:

https://developercommunity.visualstudio.com/content/problem/245328/xamarin-forms-somepagexamlcs-initializecomponent-s.html

flyingxu commented 6 years ago

@StephaneDelcroix On android,

  1. Start debug
  2. Go to android settings to change the permission settings,
  3. Then go back to the app to swipe down to scan

(Don’t start a new debug or download again during the above steps, or the permission setting will be cleared since the app is uninstalled during a new debug)

You can also try iOS, same crash.

MelbourneDeveloper commented 6 years ago

We have an Android release on Wednesday and this is looking very bad for us...

We're getting this exception all over the place. The only piece of information we're seeing is that it is happening on the class Grid, and the property is Children. It looks like Grid has multiple Children properties. But, this is only a snippet of information, we have not delved deeply in to this yet.

MelbourneDeveloper commented 6 years ago

I tried to downgrade to the previous NuGet but the bugs in that version are far more severe so we have to deploy our app to the customer with exceptions getting thrown all over the place which will seriously impact performance.

StephaneDelcroix commented 6 years ago

@MelbourneDeveloper but in your case, those exceptions are caught, right? so the issue is different from the crash reported here ? if so, please open another issue. I'll look at it

StephaneDelcroix commented 6 years ago

Looks like the problem is Mvvmcross redefining BindingContext ¯\_(ツ)_/¯. Let's see if I can repro that behavior without Mvx...

LukeTim commented 6 years ago

Is there a way to work around this?

I'm seeing this happen with the SwipeCards control. Very frustrating, nothing I try seems to resolve it.

MelbourneDeveloper commented 6 years ago

@StephaneDelcroix the exception is thrown, and then handled. It's not a crash. But, it does cause the debugger to break on the line where the exception is handled. The problem is that gobbling up exceptions eats performance.

adamped commented 6 years ago

@LukeTim @MelbourneDeveloper - if this is the same error that we were getting with the Ambiguous Exception, because we were using MvvmCross, then Stephane has PR'd a fix https://github.com/xamarin/Xamarin.Forms/pull/2766

But its not merged yet.

MelbourneDeveloper commented 6 years ago

@adamped , thanks but we are definitely not using MvvmCross.

We have to release our app in two days. @StephaneDelcroix , is there any chance of putting together a patch release? We're not going to have a chance to retest with a new NuGet package unless it's only a very minor change.

StephaneDelcroix commented 6 years ago

@MelbourneDeveloper your issue is definitely different, please open a new ticket, I'll look at fixing that tomorrow.

ryanharding commented 6 years ago

Hopefully this helps some people. ( @MelbourneDeveloper )

Was getting the same Ambiguous exception on my content pages, by adding [XamlCompilation(XamlCompilationOptions.Compile)] above the class of my content page the exception went away.

e.g.

namespace xxxxx { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class xxxxView : ContentPage {

StephaneDelcroix commented 6 years ago

@ryanharding indeed, that AmbiguousMatch only happen when runtime-inflating XAML

csstrunt commented 6 years ago

@StephaneDelcroix I put together a very simple example project showing the issue (no mvvmcross here!). App4.zip

It produces 3 AmbiguousMatchExceptions: System.Reflection.AmbiguousMatchException: Ambiguous match found. System.Reflection.AmbiguousMatchException: Ambiguous match found. System.Reflection.AmbiguousMatchException: Ambiguous match found.

Interestingly enough, the ListView by itself does NOT cause the issue. Only in conjunction with an enclosing StackLayout (or probably some other similar Layout?) the Exception gets thrown. Even more interesting is the fact that the more controls we add to the Stacklayout, the more Exceptions get thrown as I put down in the comments of my xaml.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:App4"
             x:Class="App4.MainPage"

             >

   <StackLayout>

      <!--If the ListView is NOT enclosed by a StackLayout (and no other controls are shown along the ListView), there is NO Ambiguous Exception-->
      <ListView x:Name="MyListView">
         <ListView.ItemTemplate>
            <DataTemplate>
               <ViewCell>
                  <Label Text="Some arbitrary text will do; no text binding required"/>
               </ViewCell>
            </DataTemplate>
         </ListView.ItemTemplate>
      </ListView>

      <!--If this Label is commented out, there is one Ambiguous Exception less shown in the Output Window ... ???-->
      <Label Text="Sittin on the dock of the Stacklayout"/>

      <!--If this button is commented out, there is one Ambiguous Exception less shown in the Output Window ... ???-->
      <Button Text="I'm just a button whose intentions are good ..."/>

   </StackLayout>
</ContentPage>

Hope that helps in reproducing and narrowing down the issue. Good luck! PS: I'm using Xamarin.Forms 3.0.0.446417

StephaneDelcroix commented 6 years ago

Thanks for the repro, but we know exactly where and why it happens.

rkotulan commented 6 years ago

Any estimation for release?

godrose commented 6 years ago

The latest pre-release has the same issue

duckwaffle commented 6 years ago

@StephaneDelcroix any idea of when your changes to fix this issue will be released? I even went so far as to see about getting the "nightly" build from MyGet, but it seems that the last time that was released was a few days before your PR was merged (which, I mean, you really ought to re-name the MyGet feed, as it's not really "nightly" now, is it?).

mgwalm commented 6 years ago

Ive got VS 15.2.7 and using xf 3.0.0.482510. Just updated to both today(May 31). An using Win 10 build1809.

It is still happening. As said above it is a RUNTIME exception on the LoadFromXaml in the .g.cs. The exception gets swallowed by XF.

Im only using normal basic binding, eg, <Entry x:Name="Pin1" Text="{Binding Pin1, Mode=TwoWay}"

However, the view appears to work after the exception.

mgwalm commented 6 years ago

Ive just checked - I have 11 basic bindings on a form and the exception gets thrown 11 times.