Data Separator Crashing Report In SSRS

Hi

I am attempting to place a data separator within a GS1-128 barcode, but doing so gives the following error on preview…

", hexadecimal value 0x1F, is an invalid character.

Please advise. Thanks.

@Steve_Flynn,
Thank you for your query. Please share your sample file and runnable sample application with us for our testing. We will reproduce the problem and provide our feedback after analysis.

FNC1 cannot be added manually to codetext, use this example
BarcodeGenerator lGenerator = new BarcodeGenerator(EncodeTypes.GS1Code128, “(02)04006664241007(37)1(400)7019590754”);
Bitmap lResBmp = lGenerator.GenerateBarCodeImage();

XLidl LabelX.zip (3.4 KB)

Hi

Report file attached. Thanks.

Capture.JPG (37.0 KB)

Hi

I haven’t worked with data separators before, so I am struggling to understand this. See attached image. I’m using the same application identifiers as those in your example, but the spec I’ve been given specifically tells me not to include parenthesis in the barcode itself…

“Each application identifier (AI) will be marked through parenthesis. The parenthesis are not to be added to the barcode itself. Please note that a data separator has to be coded after a variable data identifier.”

Thanks.

Yes you can generate barcode with EncodeTypes.GS1Code128 symbology and GS1 codetext without any changes, like “(02)04334035575391(400)496130071901”. The codetext is converted to GS1 AI codes by internal engine.

However “1519090510H-1848253740” and “(00)2019725101836200” are wrong GS1 codetext and cannot be encoded.
https://www.gs1.org/standards/barcodes/application-identifiers

Do you need ability to encode even wrong GS1 codetext?

Hi Alexander

The example is just test data at the moment as our customer is not yet using SSCC codes, but soon will be. Am I getting the error because the example data is non GS1 compliant? Thanks.

Yes, you will get exception when you try to encode codetext in GS1Code128 mode with wrong GS1 AI codes usage. You can see requirements to the GS1 AI codes in the upper link.

Hi

Whilst I acknowledge that the test data is not GS1 compliant, I don’t believe this is what is causing the error, as the report crashes before I am prompted for the barcode parameter (the parameter being the SSCC code). Please advise.

Ok, I investigated the library code and we don’t throw exception like this:
“hexadecimal value 0x1F, is an invalid character.”
So, it is not our exception.

Then I searched Microsoft Blogs by Google and found that this problem could be related with SQL query and data from it. You can see there also possible solutions of this problem.

PS
With new version (from 17 July) of VS2017 and VS 2019, Aspose Barcode SSRS library doesn’t work. We know about this problem, problem related with changes in Microsoft libraries and problem will be fixed in next release.

I have done some research and it seems that “0x1F” is the data separator inserted by the Aspose control. Whilst the exception is not generated by Aspose, it is caused by the Aspose bar code control when I enter the data separator. Please advise how I can enter a data separator into barcode for a Visual Studio report project. Thanks.

In which field of Aspose control do you enter data separator? Could you also provide exact codetext or value which causes this error (you can write it to text file and attach).

Because Aspose control generates only image, but its fields are writen in text format to report xml. This might cause problem if you manually write non-allowed symbols like ANSI 0x1F to some fields.

PS
XLidl LabelX.zip doesn’t cause any errors on my system but it has SQL request to DB so I can only run it in design mode.

report2019_bug1F.zip (2.8 KB)
I reproduced the issue and this issue cannot br cause by Aspose Barcode control.

You can create new report with Aspose Barcode and add text from 0X1F.txt (0x1F symbol included) to the codetext field. You cannot switch to preview mode or even write report with changes to disk with exception “, hexadecimal value 0x1F, is an invalid character.”. However in design mode the 1F symbol cannot be visible and aspose barcode generates correct codetext.

If you manually add information from file 0X1F.txt to you new report project you can see the same error. Also you see Report1.rdl _codeText field with manually inserted 1F symbol which causes error.

For the manipulations you should use notepad++ and hex plugin
https://notepad-plus-plus.org/downloads/v7.8.2/

In this case, the main reason of the error could reading 1F symbol from database (with inserting to aspose control fields) which causes xml report file to unworkable state.

CodeText = “00” & First(Fields!SSCC.Value, “DataSet1”)

The data separator is not part of the SQL dataset, I attempt to add the data separator through the Aspose options as below…

Aspose.png (44.2 KB)

The report runs without issue until I add the data separator

The report runs without issue until you add 0x1F ASCII Code.

I don’t know who tells you to use this character or where you find it but we don’t use or encode US/0x1F/FNC1 character with manual addition to the Code128 codetext.

If you want to encode GS1 codetext you should encode in this way:

  1. Set GS1Code128 as barcode type
  2. Set codetext in the mode “(GS1_code)GS1_digit_value”, “(GS1_code)GS1_digit_value1(GS1_code)GS1_digit_value2”, like “(400)7019590754” , “(02)04006664241007(37)1”.

Don’t use US/0x1F/FNC1 character manually.