Looking for Tips/Writeup on overall approach to Exception Processing

Tech-Archive recommends: Fix windows errors by optimizing your registry




Re: Looking for Tips/Writeup on overall approach to Exception
Processing

Hi All - I am fairly new to C# and am wondering how to best implement
(overall) Exception Processing within my (reasonably-sized) C# Windows
application. I do have a bunch of somewhat random questions on this
and if you can help me with only one or a few, that would still be
APPRECIATED. Here are my questions:

1. Is it recommended to put all of the "Main" coding within a "try"
block (along with a "catch" that catches all Exceptions) so that your
application will never abnormally terminate?

2. As you read the following, realize that I do NOT have a clear
overall approach for this... So much of the following describes some
questions that have initially occurred to me as I consider my design.
So here goes: Let's say most or all of my Application's methods
return a bool to indicate whether the routine successfully completed
or not. The bool will be equal to "false" ONLY if there is a logic
error or system error - never due to some invalid input from the User
and never, for example, because a User file is not found. Does it make
sense to do it this way? And if so, should the calling routine always
check for this "false" value on all called methods??? (which could be
alot of code!) And should the error message that the User sees always
come from the called routine? And does this mean I would implement a
Try block in every called method??? I would very much appreciate
anyone who can help me sort all of this out... which brings me to...

3. Does anyone know of any document on the Web with some tips and/or
suggested overall approaches to Exception Processing?

Thanks!

Rex
.



Relevant Pages

  • Re: x64 XP BSOD on USB device reset or D3 entry
    ... Have you tried running the test with driver verifier with special pool ... I did not assign any cleanup routine to any KMDF object. ... The completion routine only deletes objects that were allocated to ... The exception code that was not handled ...
    (microsoft.public.development.device.drivers)
  • Re: x64 XP BSOD on USB device reset or D3 entry
    ... Turning on the WDF verifier stopped the BSODs due to this problem. ... I did not assign any cleanup routine to any KMDF object. ... I'm porting an i386 XP KMDF USB device driver to x64 XP SP2. ... The exception code that was not handled ...
    (microsoft.public.development.device.drivers)
  • Re: Exception handling
    ... If you are dealing with input validation, you would code exception first, as you might as well throw out items that will not make it through the routine. ... The reason is you do not end up taking sloppy short cuts to get through the routine. ... It took a lot of discipline, but I found it led to lots of sloppy code, where I kept testing the same cases over and over again at each section of the routine. ...
    (microsoft.public.dotnet.languages.csharp)
  • Dynamic Enumeration Problem
    ... I'm enumerating child devices ... In DPC routine i had called the routine Bus_PlugInDeviceas ... The exception code that was not handled ... handler, status 0xc00000bb ...
    (microsoft.public.development.device.drivers)
  • Re: I Need an IsNumeric Method
    ... public bool IsNumeric ... //Try a double conversion. ... try to convert and catch the exception ... > o Don't forget that .5 is generally considered okay, ...
    (microsoft.public.dotnet.languages.csharp)