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,

AxHLink.exe Dynamics://0?DrillDown_5637192587

we use startupCmd parameter of Ax32.exe

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

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

\Classes\SysStartupCmd\Construct

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

# [ ax2012 ] dynamics protocol

[HKCR\dynamics]

URL Protocol=””

[HKCR\dynamics\Shell\Open\Command]

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 &quot;D:\AXHLink.rdp&quot;

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
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

Error

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

Solution

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

AX

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 )

Ax

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.