By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,041 Members | 1,099 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,041 IT Pros & Developers. It's quick & easy.

Exception Interruption Window DOES NOT APPEAR

P: 29
Hi. Recently I got this problem and I don't know why.
Next simple code for example:

Expand|Select|Wrap|Line Numbers
  1. Public Sub test()
  2.  Dim VectorA() As Integer = {1, 2, 3, 4, 5, 6}
  3.  For i As Integer = 0 To VectorA.GetLength(1) - 1
  4.       (some code)      
  5.  Next
  6.  
  7.  TextBox2.Text = "GetType = " & VectorA.GetType.ToString
  8.  TextBox3.Text = VectorA.GetLength(0).ToString
  9.  (other code)
  10. End Sub
There is an exeption in "GetLength(1)" because the array just have one dimension. So, when the compiler gets there, it just ignore that and every code next to this until finish the Sub block.
If I put a Try Catch statment it works, but if not, it does not interrupt the debbuging and does not show a exception message. So, I don't know where the error is.

What I need?... I need that when I put a Try Catch statment just work, but when I donīt put the Try Catch, the debbuging stops the program and show me the Exception window.

Thanks.
Apr 16 '13 #1
Share this Question
Share on Google+
15 Replies


Rabbit
Expert Mod 10K+
P: 12,383
Please use code tags when posting code.

I don't understand what your question is. There's no "error" in your syntax. VectorA.GetLength(1) will return 2.
Apr 16 '13 #2

P: 29
Hi Rabbit.
There is an error: array.GetLength(1).... That "1" is the array dimension index. The first index would be index "0".
But anyway, that example is not important here.

Just imagine that there is an error in the code. When I run de application the debbuger does not stop de program and show me the exception.

If I put a Try-Catch it works, but if not, the debbuger ignores the exception and jump every line of code until finish the entire block.

Regards.
Apr 16 '13 #3

Rabbit
Expert Mod 10K+
P: 12,383
There is an error: array.GetLength(1).... That "1" is the array dimension index. The first index would be index "0".
That's not a syntax error. Yes, the first index is 0. But there's nothing wrong with doing array.GetLength(1). Using array.GetLength(1) produces no error because there is no error in doing that.
Apr 16 '13 #4

P: 29
@Rabbit
You don't understand me. Forget the code above.

The problem is that when any program produces an exception in running time, the debbuger DO NOT STOP the program and show the exception message.
Apr 16 '13 #5

Rabbit
Expert Mod 10K+
P: 12,383
If I have to ignore the code you posted, then there's nothing I can use to diagnose your problem. Without seeing the code that's causing your issue, there's nothing I can use to tell you what's wrong.
Apr 16 '13 #6

P: 29
@Rabbit
The issue is not the code, the issue is on the debuger.
Just it. When the application runs, the debuger does not stop the application when it finds an exception.
Apr 16 '13 #7

Rabbit
Expert Mod 10K+
P: 12,383
And the problem I'm having is that I've seen no code that causes an exception.
Apr 17 '13 #8

100+
P: 158
And the problem I'm having is that I've seen no code that causes an exception.

Hey Rabbit, Check LeoVBNET's code again. Line number 3 have an exception ( Index was outside the bounds of the array ).

Expand|Select|Wrap|Line Numbers
  1. For i As Integer = 0 To VectorA.GetLength(1) - 1

Array 'VectorA' is a single dimensional array but LeoVBNET is trying to get the number of elements in the second dimension of array 'VectorA'.

The problem is that when any program produces an exception in running time, the debbuger DO NOT STOP the program and show the exception message.

@LeoVBNET
Your question looks like complaining that you get hit by an airbag inside your car when you met an accident.
Apr 17 '13 #9

Rabbit
Expert Mod 10K+
P: 12,383
That's my bad, for some reason I thought you were using an array object. And I wasn't getting an error when using an array object.

One reason that the debug window may not come up is that you ran the process with debugging turned off. So the first thing you should check is whether or not that is turned off.
Apr 17 '13 #10

P: 29
Ok Rabbit, but where can I set the debugging on/off?
Apr 17 '13 #11

Rabbit
Expert Mod 10K+
P: 12,383
That depends, how are you invoking the process?
Apr 17 '13 #12

P: 29
I don't know what you mean. I just open a new windows form project, introduce some code in Form1.Load event and then just debugging by press F5.
Apr 17 '13 #13

Rabbit
Expert Mod 10K+
P: 12,383
What operating system and version of visual studio are you using?
Apr 17 '13 #14

P: 29
Windows 7 Home Premium SP1
Visual Studio Ultimate 2012 v.11.0.51106.01 update 1
.NET Framework 4.5.50709
Apr 17 '13 #15

Rabbit
Expert Mod 10K+
P: 12,383
In the debug menu, there should be an exceptions option to set what exceptions will break execution. If you don't see it in the menu, you can enable it using the instructions here: http://msdn.microsoft.com/en-us/library/d14azbfh.aspx
Apr 18 '13 #16

Post your reply

Sign in to post your reply or Sign up for a free account.