Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

GpAddIn - Catching an unhandled exception

(0) ShareShare
ReportReport
Posted on by 150

Hi,

I have a GpAddin that is occasionally throwing an unhandled exception. Can anyone tell me how I go about capturing it, or the details of the exception?

If you wrap a function in a try...catch then any exceptions are caught by that function, however as soon as the exception leaves that function GP kicks in and closes down. I've tried AppDomain.CurrentDomain.UnhandledException and Application.ThreadException with no luck. As there are a lot of fucntions I dont want to have to wrap each one in a handler.

Thanks

Tim

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: GpAddIn - Catching an unhandled exception

    Hi,

    if you are creating a custom process in VS Tools, make sure that you must create a event log to trace the log details.

  • Verified answer
    tag1971 Profile Picture
    tag1971 150 on at
    RE: GpAddIn - Catching an unhandled exception

    Hi Andrew,

    That’s the conclusion I've come to as well. As soon as an exception leaves the function that it was raised in GP grabs it and shuts down. After much digging around it looks like GP has a global exception handler, which you can’t override from an AddIn It looks like I'll be spending some time putting exception handling into existing functions :(

    Thanks

    Tim

  • Suggested answer
    Andrew John Dean Profile Picture
    Andrew John Dean 1,337 on at
    RE: GpAddIn - Catching an unhandled exception

    Hi Tim

    From my experience of developing with VSTools, you will need {try..catch} code around every event handling entry point into your Addin logic

                (i.e.  void Login_CloseAfterOriginal(object sender, EventArgs e)  {try ..catch } )

    If you don't incorporate exception handling and an exception occurs, GP will crash and no record of the cause of the fault will be recorded in the event log.

    Regards

    Andrew Dean

  • Suggested answer
    sandipdjadhav Profile Picture
    sandipdjadhav 18,265 on at
    RE: GpAddIn - Catching an unhandled exception

    Tim,

    Please find link : blogs.msdn.com/.../debugging-visual-studio-tools-tips.aspx

    You can debug your application I have used and work like champ.

    Thanks

    Sandip Jadhav

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: GpAddIn - Catching an unhandled exception

    Hi,

    there must be a log in Application,Dexterity. please recheck the error occurrence.

  • tag1971 Profile Picture
    tag1971 150 on at
    RE: GpAddIn - Catching an unhandled exception

    Hi Nataraj,

    I've already tried looking at the event log, unfortunately no detailed information is put in there. All that’s there is related to Dynamics GP itself not the GpAddIn,

    Thanks

    Tim

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: GpAddIn - Catching an unhandled exception

    Hi,

    Please use Event viewer to trace the exceptional error.

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