While developing Windows Embedded 6.5.3 application for WMS (Warehouse Management System) which relies on Dynamics NAV web services I have encountered rather “familiar” error:
Metadata for object of type CodeUnit with id ****** is in a failed state…. error CS1001: Identifier expected.
OK, I said, I will recompile the object and restart Microsoft Dynamics NAV Business Web Services.
Recompile, restart… same error. What now? Hmm… restart Web Services Windows Service again. Nope!
Went into code and view the last function I have edited. Nothing suspicious. Compile – everything OK. Puf?!
Let’s go to error again (reading it whole this time). Whoa… Error details info:
…Error details: c:\ProgramData\Microsoft\Microsoft Dynamics NAV\60\Server\MicrosoftDynamicsNavServer\source\Codeunit\Codeunit50004.cs(498,163) : error CS1001: Identifier expected
Ok. Let’s open the error details file. It opens in Microsoft Visual Studio Tools for Applications. Went to line 498 and position 163 and I can see the following line of my function (with source in C#) which ends like:
Went back to my codeunit in NAV and opened C/AL locals of the function I have edited and I have something to see. There is a parameter WITHOUT NAME of Integer Type.
Somehow, while editing parameter list I have, inadvertently, created new parameter row, never assigning a name to it. NAV thinks this is OK and allows the codeunit to be compiled, but the NAV Business Web Services doesn’t like this.
Resolution was simple. Removed the “unintentional” parameter, recompiled codeunit, restarted NAV Web Service and everything was fine, again. 🙂