简体   繁体   中英

Throwing std::exception crashes Visual Studio 2013 IDE

I've just filed a bug report to Microsoft, on my system throwing any exception with std::exception or those that inherit it crashes the Visual Studio 2013 IDE. Have anyone else seen this problem or is it a quirk on my system that enables the bug? I can also mention that my Visual Studio 2012 on the same system have not such issues.

The following minimalist example crashes my Visual Studio 2013 IDE:

#include "stdafx.h"
#include <stdexcept>
#include <iostream>

int _tmain(int argc, _TCHAR* argv [])
{
    try
    {
        throw std::exception("Crashtest");
    }
    catch (...)
    {
        std::cerr << "Error" << std::endl; // never reached
    }

    return 0; // never reached
}

Anyone have a suggestion for a work-around until they have fixed this, it's quite annoying at the moment.

Update

Intel has posted a workaround for this bug here:

http://software.intel.com/en-us/forums/topic/494680

I just created a new C++ Console application, with precompiled header, and then pasted your code. I was not able to recreate the issue. I'm able to place a breakpoint on std::cerr << and hit it without fault.

Have you tried re-installing Visual Studio 2013? I'm guessing you have a corrupt installation or a misconfigured debugger. Make sure to remove previous versions of Visual Studio. Even though they work side-by-side I've seen issues previously with native debugging.

确保已使用选项/EHsc启用C ++异常处理。

I did some further investigation on this bug this weekend. First I uninstalled Windows 7 and upgraded to Windows 8.1 Enterprise (64-bit). Then I installed Visual Studio Ultimate 2013 (v12.0.21005 REL). I ran the program below with no problems and I thought that I had fixed the problem. However, when I installed Intel C++ Studio XE 2013 (included SP1 with update 1) the bug came back. So there seem (at least on my system) to be an issue with how Visual Studio 2013 and Intel C++ Studio 2013 works together.

I've been stuck in this problem for 3 days until I discovered that the problem was in try-catch blocks. Viewing this article: http://msdn.microsoft.com/en-us/library/0yd65esw.aspx , I realized the importance of not leaving a "catch" empty. Remove the try catch block and check, please.

Well, this problem happened to me while developing a simple sequential workflow SharePoint 2013 in Visual Studio 2013 in "OnTaskChanged" methods.

I hope the answer may help someone else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM