web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Method was not found during CIL generation

(0) ShareShare
ReportReport
Posted on by

Hi All,

I have referenced a DLL in the my batch class ( extending SysOperationServiceBase). Whenever I compile the said class it works fine and also run fine when run manually from AX. But when run from schedule batch, it throws an error :

Microsoft.Dynamics.Ax.Xpp.ClrErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ClrErrorException' was thrown. 
at Microsoft.Dynamics.Ax.Xpp.CLRInterop.staticInvoke(String typeName, String methodName, Object[] parameters, Type type)

I have run the Full CIL and It gives me a warning:

CIL generation: Exception was thrown because the .NET instance method xxxx.method was not found during CIL generation in class ClassName.method. Generating the code to make a reflection call during run time.

Any help will be appreciated, thanks in Advance.

Thanks

Mallik 

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    236,297 Most Valuable Professional on at
    RE: Microsoft.Dynamics.Ax.Xpp.ClrErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ClrErrorException' was thrown.

    First of all, ensure yourself that your DLLs has been deployed to AOS.

    Then look at what type of exception it is, what's the message and if it has any inner exceptions. Knowing that your code threw "an exception" simply isn't enough.

    You might want to debug your code in X++ first and switch to CIL when it works in X++.

  • Community Member Profile Picture
    on at
    RE: Microsoft.Dynamics.Ax.Xpp.ClrErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ClrErrorException' was thrown.

    Hi Martin,

    Thanks for reply, I have deployed the DLLs in both Server and client bin folders and also the same is code is running when I run manually (with the help of a x++ job calling the Batch class job main method) and when I automated it throws an error.

    I have tried below things

    1. changed myBatch class property to run on server.

    2. copy the Dll's to all AOS servers and client bin folders.

    3. added a DLL reference to to AOT.

    Can you suggest what else can I do. Thanks in advance

  • Martin Dráb Profile Picture
    236,297 Most Valuable Professional on at
    RE: Microsoft.Dynamics.Ax.Xpp.ClrErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ClrErrorException' was thrown.

    I already did - please read my suggestion above.

    You seems to think the DLL can't be found, but that's not what the error says. It says that your code threw an exception.

  • Community Member Profile Picture
    on at
    RE: Microsoft.Dynamics.Ax.Xpp.ClrErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ClrErrorException' was thrown.

    Dear Malik,

    Not sure if this helps you, as Martin suggested here try to get the actual error message out.

    try using try catch loop and use CLRInterop::getLastException() function after catching your exception. this may tell you the actual error or problem.

    thanks,

    Manish

  • Faizan Ashraf Profile Picture
    15 on at
    RE: Microsoft.Dynamics.Ax.Xpp.ClrErrorException: Exception of type 'Microsoft.Dynamics.Ax.Xpp.ClrErrorException' was thrown.

    May be you can check if your hot-swapping is enabled. just to to uncheck it and try again.

  • Kevin Roos Profile Picture
    265 on at
    RE: Method was not found during CIL generation

    Did you add the DLL to the server bin or in the GAC of the AOS machine?

    *edit* Didn't see there where already replies. 

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans