[ ax2012 ] calling Ax32.exe instead of AxHLink.exe

Since AxHLink.exe will limit to only the default configuration, we will call the Ax32.exe that is more open to various configuration instead.

To do that,

instead of calling

AxHLink.exe Dynamics://0?DrillDown_5637192587

we use startupCmd parameter of Ax32.exe

"C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\Ax32" "C:\path\to\configuration.axc" -startUpCmd=DrillDown_5637192587

Note that we can find multiple feature of startUpCmd under `Switch` section of the following class ( as explained in MS ref )


Note2 : allow all arguments to pass from the client is risky, so it is better to call to .bat or .lnk instead of calling directly to ax32.exe

ref : http://stackoverflow.com/questions/23336165/open-direct-links-to-ax-objects-or-datasets-from-external-application

[ ax2012 ] dynamics protocol

Access to protocol dynamics://


(Default)       =”URL:dynamics link”

URL Protocol=””


(Default)         =”path\to\AxHLink.exe %1″


ref : http://stackoverflow.com/questions/3468000/problem-setting-up-custom-url-protocol-on-windows-ce

NOTE: to open RemoteApp ( .rdp ), use mstsc command, for example

(Default) = mstsc.exe "D:\AXHLink.rdp"

or if we would like to pass parameter, just use the simple batch file and point the link to batch file


(Default) = D:\AXHLink %1

batch file that append `remoteapplicationcmdline:s:`

@echo off
copy D:\\AxHLink_Template.rdp D:\\AxHLink.rdp
echo %* >> D:\\AxHLink.rdp
call D:\\AxHLink.rdp

[ Microsoft Dynamics AX 2012 ] CIL generation: Source array was not long enough. Check srcIndex and length, and the array’s lower bounds


CIL generation: Line Number nn - Line Number nnn - Source array was not long enough. Check srcIndex and length, and the array's lower bounds.    \Classes\WhateverClass\WhateverMethod    nn    whatever    Err:nnn


On the Internet, there’s always a suggest to do a magic trick ( `Generate Full CIL` ) that solved all the symptom of Dynamics AX.

However, In my case, the `Generate Full CIL` does not help.

Scenario 1

In my case, The AX throws error `Source array was not long enough. Check srcIndex and length` and AX point the red underline error to class A,

A — use —> B


indicate error

However, the root cause of the error is in class B that is used by class A. The class B has compile error. ( I knew this by compile class B again, and found that some fields that is used in class B are missing from the table ).

After comment it out, recompile class B, and `generate increment CIL`. The error `Source array was not long enough. Check srcIndex and length, and the array’s lower bounds` is gone.

NOTE here that I don’t need to `generate full CIL` at all.

Scenario 2

I also found that, in some case AX indicates error in class A with `Source array was not long enough. Check srcIndex and length`, which class A use class B that extend from class C.

A —- use —-> B ( extends C )


indicates error

The root cause of the error is in class C. The class C has a compile error. The solution to this is like scenario 1, compile class C, and `generate increment CIL`. And again, no need to `generate full CIL`.

That’s it. Hope this article will help you, rather than waiting 4-5 hours doing nothing for the `full CIL generation` and ends up with same error as before. Try to check the modified class that the error class is used, they may contains error.

Steps to rules all of theses

In scenarios 1-2 we can knew the error class. However, in the case that we don’t know the error class. Following these steps to rule them all.

1. full compile AX  ( *** This is important, generate full CIL alone does not solve the problem )

2. fix all the compile error (  AX don’t allow us to deploy the new assembly if we had a compile error )

3. full generate CIL ( Some AX service group uses the CIL.NET assembly, so we have to generate CIL)

Once we can deploy the new .NET assembly, the problem is gone.