zero-terminated string error

Hi Raul / DenSter,

Thanks for your great support. Thankfully I am able to make that happen. Only thing is that whenever I add any string into message queue, code unit gets executed and gives following error.

This message is for C/AL programmers:The stream cannot find a zero-terminated string.The stream may be invalid, or the (variable or requested) size may be too small.

I am not able to figure out the problem.

Please help

I split this away from Asim’s post here:

Hi Ashim,

This is Kishor here.

I have already face this problem . Please check the array variable which you have changed in codeunit.

and just change it’s daimention value pluse one.


Kishor K Bhatt

Hi Kishore,

Following are variables in my code unit:

MQBus Automation ‘Navision MS-Message Queue Bus Adapter’.MSMQBusAdapter
CC2 Automation 'Navision Communication Component version '.CommunicationComponent → WithEvents = Yes.
InMsg Automation ‘Navision Communication Component version 2’.InMessage
InS InStream
Txt Text (100)

Can you please tell me which variable’s dimension I need to change.


Does anybody have solution for this??


Did you debug this? At what statement does it generate that error?


I haven’t dealt much with streams but my guess is that you are passing a string which is not null-terminated (ACSII character zero).

Hello All,

Thanx for reply,

But still I am not able to figure out the problem.

Now I am getting following error for the same code which I was previously running.

You are using an invalid data type for this function.

Please Help.



Please use Readtext instead of Read in your code.It will help you.


Abhishek Kumar Singh

Shobhit Bansal