Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5842533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:01:48+00:00 2026-05-22T12:01:48+00:00

During an unhandled exception is there some way for me to capture the output

  • 0

During an unhandled exception is there some way for me to capture the output and show an error report dialog when the application crashes?


What I’m thinking is having a small program running in the background, which only job is to listen for an abnormal exit of the main application and then show the ‘report’ dialog where the user could choose to email me the output of the error.

Not really sure how to implement this, or if this is the right way to do it.

Reporting the error message would be an easy task, but I have no idea how to capture the output of an unhandled exception or grab the exit codes (I’m assuming the program would give an exit code other then 0 when it crashes).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:01:49+00:00Added an answer on May 22, 2026 at 12:01 pm

    Your best chance is inside the application. There are two hooks:

    • AppDomain.UnhandledException is the ultimate ‘catch-all’
    • Application.ThreadException is the UI specific catch-all for exceptions that occurred in Forms threads

    The proper place to ‘catch-all’ depends on your application semantics and is difficult to say where you should put it w/o knowing your application. Application need to also set the Application.SetUnhandledExceptionMode.

    Having an external watch dog is less useful because it cannot give any meaningful information why did the application crash. By the time it detect an ‘unexpected’ exit (how does it knows is ‘unexpected’?) is way too late to collect any useful information. With an inside handler you can collect the exception and the stack and submit them to an analysis service like bugcollect.com and then you’ll have a leg ahead in understanding now only what happened, but also how often it happens and which deployment are affected (where it happens). There are other similar services like exceptioneer.com or the Windows Error Reporting (this one requires your code to be signed by a trusted authority certificate like Verisign). Relying on a service for collection of incidents is far superior to sending mail, you don’t want to wake up and find 2k incident emails in your inbox and start sifting through them to understand what happened.

    And a final world: don’t reinvent the wheel: there are already many frameworks to collect and log exceptions, like log4net and elmah.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Description: An unhandled exception occurred during the execution of the current web request. Please
We are getting the error above on some pages of an ASP.NET MVC application
Description: An unhandled exception occurred during the execution of the current web request. Please
During a discussion about security, a developer on my team asked if there was
During a typical day programming, I implement functions in a way that I would
During my apprenticeship, I have used NHibernate for some smaller projects which I mostly
During software development, there may be bugs in the codebase which are known issues.
Trying to debug a random error on a rather complex ASP.net page, there is
During half a year of Winforms-MVP I designed the following exception handling strategy. I
I am having some problems getting only a date to show in my table..

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.