Yesterday at Microsoft Dynamics AX Technical Conference 2011 Peter Villadsen, Senior Program Manager gave one of his best performances ever. Anyone who have seen Peter live in the past knows what this statement carries. And it certainly didn't hurt, that Peter had excellent news to share with us.

Peter is a dear friend of mine, a top professional program manager, and a class entertainer. In his own laid-back, eloquent and well-articulated manner Peter owns the room and the audience's attention. Peter's presentation took place in the Kodiak room - the largest of the rooms we use for breakout sessions at the Microsoft Conference Center. It seats 400 people, and many more were standing along the walls - including me. Peter masters the English language to an extend where it is impossible to tell (and believe) that he is actually a native Dane. Over the course of the years I've had the pleasure of traveling with Peter to Italy, Spain and France - and I can testify that Peter also masters these dialects of the human linguistic. I do not believe it is a coincidence that Peter works in our Language team.

The session's title were: "Developing in .NET Managed Code and other X++ enhancements". Based on that title no one expected to find such fine jewels in the treasure chest. Peter started by going through some of the "minor" improvements in the X++ language in Microsoft Dynamics AX 2012. These includes:

  1. New AS and IS keywords - with the same semantics as in C#. In X++ they work for class and table types.
  2. Support for Attributes - just like in C#.
  3. Table inheritance.
  4. Tightening up of various language constructs. X++ no longer allows return type covariance, return type contravariance, parameter covariance, parameter contravariance, and visibility contravariance. This fully aligns X++ with C#. To explain this in less language-savvy terms, it means an overriding method must have the same return type and parameters as the method it is overriding. Further; it cannot reduce the visibility, e.g. it cannot make a public method private.
  5. The dangling semi-colon is not required anymore. The spontaneous applause was much appreciated.

As if the above in itself was not enough to warrant a new release - Peter moved on to the real topic: X++ as a managed languages.

The BC.NET component has been re-engineered. In Microsoft Dynamics AX 2009 it is basically a face-less client that allows the managed world to call into the AX stack. The X++ code in AX 2009 can call out into the managed world using interop. Notice that when you call out into managed code, you cannot call back into the same AX session. I.e. no round-tripping. In Microsoft Dynamics AX 2012 this is changed. The new BC.NET component is a now thin conversion layer that can attach itself (in-process) to the AX client(s), the AOS and regular managed code. It will ensure all marshaling and type conversions happen seamlessly between the two realms. Peter demonstrated this by having a X++ class pass itself to a C# class, and let the C# class change the state of the object, by invoking a method on the X++ class. It just worked exactly like you would expect.

But wait - there is even more. In Microsoft Dynamics AX 2012 we are compiling X++ code to the CLR. At compile time we generate an XML representation of the pcode, which we can convert into IL. At run-time we will be executing the IL for batch jobs, service calls and RunAs constructs. (RunAs is a new method allowing you to request the X++ logic to be executed as IL.). Peter demonstrated how the performance characteristics are vastly different particular in situations with extremely many objects or extremely many methods calls. Even in less-extreme situations running X++ as IL is beneficial as for example it reduces the time database locks are held, and thus improves performance and scalability.

Peter started the session by quoting Bob Dylan's The Times They Are A-changin' - I believe everyone in the audience agreed.