Bug 8446 - NullPointerException in MediaPicker.PickPhotoAsync when "instant uploaded" image selected
Summary: NullPointerException in MediaPicker.PickPhotoAsync when "instant uploaded" im...
Status: RESOLVED FIXED
Alias: None
Product: Mobile API (Preview)
Classification: Xamarin
Component: Xamarin.Android ()
Version: Preview 0.6
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Eric Maupin
URL:
Depends on:
Blocks:
 
Reported: 2012-11-15 19:24 UTC by Paul Ryland
Modified: 2013-03-20 18:19 UTC (History)
2 users (show)

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

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 Paul Ryland 2012-11-15 19:24:02 UTC
On the Asus Transformer TF101 (Android 4.0.3) that I'm testing with, the PickPhotoAsync method launches the Gallery application which presents a list of images to select from. The selectable images include some that are stored locally on the sdcard and some that are marked as "Instant Upload" meaning (I assume) they are downloaded from the site picasaweb.google.com as needed.

When I select one of these 'Instant Upload' images, I get an unhandled Java.Lang.NullPointerException with the following call stack:

0x1 in System.Diagnostics.Debugger.Mono_UnhandledException at /Users/builder/data/lanes/monodroid-mac-monodroid-4.2-series/658a67dc/source/mono/mcs/class/corlib/System.Diagnostics/Debugger.cs:125	C#
0x32 in object.8d9a2038-add2-4265-81c8-b512a9ad9f1a	C#
0x25 in Android.Runtime.JNIEnv.CallObjectMethod at /Users/builder/data/lanes/monodroid-mac-monodroid-4.2-series/658a67dc/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:145	C#
0xB6 in Android.Content.ContentResolver.Query at /Users/builder/data/lanes/monodroid-mac-monodroid-4.2-series/658a67dc/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.Content.ContentResolver.cs:504	C#
0x39 in Xamarin.Media.MediaPickerActivity.GetFilePathForUri	C#
0xA8 in Xamarin.Media.MediaPickerActivity.OnActivityResult	C#
0x17 in Android.App.Activity.n_OnActivityResult_IILandroid_content_Intent_ at /Users/builder/data/lanes/monodroid-mac-monodroid-4.2-series/658a67dc/source/monodroid/src/Mono.Android/platforms/android-8/src/generated/Android.App.Activity.cs:1240	C#
0x23 in object.8d9a2038-add2-4265-81c8-b512a9ad9f1a	C#


Logcat contains the following:

11-16 13:13:10.193 V/StateManager(27855): startStateForResult class com.android.gallery3d.app.AlbumPage, 1
11-16 13:13:10.223 I/GLRootView(27855): layout content pane 800x1232
11-16 13:13:10.663 W/MessageQueue(27855): Handler (com.android.gallery3d.picasasource.PicasaAlbum$1) {41321980} sending message to a Handler on a dead thread
11-16 13:13:10.663 W/MessageQueue(27855): java.lang.RuntimeException: Handler (com.android.gallery3d.picasasource.PicasaAlbum$1) {41321980} sending message to a Handler on a dead thread
11-16 13:13:10.663 W/MessageQueue(27855):  at android.os.MessageQueue.enqueueMessage(MessageQueue.java:196)
11-16 13:13:10.663 W/MessageQueue(27855):  at android.os.Handler.sendMessageAtTime(Handler.java:473)
11-16 13:13:10.663 W/MessageQueue(27855):  at android.os.Handler.sendMessageDelayed(Handler.java:446)
11-16 13:13:10.663 W/MessageQueue(27855):  at android.os.Handler.sendMessage(Handler.java:383)
11-16 13:13:10.663 W/MessageQueue(27855):  at com.android.gallery3d.picasa.PicasaService.performSync(PicasaService.java:136)
11-16 13:13:10.663 W/MessageQueue(27855):  at com.android.gallery3d.picasa.PicasaService$1.run(PicasaService.java:67)
11-16 13:13:12.223 D/WindowManager(  168): adjustConfigurationLw, config:{1.0 0mcc0mnc (no locale) layoutdir=0 sw800dp w800dp h1232dp xlrg port ?uimode ?night finger -keyb/v/h -nav/v} mLidOpen:-1 mHasDockFeature:true mHasHallSensorFeature:true config.hardKeyboardHidden:2
11-16 13:13:12.253 E/DatabaseUtils(27855): Writing exception to parcel
11-16 13:13:12.253 E/DatabaseUtils(27855): java.lang.NullPointerException
11-16 13:13:12.253 E/DatabaseUtils(27855):  at com.android.gallery3d.provider.GalleryProvider.queryPicasaItem(GalleryProvider.java:169)
11-16 13:13:12.253 E/DatabaseUtils(27855):  at com.android.gallery3d.provider.GalleryProvider.query(GalleryProvider.java:132)
11-16 13:13:12.253 E/DatabaseUtils(27855):  at android.content.ContentProvider$Transport.query(ContentProvider.java:178)
11-16 13:13:12.253 E/DatabaseUtils(27855):  at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
11-16 13:13:12.253 E/DatabaseUtils(27855):  at android.os.Binder.execTransact(Binder.java:338)
11-16 13:13:12.253 E/DatabaseUtils(27855):  at dalvik.system.NativeStart.run(Native Method)


I've tried wrapping the PickPhotoAsync() call and the 'ContinueWith' delegate in try/catch blocks but the exception does not seem to be trapped by the C#/mono code. This bug means I can't prevent my application crashing if users select one of these images.
Comment 1 Eric Maupin 2013-03-20 18:19:10 UTC
Fixed in 0.6.3 (now available).