Источник:
http://blogs.msdn.com/b/mfp/archive/...solutions.aspx
==============
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.
1. A programmatic error
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:
- static void provokeInternalError25(Args _args)
- {
- info(strfmt('The current folder is %1',any2str(System.IO.Directory::GetCurrentDirectory())));
- }
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:
- static void avoidingInternalError25(Args _args)
- {
- str currentDirectory = System.IO.Directory::GetCurrentDirectory();
- info(strfmt('The current folder is %1', currentDirectory));
- }
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.
2. Stale data
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:
- Synchronize the data base
Right-click AOT | Data dictionary and select “Synchronize”
- Delete Usage data
Tools | Options | Usage data. Click ‘Reset’
- Debugging
Debug the steps leading up to the error, and correct the affected data – typically by deleting it.
3. Stale pcode
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:
- Restart AOS
- Start AX client
- Select “Launch model upgrade checklist” or “Compile and Synchronize” in the form that automatically opens.
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:
- Restart AOS
- Start AX client in safe mode
In command line type: AX32.exe -noauto
The –noauto option will prevent the system from running any pcode during start up, including the pcode that is triggering the “Internal error 25”, and the pcode that is launching the compile form. The client will start directly in the developer workspace to further prevent any application logic to be run.
- Right-click the root of AOT and select “Compile” or compile select portions of the AOT
- Resolve any compilation errors that could trigger a problem during start up.
==============
Источник:
http://blogs.msdn.com/b/mfp/archive/...solutions.aspx