Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

AX 2012: CIL Generation Error

Posted on by Microsoft Employee

Hello,

 

I have a reference a DLL in the AOT and use this in my class. Whenever I compile the said class, it works file but when I generate Incremental CIL Generation, it throws the following error:

CIL generation: Error: .NET Cast Type Name not found. Type System.String found on the stack. This code in Class/Table: [Class Name], Method: run may not work in CIL run time.

Any idea?

 

Thanks,

Lyka Tasis

*This post is locked for comments

  • Suggested answer
    SaverioT Profile Picture
    SaverioT 327 on at
    AX 2012: CIL Generation Error
    It depends on the code in your class. I had the same error, and in my code I expicit the cast from str (X++) to System.String (.Net), before call a .Net method inside external dll that have System.String as parameter. After that CIL compile.
    I think you had similar problem.
  • Kedar Dande Profile Picture
    Kedar Dande 640 on at
    RE: AX 2012: CIL Generation Error

    Hi All,

    Anybody resolved this issue. Even I've tried all the solutions but, didn't work for me.

    Any help!!!

  • psined Profile Picture
    psined on at
    RE: AX 2012: CIL Generation Error

    Hi all,

    Although this is an old thread, I wanted to revive it since I have pretty much the same issue and I have already tried the remedies suggested by all contributors.

    Every now and then when we attempt incremental CIL build we get hailed by similar errors from standard AX code:

    CIL generation: Error: .NET Cast Type Name not found. Type System.String found on the stack. This code in Class/Table: PCRuntimeConfigurator, Method: calculationSummaryEventHandler may not work in CIL run time. \Classes\PCRuntimeConfigurator\calculationSummaryEventHandler 1 calculationSummaryEventHandler Err:351 

    This continues to happen even after ensuring we compile using the client installed on the computer hosting the AOS and despite that the assembly Microsoft.Dynamics.AX.Xpp.Support.dll was copied from C:\Program Files\Microsoft Dynamics AX\60\Server\[AOS instance]\bin\ to C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin\.

    Any ideas what else might be missing?

  • andy007 Profile Picture
    andy007 380 on at
    RE: AX 2012: CIL Generation Error

    Thanks AlexDAX, that did the trick.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: AX 2012: CIL Generation Error

    The problem is because something in your code needs Microsoft.Dynamics.AX.Xpp.Support.dll, which is in the C:\Program Files\Microsoft Dynamics AX\60\Server\[AOS]\bin folder and not in the client folder.

    You can just change your class property RunOn to "Server" instead of "Called From" and the CIL should compile fine.  The switch back to "Called From"...and even further incremental CIL builds will work...just do the switch for the one time.

    Or you can copy the DLL to the client bin folder.

  • Suggested answer
    Simon Buxton Profile Picture
    Simon Buxton 130 on at
    RE: AX 2012: CIL Generation Error

    Hi,

    I had the same problem, and was caused by the CPU targeting in the VS project; I changed this to Any CPU, and checked that references were correctly targetted.

    Regards

  • Dick Wenning Profile Picture
    Dick Wenning 8,705 on at
    RE: AX 2012: CIL Generation Error

    sorry, but why dll this way?

    always force to use the dll server side.

    also compile always with a client on the server

    in that case you don't have to bother about deploying the dll to all clients.

    or is it a visual studio project?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: AX 2012: CIL Generation Error

    Hi,

    As i stated in my previous answer, the .dlls were missing in the client\bin - Folder of the client installation (which in most cases should be something like "C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin") and in the server\common - Folder of the Server-installation (should be something like "C:\Program Files\DynamicsAX2012\Server\Common" on the AOS-Computer).

    André

  • Freya Tan Profile Picture
    Freya Tan 935 on at
    RE: AX 2012: CIL Generation Error

    Hi! Can you still remember which locations should the .dll file be copied?

    Thanks.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: AX 2012: CIL Generation Error

    HI Lyka,

    I encountered the same problem today. I had made some changes concerning a managed control that we use in our application and could not build CIL-Code encountering the same error message. I can again by now. Here is what I did:

    After comparing my system to a 'healthy' System, I found out that I was missing the Microsoft.Dynamics.AX.Xpp.Support.dll in several points. Apparently, this dll is responsible for type conversions at runtime ( msdn.microsoft.com/.../aa595142.aspx). This dll was present in the healthy system in the client\bin-folder and in the server\common-folder of the Dynamics installation. It was not present in my Installation.

    After Copying the dll to those locations some restarting of the service, it worked again.

    Don´t ask me, why the dll was missing, because I have no clue.

    Hope this helps (even if your question was a while ago).

    André

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,902 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,316 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans