C Board  

Go Back   C Board > General Programming Boards > C# Programming

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 04-26-2008, 02:25 AM   #1
Registered User
 
Join Date: May 2006
Posts: 1,579
default exception handling

Hello everyone,


For the default approach for a console application or Windows service written in C#, if there is an uncaught exception, the console application or the Windows service will terminate? Right?


thanks in advance,
George
George2 is offline  
Old 04-26-2008, 02:54 AM   #2
Confused
 
Magos's Avatar
 
Join Date: Sep 2001
Location: Sweden
Posts: 3,125
Does for me...
It's not a that hard scenario to test
__________________
MagosX.com

Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Magos is offline  
Old 04-27-2008, 01:58 AM   #3
Registered User
 
Join Date: May 2006
Posts: 1,579
Thanks Magos,


Glad you agree with me. :-)

Quote:
Originally Posted by Magos View Post
Does for me...
It's not a that hard scenario to test

regards,
George
George2 is offline  
Old 04-29-2008, 10:48 AM   #4
Registered User
 
Join Date: Apr 2008
Location: USA
Posts: 22
Exceptional...

Code:
Try()
{
}

Catch()
{
}

Finally()
{
}
Anything that the catch method could not handle will generally go unhandled unless you specify some conditionals like an if -- else or switch case within the catch method member. This is where you can set-up a safety net that will take all un-handled exceptions and bounce the application back to its feet or you can make a general handling rule that could output a message like "unknown exception occurred."

If nothing is explicitly designed within the catch definition to handle a given exception then the application will step into the 'finally()' member for last minute instructions before terminating the application in question. This is where you will explicitly call methods to save work in progress and dispose of external service providers like browsers and notepads that your system called up during runtime.
TheRaven is offline  
Old 04-30-2008, 08:32 AM   #5
Registered User
 
Join Date: May 2006
Posts: 1,579
Thanks TheRaven,


I am interested, but seems never used before the below trick you mentioned, especially -- "an if -- else or switch case within the catch method member". Could you show some pseudo code please? So that I can learn from you.

Quote:
Originally Posted by TheRaven View Post
Anything that the catch method could not handle will generally go unhandled unless you specify some conditionals like an if -- else or switch case within the catch method member. This is where you can set-up a safety net that will take all un-handled exceptions and bounce the application back to its feet or you can make a general handling rule that could output a message like "unknown exception occurred."

regards,
George
George2 is offline  
Closed Thread

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
signal handling and exception handling lehe C++ Programming 2 06-15-2009 10:01 PM
Exception handling in a large project EVOEx C++ Programming 7 01-25-2009 07:33 AM
exception handling coletek C++ Programming 2 01-12-2009 05:28 PM
is such exception handling approach good? George2 C++ Programming 8 12-27-2007 08:54 AM
Signal and exception handling nts C++ Programming 23 11-15-2007 02:36 PM


All times are GMT -6. The time now is 02:48 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22