A while ago while delivering code for a customer (in Microsoft Dynamics AX 2012) I ran in to this problem while compiling with axbuild.exe (but not while compiling in the aot).
I haven’t been able to reproduce this error after fixing the problem, but from what I read there might be several ways to reproduce it.
So, how did I fix this?
First things first.. What does the error message mean and why does it only appear while using axbuild.exe?
Since last compilation of the object the static keyword on the method you are trying to compile has been removed or added.
When the static keyword is being added/removed you are note only changing the plain text code of the method, but also the type of the object.
The type of an aot object is stored in the model database in the table “ModelElement”.
As you can see there is a field named “ElementType”.
And here is Microsoft’s list of types.
The problem when you get this error message is that the element type is not in sync with the plain text code.
For example: Your method is saved as a static method, but in the “ModelElement” table the element type is still 12 (TableInstanceMethod) where it should be 22 (TableStaticMethod).
For some reason the compiler in the aot does not validate this, but the axbuild.exe compiler does.
Here is a comparison I did between the source and destination environment during my installation of code.
Changing this directly in sql with “Sql Server Management Studio” will do the trick.
Last 5 posts in Dynamics AX
- How to call a web API from Dynamics 365 FO X++ - December 1st, 2020
- Sales line number not unique - May 27th, 2016
- DMF - DMF Service is unavailable - November 7th, 2012
- DMF - Error occured while doing bulkcopy from temp table to entity table - November 6th, 2012
- Date and UtcDateTime interval for previous month - November 1st, 2012