Troubleshooting iOS Simulator Crashes when Using Charts in MAUI

1 Answer 223 Views
Chart
Xiaoke
Top achievements
Rank 1
Xiaoke asked on 16 Jun 2023, 07:45 PM

Hello,

When I used the RadCartesianChart and RadPieChart in MAUI with the sample code from https://docs.telerik.com/devtools/maui/controls/chart/types/pie-chart, the iOS simulator failed to open successfully, displaying a crash message. However, when I use RadButton and RadCheckBox, it works fine, so I can assure the successful configuration.

Visual Studio Community 2022 for Mac
version 17.5.7 (build 6)

Runtime
.NET 7.0.1 (64-bit)
Architecture: X64
Microsoft.macOS.Sdk 12.3.2372;

NuGet
version: 6.4.0.117

Maui: 7.0.86

Telerik.Ul.for.Maui.Trial -5.2.0

Please can you help me to solve this problem.

Best regards

 

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 16 Jun 2023, 08:35 PM

Hello Xiaoke,

Can you please confirm you finished the getting started instructions and added UseTelerik() to MauiProgram.cs?

using Telerik.Maui.Controls.Compatibility;

namespace YourMauiApplication;

public static class MauiProgram
{
    public static MauiApp CreateMauiApp()
    {
        var builder = MauiApp.CreateBuilder();
        builder
            .UseMauiApp<App>()
            .UseTelerik()
            .ConfigureFonts(fonts =>
            {
                 fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
            });

            return builder.Build();
    }
}

 

The reason I suspect this is your problem is because the RadButton and RadCheckbox are brand new components that are Handler based. Whereas the Chart is a native control that uses a renderer (the compatibility layer)... so it must have those renderers registered in order to work in .NET MAUI otherwise you get launch exception like you're seeing. Renderers are all registered in that single method call I show above.

So please, go back to the Getting Started article and skip to Step #4 to confirm that your project has that requirement. Then do a rebuild and deploy.

Regards,
Lance | Manager Technical Support
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Xiaoke
Top achievements
Rank 1
commented on 17 Jun 2023, 01:00 AM

Yes, I confirm that I have added UseTelerik() to MauiProgram.cs. When I set the Maui version to 7.0.59, the problem has been resolved. It seems that there is an issue with the RadChart in the latest Maui version. Thank you for your help.
Didi
Telerik team
commented on 19 Jun 2023, 05:08 AM

Hi, Xiaoke,

I am glad to hear downgrading the Maui version solved the behavior. Regarding to the crash with latest version, we have not been reported such behavior. If you can send us a sample app where the behavior occurs, or the page definition where the chart is added. Then we can research the case further.

Jason
Top achievements
Rank 1
commented on 21 Jan 2024, 04:45 AM

I may be having a similar problem to this. The App runs on a physical iPad device but crashes in ANY of the Mac/iOS simulators. This only happens on .net8 and Telerik.UI.for.Maui 6.6.0.

XAML:

            <chart:RadCartesianChart x:Name="PageloadChart" AutomationId="chart" BackgroundColor="#99ff443a">
                <chart:RadCartesianChart.HorizontalAxis>
                    <chart:CategoricalAxis LineColor="Gray" LabelTextColor="Black" MajorTickThickness="0"/>
                </chart:RadCartesianChart.HorizontalAxis>
                <chart:RadCartesianChart.VerticalAxis>
                    <chart:NumericalAxis Minimum="0" ShowLabels="True" MajorTickThickness="0" />
                </chart:RadCartesianChart.VerticalAxis>
                <chart:RadCartesianChart.Grid>
                    <chart:CartesianChartGrid MajorLinesVisibility="Y"
                                              MajorLineThickness="1"
                                              MajorLineColor="Gray" />
                </chart:RadCartesianChart.Grid>
                <chart:RadCartesianChart.Series>
                    <chart:BarSeries CategoryBinding="Category"
                                     ValueBinding="Value"
                                     ItemsSource="{Binding CurrentItem.PageloadData}" />
                </chart:RadCartesianChart.Series>
            </chart:RadCartesianChart>

Output window:

2024-01-20 21:37:18.288718-0700 [41587:3425083] *** NSForwarding: warning: object 0x6000016721c0 of class 'Telerik_Maui_Controls_Compatibility_ChartRenderer_iOS_TKExtendedChart' does not implement methodSignatureForSelector: -- trouble ahead
2024-01-20 21:37:18.288851-0700 [41587:3425083] *** NSForwarding: warning: object 0x6000016721c0 of class 'Telerik_Maui_Controls_Compatibility_ChartRenderer_iOS_TKExtendedChart' does not implement doesNotRecognizeSelector: -- abort
The app has been terminated.

 

Then the application hard crashes.

Jason
Top achievements
Rank 1
commented on 21 Jan 2024, 06:09 AM

This is popping up in many other forums. Makes me think it is a Telerik issue not in my code.

 

https://stackoverflow.com/questions/77844194/maui-ios-17-2-simulator-not-running-errors

Didi
Telerik team
commented on 22 Jan 2024, 09:57 AM

Hi Jason,

The issue is logged here: https://feedback.telerik.com/maui/1636181-controls-runtime-exception-on-ios-simulators-with-microsoft-net-ios-sdk-8-0-100-17-0-8490 
It happens with a concrete version of the Microsoft .NET iOS sdk. 

Fix is expected in the upcoming release, at the end of January 2024.

Tags
Chart
Asked by
Xiaoke
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or