String format options for utcDateTime

I’ve run into a problem that reminded me that while X++ types and corresponding CLR types (such as str and System.String) can often be user interchangeably, they aren’t the same. I was trying to convert a utcdatetime value to the standard “sortable” format in D365FO, for which I wrote the following code: utcdatetime currentDateTime = …

Continue reading ‘String format options for utcDateTime’ »

X++ to CIL: Object must implement IConvertible

Somebody asked in Dynamics User Group forum about an error thrown by RetailCommonWebAPI running in a batch in AX 2012 (RetailCommonWebAPI in batch mode). I don’t want to discuss that particular problem here, but I want to show the underlying cause, because it’s actually quite tricky. What I’m discussing below is related to CIL generated …

Continue reading ‘X++ to CIL: Object must implement IConvertible’ »

(In)valid conversion

X++ compiler is very benevolent when dealing with types – much more than it should be. It happily accepts code that can’t succeed at run-time, as I’ll will demonstrate in a minute. It’s unfortunate, because some errors could have been detected at compile-time and they aren’t. And that’s not all – the X++ runtime is …

Continue reading ‘(In)valid conversion’ »