2

Is it possible not have the debugger stop at the throw statement, while keeping the same functionality? I've asked around and it seems not, but I thought I'd give stackoverflow a try before I accept that's it's not possible.

class Program
{
    static void Main(string[] args)
    {
        var o = new MyClass();
        var t = new Task(o.DoStuff);
        t.Start();

        try
        {
            t.Wait();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
        }
        Console.ReadKey();
    }
}

public class MyClass
{
    public void DoStuff()
    {
        throw new Exception("Testing"); // debugger stops here!
    }
}
Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Snæbjørn
  • 10,322
  • 14
  • 65
  • 124
  • 1
    "while keeping the same functionality" what functionality is it that you want to keep? So far, you've described a single behaviour, and that's the one you're asking to get rid of. – Damien_The_Unbeliever Jan 12 '13 at 08:18
  • What I meant by that is that I don't want to handle the exception in the thread, but keep it in main – Snæbjørn Jan 12 '13 at 08:29

1 Answers1

3

Open Exceptions windows with Ctrl + Alt + E in Visual Studio. Click on which exception you want to unhandled.

Also check: Visual Studio: How to break on handled exceptions?

enter image description here

Community
  • 1
  • 1
Soner Gönül
  • 97,193
  • 102
  • 206
  • 364