Exceptions throw in try block
-
Sorry, I have to ask once more as this is killing me. My version of VS2008 stops executing on exceptions that are encountered in the try part of the try-catch block. Any ideas about what might be causing that? Is there an opion I'm missing? ty
-
Sorry, I have to ask once more as this is killing me. My version of VS2008 stops executing on exceptions that are encountered in the try part of the try-catch block. Any ideas about what might be causing that? Is there an opion I'm missing? ty
-
Post some code and maybe someone can help you.
There's nothing left in my right brain and nothing right in my left brain.
OK, well for instance, this code throws a NullReferenceException and stops my processing
Dim x
Try
Console.WriteLine(x(0))
Catch ex As ExceptionEnd Try
-
OK, well for instance, this code throws a NullReferenceException and stops my processing
Dim x
Try
Console.WriteLine(x(0))
Catch ex As ExceptionEnd Try
Do NOT create empty catch blocks; if you catch an exception, you should act on it, and either report it, or fix the situation, or both. Which line in the catch block do you want Visual Studio to highlight???????????????????????????????? :mad:
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Merry Christmas and a Happy New Year to all.
-
Do NOT create empty catch blocks; if you catch an exception, you should act on it, and either report it, or fix the situation, or both. Which line in the catch block do you want Visual Studio to highlight???????????????????????????????? :mad:
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Merry Christmas and a Happy New Year to all.
I think I am not explaining myself well. What is happening is that VS2008 is stopping execution on the error that is created within the try part of the try-catch block. My understanding (and my prior experience with VS2005) is that the debugger should ignore errors in this part of the block. ty
-
I think I am not explaining myself well. What is happening is that VS2008 is stopping execution on the error that is created within the try part of the try-catch block. My understanding (and my prior experience with VS2005) is that the debugger should ignore errors in this part of the block. ty
stop being stubborn, add a Console.WriteLine() or some other statement to the catch block, and try again. :~
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Merry Christmas and a Happy New Year to all.
-
stop being stubborn, add a Console.WriteLine() or some other statement to the catch block, and try again. :~
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Merry Christmas and a Happy New Year to all.
Doesn't matter... same thing.
Dim x
Try
Console.WriteLine(x(0))
Catch ex As Exception
Console.WriteLine("Error")
End Try -
Doesn't matter... same thing.
Dim x
Try
Console.WriteLine(x(0))
Catch ex As Exception
Console.WriteLine("Error")
End Tryasked and answered here[^]. :zzz:
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
Merry Christmas and a Happy New Year to all.
-
OK, well for instance, this code throws a NullReferenceException and stops my processing
Dim x
Try
Console.WriteLine(x(0))
Catch ex As ExceptionEnd Try
have you gone to menu tools/options/debugging/general and fooled with those settings?
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
-
have you gone to menu tools/options/debugging/general and fooled with those settings?
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
Yes, I've tried to change them all.
-
Yes, I've tried to change them all.
click on menu debug then click exceptions. i think you can define it there how you want it to behave. see if that's what your looking for.
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous 'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
-
Yes, I've tried to change them all.
-
I think I am not explaining myself well. What is happening is that VS2008 is stopping execution on the error that is created within the try part of the try-catch block. My understanding (and my prior experience with VS2005) is that the debugger should ignore errors in this part of the block. ty
cstrader232 wrote:
My understanding (and my prior experience with VS2005) is that the debugger should ignore errors in this part of the block.
Your understanding is wrong. When an exception occurs, it is "thrown" upward through the call stack until a catch is encountered or the top of the stack is reached. If you want to have code that runs no matter what you can put it in a Finally block. Or, since this is the VB section, you can use the horrific "On Error Resume Next" construct.