I've got a winforms app, and Program.cs looks something like this:
static void Main()
{
try
{
// Set up application
Application.Run();
}
catch (Exception ex)
{
// construct log from ex
log.Save(); // saves to db
}
}
This is working fine, and the log is being saved to the database as required. However, the application closes afterwards.
Is there a way I can catch exceptions and log them, then continue running the application? The code above is just a sample - in reality there will be some work done if an exception is thrown.