Click here to Skip to main content
15,879,535 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to pin List to unmanaged byte** [modified] Pin
SledgeHammer0120-Jan-11 8:41
SledgeHammer0120-Jan-11 8:41 
QuestionOn Error Resume Next Pin
Anubhava Dimri17-Jan-11 18:24
Anubhava Dimri17-Jan-11 18:24 
AnswerRe: On Error Resume Next PinPopular
JF201517-Jan-11 18:31
JF201517-Jan-11 18:31 
GeneralRe: On Error Resume Next Pin
Anubhava Dimri17-Jan-11 19:09
Anubhava Dimri17-Jan-11 19:09 
GeneralRe: On Error Resume Next Pin
fjdiewornncalwe18-Jan-11 8:56
professionalfjdiewornncalwe18-Jan-11 8:56 
AnswerRe: On Error Resume Next Pin
Dave Kreskowiak17-Jan-11 18:59
mveDave Kreskowiak17-Jan-11 18:59 
AnswerRe: On Error Resume Next Pin
Abhinav S17-Jan-11 20:55
Abhinav S17-Jan-11 20:55 
AnswerRe: On Error Resume Next Pin
OriginalGriff17-Jan-11 21:20
mveOriginalGriff17-Jan-11 21:20 
On Error Resume Next was an abortion of a solution, used to help complete idiots make an even bigger mess of things than they had started with.

What it does is hide errors. Not fix them, not get rid of them, just hide them. Until they become so huge they corrupt your data, or loose hours of user work.

Imagine if you will: as simple index error:
string[] veryValuableDataFromUsers = new string[10];
veryValuableDataFromUsers [10] = myUserTextBox.Text;
foreach (string data in veryValuableDataFromUsers)
   {
   SaveMyData(data);
   }
Now, if you run this as is, an exception will be thrown when you try to access array element 10: because the array elements run from 0 to 9 inclusive. You are told what the problem is, you can can fix it in testing, all is fine.

If you had On Error Resume Next, what happens? No error. the bad index is ignored, no problem occurs.

Until the user tries to find his data, anyway.

At which point there are two problems:
1) Very annoyed user, with possibly crucial and not recoverable information lost.
2) Bug to fix, with no idea at all of how the data came to be lost. You may even blame the idiot user for "not saving it" in the first place. 100,000 lines of code to find the problem in.

Don't do it.
Exceptions are there to tell you there is a problem, and let you deal with it.
Don't use empty catch blocks.
Log exceptions in production if you can't deal with them - that way you at least have a record of what happened when you come to fix it.

But do try to handle errors correctly before they become a major problem.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.

GeneralRe: On Error Resume Next Pin
nlarson1118-Jan-11 3:43
nlarson1118-Jan-11 3:43 
GeneralRe: On Error Resume Next Pin
OriginalGriff18-Jan-11 4:00
mveOriginalGriff18-Jan-11 4:00 
GeneralRe: On Error Resume Next Pin
nlarson1118-Jan-11 4:16
nlarson1118-Jan-11 4:16 
GeneralRe: On Error Resume Next Pin
Matty2220-Jan-11 15:16
Matty2220-Jan-11 15:16 
AnswerRe: On Error Resume Next Pin
_Erik_18-Jan-11 4:22
_Erik_18-Jan-11 4:22 
AnswerRe: On Error Resume Next [modified] Pin
Dave Doknjas18-Jan-11 10:09
Dave Doknjas18-Jan-11 10:09 
QuestionComponent design-time adjust control boundaries Pin
Chris Copeland17-Jan-11 11:27
mveChris Copeland17-Jan-11 11:27 
QuestionSorting objects in a dictionary into corresponding Pairs... Pin
roman_s17-Jan-11 9:47
roman_s17-Jan-11 9:47 
AnswerRe: Sorting objects in a dictionary into corresponding Pairs... Pin
roman_s17-Jan-11 10:56
roman_s17-Jan-11 10:56 
AnswerRe: Sorting objects in a dictionary into corresponding Pairs... Pin
Henry Minute17-Jan-11 11:25
Henry Minute17-Jan-11 11:25 
Questionusb device (not the storage volume type) Pin
Blubbo17-Jan-11 9:06
Blubbo17-Jan-11 9:06 
AnswerRe: usb device (not the storage volume type) Pin
Michael900017-Jan-11 9:19
Michael900017-Jan-11 9:19 
GeneralRe: usb device (not the storage volume type) Pin
Blubbo19-Jan-11 9:54
Blubbo19-Jan-11 9:54 
QuestionWierd exceptions when calling WCF more than once from a static class Pin
Michael900017-Jan-11 8:32
Michael900017-Jan-11 8:32 
AnswerRe: Wierd exceptions when calling WCF more than once from a static class Pin
Ravi Bhavnani17-Jan-11 11:17
professionalRavi Bhavnani17-Jan-11 11:17 
QuestionRe: Wierd exceptions when calling WCF more than once from a static class Pin
Michael900017-Jan-11 11:49
Michael900017-Jan-11 11:49 
AnswerRe: Wierd exceptions when calling WCF more than once from a static class Pin
Ravi Bhavnani17-Jan-11 11:53
professionalRavi Bhavnani17-Jan-11 11:53 

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.