Skip to content
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

App crashing - RuntimeException: getParameters failed (empty parameters) #728

Closed
joakimmag opened this issue May 23, 2018 · 23 comments
Closed

Comments

@joakimmag
Copy link

joakimmag commented May 23, 2018

The app crashes when navigating away from the scanner page, then back to the scanner page. Also when changing the orientation by rotating the device a few times. I'm using FreshMVVM as an MVVM framework if that is relevant.

Usage:

<Grid>
    <zxing:ZXingScannerView x:Name="ScannerView"
        Result="{Binding ScanResult, Mode=OneWayToSource}"
        ScanResultCommand="{Binding ProcessBarcodeCommand}"
        IsScanning="{Binding IsScanning}"
        IsAnalyzing="{Binding IsAnalyzing}" />
    <zxing:ZXingDefaultOverlay x:Name="ScannerOverlay"
        TopText="Hold your phone up to the QR code"
        BottomText="Scanning will happen automatically"
        ShowFlashButton="True"/>

Full stack trace: https://hastebin.com/ulequfucim.sql

05-23 13:35:13.757 E/mono-rt (24409): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.RuntimeException: getParameters failed (empty parameters)
05-23 13:35:13.757 E/mono-rt (24409):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <f32579baafc1404fa37ba3ec1abdc0bd>:0 
05-23 13:35:13.757 E/mono-rt (24409):   at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <09bf3e262b934ffab2ba01f9fc7fd54d>:0 
05-23 13:35:13.757 E/mono-rt (24409):   at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in <09bf3e262b934ffab2ba01f9fc7fd54d>:0 
05-23 13:35:13.757 E/mono-rt (24409):   at Android.Hardware.Camera.GetParameters () [0x0000a] in <25661073a35344a89f215a4cf81af37c>:0 
05-23 13:35:13.757 E/mono-rt (24409):   at ZXing.Mobile.CameraAccess.CameraController.ApplyCameraSettings () [0x00033] in <819b29aa6d91462699e19a679be55a44>:0 
05-23 13:35:13.757 E/mono-rt (24409):   at ZXing.Mobile.CameraAccess.CameraController.RefreshCamera () [0x00010] in <819b29aa6d91462699e19a679be55a44>:0 
05-23 13:35:13.757 E/mono-rt (24409):   at ZXing.Mobile.CameraAccess.CameraAnalyzer.RefreshCamera () [0x00001] in <819b29aa6d91462699e19a679be55a44>:0 
05-23 13:35:13.757 E/mono-rt (24409):   at ZXing.Mobile.ZXingSurfaceView+<OnWindowFocusChanged>d__29.MoveNext () [0x0008f] in <819b29aa6d91462699e19a679be55a44>:0 
05-23 13:35:13.757 E/mono-rt (24409): --- End of stack trace from previous location where exception was thrown ---
@joakimmag joakimmag changed the title RuntimeException: getParameters failed (empty parameters) App crashing - RuntimeException: getParameters failed (empty parameters) May 25, 2018
@bensafeag
Copy link

Java.Lang.RuntimeException: getParameters failed (empty parameters) encountered after a successful scan, navigation change, and another successful scan. Xamarin Forms

@hponaganti
Copy link

Observing same on Android

@davidbuckleyni
Copy link

davidbuckleyni commented Sep 28, 2019

Did @hponaganti @bensafeag manage to solve this just getting the exact same app failed QA testing because of it strange it only happens after the 3 x scan. Using Xamrian Forms 4.2.0.709249 Zxing .mobile .forms 2.4.1

09-28 15:37:54.285 D/AppCenterCrashes( 8983): Saving uncaught exception.
09-28 15:37:54.319 D/AppCenterCrashes( 8983): Saved JSON content for ingestion into /data/user/0/com.companyname.FuelStockApp/files/error/8dcf8224-5249-44dd-bf2a-be930577dd06.json
09-28 15:37:54.360 D/AppCenterCrashes( 8983): Saved Throwable as is for client side inspection in /data/user/0/com.companyname.FuelStockApp/files/error/8dcf8224-5249-44dd-bf2a-be930577dd06.throwable throwable:
09-28 15:37:54.360 D/AppCenterCrashes( 8983): java.lang.RuntimeException: getParameters failed (empty parameters)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.hardware.Camera.native_getParameters(Native Method)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.hardware.Camera.getParameters(Camera.java:2189)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at md5bb098716dd46c8e113564e6b42b7cde9.ZXingSurfaceView.n_onWindowFocusChanged(Native Method)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at md5bb098716dd46c8e113564e6b42b7cde9.ZXingSurfaceView.onWindowFocusChanged(ZXingSurfaceView.java:76)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.View.dispatchWindowFocusChanged(View.java:12891)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewRootImpl.handleWindowFocusChanged(ViewRootImpl.java:2811)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewRootImpl.access$1100(ViewRootImpl.java:174)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4518)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.os.Handler.dispatchMessage(Handler.java:112)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.os.Looper.loop(Looper.java:216)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at android.app.ActivityThread.main(ActivityThread.java:7625)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at java.lang.reflect.Method.invoke(Native Method)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
09-28 15:37:54.360 D/AppCenterCrashes( 8983): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
09-28 15:37:54.369 D/Mono ( 8983): DllImport searching in: '__Internal' ('(null)').
09-28 15:37:54.369 D/Mono ( 8983): Searching for 'java_interop_jnienv_throw'.
09-28 15:37:54.369 D/Mono ( 8983): Probing 'java_interop_jnienv_throw'.
09-28 15:37:54.370 D/Mono ( 8983): Found as 'java_interop_jnienv_throw'.
Java.Lang.RuntimeException: ''

09-28 15:37:59.887 E/mono-rt ( 8983): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.RuntimeException: getParameters failed (empty parameters)
09-28 15:37:59.887 E/mono-rt ( 8983): at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in :0
09-28 15:37:59.887 E/mono-rt ( 8983): at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in :0
09-28 15:37:59.887 E/mono-rt ( 8983): at Android.Hardware.Camera.GetParameters () [0x0000a] in <3d3cf2a3639e4422aea8bb417e71ff8d>:0
09-28 15:37:59.887 E/mono-rt ( 8983): at ZXing.Mobile.CameraAccess.CameraController.ApplyCameraSettings () [0x00033] in <819b29aa6d91462699e19a679be55a44>:0
09-28 15:37:59.887 E/mono-rt ( 8983): at ZXing.Mobile.CameraAccess.CameraController.RefreshCamera () [0x00010] in <819b29aa6d91462699e19a679be55a44>:0
09-28 15:37:59.887 E/mono-rt ( 8983): at ZXing.Mobile.CameraAccess.CameraAnalyzer.RefreshCamera () [0x00001] in <819b29aa6d91462699e19a679be55a44>:0
09-28 15:37:59.887 E/mono-rt ( 8983): at ZXing.Mobile.ZXingSurfaceView.OnWindowFocusChanged (System.Boolean hasWindowFocus) [0x0008f] in <819b29aa6d91462699e19a679be55a44>:0
09-28 15:37:59.887 E/mono-rt ( 8983): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr)
09-28 15:37:59.887 E/mono-rt ( 8983): at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr)
09-28 15:37:59.887 E/mono-rt ( 8983): --- End of stack trace from previous location where exception was thrown ---
09-28 15:37:59.887 E/mono-rt ( 8983):
09-28 15:37:59.887 E/mono-rt ( 8983): at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in :0
09-28 15:37:59.887 E/mono-rt ( 8983): at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0002a] in :0
09-28 15:37:59.887 E/mono-rt ( 8983): at Java.Lang.Throwable.get_Message () [0x0000a] in <3d3cf2a3639e4422aea8bb417e71ff8d>:0
09-28 15:37:59.887 E/mono-rt ( 8983): --- End of managed Java.Lang.RuntimeException stack trace ---
09-28 15:37:59.887 E/mono-rt ( 8983): java.lang.RuntimeException: getParameters failed (empty parameters)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.hardware.Camera.native_getParameters(Native Method)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.hardware.Camera.getParameters(Camera.java:2189)
09-28 15:37:59.887 E/mono-rt ( 8983): at md5bb098716dd46c8e113564e6b42b7cde9.ZXingSurfaceView.n_onWindowFocusChanged(Native Method)
09-28 15:37:59.887 E/mono-rt ( 8983): at md5bb098716dd46c8e113564e6b42b7cde9.ZXingSurfaceView.onWindowFocusChanged(ZXingSurfaceView.java:76)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.View.dispatchWindowFocusChanged(View.java:12891)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewGroup.dispatchWindowFocusChanged(ViewGroup.java:1465)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewRootImpl.handleWindowFocusChanged(ViewRootImpl.java:2811)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewRootImpl.access$1100(ViewRootImpl.java:174)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4518)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.os.Handler.dispatchMessage(Handler.java:112)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.os.Looper.loop(Looper.java:216)
09-28 15:37:59.887 E/mono-rt ( 8983): at android.app.ActivityThread.ma

@Redth
Copy link
Owner

Redth commented Mar 13, 2020

Thanks for reporting this issue! Unforunately it took me way too long to respond 😭. Sorry, I apologize! Recently the source code for this project was completely refactored to modernize it. Many PR's were included in this effort, and many bugs were hopefully fixed. Please try out the latest 3.x series of NuGet packages (currently in prerelease). To try and make the project more maintainable in my spare time going forward, I've decided to close all existing issues to start with a clean slate. If you're still experiencing this issue on the newest version, please open a new issue with as much detail as possible. Thank you for your patience and understanding! Happy scanning!

@Redth Redth closed this as completed Mar 13, 2020
@roomanalikhan
Copy link

Thanks for reporting this issue! Unforunately it took me way too long to respond 😭. Sorry, I apologize! Recently the source code for this project was completely refactored to modernize it. Many PR's were included in this effort, and many bugs were hopefully fixed. Please try out the latest 3.x series of NuGet packages (currently in prerelease). To try and make the project more maintainable in my spare time going forward, I've decided to close all existing issues to start with a clean slate. If you're still experiencing this issue on the newest version, please open a new issue with as much detail as possible. Thank you for your patience and understanding! Happy scanning!

The issue still exists in v3.0.0-beta5 (pre release) as well.

@chris-krogsystems
Copy link

I'm seeing this on v2.4.1. If you have a successful scan, set IsAnalyzing to false, navigate away from the scan page, then return and set IsAnalyzing to true again, then the camera window freezes. Tilting the phone to trigger a redraw causes the "getParameters() failed" error and the app crashes.

I was able to work around this by resetting Content for the ContentView control that the ZXingScannerView is part of; i.e. { var tempContent = Content; Content = null; Content = tempContent; }, based on a comment I saw in another thread. I do this within the OnAppearing call and it seems to work reliably.

@gceaser
Copy link

gceaser commented Jan 4, 2021

I'm seeing this on v2.4.1. If you have a successful scan, set IsAnalyzing to false, navigate away from the scan page, then return and set IsAnalyzing to true again, then the camera window freezes. Tilting the phone to trigger a redraw causes the "getParameters() failed" error and the app crashes.

I was able to work around this by resetting Content for the ContentView control that the ZXingScannerView is part of; i.e. { var tempContent = Content; Content = null; Content = tempContent; }, based on a comment I saw in another thread. I do this within the OnAppearing call and it seems to work reliably.

Where in the OnAppearing did you add this code? Here is what I put in mine and it did not seem to help. I am assuming I have the code in the wrong place.

     protected async override void OnAppearing()
        {
            try
            {
                await NavHelper.ShowProcessingPopUp();
                base.OnAppearing();
                var tempContent = Content; 
                Content = null; 
                Content = tempContent;
                await NavHelper.HideProcessingPopUp();

            }
            catch (Exception ex)
            {
                App.ProcessException(ex);
            }    
        }


