Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.
This repository was archived by the owner on May 15, 2024. It is now read-only.

[Bug] App crashes on ios simulator when using PhoneDialer.Open() even though exception handling is present #1652

@themronion

Description

@themronion

Steps to Reproduce

I am aware the apple didnt implement phone calls and sms on their simulator but i dont understand why this code still crashes. The exception is being thrown and it must be catched in the catch block. Maybe there is something else going on there (maybe that has something to do with Hot Reload)? Give it a look please, maybe it is a bug?

try
{ 
     PhoneDialer.Open("yourphone");
}
catch (Exception ex)
{
     Console.WriteLine($"Exception while opening dialer: {ex.Message}");
}

Even though try catch is present is the code the app will crash with the fllowing stack trace:

2021-01-24 14:27:20.995519+0200 MobilAutoNew.iOS[24092:144521] -canOpenURL: failed for URL: "tel:0000000000" - error: "This app is not allowed to query for scheme tel"
**Xamarin.Essentials.FeatureNotSupportedException:** 'Specified method is not supported.'

[HotReload] (2021-01-24 14:27:23.5): ERROR: Caught exception in AgentStatusChangedHandler at 215: Xamarin.HotReload.UnhandledDeviceException: Specified method is not supported.
   в Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
   в Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
[HotReload] (2021-01-24 14:27:23.5): ERROR: Specified method is not supported.
	at Xamarin.Essentials.PhoneDialer.ValidateOpen (System.String number) [0x0001a] in D:\a\1\s\Xamarin.Essentials\PhoneDialer\PhoneDialer.shared.cs:13
	at Xamarin.Essentials.PhoneDialer.PlatformOpen (System.String number) [0x0000a] in D:\a\1\s\Xamarin.Essentials\PhoneDialer\PhoneDialer.ios.cs:16
	at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021
	at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/Foundation/NSAction.cs:178
	at at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr) in :0
	at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:86
	at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:65
	at MobilAutoNew.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\pavlo\source\repos\MobilAutoNew\MobilAutoNew.iOS\Main.cs:17
[HotReload] (2021-01-24 14:27:23.5): INFO: Не удалось запустить Горячую перезагрузку XAML. Если проблема сохраняется, выберите "Справка" -> "Сообщить о проблеме".
[HotReload] (2021-01-24 14:27:23.5): INFO: Stopping All Hot Reload sessions due to Failed ...
[HotReload] (2021-01-24 14:27:23.5): INFO: (MobilAutoNew.iOS) Stopped Hot Reload session due to Failed ...
[HotReload] (2021-01-24 14:27:23.5): INFO: Stopped Hot Reload session.
[HotReload] (2021-01-24 14:27:23.5): ERROR: (MobilAutoNew.iOS) Caught exception in Debugger_TargetUnhandledException at 208: Xamarin.HotReload.UnhandledDeviceException: Specified method is not supported.

Thread finished: <Thread Pool> #8
Поток 0x8 завершился с кодом 0 (0x0).
Thread started: <Thread Pool> #17
2021-01-24 14:27:22.647329+0200 MobilAutoNew.iOS[24092:144521] 
Unhandled Exception:
Xamarin.Essentials.FeatureNotSupportedException: Specified method is not supported.
  at Xamarin.Essentials.PhoneDialer.ValidateOpen (System.String number) [0x0001a] in D:\a\1\s\Xamarin.Essentials\PhoneDialer\PhoneDialer.shared.cs:13 
  at Xamarin.Essentials.PhoneDialer.PlatformOpen (System.String number) [0x0000a] in D:\a\1\s\Xamarin.Essentials\PhoneDialer\PhoneDialer.ios.cs:16 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 
  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/Foundation/NSAction.cs:178 
