Sossenbinder
Sossenbinder

Reputation: 5322

Can I see which line threw an exception when they are being displayed on the 'Output' window?

Whenever I go into debug mode, and I see the

A first chance exception of type '..' occurred in '...'.exe

I would really like to be able to see which line has thrown that exception, especially in projects which have a lot of exception throwing lines.

It's barely possibly to rewrite it to print a stacktrace everywhere an exception is thrown, so I'd like to know if there's an option to show line numbers with said error message?

EDIT: I'm using Visual Studio 2013

Upvotes: 1

Views: 93

Answers (1)

Ian
Ian

Reputation: 34549

If you include the PDB file alongside the executable then stack traces should include line numbers by default. The PDB file are essentially the debug symbols that help map the executed instructions back to the code it was compiled from.

What you may well be seeing however are the caught exceptions, that are handled. Generally an un-caught exception will cause your program to break. If you want to see these handled exceptions to see what's causing them you need to use the exception dialog - and toggle handled exceptions:

enter image description here

This will then break at the exceptions that are thrown (even if caught later on).

Upvotes: 3

Related Questions