Xamarin.forms: CarouselView on iOS in XamarinForms 3.6: System.InvalidCastException: Specified cast is not valid.

Created on 7 Mar 2019  路  10Comments  路  Source: xamarin/Xamarin.Forms

Description

When trying to use the CarouselView after updating to Xamarin Forms 3.6 the iOS app crashes in the Main function of the Application class with the following exception:

System.InvalidCastException: Specified cast is not valid.

The CarouselView works perfect on Android without any issues.

Stacktrace:

{System.InvalidCastException: Specified cast is not valid.
at (wrapper castclass) System.Object.__castclass_with_cache(object,intptr,intptr)
at Xamarin.Forms.Internals.Registrar1[TRegistrable].GetHandler (System.Type type, System.Type visualType) [0x00030] in D:\a\1\s\Xamarin.Forms.Core\Registrar.cs:56 at Xamarin.Forms.Internals.Registrar1[TRegistrable].GetHandlerForObject[TOut] (System.Object obj) [0x0002c] in D:\a\1\s\Xamarin.Forms.Core\Registrar.cs:91
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00005] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003d] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in <0648e2dffe9e4201b8c6e274ced6579f>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003d] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad () [0x00086] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper(intptr,intptr)
at UIKit.UIViewController.get_View () [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.15/src/Xamarin.iOS/UIKit/UIViewController.g.cs:2983
at Xamarin.Forms.Platform.iOS.PageRenderer.get_NativeView () [0x00008] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.PageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0004f] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.Platform.AddChild (Xamarin.Forms.VisualElement view) [0x00027] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.Platform.WillAppear () [0x00043] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.PlatformRenderer.ViewWillAppear (System.Boolean animated) [0x00016] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at (wrapper managed-to-native) ObjCRuntime.Messaging.void_objc_msgSend_IntPtr(intptr,intptr,intptr)
at UIKit.UIWindow.set_RootViewController (UIKit.UIViewController value) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.15/src/Xamarin.iOS/UIKit/UIWindow.g.cs:335
at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.UpdateMainPage () [0x00043] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.ApplicationOnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs args) [0x00012] in <0648e2dffe9e4201b8c6e274ced6579f>:0
at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:173
at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in D:\a\1\s

Any ideas how to make the CarouselView work on iOS?

carouselview in-progress iOS 馃崕 bug

Most helpful comment

CarouselView is not implemented yet, you could check the the branch we are working on https://github.com/xamarin/Xamarin.Forms/tree/spec-carousel

I can get you some nupkg to test if you want .

All 10 comments

@Ferenesht Can you please attach your sample project? Thanks!

I have the same issue

I have this issue with the 3.5 version.

CarouselView is not implemented yet, you could check the the branch we are working on https://github.com/xamarin/Xamarin.Forms/tree/spec-carousel

I can get you some nupkg to test if you want .

Well, I can confirm that this worked on Android on the version posted, but not on the latest master.

@Ferenesht the long and the short of it is that we don't really have a CV for you to preview at the moment. We got re-tasked to getting Shell working. So please stay tuned after Shell ships for new on CV. Gonna close this bug out for now but feel free to re-open once we get a public CV released to preview.

We aren't supporting CarouselView yet, we are tracking that work with the spec and you can try the implementation to give feedback using this pr https://github.com/xamarin/Xamarin.Forms/pull/5044

Team,
When is CarouselView for iOS expected to be released?

Our app mainly depends on this control and we couldn't able to update XF to 4.0 and utilise its features completely.

@akaruthethil-nlg CarouselView is currently scheduled for 4.2. You can always check our roadmap here: https://github.com/xamarin/Xamarin.Forms/wiki/Feature-Roadmap#420-augustseptember-2019

Was this page helpful?
0 / 5 - 0 ratings