--- End of stack trace from previous location where exception was thrown ---

  at (w
rapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at MobilAutoNew.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\pavlo\source\repos\MobilAutoNew\MobilAutoNew.iOS\Main.cs:17
2021-01-24 14:27:22.649358+0200 MobilAutoNew.iOS[24092:144521] Unhandled managed exception: Specified method is not supported. (Xamarin.Essentials.FeatureNotSupportedException)
  at Xamarin.Essentials.PhoneDialer.ValidateOpen (System.String number) [0x0001a] in D:\a\1\s\Xamarin.Essentials\PhoneDialer\PhoneDialer.shared.cs:13 
  at Xamarin.Essentials.PhoneDialer.PlatformOpen (System.String number) [0x0000a] in D:\a\1\s\Xamarin.Essentials\PhoneDialer\PhoneDialer.ios.cs:16 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 
  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/Foundation/NSAction.cs:178 
--- End of stack trace from previous location where exception was thrown ---

  at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/14.6.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:65 
  at MobilAutoNew.iOS.Application.Main (System.String[] args) [0x00001] in C:\Users\pavlo\source\repos\MobilAutoNew\MobilAutoNew.iOS\Main.cs:17

=================================================================
	Native Crash Reporting
=================================================================
Got a abrt 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:
=================================================================
	0x108b94535 - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : mono_dump_native_crash_info
	0x108b889be - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : mono_handle_native_crash
	0x108b93b4f - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : sigabrt_signal_handler
	0x7fff60c815fd - /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
	0x7fb55960de00 - Unknown
	0x7fff200fab94 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : abort
	0x108dd7ddf - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : xamarin_unhandled_exception_handler
	0x108c4a955 - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : mono_invoke_unhandled_exception_hook
	0x108b883ca - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : mono_handle_exception_internal
	0x108b86879 - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : mono_handle_exception
	0x108b06f09 - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : mono_amd64_throw_exception
	0x10c0ad5b0 - Unknown
	0x108dd7b2b - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : xamarin_process_managed_exception
	0x108a719af - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : _ZL31native_to_managed_trampoline_36P11objc_objectP13objc_selectorPP11_MonoMethodj
	0x108a7758c - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : -[__MonoMac_NSAsyncSynchronizationContextDispatcher xamarinApplySelector]
	0x7fff208582ba - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/Foundation.framework/Foundation : __NSThreadPerformPerform
	0x7fff2038f38a - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
	0x7fff2038f282 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSource0
	0x7fff2038e764 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopDoSources0
	0x7fff20388f2f - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : __CFRunLoopRun
	0x7fff203886d6 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation : CFRunLoopRunSpecific
	0x7fff2bededb3 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Private
Frameworks/GraphicsServices.framework/GraphicsServices : GSEventRunModal
	0x7fff24690e0b - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : -[UIApplication _run]
	0x7fff24695cbc - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore : UIApplicationMain
	0x110ff9955 - Unknown
	0x110decde3 - Unknown
	0x10f937123 - Unknown
	0x108b9ec71 - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : mono_jit_runtime_invoke
	0x108cc5148 - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : mono_runtime_invoke_checked
	0x108ccb4b5 - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : mono_runtime_exec_main_checked
	0x108afda8c - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : mono_jit_exec
	0x108dea31d - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : xamarin_main
	0x108ab7df7 - /Users/mr.onion/Library/Developer/CoreSimulator/Devices/E1FBE390-5D4B-4907-A100-443F28C66670/data/Containers/Bundle/Application/F446707B-2C5D-4A02-80C0-AA4301A9D582/MobilAutoNew.iOS.app/MobilAutoNew.iOS : main
	0x7fff202593e9 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libdyld.dylib : start

=================================================================
	Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x7fff60c5833a):0x7fff60c5832a  ff ff c3 90 90 90 b8 48 01 00 02 49 89 ca 0f 05  .......H...I....

0x7fff60c5833a  73 08 48 89 c7 e9 e5 a2 ff ff c3 90 90 90 b8 53  s.H............S
0x7fff60c5834a  00 00 02 49 89 ca 0f 05 73 08 48 89 c7 e9 cd a2  ...I....s.H.....
0x7fff60c5835a  ff ff c3 90 90 90 b8 83 01 00 02 49 89 ca 0f 05  ...........I....

=================================================================
	Managed Stacktrace:
=================================================================
=================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions