CIL Generation - AX 2012 - Error when generating

 You receive this when you run a full "Compile into .Net Framework CIL", together with "CIL generation: The given key was not present in the dictionary.".


 If this is the case, you have option A) that is run a complete AOT compile. However, this is too much time consuming and you could try a shortcut: look at the generation log (the path can be found in this post) and you will see something like:

Finished pass 1 at 7/24/2012 2:24:38 PM
Error when loading the method. Type: ProjTable, Method: initValue
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.

....
The CIL generator found errors and could not save the new assembly.
Errors: 3
Warnings: 0
 

So, just compile the objects in case and give it another try ... the CIL should be generating now.

7 comments:

  1. Thank you! Saved us from having to do a second full app compile overnight :)

    ReplyDelete
  2. If you receive this error:

    System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
    Parameter name: index
    at System.Collections.Generic.List`1.get_Item(Int32 index)
    at Microsoft.Dynamics.Ax.Xpp.ILGenerator.loadFieldsIL(TypeBuilder typeBuilder)
    at Microsoft.Dynamics.Ax.Xpp.ILGenerator.declareFields()
    at Microsoft.Dynamics.Ax.Xpp.ILGenerator.GenerateXppModule()
    The CIL generator found errors and could not save the new assembly.
    Errors: 1
    Warnings: 0

    1. Compile All application
    2. Fix all errors you encountered
    3. Compile CIL

    Voilá

    ReplyDelete
  3. Thanks a span, saved lots of time

    ReplyDelete
  4. Thank You it saved me doing a full CIL generation

    ReplyDelete
  5. Thanks you just saved my ass. A full AOT Compile would cost me the remainder of the night.

    ReplyDelete
    Replies
    1. I am facing the same problem, error occurred during the Compilation to .Net CIL Generation, I did the same what ever you mention,
      I went to the location of XPPIL directory and removed all the assembly from there, after that i synchronize the database and the full compilation and next the CIL generation, but no improvement.
      I want to dictate my scenario over here.
      My Database is 2012 standard and located on this (10.6.123.50)
      and AX2012 R3 is on different IP (10.6.123.51).
      Installation done successfully as well as Application Compile without any error.
      the next step when compile with CIL Generation, error occurred "The CIL generator found errors and could not save the new assembly”.
      what should be possible error in this environment.
      For your clarification,
      User is Member of Domain Admin and Admin of local system.
      Thanking you

      Delete