Grial-UI-Kit-Support
Grial-UI-Kit-Support copied to clipboard
ObjectDisposedException when changing orientation on Android
Description
In our MAUI application, an ObjectDisposedException occurs when the device orientation is changed. This issue is specifically encountered on Android devices. The exception message states: "System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Microsoft.Maui.Platform.LayoutViewGroup'." The exception occurs on the line: GrialKit.NotifyConfigurationChanged(newConfig);. However, we have observed the same exception on multiple screens, and the object type mentioned in the exception is not always the same.
Steps to Reproduce
- Open the application on an Android device.
- Navigate to any screen with styles that change based on orientation.
- Change the device orientation from portrait to landscape or vice versa.
Expected Behavior
The application should adjust to the new orientation without throwing any exceptions.
Actual Behavior
The application throws an ObjectDisposedException and may crash or behave unexpectedly.
Basic Information
- Version with issue (.NET MAUI or Xamarin.Forms?): .NET MAUI
- IDE: Visual Studio 2022 17.10.3
- Platform Target Frameworks:
- Android: 14.0 API 34
- Nuget Packages: -- Microsoft.Maui.Controls 8.0.61 -- GrialMaui 4.2.115
- Affected Devices: Tested on emulator and Samsung S23 FE