VB.NET exception doesn't stop the debugger


I'm using VB.NET Express 2008, coding a Windows Forms project, and using a WebBrowser control.

The problem is that every time I run the application and it throws an exception the debugger doesn't stop in the error line, instead, three things happen:

1- The program exits from the function or sub where the error was thrown, but all the control event handlers continue running, so if I click on a button in the form then its event code is executed.

2- The WeBrowser control navigates to an unresisting page (I see the  IE's not found error page), even if the code that threw the error is not related to the WebBrowser control.

3- In the inmmediate  Window I see the exception text, for example "A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll".

Why is this happening? When I get into an exception I expect the execution to stop immediately.

Any ideas?

LVL 13
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

what line is the application throwing the error?  is it in regards to the web browser control?
rettiseertAuthor Commented:

Any line that throws an error (no matter which) produces the same result. Even if it is not related with the WebBrowser control.
rettiseertAuthor Commented:

Here you can see a demo project reproducing this error:


just run the project, click on the IE icon, and then in the Camera icon.

Thanks for any help
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

What is the error that you are seeing?  The only error I get is when I click on your Camera icon and that error looks like it is being raised on purpose in this line of code:

    Private Sub CaptureCurrentIEOrder()
    End Sub

I get no errors or warnings when I click on the IE icon or your button.
rettiseertAuthor Commented:

Yes, the error is being raised on purpose as a test. What I expect after executing the line Err.Raise(1) is that the VB debugger stop and show an "Unhandling exception" window, but instead the program keeps running.
Check out this link and see if it get's you what you need.




Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rettiseertAuthor Commented:
Wonderful! thank you!!!

Who changed that in my config?!
Actually, that is the default setting.  By default it seems to ignore quite a few exception errors.

Have a good weekend,

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.