XamarinCommunityToolkit icon indicating copy to clipboard operation
XamarinCommunityToolkit copied to clipboard

[Bug] CameraFragment.DisposeImageReader (): System.NullReferenceException: Object reference not set to an instance of an object

Open pvw-4bs opened this issue 3 years ago • 4 comments

Description

One the tablets crashed today after taking a picture with the CameraView. With the following error:

CameraFragment.DisposeImageReader (): System.NullReferenceException: Object reference not set to an instance of an object

Stack Trace

System.NullReferenceException: Object reference not set to an instance of an object at Xamarin.CommunityToolkit.UI.Views.CameraFragment.DisposeImageReader () [0x00013] in :0 at Xamarin.CommunityToolkit.UI.Views.CameraFragment.CloseDevice () [0x00051] in :0 at Xamarin.CommunityToolkit.UI.Views.CameraFragment.Android.Views.TextureView.ISurfaceTextureListener.OnSurfaceTextureDestroyed (Android.Graphics.SurfaceTexture surface) [0x00000] in :0 at Android.Views.TextureView+ISurfaceTextureListenerInvoker.n_OnSurfaceTextureDestroyed_Landroid_graphics_SurfaceTexture_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_surface) [0x0000f] in <7b5798cd11bb47ceaeae29d342017937>:0 at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.144(intptr,intptr,intptr)

I've checked the source CameraFragment.cs and the dispose is checked for null and is surrounded by Try {} Catch, but still it crashed the App

If there's anything i can add or log feel free to ask me.

Thanks in advance.

Link to Reproduction Sample

I'm sorry i can't reproduce it. Around 300 pictures were taken by 6 different devices. This was the only crash.

Steps to Reproduce

See above remark

Expected Behavior

Not to crash

Actual Behavior

Crashed

Basic Information

  • Version with issue: 1.2

  • Last known good version: -

  • IDE: VS 2019

  • Platform Target Frameworks:

    • Android: Android 11
  • Android Support Library Version: /

  • Nuget Packages: /

  • Affected Devices: Samsung SM-T725

Workaround

None

Reproduction imagery

None report-2517680281170579999-2d5dc0c9-e3b0-440b-bb52-b79b22af0f56.txt

pvw-4bs avatar Oct 15 '21 07:10 pvw-4bs

I got this issue as well in latest version. Hope it will be fixed soon.

nqtrung-ct avatar Jul 27 '22 09:07 nqtrung-ct

There is a detailed analysis of this bug in https://github.com/xamarin/XamarinCommunityToolkit/issues/1413 The user even fixed the issue in his fork here: https://github.com/NuAoA/XamarinCommunityToolkit/commit/8f0d51df6a69bd48fa1640d2e04c5cf115140844 But unfortunately he doesn't made a pull request to the main repo.

aliotard avatar Aug 23 '22 09:08 aliotard

Also getting this issue! A fixed version of the toolkit would help alot!

andreasbrostencab avatar Sep 13 '22 05:09 andreasbrostencab

I am also facing this issue, hope it gets fixed in a newer version

JoseAIG avatar Jan 13 '23 15:01 JoseAIG