-
Notifications
You must be signed in to change notification settings - Fork 545
Closed
Closed
Copy link
Labels
bugIf an issue is a bug or a pull request a bug fixIf an issue is a bug or a pull request a bug fix
Milestone
Description
Apple platform
iOS
Framework version
net9.0-*
Affected platform version
MAUI 9.0.21
Description
Getting a crash report with the following stack trace
System.ArgumentNullException: ArgumentNull_Generic Arg_ParamName_Name, window
?, in NativeHandle NativeObjectExtensions.GetNonNullHandle(INativeObject, string)
?, in UIInterfaceOrientationMask UIApplication.SupportedInterfaceOrientationsForWindow(UIWindow)
?, in UIInterfaceOrientationMask AppDelegate.GetSupportedInterfaceOrientations(UIApplication application, UIWindow forWindow)
?, in UIInterfaceOrientationMask __Registrar_Callbacks__.callback_11_CadabraMobile_iOS_AppDelegate_GetSupportedInterfaceOrientations(IntPtr pobj, IntPtr sel, IntPtr p0, IntPtr p1, IntPtr* exception_gchandle)
Apple marks the window parameter as nullable, but the generated code seems to be doing a null check.
Steps to Reproduce
My app is overriding supportedInterfaceOrientationsForWindow because we disallow rotation on all but one screen, so this can not be hardcoded in the info.plist
[Export("application:supportedInterfaceOrientationsForWindow:")]
public UIInterfaceOrientationMask GetSupportedInterfaceOrientations(UIApplication application,
UIWindow? forWindow)
{
if (forWindow?.WindowScene != null && AllowRotation)
{
return UIInterfaceOrientationMask.All;
}
return application.SupportedInterfaceOrientationsForWindow(forWindow);
}
Crash is being reported for iPad Pro (12.9-inch) (3rd generation) running iOS 17.6, app in foreground
Did you find any workaround?
No response
Relevant logs
No response
Metadata
Metadata
Assignees
Labels
bugIf an issue is a bug or a pull request a bug fixIf an issue is a bug or a pull request a bug fix