Skip to content

Show user-friendly message [for missing permissions in plist] instead of SIGABRT #4831

Description

@EgorBo

Steps to Reproduce

  1. Create a blank Xamarin.iOS project
  2. Add the following line in ViewDidLoad:
await AVCaptureDevice.RequestAccessForMediaTypeAsync(AVAuthorizationMediaType.Video);
  1. Run (debug)

Expected Behavior

Some user friendly message telling user that he forgot to add a permission to his plist. In this case it's NSCameraUsageDescription

Actual Behavior

iOS Device:

2018-09-18 01:00:36.911 cameratest[5690:1243077] critical: 
Native stacktrace:

2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	0   libmonosgen-2.0.dylib               0x0000000100b8d560 mono_handle_native_crash + 224
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	1   libsystem_platform.dylib            0x0000000188c2aa20 <redacted> + 56
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	2   libsystem_kernel.dylib              0x0000000188bad838 <redacted> + 100
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	3   libsystem_kernel.dylib              0x0000000188bad868 fcntl + 0
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	4   TCC                                 0x000000018be6db80 <redacted> + 0
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	5   TCC                                 0x000000018be6dab4 <redacted> + 0
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	6   TCC                                 0x000000018be71c5c <redacted> + 276
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	7   libxpc.dylib                        0x0000000188c7e514 <redacted> + 60
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	8   libxpc.dylib                        0x0000000188c71b3c <redacted> + 88
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	9   libdispatch.dylib                   0x0000000188a58504 <redacted> + 16
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	10  libdispatch.dylib                   0x0000000188a2bb4c <redacted> + 312
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	11  libdispatch.dylib                   0x0000000188a3b884 <redacted> + 1220
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	12  libsystem_pthread.dylib             0x0000000188c3a100 _pthread_wqthread + 328
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 	13  libsystem_pthread.dylib             0x0000000188c3cd00 start_wqthread + 4
2018-09-18 01:00:36.914 cameratest[5690:1243077] critical: 
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

iOS Simulator (at least it notifies user):

[access] This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.
2018-09-18 00:59:46.023968+0300 cameratest[94844:7937209] critical: 
Native stacktrace:
2018-09-18 00:59:46.029159+0300 cameratest[94844:7937209] critical: 	0   cameratest                          0x0000000109670a54 mono_handle_native_crash + 244
...

Environment

=== Visual Studio Community 2017 for Mac ===

Version 7.6.6 (build 14)
Installation UUID: ccc13a0b-ff7c-44c6-9fbb-12a47af60004
Runtime:
	Mono 5.12.0.305 (2018-02/e0e035e3b14) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)
	Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

	Package version: 512000305

=== NuGet ===

Version: 4.3.1.4445

=== .NET Core ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
	3.0.0-preview1-26814-05
	2.1.1
	2.1.0
	2.1.0-preview2-26406-04
	2.1.0-preview1-26216-03
	2.0.5
SDK: /usr/local/share/dotnet/sdk/3.0.100-alpha1-009428/Sdks
SDK Versions:
	3.0.100-alpha1-009428
	2.1.301
	2.1.300
	2.1.300-preview2-008533
	2.1.300-preview1-008174
	2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.12.0/lib/mono/msbuild/15.0/bin/Sdks

=== Xamarin.Profiler ===

Version: 1.6.3
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 10.0 (14274.19)
Build 10L177m

=== Xamarin.Mac ===

Version: 4.99.3.741 (Visual Studio Community)
Hash: eeca0b87
Branch: 
Build date: 2018-09-13 15:01:04-0400

=== Xamarin.iOS ===

Version: 12.0.0.11 (Visual Studio Community)
Hash: eeca0b87
Branch: xcode10
Build date: 2018-09-13 15:01:03-0400

=== Xamarin.Android ===

Version: 8.3.3.2 (Visual Studio Community)
Android SDK: /Users/egorb/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3 (API level 15)
		4.4   (API level 19)
		6.0   (API level 23)
		7.0   (API level 24)
		7.1   (API level 25)
		8.0   (API level 26)
		8.1   (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 27.0.1
SDK Build Tools Version: 27.0.3

Java SDK: /usr
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 706060014
Git revision: 5fb9d5d4381378b850aab3fb6c59252695f6776d
Build date: 2018-09-14 16:13:50+00
Build branch: release-7.6-xcode10
Xamarin extensions: 96db24c7730531168cd53408e452a6d95150e05b

=== Operating System ===

Mac OS X 10.13.6
Darwin 17.7.0 Darwin Kernel Version 17.7.0
    Thu Jun 21 22:53:14 PDT 2018
    root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64

=== Enabled user installed extensions ===

Internet of Things (IoT) development (Preview) 7.5

iPhone X iOS 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThe issue or pull request is an enhancementiOSIssues affecting iOSmacOSIssues affecting macOS

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions