Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I see the what() message from an unhandled std::exception in Visual Studio 2012?

Is there a way to see the explanatory string from an unhandled exception? I'm using Visual Studio 2012 Express and can't seem to find a way to see it.

When I run the following code:

#include <stdexcept>

int main(int argc, char* argv[])
{
    throw std::runtime_error("warp core breach");
    return 0;
}

all I get in the output window is this:

First-chance exception at 0x7652C41F in vstest.exe: Microsoft C++ exception: std::runtime_error at memory location 0x0015F6A4.
Unhandled exception at at 0x7652C41F in vstest.exe: Microsoft C++ exception: std::runtime_error at memory location 0x0015F6A4.

I would have expected the "warp core breach" message to be printed there. I have all options under Debugging->Output Window->General Output Settings set to On.

like image 376
Gordon Freeman Avatar asked Nov 21 '12 17:11

Gordon Freeman


People also ask

How do I see exceptions in Visual Studio?

With a solution open in Visual Studio, use Debug > Windows > Exception Settings to open the Exception Settings window. Provide handlers that respond to the most important exceptions.

How do I ignore exceptions in Visual Studio?

When you run Visual Studio in debug mode, there are Exception Setting on the bottom tool bar. Once you click it, there are all type exceptions. Uncheck exceptions that you want.

What is user unhandled exception?

An unhandled exception is an error in a computer program or application when the code has no appropriate handling exceptions.


1 Answers

You'll get a window when the exception is thrown with the option to break/continue/ignore. Copy and paste the hex address this dialog reports, then click the break button. Now in a watch window, enter something like: (std::runtime_error*)(0x002cfbc8) into a cell in the first column.

watch window

like image 69
Bret Kuhns Avatar answered Nov 16 '22 02:11

Bret Kuhns