dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

CommunityToolkit.Maui. popup crashes on iOS only #18952

Closed Swodah closed 11 months ago

Swodah commented 11 months ago

Description

A page CheckInOutLandingPage call static method that takes the page as a variable: await CheckInOutHelper.ShowCheckOutSuccess(this); method does the following:

  var dialog = new AnimDialog
  {
      IconAnimation = "warning.json",
      Title = MauiProgram.translator.GetText("CheckinFailedCode"),
      OkButton = ShowRetry == true ? MauiProgram.translator.GetText("Retry") : null,
      CancelButton = MauiProgram.translator.GetText("Back"),
      AudioFile = MediaSource.FromResource("CheckInOutFail.mp3"),
      CanBeDismissedByTappingOutsideOfPopup = false
  };

  var result = await parent.ShowPopupAsync(dialog);
  return result;

Note AnimDialog is a page that inherits from CommunityToolkit.Maui. popup

On Windows and android it plays the popup without issues. On iOS it causes a crash. Previously we got no crash but the page was broken.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.3

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

7.0.100

Affected platforms

iOS

Affected platform versions

ios 17.0 ipad simulator and iPadOS 17.1.1 physical device

Did you find any workaround?

No response

Relevant log output

the following stack trace:

   at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:line 2594
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 60
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
   at UMS_APP_MAUI.Program.Main(String[] args) in D:\Projects\Applab_MAUI\UMS_APP_MAUI\Platforms\iOS\Program.cs:line 12

and this message: ObjCRuntime.ObjCException: 'Objective-C exception thrown. Name: UIViewControllerHierarchyInconsistency Reason: child view controller:<AVPlayerViewController: 0x7fe4b5ddc000> should have parent view controller:<Microsoft_Maui_Platform_PageViewController: 0x7fe4b83321c0> but actual parent is:<Microsoft_Maui_Platform_PageViewController: 0x7fe4b3b742c0> Native stack trace: 0 CoreFoundation 0x0000000111a7428d __exceptionPreprocess + 242 1 libobjc.A.dylib 0x000000012362c894 objc_exception_throw + 48 2 CoreFoundation 0x0000000111a7416b -[NSException initWithCoder:] + 0 3 UIKitCore 0x000000013cfb7bb5 -[UIView(Hierarchy) _associatedViewControllerForwardsAppearanceCallbacks:performHierarchyCheck:isRoot:] + 287 4 UIKitCore 0x000000013cfb84bd -[UIView(Hierarchy) _willMoveToWindow:withAncestorView:] + 330 5 UIKitCore 0x000000013cfb94c0 _makeSubTreePerformSelector + 655 6 UIKitCore 0x000000013cfb9502 _makeSubTreePerformSelector + 721 7 UIKitCore 0x000000013cfb9502 _makeSubTreePerformSelector + 721 8 UIKitCore 0x000000013cfb9502 _makeSubTreePerformSelector + 721 9 UIKitCore 0x000000013cfb9502 _makeSubTreePerformSelector + 721 10 UIKitCore 0x000000013cfb9502 _makeSubTreePerformSelector + 721 11 UIKitCore 0x000000013cfb9502 _makeSubTreePerformSelector + 721 12 UIKitCore 0x000000013cfb9502 _makeSubTreePerformSelector + 721 13 UIKitCore 0x000000013cfb9502 _makeSubTreePerformSelector + 721 14 UIKitCore 0x000000013cfc9c41 -[UIView(Internal) _addSubview:positioned:relativeTo:] + 524 15 UIKitCore 0x000000013bf68291 __67-[UIViewControllerBuiltinTransitionViewAnimator animateTransition:]_block_invoke_2 + 46 16 UIKitCore 0x000000013cfc2ac4 +[UIView(Animation) performWithoutAnimation:] + 84 17 UIKitCore 0x000000013bf6821b __67-[UIViewControllerBuiltinTransitionViewAnimator animateTransition:]_block_invoke + 115 18 UIKitCore 0x000000013cfc447f +[UIView _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 593 19 UIKitCore 0x000000013cfc4ad1 +[UIView(UIViewAnimationWithBlocks) animateWithDuration:delay:options:animations:completion:] + 25 20 UIKitCore 0x000000013bf67fba -[UIViewControllerBuiltinTransitionViewAnimator animateTransition:] + 3624 21 UIKitCore 0x000000013bd7f45e -[_UIModernPopoverAnimationController animateTransition:] + 606 22 UIKitCore 0x000000013bf70a2d ___UIViewControllerTransitioningRunCustomTransition_block_invoke_2 + 59 23 UIKitCore 0x000000013c107975 +[UIKeyboardSceneDelegate _pinInputViewsForKeyboardSceneDelegate:onBehalfOfResponder:duringBlock:] + 100 24 UIKitCore 0x000000013bf709b8 ___UIViewControllerTransitioningRunCustomTransition_block_invoke.649 + 178 25 UIKitCore 0x000000013cfc2810 +[UIView(Animation) _setAlongsideAnimations:toRunByEndOfBlock:] + 176 26 UIKitCore 0x000000013bf70839 _UIViewControllerTransitioningRunCustomTransition + 577 27 UIKitCore 0x000000013be007a1 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke.430 + 2431 28 UIKitCore 0x000000013cf5799c -[_UIAfterCACommitBlock run] + 55 29 UIKitCore 0x000000013cf57e82 -[_UIAfterCACommitQueue flush] + 189 30 UIKitCore 0x000000013c913b5f _runAfterCACommitDeferredBlocks + 784 31 UIKitCore 0x000000013c902a05 _cleanUpAfterCAFlushAndRunDeferredBlocks + 96 32 UIKitCore 0x000000013c9377f8 _afterCACommitHandler + 58 33 CoreFoundation 0x00000001119cfd94 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23 34 CoreFoundation 0x00000001119ca72a __CFRunLoopDoObservers + 534 35 CoreFoundation 0x00000001119cac72 __CFRunLoopRun + 1158 36 CoreFoundation 0x00000001119ca409 CFRunLoopRunSpecific + 557 37 GraphicsServices 0x000000012a81d187 GSEventRunModal + 137 38 UIKitCore 0x000000013c9043a2 -[UIApplication _run] + 972 39 UIKitCore 0x000000013c908e10 UIApplicationMain + 123 40 libxamarin-dotnet-debug.dylib 0x000000010edb74da xamarin_UIApplicationMain + 58 41 libmonosgen-2.0.dylib 0x000000010f555bc5 do_icall + 341 42 libmonosgen-2.0.dylib 0x000000010f554357 do_icall_wrapper + 295 43 libmonosgen-2.0.dylib 0x000000010f545076 mono_interp_exec_method + 3990 44 libmonosgen-2.0.dylib 0x000000010f5427e3 interp_runtime_invoke + 259 45 libmonosgen-2.0.dylib 0x000000010f628908 mono_runtime_invoke_checked + 136 46 libmonosgen-2.0.dylib 0x000000010f6300db mono_runtime_exec_main_checked + 107 47 libmonosgen-2.0.dylib 0x000000010f494f52 mono_jit_exec + 354 48 libxamarin-dotnet-debug.dylib 0x000000010edfbbba xamarin_main + 1898 49 UMS_APP_MAUI 0x00000001046345d4 main + 68 50 dyld 0x000000010d6023ee start_sim + 10 51 ??? 0x0000000204d3e3a6 0x0 + 8670929830 '

PureWeen commented 11 months ago

This issue was moved to CommunityToolkit/Maui#1556