This article applies to Microsoft Dynamics AX 2012.
The error message ”Internal error 25” is a generic error message that occurs when one type is trying to be converted into another incompatible type at runtime.
This error can be triggered in a myriad of different situations. However; there are three likely root causes to this.
In the ideal world the X++ compiler would detect any illegal X++ construct, that could lead to conversion between incompatible types. There are unfortunately a few situations where the X++ compiler doesn’t have enough information to do so. In X++ the type anytype can be used to denote any type in the system. Whenever the compiler sees a variable, parameter or return type of this type, it will not perform any type checking.This means that the code using the anytype type must explicitly verify the variable/parameter/return type is compatible with how it is being used. Failing to do so can lead to an “Internal error 25”.
Consider this code:
It will result in an “Internal error 25”. The function any2str() accepts an anytype as parameter, so the compiler will not perform any checking. However, the implementation of any2str() doesn’t support that a System.String (CLR Object) is passed in – and thus this error. As an X++ developer the only remedy is to work around the issue. In above example by assigning the System.String to a str (X++ native type). That will work because the interpreter’s assignment implementation do support conversion of System.String to str. The code then becomes:
One might argue that the interpreter’s assignment conversion should have solved the issue when using any2str() too. That unfortunately cannot be done, as the interpreter will not perform any conversion as the receiving side claims to support anytype.
The type to convert might originate from data in the data base. If the data has been stored in one format and is being retrieved in another, it could lead to this situation.Things to try:
The compiler produces pcode from the X++ code. This pcode is stored in the model store, and thus imported to the model store via AXUtil import (or AOD import). Given pcode often is referencing meta data from other models, the model store needs to be recompiled when new models are added or removed. Until the model store has been recompiled the interpreter may interpret metadata incorrectly, which can lead to “Internal error 25”. AXUtil will inform you about this after import, and so will Dynamics AX the first time a client is started.
The steps to take are:
Given the nature of the problem, the internal error 25 can occur before the system has had a chance to open the form automatically. This typically occurs when one of these classes are customized: Application, Infolog or ClassFactory. It can also occur, if elements referenced by these classes are customized.
To solve this issue follow these steps: