Bug 34225 - [Xamarin.Mobile] MediaPicker throwing System.NotSupportedException on iOS 9 device/simulator
Summary: [Xamarin.Mobile] MediaPicker throwing System.NotSupportedException on iOS 9 d...
Status: RESOLVED FIXED
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components ()
Version: N/A
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Jon Dick
URL:
Depends on:
Blocks:
 
Reported: 2015-09-23 22:50 UTC by Jon Goldberger [MSFT]
Modified: 2015-10-27 13:48 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test Project (25.97 KB, application/zip)
2015-09-23 22:50 UTC, Jon Goldberger [MSFT]
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Jon Goldberger [MSFT] 2015-09-23 22:50:23 UTC
Created attachment 13045 [details]
Test Project

## Description

This does not occur every time, but whether picking a photo from the Photos album or taking a picture after a few attempts the NotSupportedException is thrown, and not always at the same point in the user code. This seems to be an iOS 9 issue only. Testing on an iOS 8 device/simulator works as expected and I was not able to get the exception after picking many photos. ON iOS 90 the issue occurs regularly after a couple to a few click of the button to pick a photo (or take a picture if on device).

## Steps to reproduce

1. Open the attached test project

2. Launch to iSO 9 simulator.

3. Tap button and select a picture from the Photo album

4. Repeat step 3 until exception is thrown.

Expected result: Exception will never be thrown.

Actual result: Exception is thrown.

## Stack trace (Managed and native)

>2015-09-23 16:47:19.702 MediaPick9[3080:998198] Unhandled managed exception:
>Operation is not supported. (System.NotSupportedException)
>  at Xamarin.Media.MediaPickerController.set_Delegate (Foundation.NSObject value) [0x00000] in <filename unknown>:0 
>  at (wrapper managed-to-native) Foundation.NSObject:xamarin_release_managed_ref (intptr,intptr)
>  at Foundation.NSObject.ReleaseManagedRef () [0x00000] in /Users/builder/data/lanes/2077/d8e9592a/source/maccore/src/Foundation/NSObject2.cs:199 
>  at Foundation.NSObject+NSObject_Disposer.Drain (Foundation.NSObject ctx) [0x00062] in /Users/builder/data/lanes/2077/d8e9592a/source/maccore/src/Foundation/NSObject2.cs:788 
>  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
>  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/2077/d8e9592a/source/maccore/src/UIKit/UIApplication.cs:74 
>  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Users/builder/data/lanes/2077/d8e9592a/source/maccore/src/UIKit/UIApplication.cs:57 
>  at MediaPick9.Application.Main (System.String[] args) [0x00008] in /Users/apple/Downloads/MediaPick9/MediaPick9/Main.cs:12 
>2015-09-23 16:47:19.707 MediaPick9[3080:998198] critical: Stacktrace:
>
>2015-09-23 16:47:19.707 MediaPick9[3080:998198] critical: 
>Native stacktrace:
>
>2015-09-23 16:47:19.923 MediaPick9[3080:998198] critical: 	0   MediaPick9                          0x00000001004fecd4 mono_handle_native_sigsegv + 260
>2015-09-23 16:47:19.923 MediaPick9[3080:998198] critical: 	1   libsystem_platform.dylib            0x000000019ae6194c _sigtramp + 68
>2015-09-23 16:47:19.923 MediaPick9[3080:998198] critical: 	2   libsystem_pthread.dylib             0x000000019ae68f0c pthread_kill + 112
>2015-09-23 16:47:19.924 MediaPick9[3080:998198] critical: 	3   libsystem_c.dylib                   0x000000019ad12b78 abort + 140
>2015-09-23 16:47:19.924 MediaPick9[3080:998198] critical: 	4   MediaPick9                          0x00000001005ef7dc _ZL15print_exceptionP10MonoObjectbP15NSMutableString + 0
>2015-09-23 16:47:19.924 MediaPick9[3080:998198] critical: 	5   MediaPick9                          0x00000001004ff368 mono_invoke_unhandled_exception_hook + 96
>2015-09-23 16:47:19.925 MediaPick9[3080:998198] critical: 	6   MediaPick9                          0x00000001004fe824 mono_handle_exception_internal + 4536
>2015-09-23 16:47:19.925 MediaPick9[3080:998198] critical: 	7   MediaPick9                          0x00000001004fd660 mono_handle_exception + 40
>2015-09-23 16:47:19.925 MediaPick9[3080:998198] critical: 	8   MediaPick9                          0x00000001004f65dc mono_arm_throw_exception + 148
>2015-09-23 16:47:19.926 MediaPick9[3080:998198] critical: 	9   MediaPick9                          0x00000001002bd398 throw_exception + 136
>2015-09-23 16:47:19.926 MediaPick9[3080:998198] critical: 	10  MediaPick9                          0x0000000100492d4c Xamarin_Media_MediaPickerController_set_Delegate_Foundation_NSObject + 108
>2015-09-23 16:47:19.926 MediaPick9[3080:998198] critical: 	11  MediaPick9                          0x00000001002910d4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244
>2015-09-23 16:47:19.927 MediaPick9[3080:998198] critical: 	12  MediaPick9                          0x000000010050df00 mono_jit_runtime_invoke + 1264
>2015-09-23 16:47:19.927 MediaPick9[3080:998198] critical: 	13  MediaPick9                          0x0000000100571530 mono_runtime_invoke + 124
>2015-09-23 16:47:19.927 MediaPick9[3080:998198] critical: 	14  MediaPick9                          0x00000001004c7d9c _ZL30native_to_managed_trampoline_3P11objc_objectP13objc_selectorPP11_MonoMethodS0_PKcS7_S7_ + 404
>2015-09-23 16:47:19.927 MediaPick9[3080:998198] critical: 	15  MediaPick9                          0x00000001004cb29c -[Xamarin_Media_MediaPickerController setDelegate:] + 80
>2015-09-23 16:47:19.928 MediaPick9[3080:998198] critical: 	16  UIKit                               0x000000018b22d808 <redacted> + 80
>2015-09-23 16:47:19.928 MediaPick9[3080:998198] critical: 	17  UIKit                               0x000000018b595588 <redacted> + 64
>2015-09-23 16:47:19.928 MediaPick9[3080:998198] critical: 	18  libobjc.A.dylib                     0x000000019a4676d8 <redacted> + 356
>2015-09-23 16:47:19.929 MediaPick9[3080:998198] critical: 	19  libobjc.A.dylib                     0x000000019a46208c objc_destructInstance + 104
>2015-09-23 16:47:19.929 MediaPick9[3080:998198] critical: 	20  libobjc.A.dylib                     0x000000019a4620e0 object_dispose + 28
>2015-09-23 16:47:19.929 MediaPick9[3080:998198] critical: 	21  MediaPick9                          0x00000001005f1ebc _ZL33invoke_objc_method_implementationP11objc_objectP13objc_selectorPFS0_S0_S2_zE + 60
>2015-09-23 16:47:19.929 MediaPick9[3080:998198] critical: 	22  MediaPick9                          0x00000001005f1e5c xamarin_release_trampoline + 180
>2015-09-23 16:47:19.930 MediaPick9[3080:998198] critical: 	23  MediaPick9                          0x00000001004cb8f8 -[Xamarin_Media_MediaPickerDelegate release] + 32
>2015-09-23 16:47:19.930 MediaPick9[3080:998198] critical: 	24  MediaPick9                          0x00000001005f0edc xamarin_release_managed_ref + 104
>2015-09-23 16:47:19.930 MediaPick9[3080:998198] critical: 	25  MediaPick9                          0x0000000100164a08 wrapper_managed_to_native_Foundation_NSObject_xamarin_release_managed_ref_intptr_intptr + 104
>2015-09-23 16:47:19.931 MediaPick9[3080:998198] critical: 	26  MediaPick9                          0x000000010011d7c8 Foundation_NSObject_ReleaseManagedRef + 40
>2015-09-23 16:47:19.931 MediaPick9[3080:998198] critical: 	27  MediaPick9                          0x000000010011f7e0 Foundation_NSObject_NSObject_Disposer_Drain_Foundation_NSObject + 288
>2015-09-23 16:47:19.932 MediaPick9[3080:998198] critical: 	28  MediaPick9                          0x00000001002910d4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244
>2015-09-23 16:47:19.932 MediaPick9[3080:998198] critical: 	29  MediaPick9                          0x000000010050df00 mono_jit_runtime_invoke + 1264
>2015-09-23 16:47:19.933 MediaPick9[3080:998198] critical: 	30  MediaPick9                          0x0000000100571530 mono_runtime_invoke + 124
>2015-09-23 16:47:19.933 MediaPick9[3080:998198] critical: 	31  MediaPick9                          0x00000001004caacc _ZL31native_to_managed_trampoline_14P11objc_objectP13objc_selectorPP11_MonoMethodS0_PKcS7_S7_ + 352
>2015-09-23 16:47:19.933 MediaPick9[3080:998198] critical: 	32  MediaPick9                          0x00000001004ca960 +[__NSObject_Disposer drain:] + 76
>2015-09-23 16:47:19.934 MediaPick9[3080:998198] critical: 	33  Foundation                          0x0000000186893318 <redacted> + 340
>2015-09-23 16:47:19.934 MediaPick9[3080:998198] critical: 	34  CoreFoundation                      0x000000018590c5a4 <redacted> + 24
>2015-09-23 16:47:19.934 MediaPick9[3080:998198] critical: 	35  CoreFoundation                      0x000000018590c038 <redacted> + 540
>2015-09-23 16:47:19.935 MediaPick9[3080:998198] critical: 	36  CoreFoundation                      0x0000000185909d38 <redacted> + 724
>2015-09-23 16:47:19.935 MediaPick9[3080:998198] critical: 	37  CoreFoundation                      0x0000000185838dc0 CFRunLoopRunSpecific + 384
>2015-09-23 16:47:19.935 MediaPick9[3080:998198] critical: 	38  GraphicsServices                    0x000000019098c088 GSEventRunModal + 180
>2015-09-23 16:47:19.935 MediaPick9[3080:998198] critical: 	39  UIKit                               0x000000018af12f60 UIApplicationMain + 204
>2015-09-23 16:47:19.936 MediaPick9[3080:998198] critical: 	40  MediaPick9                          0x000000010016b0dc wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 348
>2015-09-23 16:47:19.936 MediaPick9[3080:998198] critical: 	41  MediaPick9                          0x000000010013bd3c UIKit_UIApplication_Main_string___intptr_intptr + 44
>2015-09-23 16:47:19.936 MediaPick9[3080:998198] critical: 	42  MediaPick9                          0x000000010013bcfc UIKit_UIApplication_Main_string___string_string + 172
>2015-09-23 16:47:19.936 MediaPick9[3080:998198] critical: 	43  MediaPick9                          0x000000010010eefc MediaPick9_Application_Main_string__ + 156
>2015-09-23 16:47:19.936 MediaPick9[3080:998198] critical: 	44  MediaPick9                          0x00000001002910d4 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 244
>2015-09-23 16:47:19.937 MediaPick9[3080:998198] critical: 	45  MediaPick9                          0x000000010050df00 mono_jit_runtime_invoke + 1264
>2015-09-23 16:47:19.937 MediaPick9[3080:998198] critical: 	46  MediaPick9                          0x0000000100571530 mono_runtime_invoke + 124
>2015-09-23 16:47:19.937 MediaPick9[3080:998198] critical: 	47  MediaPick9                          0x0000000100575db8 mono_runtime_exec_main + 400
>2015-09-23 16:47:19.937 MediaPick9[3080:998198] critical: 	48  MediaPick9                          0x0000000100606488 xamarin_main + 1840
>2015-09-23 16:47:19.937 MediaPick9[3080:998198] critical: 	49  MediaPick9                          0x00000001004cc35c main + 96
>2015-09-23 16:47:19.938 MediaPick9[3080:998198] critical: 	50  libdyld.dylib                       0x000000019ac828b8 <redacted> + 4
>2015-09-23 16:47:19.938 MediaPick9[3080:998198] 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.
>=================================================================


