Service name can be getted from services.msc properties
:: 0) setup configuration SET serviceName=XXXXXX :: 1) restart service net stop %serviceName% net start %serviceName%
Service name can be getted from services.msc properties
:: 0) setup configuration SET serviceName=XXXXXX :: 1) restart service net stop %serviceName% net start %serviceName%
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.
1. new File
2. test.udl
3. double click
4. we can select provider driver
NOTE : if in 64 bit machine, but the driver is 32 bit ( i.e. `Oracle Provider for OLE DB` ), try to execute UDL in 32 bit mode using the following command.
C:\Users\User>c:\Windows\SysWOW64\rundll32.exe "c:\Program Files (x86)\Common Files\System\Ole DB\oledb32.dll",OpenDSLFile C:\Users\User\Desktop\test.udl
The sourcecode of the UDL file is showing below.
[oledb] ; Everything after this line is an OLE DB initstring Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=userIdNaja;Data Source=XXX.XXX.XXX.XXX