Free Support Forum - aspose.com

Endless loop when looking for barcodes

Hi

I cannot read barcodes for certain types. For example Code39Standard. It seems to loop endlessly. I tried adding a timeout but it never times out. I have to kill the process.

This is the 2019 C++ library.

Still awaiting the 2021 version with Swiss support and the bug fix for DataMatrix reading.

Thanks

Occurs second time I read some barcode types like Code39Standard. For example DataMatrix it does not happen - I can read it again and again.

Only thing that looks out of place is the PrepareForUnload that I call for each image I look for barcodes on…

std::list<BarcodeHelper::Barcode> BarcodeHelper::barcodes(const unsigned char* filedata, const size_t filesize, const std::wstring& barcodetype)

{
System::IO::MemoryStream::Ptr stream = System::MakeObjectSystem::IO::MemoryStream();
// TODO: is this really the best way of getting data into Aspose?
for (size_t i = 0; i < filesize; i++)
stream->WriteByte(*(filedata + i));
stream->set_Position(0);

std::list<Barcode> result;

System::SharedPtr<BarCodeReader> reader = System::MakeObject<BarCodeReader>(stream, DecodeType::Code39Standard);

while (reader->Read() == true)
{
}

System::AsposeCppLibrary::PrepareForUnload(); // probably not the optimal place, but it is required before shutting down application, after reader->Read() has been called once

return result;

}

@bleze,
You may please create a new solution that can be compiled and executed here without any missing reference to reproduce the issue. Provide your sample images also for our reference. We will analyze the scenario and share our feedback accordingly.

Hi

Like I suspected the placement of PrepareForUnload is the cause of this. This function cannot be called twice, because it will cause the endless loop for Code39Standard and others (all 1D?).

Hopefully you can fix if for 21.2 release of C++?

NB! I cannot move this call due to the nature of the plugin system in my application.

To get sample to work, copy “0.png” to build folder. It will run barcode reader twice on it. Actually the image does not seem to matter. Any image will cause this error.

Thanks
barcodeendlessloop.zip (1.5 MB)

@bleze,
We have observed the issue and logged it in our database for further investigation. You will be notified here once any update is ready for sharing.

This issue is logged as:

BARCODECPP-444 - Endless loop when looking for barcodes

Datamatrix reading won’t be fixed in current C++ release and I cannot give ETA. There are broken Datamatrix L-pattern and currently we don’t have stable algorithm to restore this corruption.

But will C++ lib be updated more often than every second year? Because right now I do not have a good feeling in my stomach and won’t purchase 2 user licenses, until I’m confident Aspose is the way to go for reading and creating barcodes.

Where can I find the list of known issues and outstanding bugs in the upcoming release?

@bleze,
We have noted your concern and will share our feedback soon.