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

  • SEARCH
  • Home
  • 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 7045015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:28:42+00:00 2026-05-28T02:28:42+00:00

What ? I am developing a Console Application that needs to keep running 24/7

  • 0

What ?
I am developing a Console Application that needs to keep running 24/7 No Matter What
Is there any way to stop a Multi-Threaded Application from getting blown up by some unhandled exception happening in “some thread somewhere” ?

Why ?
Please refrain from giving lessons like “you should manage all your exceptions”, “this should never happen” etc. I have my reasons : We are in test deployment and we need to keep this running, log exceptions, and restart all threads again. If anything unplanned happens and causes an unhandled exception to be thrown, it needs to be detected and some method called to restart all threads(atomicity is impossible due due the tier design)

This being said, I am aware it might no be possible to restart an application from “within” if it has blown because of and UnhandledException (which I already implemented).

So far, I have used Quartz.net’s FileScan Job and a Flag File to detect stuff like that and restart the application from outwards. But this sounds hacky to me. I would like to find something cleaner and less quick and dirty.

DownVoting / Sniping Warning : I KNOW this might NOT be possible “as is'”.
Please be creative/helpful rather than abruptly critic and think of this more as an “Open question”

  • 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-28T02:28:43+00:00Added an answer on May 28, 2026 at 2:28 am

    You need to attach an event handler to UnhandledException event on the Current AppDomain:

    AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler

    Inside the handler, you will have to somehow save enough state (to a file, database, etc.) for the restarted application to pass along to the new threads. Then instantiate a new instance of your Console application with a call to System.Diagnostics.Process.Start("MyConsoleApp.exe").

    Be very careful to introduce logic to avoid a continuous loop of crash/restart/crash/restart.

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

Sidebar

Related Questions

When developing a Win32 Application (non-console application) in Visual Studio 2005, is there any
I am developing a console application. I need to emulate the way how the
I'm developing a Silverlight application where I want to simulate a console. There are
I am developing a C# Console application, that has nothing to do with the
I'm developing an application that is running a lot of TcpListener tasks using c#
I am developing a c# console application that requires some 3rd party assemblies(DLL). On
I am developing one console application using perl script. In that I am printing
I am developing a console application in C#, and was wondering if there was
This is a console application that I am developing using VS2010 in C#. II
I am developing console application in .Net and I want to change a behavior

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.