Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Method was not found during CIL generation

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

  • Kevin Roos Profile Picture
    Kevin Roos 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. 

  • Faizan Ashraf Profile Picture
    Faizan Ashraf 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.

  • Community Member Profile Picture
    Community Member Microsoft Employee 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

  • Martin Dráb Profile Picture
    Martin Dráb 230,445 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
    Community Member Microsoft Employee 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
    Martin Dráb 230,445 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++.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans