Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

CarouselView on iOS in XamarinForms 3.6: System.InvalidCastException: Specified cast is not valid. #5488

Closed
Ferenesht opened this issue Mar 7, 2019 · 10 comments
Labels
a/carouselview in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛
Milestone

Comments

@Ferenesht
Copy link

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?

@samhouts
Copy link
Member

samhouts commented Mar 7, 2019

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

@samhouts samhouts added s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. labels Mar 7, 2019
@Ferenesht
Copy link
Author

Sure thing!

https://github.com/bjorndaniel/CarouselViewBug

@Ralle1986
Copy link

I have the same issue

@samhouts samhouts removed s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/needs-repro ❔ This reported issue doesn't include a sample project reproducing the issue. Please provide one. labels Mar 11, 2019
@samhouts samhouts added this to the 4.0.0 milestone Mar 11, 2019
@danielmeza
Copy link

I have this issue with the 3.5 version.

@rmarinho
Copy link
Member

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 .

@samhouts samhouts modified the milestones: 4.0.0, 4.1.0 Apr 16, 2019
@kingces95
Copy link
Contributor

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

@kingces95
Copy link
Contributor

@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.

@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Jun 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/carouselview in-progress This issue has an associated pull request that may resolve it! p/iOS 🍎 t/bug 🐛
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants