ZXingBarcodeImageView Navigation Back - Xamarin Forms - System.ArgumentException: Found empty contents

0

I have a view with the ZXingBarcodeImageView implementation

<zx:ZXingBarcodeImageView BarcodeFormat="QR_CODE"
                                                  BarcodeValue="{Binding QrCode}"
                                                  VerticalOptions="End"
                                                  HorizontalOptions="CenterAndExpand"
                                                  HeightRequest="180"
                                                  WidthRequest="180" Margin="0,15">
                                <zx:ZXingBarcodeImageView.BarcodeOptions>
                                    <zxcm:EncodingOptions Width="300" Height="300" />
                                </zx:ZXingBarcodeImageView.BarcodeOptions>
                            </zx:ZXingBarcodeImageView>

and I have the property in the ViewModel, the error is when I navigate to the previous view, throwing the following error.

  

System.ArgumentException: Found empty contents

In the ViewModel, you have the following:

public class CarnetViewModel : BindableBase, INavigationAware, IDestructible
{
      protected INavigationService NavigationService { get; private set; }

      public CarnetViewModel(INavigationService navigationService)
      {
          NavigationService = navigationService;
      }

        /// <summary>
        /// The qr code
        /// </summary>
        private string qrCode;

        /// <summary>
        /// Gets or sets the qr code.
        /// </summary>
        /// <value>
        /// The qr code.
        /// </value>
        public string QrCode
        {
            get => qrCode;
            set { SetProperty(ref qrCode, value); }
        }
}

NOTE: The Prism Framework has been implemented for navigation and MVVM.

Following up I found a more detailed error, but I still do not know how I can control it.

Unhandled Exception from source=AndroidEnvironment
System.ArgumentException: Found empty contents
at ZXing.QrCode.QRCodeWriter.encode (System.String contents, ZXing.BarcodeFormat format, System.Int32 width, System.Int32 height, System.Collections.Generic.IDictionary'2[TKey,TValue] hints) [0x00008] in <ccd33a3710ff407d90a31fb75c8c27de>:0 
at ZXing.MultiFormatWriter.encode (System.String contents, ZXing.BarcodeFormat format, System.Int32 width, System.Int32 height, System.Collections.Generic.IDictionary'2[TKey,TValue] hints) [0x00033] in <ccd33a3710ff407d90a31fb75c8c27de>:0 
at ZXing.BarcodeWriterGeneric.Encode (System.String contents) [0x0002f] in <ccd33a3710ff407d90a31fb75c8c27de>:0 
at ZXing.BarcodeWriter'1[TOutput].Write (System.String contents) [0x00013] in <ccd33a3710ff407d90a31fb75c8c27de>:0 
at ZXing.Net.Mobile.Forms.Android.ZXingBarcodeImageViewRenderer+<>c__DisplayClass5_0.<regenerate>b__0 () [0x00000] in <6a1930ceea034eb28eda2834838f88c6>:0 
at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <a10f61e70eeb434e952fef884856c199>:0 
at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <a10f61e70eeb434e952fef884856c199>:0 
at (wrapper dynamic-method) System.Object.48(intptr,intptr)
    
asked by Jairo1010 12.10.2018 в 19:29
source

0 answers