## My Environment

=== Xamarin Studio ===

Version 5.9.7 (build 9)
Installation UUID: 964c531b-d928-456b-a9ae-e1f82266b360
Runtime:
	Mono 4.0.4 ((detached/cb6d6b2)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400040002

=== Apple Developer Tools ===

Xcode 7.0 (8227)
Build 7A220

=== Xamarin.iOS ===

Version: 9.0.1.20 (Business Edition)
Hash: d8e9592
Branch: master
Build date: 2015-09-18 23:22:05-0400

=== Xamarin.Android ===

Version: 5.1.6.7 (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
Java SDK: /usr
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.0.2.111 (Business Edition)

=== Build Information ===

Release ID: 509070009
Git revision: 31fa64709030b3edb971237780a452a4c69943c4
Build date: 2015-09-17 11:44:37-04
Xamarin addins: b105d33d8cd72911ff2cf3ee0b7715d37e5f19a6

=== Operating System ===

Mac OS X 10.11.1
Darwin Jons-iMac.local 15.0.0 Darwin Kernel Version 15.0.0
    Tue Sep 15 12:43:52 PDT 2015
    root:xnu-3247.10.9~3/RELEASE_X86_64 x86_64
Comment 1 SIMON 2015-09-28 02:56:36 UTC
I am also facing the same issue.
Comment 2 SIMON 2015-09-28 11:30:57 UTC
@jon this issue has been fixed in xamarin.mobile git

https://github.com/xamarin/Xamarin.Mobile

but not updated in xamarin website.

I have added the project directly to my solution

it now works.
Comment 3 Jon Dick 2015-09-28 15:38:47 UTC
Yes, this is fixed in master and will be released to the component store soon.
Comment 4 Ida 2015-10-27 02:46:19 UTC
Has this been release to the component store?
Comment 5 Jon Dick 2015-10-27 13:48:57 UTC
@Ida Yes it has been released to the component store.