“Exception has been thrown by the target of an invocation” – solved

Blogging this so that I don’t forget it yet again.

The users logged into a new AX 2012 CU3 environment, and got this error when they tried to run the Purchase Order, the bane of 2012, it would seem!

“Exception has been thrown by the target of an invocation.”

 

1-22-2013 5-01-34 PM

 

 

The fix is simple – for every user, go to “Tools > Options > Development > General” and UNCHECK the “Execute business operations in CIL” box.

 

 

1-22-2013 5-27-57 PM

 

Presto.

 

Happy DAXing!

Advertisements

About janeteblake

Dynamics AX developer
This entry was posted in AX2012, Bug, Dynamics AX. Bookmark the permalink.

16 Responses to “Exception has been thrown by the target of an invocation” – solved

  1. p.m.sudha03@gmail.com says:

    Hi,
    I tried this but got an error “error in getting SID”

  2. Mansoor Adeel says:

    it worked for me, but started giving another error on PO “Voucher No. XXXX already exists”. When I check number sequences, i can’t find the number system is displaying in error! Any help

  3. Thanks a lot .. Worked for me as well

  4. Paul says:

    Solebed my issue to. Thanks.

  5. Paul says:

    Should have read solved rather than solebed! P

  6. Tom says:

    I don’t have the the development option under tools.

    • janeteblake says:

      Tom, thank you for mentioning that. Yes, I’ve seen that when the users were not privileged. You should get a system administrator to do it for you. Then it will work!

  7. MannyIndy says:

    Technically, this is not a solution. It is just a workaround that is masking the real problem. You are just bypassing the CIL compiled code. Ideally, you should trap the CLR exception and try to resolve that. Besides, as you have noted, this option is available only to users who are system admins.

  8. nick townsend says:

    Does the message indicate there is an error in the CIL compiled code, how would you go about fixing this error correctly ?

    • janeteblake says:

      Yes, it does indicate exactly that, and you need to resolve the code issue ultimately using normal debugging/VS debugging procedures.

      • nick townsend says:

        Thanks for your reply Janete. I guess I’m confused as to why the code would act differently in interpreted mode than in compiled mode, it’s the same code it’s running isn’t it, just in a different way ?

  9. Alex says:

    Do not do this as a solution. This basically disables functionality all over the system. You should debug and solve the actual error.

  10. Ravi Theja Madisetty says:

    Hello Jeneteblake,
    When I’m trying to open AX application immediately getting this error on screen and application is going to not responding mode. I have tried to recreate XPPIL folder, but failed (Folder partially created). Finally restarting server will resolve my issue. Seems it’s a strange error in my case.

    Thanks.,
    Ravi Theja Madisetty
    https://techguns,wordpress.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s