NetBarcode icon indicating copy to clipboard operation
NetBarcode copied to clipboard

System.NullReferenceException: Object reference not set to an instance of an object.

Open enriquerdz opened this issue 5 years ago • 4 comments

System.NullReferenceException: Object reference not set to an instance of an object. at NetBarcode.Types.EAN13.GetEncoding()} | System.NullReferenceException

CODE:

var barcode = new Barcode(newStringValue, TypeNet.EAN13, true); <--- Exception origen

use implement

using NetBarcode; using TypeNet = NetBarcode.Type;

Ambient:

Ubuntu 20.04 NetCore 3.1

enriquerdz avatar Dec 16 '20 03:12 enriquerdz

Hi, you install some native dependencies?

sudo apt install libc6-dev 
sudo apt install libgdiplus

Tagliatti avatar Dec 24 '20 04:12 Tagliatti

I have installed the depencencies that you comment and it keeps giving the error.

enriquerdz avatar Dec 28 '20 15:12 enriquerdz

If you use (new Barcode("543534")).GetImage(); it works?

Tagliatti avatar Dec 28 '20 15:12 Tagliatti

In my case this NullReferenceException was caused by country three digit code check, because the first three digit are 000, at: https://github.com/Tagliatti/NetBarcode/blob/master/NetBarcode/Types/EAN13.cs line 90 Its not stopped my app because the next check of two digit code does not throw an exception.

CarlosEvandro-Fi avatar Apr 07 '22 16:04 CarlosEvandro-Fi