2

I'm working on a big C++ project which I haven't created, but the following short code fully represents a problem which I'm faced with:

#include <string>
#include <iostream>
int main(int argc, char **argv){
    using namespace std;
    try{
        string str;
        str = "r";
        double d = stod(str);
        cout << "'stod' worked! d = " << d << endl;
    }
    catch (invalid_argument){
        cout << "I'm in 'catch'\n";
    }
    cout << "I'm after 'try-catch'\n";
    cin.get();
    cin.get();
    return 0;
}

If I launch the code without debugger, everything works fine and as expected it gets into the catch-scope and then main() proceeds.

If I use the debugger, Visual Studio under 32-bit configuration restarts immediately or under 64-bit configuration I get a message: "The debugger's worker process (msvsmon.exe) unexpectedly exited. Debugging will be aborted."

I'm using VS2013 Ultimate on Windows 8.1 Professional.

Due to this post: msvsmon.exe crashed when debugging I have already installed Update 4. I have no breakpoints. In DEBUG->EXCEPTIONS the reset was done.

I also do not understand, what msvsmon.exe is. The Google-search combines it with remote debugger which confuses me a little bit, because I'm using the local debugger, at least I press each time the 'Local Windows Debugger' button.

Could anybody help me out?

Community
  • 1
  • 1
Zed
  • 21
  • 2
  • should say thanks to MS that windows doesn't go for reboot ) Seriously, what do you get if you replace catch (invalid_argument) with catch(...) ? – Tebe Jun 15 '15 at 21:18
  • I'm catching invalid_argument which is thrown by stod(), or what do you mean? – Zed Jun 15 '15 at 21:22
  • What are the exceptions that Visual Studio Debugger is handling or catching for you? What I have seen is that an exception is thrown and caught by the debugger and then you can choose to have the debugger rethrow the exception. It sounds like the debugger catch is having a problem and the debugger is catching the exception first and can't handle it. However what are the settings for the debugger to catch exceptions? – Richard Chambers Jun 15 '15 at 21:24
  • It seems to me also, that the debugger cannot handle the exception. This simple code handles by itself its exception. I didn't want that debugger somehow disturbs the code and I unmarked all exception in DEBUG->EXCEPTIONS. No positive results. Marking all exceptions also doesn't help – Zed Jun 15 '15 at 21:38
  • Everything that I have seen indicates that you need to actually delete all break points and then rebuild everything. It sounds like there is some kind of a data inconsistency in the various meta-data about the application and the Visual Studio tools. Also this is interesting post about mvsmon.exe and it being enabled due to some project settings that were turned on by helpful tools https://go4answers.webhost4life.com/Example/prevent-visual-studio-starting-52229.aspx – Richard Chambers Jun 15 '15 at 21:43
  • 1
    Your link gave me a clue to play with debugging settings. I've set PROJECT-> project_name PROPERTIES->Configuration Properties->Debugging->DebuggerType to 'Mixed', previously 'Auto', and everything started to work! Thank you! – Zed Jun 16 '15 at 12:47
  • This was copied from comments on an answer I deleted. Typically, best practice is to catch exceptions by reference. Explanations can be found here: http://stackoverflow.com/a/2522311/2250588 and here: http://blog.knatten.org/2010/04/02/always-catch-exceptions-by-reference – iheanyi Jun 17 '15 at 15:57

0 Answers0