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

[Bug] CameraFragment.DisposeImageReader Null Reference Exception #1958

Open
pauldiston opened this issue Mar 21, 2023 · 0 comments
Open

[Bug] CameraFragment.DisposeImageReader Null Reference Exception #1958

pauldiston opened this issue Mar 21, 2023 · 0 comments
Labels
bug Something isn't working. Breaky break.

Comments

@pauldiston
Copy link

pauldiston commented Mar 21, 2023

Description

Upon calling the Navigation.PopModalAsync on a page that contains the CameraView a Null Reference Exception is raised from the CameraFragment.DisposeImageReader method.

Stack Trace

Xamarin Exception Stack:
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.CommunityToolkit.UI.Views.CameraFragment.DisposeImageReader () [0x00013] in <0a68dce273b64a29949c8b1d7ab84eee>:0
at Xamarin.CommunityToolkit.UI.Views.CameraFragment.CloseDevice () [0x00051] in <0a68dce273b64a29949c8b1d7ab84eee>:0
at Xamarin.CommunityToolkit.UI.Views.CameraFragment.CloseDevice (Android.Hardware.Camera2.CameraDevice inputDevice) [0x00009] in <0a68dce273b64a29949c8b1d7ab84eee>:0
at Xamarin.CommunityToolkit.UI.Views.CameraFragment.b__63_3 (Android.Hardware.Camera2.CameraDevice device) [0x00013] in <0a68dce273b64a29949c8b1d7ab84eee>:0
at Xamarin.CommunityToolkit.UI.Views.CameraStateListener.OnClosed (Android.Hardware.Camera2.CameraDevice camera) [0x0000a] in <0a68dce273b64a29949c8b1d7ab84eee>:0
at Android.Hardware.Camera2.CameraDevice+StateCallback.n_OnClosed_Landroid_hardware_camera2_CameraDevice_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_camera) [0x0000f] in :0
at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V (_JniMarshal_PPL_V callback, System.IntPtr jnienv, System.IntPtr klazz, System.IntPtr p0) [0x00005] in :0

Secondary Stack Trace

Xamarin.CommunityToolkit.UI.Views
CameraFragment.DisposeImageReader ()
Xamarin.CommunityToolkit.UI.Views
CameraFragment.CloseDevice ()
Xamarin.CommunityToolkit.UI.Views.CameraFragment.Android.Views.TextureView
ISurfaceTextureListener.OnSurfaceTextureDestroyed (Android.Graphics.SurfaceTexture surface)
Android.Views
TextureView+ISurfaceTextureListenerInvoker.n_OnSurfaceTextureDestroyed_Landroid_graphics_SurfaceTexture_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_surface)
Android.Runtime
JNINativeWrapper.Wrap_JniMarshal_PPL_Z (_JniMarshal_PPL_Z callback, System.IntPtr jnienv, System.IntPtr klazz, System.IntPtr p0)
Java.Interop
JniEnvironment+InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args)
Java.Interop
JniPeerMembers+JniInstanceMethods.InvokeVirtualVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters)
Android.Views
ViewGroup.RemoveView (Android.Views.View view)
Xamarin.Forms.Platform.Android
ViewExtensions.RemoveFromParent (Android.Views.View view)
Xamarin.Forms.Platform.Android.AppCompat.Platform.Xamarin.Forms
INavigation.PopModalAsync (System.Boolean animated)
Xamarin.Forms.Internals
NavigationProxy.OnPopModal (System.Boolean animated)
Xamarin.Forms
Application+NavigationImpl.<>n__0 (System.Boolean animated)
Xamarin.Forms
Application+NavigationImpl.OnPopModal (System.Boolean animated)
MyView
PhotoCaptureView.OKButton_OnClicked (System.Object sender, System.EventArgs e)

Steps to Reproduce

  1. Call Navigation.PushModalAsync with a page that contains the CameraView
  2. Take a photo
  3. Call the Navigation.PopModalAsync

Expected Behavior

No exception is raised

Actual Behavior

A Null Reference Exception is raised sometimes. This doesn't happen all the time.

Basic Information

  • Version with issue: 2.0.5
  • Last known good version: N/A
  • IDE: Visual Studio 2022
  • Platform Target Frameworks:
    • Android: 12
  • Affected Devices: Honeywell CT60

Workaround

No workaround found at this time.

@pauldiston pauldiston added the bug Something isn't working. Breaky break. label Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working. Breaky break.
Projects
None yet
Development

No branches or pull requests

1 participant