Grial-UI-Kit-Support icon indicating copy to clipboard operation
Grial-UI-Kit-Support copied to clipboard

ObjectDisposedException when changing orientation on Android

Open francois-junker opened this issue 7 months ago • 0 comments

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

  1. Open the application on an Android device.
  2. Navigate to any screen with styles that change based on orientation.
  3. 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

francois-junker avatar Jul 02 '24 13:07 francois-junker