@chris-krogsystems
Copy link

I'm seeing this on v2.4.1. If you have a successful scan, set IsAnalyzing to false, navigate away from the scan page, then return and set IsAnalyzing to true again, then the camera window freezes. Tilting the phone to trigger a redraw causes the "getParameters() failed" error and the app crashes.
I was able to work around this by resetting Content for the ContentView control that the ZXingScannerView is part of; i.e. { var tempContent = Content; Content = null; Content = tempContent; }, based on a comment I saw in another thread. I do this within the OnAppearing call and it seems to work reliably.

Where in the OnAppearing did you add this code? Here is what I put in mine and it did not seem to help. I am assuming I have the code in the wrong place.

     protected async override void OnAppearing()
        {
            try
            {
                await NavHelper.ShowProcessingPopUp();
                base.OnAppearing();
                var tempContent = Content; 
                Content = null; 
                Content = tempContent;
                await NavHelper.HideProcessingPopUp();

            }
            catch (Exception ex)
            {
                App.ProcessException(ex);
            }    
        }

This looks similar to mine. The only significant difference I see is that mine is wrapped in Device.BeginInvokeOnMainThread(), which shouldn't be necessary anyways in OnAppearing.

        base.OnAppearing();

        Device.BeginInvokeOnMainThread(() => BarcodeScanner.ResetScanning());

BarcodeScanner is a custom control. The ResetScanning function is just

    public void ResetScanning()
    {
        ScanningEnabled = !TapToScan;
    }

where ScanningEnabled is a property for the custom control. In the switch for my OnPropertyChanged I have:

            case nameof(ScanningEnabled):
                var tempContent = Content;
                Content = null;
                Content = tempContent;
                BottomBar.IsVisible = TapToScan && !ScanningEnabled;
                CancelPanel.IsVisible = TapToScan && ScanningEnabled;
                StartScanningButton.IsVisible = TapToScan && !ScanningEnabled;
                if (Scanner != null)
                {
                    Scanner.IsAnalyzing = ScanningEnabled;

                    Scanner.OnScanResult -= Scanner_OnScanResult;

                    if (ScanningEnabled)
                        Scanner.OnScanResult += Scanner_OnScanResult;
                }
                break;

Hope that helps.

rdfordatascience-ops pushed a commit to rdfordatascience-ops/ZXing.Net.Mobile that referenced this issue Jul 27, 2021
@zubair1995
Copy link

Still facing this issue in Android 10.0

@MVanEester
Copy link

MVanEester commented Sep 28, 2021

also still facing this issue...

Android 11.0 R
ZXing.Net.Mobile 2.4.1

.xaml

<zxing:ZXingScannerView x:Name="Scan"
                                    ScaleX="1.3"
                                    OnScanResult="Scan_OnScanResult"
                                    IsAnalyzing="True"
                                    IsScanning="True"/>

Almost Always with a ScannerView in the xaml.

ScannerPages work fine.

@SteRompen
Copy link

Has anyone found a solution yet? I am looking to solve this error for a couple of hours right now... maybe @MVanEester ?

@jhonatansantos61
Copy link

jhonatansantos61 commented Mar 25, 2022

Unfortunately I'm having the same problem. I noticed that there are times when the reading is done very fast and it already causes the exception. Does anyone know how to solve?

@SteRompen
Copy link

@jhonatansantos61 I tried to contact multiple developers working with Xamarin... also some real professionals. They were not able to fix it. It happens in situations you describe, but also when you want to go back to the page where the scanner is located. I think there is an issue with the package, seems like there is still no solution for it :(

@lucamartiger
Copy link

lucamartiger commented May 3, 2022

are there any news about this problem?

EDIT: the only workaround that I found it's to remove the page that contains scan view from navigation stack. At the second time that I load that page, the scan works.

@jhonatansantos61
Copy link

@jhonatansantos61Tentei entrar em contato com vários desenvolvedores que trabalham com Xamarin... também alguns profissionais reais. Eles não foram capazes de corrigi-lo. Isso acontece em situações que você descreve, mas também quando você deseja voltar para a página onde o scanner está localizado. Acho que há um problema com o pacote, parece que ainda não há solução para isso :(

I configured ZXing in the page builder and it worked correctl

cameraQrCode.Options = new ZXing.Mobile.MobileBarcodeScanningOptions
{
DelayBetweenAnalyzingFrames = 200,
DelayBetweenContinuousScans = 5000,
TryHarder = true
};

@SteRompen
Copy link

@lucamartiger could you explain how you removed the page from the navigation stack? It sounds like this is a great solution for this problem!

@lucamartiger
Copy link

@lucamartiger could you explain how you removed the page from the navigation stack? It sounds like this is a great solution for this problem!

yes, at the end I adopted this solution. thanks.

@MartinezOtero
Copy link

@lucamartiger could you explain how you removed the page from the navigation stack? It sounds like this is a great solution for this problem!

yes, at the end I adopted this solution. thanks.

Im facing similar problem on Zxing 3.1.0-beta2 combining ZXingScannerViewRenderer default with a ZXingScannerViewRenderer on Android and your workarround works like a charm.

Thanks a lot @lucamartiger

Also will be great if the issue is solved by the authors of the library

@lucamartiger
Copy link

@lucamartiger could you explain how you removed the page from the navigation stack? It sounds like this is a great solution for this problem!

Sorry, I didn't read very well your post and I didn't notice that there was a question.
I simply use the RemoveFromStack method of the INavigator interface (I remove the page that contains the ScanView) after the first scan. When I do the following scan, it works.

@Jerome-Liger
Copy link

5 years this issue persists, and it's not acceptable for our applications to CRASHE violently in production :-(
As nobody move... so I will.

Related Issues : #728 #924 #1011 (and maybe more ? I stopped my search here...)

A pull request #1002 has been kindly submitted by @rdfordatascience-ops (thanks ;-)) but has never been merged, accepted or included in a new version...
It's not a "clean" solution, but it's better than CRASHES.

So :

  • I forked this repo (https://github.com/Respawnsive/ZXing.Net.Mobile)
  • I've applied the PR 1002 :
    • Just a "try-catch" block for not CRASHING our apps
    • Apparently, it continues to works normaly even after an exception raised here... (@rdfordatascience-ops you can confirm ?)
  • I've deleted some target platforms (I don't have time to install all the SDKs required for platforms that nobody use ;-)) :
    • Tizen
    • MacOS
    • Windows UAP
    • (so I only keep .netStandard/Android/iOS
  • I build successfully, generate NuGetPackages and publish them :

https://www.nuget.org/packages/Respawnsive.ZXing.Net.Mobile/
https://www.nuget.org/packages/Respawnsive.ZXing.Net.Mobile.Forms/

-> 1 hour, that's all what it takes to me...

So I hope this will be usefull for some peoples... because the "real production world" is not focused on MAUI (not yet at least ;-))
Regards

@MartinRobins
Copy link

@Jerome-Liger

Given that it has now been a couple of months since you made and published your fix, can you confirm if it has indeed resolved the problem as if so I will switch to your implementation.

@Jerome-Liger
Copy link

@MartinRobins yes, since I use my package, I just cleared all my applications crashes report in AppCenter.
And I asked my customers/end-users, no problem or bug have been encountered with the scan (since 2 month).

Just be carefull, I've removed completely Tizen/MacOS/UWP in this package !
And of course I'm not responsible for maintaining this packages (I've just add a try-catch ^^)

But I'm always interested in feedback... if you use it, feel free to get back to me.

Regards

@MartinRobins
Copy link

@Jerome-Liger

That is excellent news. I don't need Tizen/MacOS/UWP either, just Android and maybe iOS so that is perfect (and I promise not to hold you responsible either). Thanks for taking the time and effort, both for the fix and for responding to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests