Error “No metadata class defined for data contract object” in Dynamics AX 2012

The information in this post is based on Dynamics AX 2012 R3. It may or may not be valid for other versions.

I recently encountered the somewhat cryptic error message “No metadata class defined for data contract object” when trying to start a SysOperation controller class.

After a bit of investigation, it turns out that the cause of this was that I forgot to decorate the ClassDeclaration of the data contract class with the [DataContractAttribute] attribute.

It seems there are a couple of other possible causes, but the above is the by far most likely one. Strange that I haven’t encountered it before, but I guess I’ve never forgotten that attribute before, then 😉

Hereby noted for future reference 🙂