enisn / Xamarin.Forms.InputKit

CheckBox, Radio Button, Labeled Slider, Dropdowns etc.
MIT License
579 stars 98 forks source link

MAUI: App crash due to "Unable to find IAnimationManager for 'Microsoft.Maui.Controls.Shapes.Path'. Arg_ParamName_Name, animatable" by using inputkit:RadioButton #359

Closed satish-dnv closed 23 hours ago

satish-dnv commented 7 months ago

Describe the bug

Hi, I am encountering a critical issue in my .NET MAUI app when using the RadioButton from InputKit.MAUI package. The app crashes with the following error message:

"Unable to find IAnimationManager for 'Microsoft.Maui.Controls.Shapes.Path'. Arg_ParamName_Name, animatable"

This issue has been identified through logs in Sentry and is causing the app to become unusable. The App crashes in both Android and iOS.

To Reproduce Steps to reproduce the behavior:

  1. Use InputKit:RadioButton in XAML file.
  2. Build and deploy the app in release mode.
  3. Open the application, login with credentials and close the app.
  4. Try to open the application again by tapping on it.
  5. App crash at dashboard page, throwing the error in sentry logs.

Expected behavior Should be able to open the app unlimited times without a crash.

Screenshots

Screenshot 2023-11-20 at 10 11 46 AM

Smartphone (please complete the following information):

satish-dnv commented 7 months ago

Hi @enisn! We successfully addressed the bug by tweaking the code in the "src/InputKit.Maui/Shared/Controls/RadioButton.cs" file. Specifically, we replaced the iconChecked.ScaleTo(isChecked ? DOT_FULL_SCALE : 0, 180); with the following code: if (isChecked) { iconChecked.Scale = DOT_FULL_SCALE; } else { iconChecked.Scale = 0; } While this solution resolves the bug, it does impact the animation effect. We recommend investigating and refining the ScaleTo() function for a more seamless animation experience.

Thanks!

enisn commented 7 months ago

Thanks for the detailed information, We have faced this issue before in earlier version of MAUI https://github.com/dotnet/maui/issues/3353#issuecomment-1078861688

I'll investigate it again and if it happens in MAUI, I'll open an issue to dotnet/maui repo again

jbeen25 commented 6 days ago

My issue is a nearly identical problem. While the above comment did help me lead to a solution it was too abstract so I am going to add clarity to this comment. The easiest way to reproduce this bug is by attempting to set .IsChecked = true in the constructor of View/Page. This has to do with the nature of animation triggering from .IsChecked.

public MainPage()
{
    InitializeComponent();
    CheckBox.IsChecked = true;
}

To get around this, you need to use the Loaded event handle for your View/Page because animations can be performed once the View/Page is loaded.

private void ContentPage_Loaded(object sender, EventArgs e)
{
    CheckBox.IsChecked = true;
}

I am not aware of how to skip the animation by turning it off; however, I have a gut feeling it might be impossible to do so and is required to make the checkmark.