Mahdi Ghiasi
Mahdi Ghiasi

Reputation: 15311

Visual Studio can't handle errors

I am using Visual C# 2010 Express and Visual Basic 2010 Express on my Windows 8 developer preview PC.

Before, there was no problem, both VB and C# work fine. But today, both VB and C# can't handle errors. I have created a simple application with VB and C#. (.Net framework 4.0) the codes are here:

VB.Net :

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Throw New Exception("Hi")
End Sub

C# :

    private void Form1_Load(object sender, EventArgs e)
    {
        throw new Exception("Hi");
    }

When I run the program, this dialog appears:

enter image description here

And after clicking OK, the error dialog shows for a little moments and then program stops quickly. So, I can't even read the error on the error dialog...

So, What is the problem?

EDIT : Visual studio should show a exception dialog like this : enter image description here

But visual studio shows the dialog shown in first image instead of this dialog. So, I can't debug my program.

EDIT 2 : If I enable break exception when thrown in Exceptions dialog, the problem solves, but at that point, visual studio breaks on EVERY exception , even handled exceptions... I don't want to break on every exception...

Upvotes: 1

Views: 366

Answers (2)

Elmo
Elmo

Reputation: 6471

Try resetting all settings : MenuBar => Tools => Import and Export Settings => Reset all settings

If it still doesn't work, run VS as admin and in Windows XP compatibility mode.

Upvotes: 1

Chris Dunaway
Chris Dunaway

Reputation: 11216

Have you checked VS debug settings? Specifically, under Tools > Options > Debugging > General check the options for when to break on exceptions.

Also, what do you have set under Debug > Exceptions, specifically under the "Common Language Runtime Exceptions"? VS may not break on an exception unless you have told it to do so.

Upvotes: 1

Related Questions