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)

Third party component/Dll exception handling

(0) ShareShare
ReportReport
Posted on by 1,559

Hi Friends,

We are using QASProOnDemand for address checking, most of time, it works great.

But, once a while, we got exception, actually, it erred out without throw exception since we couldn't catch exception.

I am not sure others experience similar problem. How can I do to handle it?

Thanks,

River

*This post is locked for comments

I have the same question (0)
  • Ganriver1 Profile Picture
    1,559 on at
    RE: Third party component/Dll exception handling

    Thanks a lot! Guys.

  • Verified answer
    Martin Dráb Profile Picture
    235,959 Most Valuable Professional on at
    RE: Third party component/Dll exception handling

    AX doesn't allow catching exceptions inside transactions (with a few exception, which don't apply to your case). AX aborts the transaction and continues execution after the transaction, therefore your exception handling code inside the transaction is skipped.

  • Ganriver1 Profile Picture
    1,559 on at
    RE: Third party component/Dll exception handling

    Hi Ievgen,

    That's what I did, see code, only thing it's inside transaction.

    Why it should be outside of transaction, we use a wrapper class to call 'checkaddress' method of QASProOnDemand.

    Thanks,

    River

       try

       {

           clientFactory = new QASProOnDemand.QASClientFactory();

           engine = clientFactory.createEngine(#QASURL, #UserName, #Password);

           canSearch = clientFactory.CanSearch(engine , qasCountry, qasLayout);

       }

       catch(Exception::CLRError)

       {

           error("An error occurred with the QAS service");

       }

  • Verified answer
    Mea_ Profile Picture
    60,284 on at
    RE: Third party component/Dll exception handling

    HI Ganriver,

    You need to catch Exception::CLRError and this catch should be outside of any transactions.

    It's hard to say more without seeing actual code.

  • Ganriver1 Profile Picture
    1,559 on at
    RE: Third party component/Dll exception handling

    FYI, here is call stack :

    [s]    \Classes\Application\ttsNotifyAbort                                                                     5

    [s]    \Classes\CLRObject\CanSearch                                                                            

    [s]    \Classes\QASProOnDemandService\CheckAddress                                                          46

    Try block couldn't catch any exceptions:-(

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
doninep Profile Picture

doninep 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans