If string content passed to BarcodeGeneratorView component running in BarcodeFormat.QrCode mode, inner BarcodeGeneratorViewHandler throws ZXing.WriterException and MAUI application crashes.
ZXing.WriterException
Message=Data too big
Source=zxing
StackTrace:
at ZXing.QrCode.Internal.Encoder.chooseVersion(Int32 numInputBits, ErrorCorrectionLevel ecLevel)
at ZXing.QrCode.Internal.Encoder.recommendVersion(ErrorCorrectionLevel ecLevel, Mode mode, BitArray headerBits, BitArray dataBits)
at ZXing.QrCode.Internal.Encoder.encode(String content, ErrorCorrectionLevel ecLevel, IDictionary`2 hints)
at ZXing.QrCode.QRCodeWriter.encode(String contents, BarcodeFormat format, Int32 width, Int32 height, IDictionary`2 hints)
at ZXing.MultiFormatWriter.encode(String contents, BarcodeFormat format, Int32 width, Int32 height, IDictionary`2 hints)
at ZXing.BarcodeWriterGeneric.Encode(String contents)
at ZXing.BarcodeWriter`1[[Android.Graphics.Bitmap, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].Write(String contents)
at ZXing.Net.Maui.BarcodeGeneratorViewHandler.UpdateBarcode()
at ZXing.Net.Maui.BarcodeGeneratorViewHandler.ConnectHandler(ImageView nativeView)
at Microsoft.Maui.Handlers.ViewHandler`2[[ZXing.Net.Maui.IBarcodeGeneratorView, ZXing.Net.MAUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[Android.Widget.ImageView, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]].OnConnectHandler(View platformView) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandlerOfT.cs:line 76
at Microsoft.Maui.Handlers.ViewHandler.OnConnectHandler(Object platformView) in D:\a\_work\1\s\src\Core\src\Handlers\View\ViewHandler.cs:line 204
This edge scenario should be somehow handled so as:
If string content passed to
BarcodeGeneratorView
component running inBarcodeFormat.QrCode
mode, innerBarcodeGeneratorViewHandler
throwsZXing.WriterException
and MAUI application crashes.This edge scenario should be somehow handled so as:
BarcodeGeneratorView
somehow reports invalid input