Is there a way to do batch decoding of QRCodes from webcam?

Oct 28, 2013 at 8:17 PM
Hi everyone,
I've been trying to put ZXing.NET to work in a museum. I'm writing an application to catalogue and manage literally thousands of various computer "antiquities" in Poland's first and only Computer History Museum.
Instead of relying on proprietary hardware for barcode scanning, I opted for using webcam + QRCodes. My problem is as follows: using sourcecode provided with the library's demos, I managed to get my code to scan and recognize - in order to query the database for the antique's status/data - QRCode from webcam feed.
But when I tried to clone and rewrite the method to get a batch-scan mode - to operate similarly to a cashier's barcode reader - I get stuck with a strange - almost out-of-place - exception.
The code goes like this:
private void DoBatchDecoding(object sender, EventArgs args) 
            var timerStart = DateTime.Now.Ticks;

            var image = capture.QueryFrame();
            if (image != null)
                using (image)
                    // show it
                    CapturePreview.Image = image.ToBitmap();
                    // decode it
                    var result = reader.Decode(image);

                    // show result
                    if (result != null)
                        WynikTextBox.Text = result.Text;
                        id = result.Text.Split(new String[] { "\\" }, StringSplitOptions.RemoveEmptyEntries).Last();
This method is called from inside the "scan" button:
if (batchscan)
                        Application.Idle -= DoBatchDecoding;
                        string[] explist = listaeksponatow.ToArray();
                        for (int i = 0; i < (int)explist.Length; i++) 
                    else Application.Idle -= DoDecoding;
the variable
is defined globally in the parent class as
private List<string> listaeksponatow;
and its role is to hold the ID's of the antiquities being batch-processed.
The error thrown by VS2012 is "NullReferenceException" at this line - when switching to batch mode :
This strange error keeps baffling me for a week or so, I didn't manage to come to any solution so far and I'm running out of ideas. I would be really grateful for any help. Thanks in advance,
Oct 31, 2013 at 8:21 PM
Please post the value of result.Text which it has at the time when the exception occurs.
And the full stack trace of the exception is also very helpful.
Nov 4, 2013 at 9:59 PM
Stupid me :( Your enquiry made me think and rethink the error. A I'm not fond of using lists on daily basis, I made a childish mistake of not using a list constructor.
After modifying
private List<string> listaeksponatow;
private List<string> listaeksponatow = new List<string>();
the error is gone.
I'm so sorry I have have bothered you with such a trivialism.