AL icon indicating copy to clipboard operation
AL copied to clipboard

[Question] TextBuilder Microsoft.Dynamics.Nav.Types.Exceptions.NavNCLArgumentException

Open OleTeichmann opened this issue 8 years ago • 5 comments

I am using a TextBuilder Variable and in an automated Test. The function where it is used uses a return value of Text. When TextBuilder.ToText() is called i get following exception:

Exception of type 'Microsoft.Dynamics.Nav.Types.Exceptions.NavNCLArgumentException' was thrown.

Can somebody help me with this issue?

OleTeichmann avatar Jul 19 '18 12:07 OleTeichmann

Hi @OleTeichmann, What version are you running? Do you have a snippet of code that reproduces the problem?

thpeder avatar Jul 19 '18 12:07 thpeder

@thpeder already solved the issue, was because of TextBuilder.Replace('','');

OleTeichmann avatar Jul 19 '18 12:07 OleTeichmann

@OleTeichmann, I would still like to know how you got the exception, because the compiler should have stopped you from compiling that with an diagnostic saying something like: can't find member of name ",".

thpeder avatar Jul 19 '18 13:07 thpeder

@thpeder AL Language Version: 0.16.19969 procedure ConvertSpecialChars(TextPar : Text) : Text; var TextCharBuilder: TextBuilder; begin TextCharBuilder.Append(TextPar); TextCharBuilder.Replace('Ä','Ae'); TextCharBuilder.Replace('',''); exit(TextCharBuilder.ToText()); end;

I got the Error at TextCharBuilder.Replace('','');

OleTeichmann avatar Jul 19 '18 13:07 OleTeichmann

That was actually the expected behavior since the first argument should not be empty. Thanks for the feedback 👍

thpeder avatar Jul 19 '18 13:07 thpeder