3

I am using the ZXing.Mobile.Forms Scanning Libary and I am getting the following error The strange thing is its works for scans in a row but on the fourth scan it boms out

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): [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 <f13ae3cb9fcf47aa8f3adccd03288827>: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 <f13ae3cb9fcf47aa8f3adccd03288827>: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): 

I am using the following to capture the scan on button click and this does work but only for the first 3 scanns.

public string BarCode { get; set; }

var scanPage = new ZXingScannerPage();
scanPage.ToggleTorch();
await Navigation.PushAsync(scanPage);
scanPage.OnScanResult += (result) =>
{
   // Stop scanning
   scanPage.IsScanning = false;

  // Pop the page and show the result
  Device.BeginInvokeOnMainThread(async () =>
  {
    await Navigation.PopAsync();
    BarCode = result.Text;
   }
//I call my save function here.
StockTakeTransaction stockTake = new StockTakeTransaction();
stockTake.StockTakeCountSheetItemId = item.StocktakeCountShtItemID;
stockTake.Quantity = 1;
stockTake.MobileDeviceCode = settings.DeviceID.ToString();
stockTake.WarehouseId = WarehouseId;
stockTake.MobileDeviceUser = settings.UserName.ToString();
transferList.Add(stockTake);


 SaveFunction(sender, e, stockTake);

}

The save function here is called from the above method

 private async void SaveFunction(object sender, EventArgs e, StockTakeTransaction StockTakeitem)
 {
     Device.BeginInvokeOnMainThread(async () => { 
            BtnScanStockTakeItem_Clicked(sender, e); });

 }

I do some postback to api which works so I am not keeping it here I then click the btn for a scan again. It's quite odd that its happening like this was QA testing that picked it up

c-sharp-and-swiftui-devni
  • 3,743
  • 4
  • 39
  • 100

0 Answers0