I have a ContentPage (called VideoPage) in which I add a MediaElement, no autoplay, no playback controls displayed.
I navigate to this page from another ContentPage (called MainPage), with Navigation.PushAsync(new VideoPage())
Sometimes when I navigate back from the VideoPage to the MainPage, using the default shell back navigation, the MainPage becomes completely frozen/unresponsive.
This is not always the case, only sometimes this happens, but if I try it a few times, I manage to reproduce the fault behaviour.
I use Xamarin Forms 4.7.1080.
This happens only in iOS, on Android I don't have this problem.
This behaviour is independent of starting or not starting the playback of the mp4 in the MediaElement.
A sample application can be found here: https://wetransfer.com/downloads/c0cb60b8520c8fda40882a263c12574120200724125634/938ab9
Here is a crash dump I get in the test app:
Native Crash Reporting
================================================================= Got a segv while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.
================================================================= Native stacktrace:
```0x100bb0885 - /Users/gbladmin/Library/Developer/CoreSimulator/Devices/C16ED7B8-CA8C-4D19-967C-FF3E2218F340/data/Containers/Bundle/Application/7F89C9DB-08DC-40E3-802E-DF85C390EE7D/testmediaelement.iOS.app/testmediaelement.iOS : mono_dump_native_crash_info
0x100ba53e5 - /Users/gbladmin/Library/Developer/CoreSimulator/Devices/C16ED7B8-CA8C-4D19-967C-FF3E2218F340/data/Containers/Bundle/Application/7F89C9DB-08DC-40E3-802E-DF85C390EE7D/testmediaelement.iOS.app/testmediaelement.iOS : mono_handle_native_crash
0x100bb717b - /Users/gbladmin/Library/Developer/CoreSimulator/Devices/C16ED7B8-CA8C-4D19-967C-FF3E2218F340/data/Containers/Bundle/Application/7F89C9DB-08DC-40E3-802E-DF85C390EE7D/testmediaelement.iOS.app/testmediaelement.iOS : mono_sigsegv_signal_handler_debug
0x7fff51c005fd - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
0x7fff51bdda55 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_malloc.dylib : malloc
0x7fff258f25a3 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation : NSKeyValueWillChangeWithPerThreadPendingNotifications
0x108a44a24 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/AccessibilityBundles/AVFoundation.axbundle/AVFoundation : -[AVPlayerAccessibility willChangeValueForKey:]
0x7fff2095ec53 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/AVFoundation : -[AVPlayer setRate:withVolumeRampDuration:playImmediately:rateChangeReason:]
0x7fff2095f01a - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/AVFoundation.framework/AVFoundation : -[AVPlayer setRate:]
0x100dd3949 - /Users/gbladmin/Library/Developer/CoreSimulator/Devices/C16ED7B8-CA8C-4D19-967C-FF3E2218F340/data/Containers/Bundle/Application/7F89C9DB-08DC-40E3-802E-DF85C390EE7D/testmediaelement.iOS.app/testmediaelement.iOS : xamarin_dyn_objc_msgSend
0x107b6c5c2 - Unknown
0x118b0db83 - Unknown
0x118b0d043 - Unknown```
================================================================= Basic Fault Address Reporting
Memory around native instruction pointer (0x7fff50ba75f1):0x7fff50ba75e1 08 5b 41 5e 41 5f 5d c3 48 85 ff 7e 09 48 8b 07 .[A^A_].H..~.H.. 0x7fff50ba75f1 8a 40 1c 24 01 c3 31 c0 c3 48 85 ff 74 17 78 1d .@.$..1..H..t.x. 0x7fff50ba7601 48 8b 07 48 85 c0 74 0d 48 89 c7 be 01 00 00 00 H..H..t.H....... 0x7fff50ba7611 e9 a0 d4 00 00 48 8d 05 5b 1c 02 00 c3 48 89 f8 .....H..[....H..
================================================================= Managed Stacktrace:
```at <unknown> <0xffffffff>
at ObjCRuntime.Messaging:void_objc_msgSend <0x000e1>
at AVFoundation.AVPlayer:Pause <0x00122>
at Xamarin.Forms.Platform.iOS.MediaElementRenderer:Dispose <0x00253>
at Foundation.NSObject:Dispose <0x00074>
at Xamarin.Forms.Platform.iOS.DisposeHelpers:DisposeModalAndChildRenderers <0x0030f>
at Xamarin.Forms.Platform.iOS.Platform:HandleChildRemoved <0x000d2>
at Xamarin.Forms.Element:OnDescendantRemoved <0x00120>
at Xamarin.Forms.Element:OnDescendantRemoved <0x001a2>
at Xamarin.Forms.Element:OnDescendantRemoved <0x001a2>
at Xamarin.Forms.Element:OnChildRemoved <0x00182>
at Xamarin.Forms.ShellSection:OnChildRemoved <0x00372>
at Xamarin.Forms.ShellSection:RemovePage <0x000d7>
at <Xamarin-Forms-IShellSectionController-SendPopping>d__21:MoveNext <0x00522>
at MoveNextRunner:InvokeMoveNext <0x000ab>
at System.Threading.ExecutionContext:RunInternal <0x00585>
at System.Threading.ExecutionContext:Run <0x00092>
at MoveNextRunner:Run <0x001aa>
at System.Threading.Tasks.AwaitTaskContinuation:InvokeAction <0x00093>
at System.Threading.Tasks.AwaitTaskContinuation:RunCallback <0x00153>
at System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run <0x0013a>
at System.Threading.Tasks.Task:FinishContinuations <0x00e0b>
at System.Threading.Tasks.Task:FinishStageThree <0x0015a>
at System.Threading.Tasks.Task`1:TrySetResult <0x0022a>
at System.Threading.Tasks.TaskCompletionSource`1:TrySetResult <0x00092>
at NavDelegate:DidShowViewController <0x00222>
at <Module>:runtime_invoke_void__this___object_object_byte <0x001fa>
at <unknown> <0xffffffff>
at UIKit.UIApplication:UIApplicationMain <0x00254>
at UIKit.UIApplication:Main <0x000b2>
at UIKit.UIApplication:Main <0x00132>
at testmediaelement.iOS.Application:Main <0x00092>
at <Module>:runtime_invoke_void_object <0x00198>```
=================================================================