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

[Bug] Using MediaPicker.CapturePhotoAsync(); Gets Error #1481

Closed
ibrahimdarahem opened this issue Oct 28, 2020 · 3 comments · Fixed by #1555
Closed

[Bug] Using MediaPicker.CapturePhotoAsync(); Gets Error #1481

ibrahimdarahem opened this issue Oct 28, 2020 · 3 comments · Fixed by #1555
Labels
bug Something isn't working
Milestone

Comments

@ibrahimdarahem
Copy link

Description

when using MediaPicker.CapturePhotoAsync(); get error "Object reference not set to an instance of an object"

I got this error when testing on Android.

Steps to Reproduce

        var result = await MediaPicker.CapturePhotoAsync();
        var stream = await result.OpenReadAsync();
        imgDocImage.Source = ImageSource.FromStream(() => stream);

just when running first line after shot the photo on phone gets the error : "Object reference not set to an instance of an object"
on the first line, I mean before get a value in "result".

Test on Xiaomi note 9 (Android 10)

Expected Behavior

Actual Behavior

Basic Information

  • Version with issue: 1.6.0 pre2

  • Last known good version:

  • IDE: Visual Studio 2019

  • Platform Target Frameworks:

    • iOS:
    • Android:
  • Android Support Library Version:

  • Nuget Packages: Xamarin.Essentials 1.6.0-pre2

  • Affected Devices: Xiaomi Redmi note 9 (Android 10)

Screenshots

Reproduction Link

@ibrahimdarahem ibrahimdarahem added the bug Something isn't working label Oct 28, 2020
@Sunnya93
Copy link

Sunnya93 commented Nov 3, 2020

I have Same Bug. In my Galaxy Note 9..
Except for camera, however, camera apps (such as the snow app) don't show this bug.

@mchlkoval
Copy link

Likewise, for me I am using:

  • Xamarin.Essentials 1.6.0-pre2
  • Xamarin.Forms 4.8.0.1560

On my OnePlus 5T (Android 10). After capturing a photo I get a shot of it with three options at the bottom: Retake, Approve, and Cancel. Clicking Retake or Cancel does what it should without any issues. However, clicking the check box for approval results in a null reference exception that I suspect is outside of my code's scope as it never hits my catch statement.

I suspect that perhaps there is a missing handler or listener for that type of workflow? CaptureVideo works fine, but as I recall videos don't provide a preview of what you just took in order for you to approve/discard what you captured.

@mattleibow mattleibow added this to the 1.6.0 milestone Nov 29, 2020
@leijae
Copy link

leijae commented Nov 30, 2020

Same issue with:
Xamarin Essentials 1.6pre4
Android 11 API 30
Pixel 2 x86_x64
XF 4.8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants