-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] UI Freeze and 'Cannot Access a Disposed Object' Error While Continuously Scanning Barcodes or Repeatedly Scanning a Single Barcode #40
Comments
Hello @thomasgalliker , In the context of BarcodeAnalyze under Android codebase, the current implementation catches exceptions and log it
I’m wondering if this supposed to be throwing the exception |
Thanks for reporting this issue. I have to look at it. |
@HaileyKim04 are you using AppShell or classic navigation? If you find the time to create a small repro app which causes this issue, I‘d be very happy. |
Yes, I am using classic navigation. This is the repository, and I noticed that scanning stops after scanning several barocdes in the repository. |
Hi , just want to say amazing barcode scanning control, unfortunately I am having the same issue: CameraScanner.Maui.BarcodeAnalyzer: Error: Analyze failed with exception System.ObjectDisposedException: Cannot access a disposed object. System.ObjectDisposedException: Cannot access a disposed object. I am using AppShell navigation |
Thanks for reporting 👍🏻 I'm currently bit in pre-release stress but I'm positive we can solve this. |
Is it possible to reproduce with the sample app in this repository? Or can anyone create a super-small sample app which causes this issue? |
Not sure yet but might have found a fix, when i am confident its actually working consistently I can show you what I did. Prolly a threading issue. |
I think because the Analyze method was set to async void along with this line
you were getting a race condition. if you remove the async from the method signature and wrap that above line of code a Task.Run like this:
The problem seems to stop happening. so the entire method looks like this.
public void Analyze(IImageProxy proxyImage)
}
|
Yes, I could reproduce this error in the sample demo app. One strange thing is I cannot reproduce the issue in sample as long as the library Project is referenced in the Sample project. I used the QR code scanner page and ViewModel to edit the code. Steps to produce:
|
I usually get these three exceptions very quickly in logs, but after applying this code, they are now hard to reproduce. No UI freezing issue so far. Exceptions: Cannot access a disposed object. Object name: 'AndroidX.Camera.Core.SettableImageProxy'. Would it be possible to create a PR for this fix and publish a new version? |
Ok. I gonna have a look at this code. On which devices did you have the UI freezes? |
I’ve tried two different devices: a Samsung S21 and an A15. Sometimes, I can reproduce the UI freeze, but not always. Also, the scanning stopped working, and I got the exception: 'Cannot access a disposed object. Object name: 'AndroidX.Camera.Core.SettableImageProxy' |
@thomasgalliker Despite the bugs, this is the best plugin at the moment. Thanks for your work! |
We‘re using this plugin in production apps. And yes we also experience the ObjectDisposedException. Sadly there are even worse problems I have to care about. I‘ll come back to this. |
Description
This issue arises when scanning a single barcode for an extended period, when the camera stops functioning after multiple scans, or when switching between barcode scanning and unrelated screens (e.g., a barcode image or any random background)**
Steps to Reproduce
CameraView
.Expected Behavior
Actual Behavior
Cannot access a disposed object. Object name: 'AndroidX.Camera.View.Transform.CoordinateTransform'.
Basic Information
Screenshots, Attachments, Links
Cannot access a disposed object. Object name: 'AndroidX.Camera.View.Transform.CoordinateTransform'.
The text was updated successfully, but these errors were encountered: