Exception Interruption Window DOES NOT APPEAR

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LeoVBNET
    New Member
    • Apr 2013
    • 29

    Exception Interruption Window DOES NOT APPEAR

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

    Code:
    Public Sub test()
     Dim VectorA() As Integer = {1, 2, 3, 4, 5, 6}
     For i As Integer = 0 To VectorA.GetLength[B](1)[/B] - 1
          (some code)      
     Next
    
     TextBox2.Text = "GetType = " & VectorA.GetType.ToString
     TextBox3.Text = VectorA.GetLength(0).ToString
     (other code)
    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.
    Last edited by Rabbit; Apr 16 '13, 04:44 PM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code tags when posting code.

    I don't understand what your question is. There's no "error" in your syntax. VectorA.GetLeng th(1) will return 2.

    Comment

    • LeoVBNET
      New Member
      • Apr 2013
      • 29

      #3
      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.

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        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.

        Comment

        • LeoVBNET
          New Member
          • Apr 2013
          • 29

          #5
          ...

          Originally posted by Rabbit
          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.
          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.

          Comment

          • Rabbit
            Recognized Expert MVP
            • Jan 2007
            • 12517

            #6
            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.

            Comment

            • LeoVBNET
              New Member
              • Apr 2013
              • 29

              #7
              Originally posted by Rabbit
              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.
              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.

              Comment

              • Rabbit
                Recognized Expert MVP
                • Jan 2007
                • 12517

                #8
                And the problem I'm having is that I've seen no code that causes an exception.

                Comment

                • vijay6
                  New Member
                  • Mar 2010
                  • 158

                  #9
                  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 ).

                  Code:
                  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.

                  Originally posted by LeoVBNET
                  LeoVBNET
                  Your question looks like complaining that you get hit by an airbag inside your car when you met an accident.

                  Comment

                  • Rabbit
                    Recognized Expert MVP
                    • Jan 2007
                    • 12517

                    #10
                    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.

                    Comment

                    • LeoVBNET
                      New Member
                      • Apr 2013
                      • 29

                      #11
                      Ok Rabbit, but where can I set the debugging on/off?

                      Comment

                      • Rabbit
                        Recognized Expert MVP
                        • Jan 2007
                        • 12517

                        #12
                        That depends, how are you invoking the process?

                        Comment

                        • LeoVBNET
                          New Member
                          • Apr 2013
                          • 29

                          #13
                          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.

                          Comment

                          • Rabbit
                            Recognized Expert MVP
                            • Jan 2007
                            • 12517

                            #14
                            What operating system and version of visual studio are you using?

                            Comment

                            • LeoVBNET
                              New Member
                              • Apr 2013
                              • 29

                              #15
                              Windows 7 Home Premium SP1
                              Visual Studio Ultimate 2012 v.11.0.51106.01 update 1
                              .NET Framework 4.5.50709

                              Comment

                              Working...