-
April 28th, 2013, 03:56 AM
#1
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.
Thanks!!!
-
April 28th, 2013, 08:29 AM
#2
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.
-
April 28th, 2013, 02:22 PM
#3
Re: CLR Debbuger (F5) ignores some exceptions in Windows Form apps
Originally Posted by DataMiser
Are you using the form load event for this code in the windows form app?
That's right.
-
April 28th, 2013, 02:46 PM
#4
Re: CLR Debbuger (F5) ignores some exceptions in Windows Form apps
Are you using OPTION STRICT or some other OPTION?
-
April 28th, 2013, 02:54 PM
#5
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
-
April 28th, 2013, 07:51 PM
#6
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.
-
April 29th, 2013, 08:12 AM
#7
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|