Bug 4138 - NullReferenceException in MediaPicker.TakePhotoAsync
Summary: NullReferenceException in MediaPicker.TakePhotoAsync
Alias: None
Product: Mobile API (Preview)
Classification: Xamarin
Component: Xamarin.Android ()
Version: Preview
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Eric Maupin
Depends on:
Reported: 2012-03-28 18:14 UTC by Chris Tossing
Modified: 2012-03-30 10:14 UTC (History)
2 users (show)

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:

Description Chris Tossing 2012-03-28 18:14:21 UTC
We can run the media picker sample, although it seemed to return a null image for some reason, but when we try to put almost the same code in our app, it crashes in the Xamarin.Mobile assembly.  We checked the permissions, and the sample does not seem to require any permissions (e.g. the camera permission).

We are getting the following stack trace:

      0x7 in Xamarin.Media.MediaPickerActivity.Touch
      0x158 in Xamarin.Media.MediaPickerActivity.OnCreate
      0x12 in Android.App.Activity.n_OnCreate_Landroid_os_Bundle_
      0x12 in System.Object.36e725bc-2d06-4843-bb15-3a6de0d158e2
Comment 1 Eric Maupin 2012-03-28 18:34:46 UTC
Where were you trying this? The simulator, or a device (and which device running what version)?
Comment 2 Chris Tossing 2012-03-30 10:14:16 UTC
It turns out we were missing the external storage permission.  The NullReferenceException is not an issue, but the null image is still an issue.  I will file a separate bug for this.

It might be a good idea, if it's not already there, to document that the external storage permission is required to use the MediaPicker class to take photos.