Loading Chart crashes on iOS - InvalidCastException

9 posts, 0 answers
  1. user01
    user01 avatar
    1 posts
    Member since:
    Apr 2018

    Posted 23 Sep 2019 Link to this post

    Starting from 2018.3.912.1 (was not able to reproduce in 2018.2.821.1 or earlier), loading charts on iOS crashes the device. This happens in the sample project SDKBrowser provided as well, when opening any of the Series charts (specifically the Vertical Bar which is what we have been using).

    Stack trace of the crash:

     

    System.InvalidCastException: Specified cast is not valid.
      at Telerik.XamarinForms.ChartRenderer.iOS.ManagedChartDataSource.GetDataPoint (TelerikUI.TKChart chart, System.nuint dataIndex, System.nuint seriesIndex) [0x0002a] in <94eed00967c543f5a13e0605d41bd543>:0
      at Telerik.XamarinForms.ChartRenderer.iOS.ManagedChartDataSource.GetPoint (TelerikUI.TKChart chart, System.nuint dataIndex, System.nuint seriesIndex) [0x0002c] in <94eed00967c543f5a13e0605d41bd543>:0
      at (wrapper managed-to-native) ApiDefinition.Messaging.void_objc_msgSendSuper_IntPtr(intptr,intptr,intptr)
      at TelerikUI.TKChart.set_XAxis (TelerikUI.TKChartAxis value) [0x00047] in <44e9726d5f6f4545a2e89f7d32ff2c9f>:0
      at Telerik.XamarinForms.ChartRenderer.iOS.CartesianChartAdapter.UpdateXAxis (Telerik.XamarinForms.Chart.RadCartesianChart sourceOwner, TelerikUI.TKChart targetOwner) [0x0002e] in <94eed00967c543f5a13e0605d41bd543>:0
      at Telerik.XamarinForms.ChartRenderer.iOS.CartesianChartAdapter.UpdateCore (Telerik.XamarinForms.Chart.RadCartesianChart sourceOwner, Telerik.XamarinForms.ChartRenderer.iOS.TKExtendedChart targetOwner, System.String propertyName, Telerik.XamarinForms.Common.IParentElement sourceOwnerRoot, System.Object targetOwnerRoot) [0x0003f] in <94eed00967c543f5a13e0605d41bd543>:0
      at Telerik.XamarinForms.ChartRenderer.iOS.BaseChartAdapter`1[S].Update (System.Object sourceOwner, System.Object targetOwner, System.String propertyName, System.Object sourceOwnerRoot, System.Object targetOwnerRoot) [0x00000] in <94eed00967c543f5a13e0605d41bd543>:0
      at Telerik.XamarinForms.Common.XamarinToNativeControlExtensions.Update[T,K] (T nativeElement, K xfЕlement, System.String propertyName, System.Object sourceOwnerRoot, System.Object targetOwnerRoot) [0x00031] in <e2f1740c30914d7ea94cb9f8115f6f61>:0
      at Telerik.XamarinForms.ChartRenderer.iOS.BaseChartRenderer`1[T].OnElementAttached (T newElement) [0x00068] in <94eed00967c543f5a13e0605d41bd543>:0
      at Telerik.XamarinForms.ChartRenderer.iOS.CartesianChartRenderer.OnElementAttached (Telerik.XamarinForms.Chart.RadCartesianChart newElement) [0x00000] in <94eed00967c543f5a13e0605d41bd543>:0
      at Telerik.XamarinForms.Common.iOS.IosRendererBase`2[S,T].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x0003f] in <e2f1740c30914d7ea94cb9f8115f6f61>:0
      at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x0012a] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003d] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000de] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003d] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x000de] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003d] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (System.Object sender, Xamarin.Forms.ElementEventArgs e) [0x0000f] in <0da03a4594684a9bbf17d4a99d39fbc2>:0
      at Xamarin.Forms.Element.OnChildAdded (Xamarin.Forms.Element child) [0x0000f] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:332
      at Xamarin.Forms.VisualElement.OnChildAdded (Xamarin.Forms.Element child) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\VisualElement.cs:742
      at Xamarin.Forms.Layout.OnInternalAdded (Xamarin.Forms.View view) [0x0001d] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:453
      at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00078] in D:\a\1\s\Xamarin.Forms.Core\Layout.cs:443
      at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00018] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:263
      at System.Collections.ObjectModel.ObservableCollection`1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:338
      at System.Collections.ObjectModel.ObservableCollection`1[T].InsertItem (System.Int32 index, T item) [0x0001a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.ObjectModel/src/System/Collections/ObjectModel/ObservableCollection.cs:196
      at System.Collections.ObjectModel.Collection`1[T].Add (T item) [0x00020] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs:71
      at Xamarin.Forms.ContentPresenter.OnContentChanged (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x0004e] in D:\a\1\s\Xamarin.Forms.Core\ContentPresenter.cs:88
      at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
      at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.16.1.24/src/Xamarin.iOS/Foundation/NSAction.cs:178
      at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
      at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.16.1.24/src/Xamarin.iOS/UIKit/UIApplication.cs:86
      at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.16.1.24/src/Xamarin.iOS/UIKit/UIApplication.cs:65
      at SDKBrowser.iOS.Application.Main (System.String[] args) [0x00001] in /Users/username/Downloads/613233149246cf225930444fa4e25dc3_Telerik_UI_for_Xamarin_2019_3_913_1_Trial/Examples/Forms/SDKBrowser/SDKBrowser.iOS/Main.cs:14

     

    This is happening on iOS Simulator 12.4, and on device on iOS 13.0. The current workaround is to stay on the old version of 2018.2.*, but this is not really a good workaround.

  2. Yana
    Admin
    Yana avatar
    4948 posts

    Posted 24 Sep 2019 Link to this post

    Hello,

    Thank you for sending the detailed stack trace.

    I managed to reproduce the exception on iOS in certain cases ( it is not reproduced on every emulator, that's probably the reason we missed it). I logged a public bug report on your behalf, please follow the item below in order to get notified on status changes:

    https://feedback.telerik.com/xamarin/1431067-chart-ios-invalidcastexception-is-thrown-when-the-chart-is-loaded

    I escalated the issue to the dev team, so they will look into it at first chance. 

    I am sorry for the caused inconvenience. I've updated your points as a small sign of gratitude for your involvement.

    Regards,
    Yana
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Chris
    Chris avatar
    7 posts
    Member since:
    Apr 2012

    Posted 05 Oct 2019 Link to this post

    Can confirm this is happening for us as well with version 2019.3.913.1, using a number of different simulators running iOS 10.2, 12.4.1, and 13.0. Also occurs on a physical iOS XS Max device. So far we haven't been able to find a case where it doesn't happen actually.

    Will follow the above public bug report, thanks!

  4. Yana
    Admin
    Yana avatar
    4948 posts

    Posted 07 Oct 2019 Link to this post

    Hello guys,

    I'm glad to inform you the issue is now resolved in the latest minor release 2019.3.1004. 

    Please give it a try it and if you experience any issues, drop us a line.

    Regards,
    Yana
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Ian
    Ian avatar
    68 posts
    Member since:
    Jul 2017

    Posted 19 Jan Link to this post

    Where can one find this update? The latest version that I can find from Telerik Nuget server is 2019.2.619.1. With this version, I'm still getting the in valid cast exception.
  6. Yana
    Admin
    Yana avatar
    4948 posts

    Posted 20 Jan Link to this post

    Hello Ian,

    You'd need to have a valid trial or paid license at the time the version was released  ( October 4, 2019 for the concrete version).

    Please check the account you're using for logging into the Telerik Nuget Server and update it, if needed.

    If you still have difficulties with this, open a support ticket with more details on your account, so I can assist you further.

    Regards,
    Yana
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Warren Rogers
    Warren Rogers avatar
    2 posts
    Member since:
    Jun 2018

    Posted 20 Jan in reply to Yana Link to this post

    The subscription expired in June 2019.

    Please could you explain why this error occurs? Why would a previously working component stop working?

  8. Ian
    Ian avatar
    68 posts
    Member since:
    Jul 2017

    Posted 20 Jan in reply to Warren Rogers Link to this post

    Sorry, that wasn't Warren above. It was me, Ian!
  9. Yana
    Admin
    Yana avatar
    4948 posts

    Posted 21 Jan Link to this post

    Hi Ian,

    I checked the issue discussed in this thread and actually it occurred with an upgrade of Visual Studio 2019 - customers started to experience the exception after upgrading to VS 2019 16.3.1. It seems something has changed in msbuild with that version and our dev team managed to adapt our code to the changes with 2019.2.1004 minor release, so that it handles the scenario correctly.

    I am sorry for the caused inconvenience.

    Regards,
    Yana
    Progress Telerik

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top