MvvmCross / MvvmCross-AndroidSupport

Android support library packages for MvvmCross: The .NET MVVM framework for cross-platform solutions.
http://mvvmcross.com
15 stars 0 forks source link

upgrade to Xamarin 6 breaks mvvmcross android view MvxAutoCompleteTextView #284

Closed ghost closed 8 years ago

ghost commented 8 years ago

This code works on Xamarin 5

MvxAutoCompleteTextView _plateSearch = v.FindViewById<MvxAutoCompleteTextView>(Resource.Id.PlateSearch);

however after upgrading to Xamarin 6

System.InvalidCastException: Unable to convert instance of type 'MvvmCross.Droid.Support.V7.AppCompat.Widget.MvxAppCompatAutoCompleteTextView' to type 'MvvmCross.Binding.Droid.Views.MvxAutoCompleteTextView'.

MVVMCross 4.4 libraries Xamarin.Android.Support.v4 - 23.3 Xamarin.Android.Support.v7 23.3

Tried solution clean, tried restart, tried closing and re-opening Xamarin. Tried upgrading to latest mvvmcross libraries and latest Xamarin.Android.Support.v4 & Xamarin.Android.Support.v7 - same issue

please help as this is holding up our latest release to production.

martijn00 commented 8 years ago

So what happens if you don't cast it to MvxAutoCompleteTextView?

ghost commented 8 years ago

indicates it cannot do a implicit cast hence will not build. Error CS0266: Cannot implicitly convert type Android.Views.View' toMvvmCross.Binding.Droid.Views.MvxAutoCompleteTextView'. An explicit conversion exists (are you missing a cast?) (CS0266)

Cheesebaron commented 8 years ago

What namespace are you using in your AXML file? Seems like you are using MvxAutoCompleteTextView from one library in your AXML and trying to cast it to something else. Check your types and namespaces.

martijn00 commented 8 years ago

Isn't this related to https://github.com/MvvmCross/MvvmCross-AndroidSupport/issues/257 ?

Cheesebaron commented 8 years ago

It does not seem like it is related. I looks like a casting exception because wrong namespaces are used. However, it is not clear at all from the example given.