Performance Degradation, ANR, and Crashes After Migrating from Xamarin.Forms to .NET MAUI (v8) #26567
Replies: 1 comment
-
I would recommend to start with: https://learn.microsoft.com/en-us/dotnet/maui/deployment/performance?view=net-maui-9.0. It shows how to profile your app. That should show you perf bottlenecks. It is also true that while even though MAUI has improved a lot in terms of performance (and keeps improving with every release really), there are still known issue/improvements to be made. Also I would check if MAUI for .NET 9 makes your app faster or not. For many scenarios, it is. There are many changes between MAUI .NET 8 and 9 (bugfixes and perf improvements mostly). If you find something that is very slow, it's certainly good to report it in this repo or ask on Discord. |
Beta Was this translation helpful? Give feedback.
-
Environment:
Background: We migrated an enterprise application from Xamarin.Forms to .NET MAUI, following the recommended migration steps provided by Microsoft and community best practices. The app is complex and includes workflows involving PRISM for dependency injection and Navigation, Realm for offline database functionality, ReFit for network communication, and custom camera implementations for photo capture, along with SkiaSharp for some custom drawings.
After migrating to .NET MAUI (version 8), the performance of the app has significantly degraded. The app now experiences frequent ANR (Application Not Responding) issues and crashes, especially in workflows that were previously smooth and fast in Xamarin.Forms. Additionally, rendering performance has suffered after migrating custom renderers to handlers as per the latest guidelines.
We are using MAUI's built-in dependency injection (DI) for Pages and ViewModels, and we are still utilizing DryIoC (from PRISM) specifically for managing navigation. This mixture of DI frameworks might be contributing to the issue.
Issues:
1. Performance Degradation:
The app is much slower after migration. Screens that were responsive and fast in Xamarin.Forms now take longer to load and become unresponsive at times.
2. ANR (Application Not Responding):
The app frequently freezes, especially during network calls (via ReFit) or while interacting with the offline database (Realm). These delays are leading to ANR issues, where the app is not responsive for several seconds.
3. Crashes:
The app is experiencing frequent crashes. These are particularly happening when performing complex workflows like photo capture via custom camera implementations or drawing with SkiaSharp.
4. Rendering Issues:
After migrating from custom renderers to handlers, UI elements are not rendering as smoothly as before. Some UI elements are delayed in updating or fail to update correctly.
Steps Taken:
Expected Behavior:
Actual Behavior:
Request for Help:
Could anyone provide guidance on improving performance and stability in this scenario? Are there any known issues or workarounds related to complex workflows, Realm, ReFit, custom camera implementations, SkiaSharp, or renderers-to-handlers migration in .NET MAUI that could be contributing to these problems?
Any help or pointers would be greatly appreciated!
Additional Information:
Beta Was this translation helpful? Give feedback.
All reactions