CLR Debbuger (F5) ignores some exceptions in Windows Form apps
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: CLR Debbuger (F5) ignores some exceptions in Windows Form apps

  1. #1
    Join Date
    Apr 2013
    Posts
    10

    Question CLR Debbuger (F5) ignores some exceptions in Windows Form apps

    Hello

    When run (F5 Debug) a Windows Form application I'm working with, there is some exceptions that are not cacthed by CLR debbuger. But the same code in a Console Application every exceptions are cacthed.

    Below, I post 2 simple code examples with errors.

    Code example #1
    Code:
        Sub Main()
            Dim var(6) As Integer
            var(8) = 33   <------- EXCEPTION
        End Sub
    Code example #2
    Code:
        Sub Main()
            Dim Pila As New Stack(Of Integer)
            Pila.Push(5)
            Pila.Push(9)
            Pila.Push(3)
            Pila.Push(CInt("hello"))  <------ EXCEPTION
        End Sub
    This is important: note that in Console App these exceptions are captured by CLR debuuger, but in Windows Form App NOT !!! That's my problem.

    I attached my default Debug menu - Exceptions configuration.

    Name:  exceptions.jpg
Views: 359
Size:  67.2 KB

    Thanks!!!

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,783

    Re: CLR Debbuger (F5) ignores some exceptions in Windows Form apps

    Are you using the form load event for this code in the windows form app?
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Apr 2013
    Posts
    10

    Re: CLR Debbuger (F5) ignores some exceptions in Windows Form apps

    Quote Originally Posted by DataMiser View Post
    Are you using the form load event for this code in the windows form app?
    That's right.

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,874

    Re: CLR Debbuger (F5) ignores some exceptions in Windows Form apps

    Are you using OPTION STRICT or some other OPTION?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Apr 2013
    Posts
    10

    Re: CLR Debbuger (F5) ignores some exceptions in Windows Form apps

    Every setting I use is inside the Project Properties Menu.

    Option Explicit - ON
    Option Strict - ON
    Option infer - Off

  6. #6
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    4,783

    Re: CLR Debbuger (F5) ignores some exceptions in Windows Form apps

    I have heard several people mention that errors may be unreported in the form load event under windows 7. The solution is to either put the code somewhere else or use a try catch block to trap the error.
    Always use [code][/code] tags when posting code.

  7. #7
    Join Date
    Apr 2013
    Posts
    10

    Re: CLR Debbuger (F5) ignores some exceptions in Windows Form apps

    Well, I have heard that this problem occurs in 64bit based machines and code running within the Form load event. Anyway, I don't know how Microsoft have not announced a patch or something to fix this issue. It seems to me very strange. Using a Try/Catch block is good, but precisely, several times you don't notice about these possible erorrs until CLR pops up with exception. Besides, I'm not sure nethier it is just in the main Form Load event nor in every forms your project has. Remember that when CLR detects an exception it first goes backwards within the code to find some exception handler, and it's possible that it was called (in some moment) by the "bad" Form, so...

    Well, let's see what happen. If any information about it gets me, I will post it here.
    Regards.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center