Click here to Skip to main content
15,906,625 members
Home / Discussions / C#
   

C#

 
GeneralRe: .NET, Reflection and private members Pin
sreejith ss nair12-Sep-04 20:44
sreejith ss nair12-Sep-04 20:44 
QuestionWorking with BrowseFolderDialog flawed? Pin
LongRange.Shooter12-Sep-04 15:39
LongRange.Shooter12-Sep-04 15:39 
AnswerRe: Working with BrowseFolderDialog flawed? Pin
Stefan Troschuetz13-Sep-04 0:25
Stefan Troschuetz13-Sep-04 0:25 
Generali see why C# SHOULD have required to catch exceptions now Pin
vista2712-Sep-04 12:00
vista2712-Sep-04 12:00 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Colin Angus Mackay12-Sep-04 13:52
Colin Angus Mackay12-Sep-04 13:52 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Alex Korchemniy12-Sep-04 20:29
Alex Korchemniy12-Sep-04 20:29 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Colin Angus Mackay12-Sep-04 22:20
Colin Angus Mackay12-Sep-04 22:20 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
User 12301612-Sep-04 22:38
User 12301612-Sep-04 22:38 
> what so hard about tracking down a general exception.

There are some general exceptions that can occur just about any time, for example. Think of an ExecutionEngineException, a StackOverflowException ThreadAbortException or OutOfMemoryException. It's almost impossible to handle some of these exceptions so that your application will run as expected afterwards (for some, even your finally-blocks will NOT be executed). But even if we're talking about not so "serious" exceptions: Often a single call to some method may result in one of five or more different exceptions. A general catch-block will handle all of these. But I think that often it's almost impossible to be sure such a catch-block can handle all of these exceptions properly. What you may get is unexpected behavior of your application. You may not even notice that something's wrong the time the error occurs, but maybe hundreds of lines of code later, and then these exceptions ARE hard to track down.

So I agree with Colin: using a general catch (Exception)-block may be a not so good idea. Instead, trying to catch specialized exceptions is the way to go. On the one hand, you can be sure what has to be done to get your application into a defined state. On the other hand, if any exception occurs you don't expect, you instantly will see that something's wrong (unhandled exception). Your way (setting a breakpoint) requires that you KNOW something went wrong. Handling general exception, this may not be the case, you may just get very unexpected behavior of your application afterwards, not knowing where the actual problem lies.

Just my 2 cents...

GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Christian Graus12-Sep-04 13:52
protectorChristian Graus12-Sep-04 13:52 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Nicholas Cardi12-Sep-04 13:57
Nicholas Cardi12-Sep-04 13:57 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Salil Khedkar13-Sep-04 1:26
Salil Khedkar13-Sep-04 1:26 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Salil Khedkar13-Sep-04 1:29
Salil Khedkar13-Sep-04 1:29 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
bjoernen13-Sep-04 2:58
bjoernen13-Sep-04 2:58 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
elguaro12-Oct-04 14:36
elguaro12-Oct-04 14:36 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
bjoernen12-Oct-04 20:08
bjoernen12-Oct-04 20:08 
Generalkeypreview problem ( listview and buttons) Pin
BrownJacket12-Sep-04 10:19
BrownJacket12-Sep-04 10:19 
GeneralListView Problem Pin
Tomas Brennan12-Sep-04 8:50
Tomas Brennan12-Sep-04 8:50 
GeneralRe: ListView Problem Pin
VanesaAFESRG12-Sep-04 17:05
VanesaAFESRG12-Sep-04 17:05 
GeneralRe: ListView Problem Pin
Tomas Brennan13-Sep-04 2:07
Tomas Brennan13-Sep-04 2:07 
GeneralRe: ListView Problem Pin
VanesaAFESRG13-Sep-04 14:42
VanesaAFESRG13-Sep-04 14:42 
GeneralRe: ListView Problem Pin
Tomas Brennan17-Sep-04 5:56
Tomas Brennan17-Sep-04 5:56 
GeneralRe: ListView Problem Pin
SandeepN13-Sep-04 13:05
SandeepN13-Sep-04 13:05 
GeneralRe: ListView Problem Pin
Tomas Brennan17-Sep-04 6:00
Tomas Brennan17-Sep-04 6:00 
GeneralPerformance question Pin
BoxenBiene12-Sep-04 4:21
BoxenBiene12-Sep-04 4:21 
Generalswitch question Pin
BoxenBiene12-Sep-04 3:37
BoxenBiene12-Sep-04 3:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.