This project has moved and is read-only. For the latest updates, please go here.

The BarcodeDrawFactory is not thread-safe


At least one of the specific barcode draw factories are not thread safe. The static constructor performs non-synchronized operations that may cause exceptions to be thrown while building the map of glyphs.

Example for producing exception:
var largeString = "0123456789";
Func<string, BarcodeMetrics, Image> f = BarcodeDrawFactory.Code25InterleavedWithoutChecksum.Draw;
Parallel.ForEach(Enumerable.Range(0, 10), i =>
    for(var x = 0; x < 1000000; x++) {}
    f(largeString, new BarcodeMetrics1d(2, 30));


thzinc wrote Jul 17, 2015 at 9:45 PM

I've submitted a patch to fix this issue.