I am using code sample found here: https://github.com/Redth/ZXing.Net.Mobile/blob/master/Samples/Forms/Core/HomePage.cs
MainActivity.cs
`
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(bundle);
ZXing.Net.Mobile.Forms.Android.Platform.Init();
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{
global::ZXing.Net.Mobile.Android.PermissionsHandler.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
`
Home.xaml.cs
`
public partial class Home : ContentPage
{
ZXingScannerPage scanPage;
Button buttonScanDefaultOverlay;
public Home() : base()
{
buttonScanDefaultOverlay = new Button
{
Text = "Scan with Default Overlay",
AutomationId = "scanWithDefaultOverlay",
};
buttonScanDefaultOverlay.Clicked += async delegate {
scanPage = new ZXingScannerPage();
scanPage.OnScanResult += (result) => {
scanPage.IsScanning = false;
Device.BeginInvokeOnMainThread(() => {
Navigation.PopAsync();
DisplayAlert("Scanned Barcode", result.Text, "OK");
});
};
await Navigation.PushAsync(scanPage);
};
var stack = new StackLayout();
stack.Children.Add(buttonScanDefaultOverlay);
Content = stack;
}
}
`
AndroidManifest.xml
AssemblyInfo.cs
[assembly: UsesPermission(Android.Manifest.Permission.Flashlight)]

Upon pressing the button I get thrown the following exceptions:
Where am I supposed to handle them?
I have exactly the same issue. Tried anything! Can not find the cause.
I have the same issue ...
When I attach my physical device to my PC with a USB cable , instead of using 'Xamarin Live', then the error does not occur.... So in my opinion: problem solved
Yep, don't bother using Live Player.
I am also facing the same issue when using Xamarin live player and it occurs at any line of code that creates a new object in the ZXing.Net.Mobile library . donno if this is an issue with live player itself as i dont get any issue on my device and droid emulator
had the same issue but figured out it was because zxing assembly was not loaded when using Xamarin live player. Plugged in usb cable deployed works.
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!
Most helpful comment
Yep, don't bother using Live Player.