views:

441

answers:

3

I'm writing a class in C++ that I cannot debug by using F5. The code will run from another "service" that will invoke it. In the past I've used __debugbreak() and when I got a window telling me that an exception was thrown selected to debug it.

Recently I've updated to windows 7 and it kept working for a while.

Today when I've tried to debug a piece of my code instead of shown the regular dialog that tells me that VSTestHost has stopped working and enable me to to debug the application I got a different dialog suggesting I send the data to microsoft for analysis.

Does anyone knows how can I fix this issue so I'll be able to debug my code?

A: 

You could try debug > attach to process.

SP
Sometimes that can be a problem because by the time you attach to the process your code has already gotten past that point. In those cases I find it helpful to put a Sleep(10000) right before the point I want to break. Gives me just enough time to attach to the process.
Ferruccio
I'm not looking for another way to debug - I want ot fix the current why I'm debugging my code
Dror Helper
+1  A: 

In that case...

http://community.codesmithtools.com/blogs/blake/archive/2009/06/03/tips-amp-tricks-debugging-codesmith-on-microsoft-windows-7.aspx

Here is the quick overview of what you need to-do to enable debugging on a Microsoft Windows 7 machine:

Update the Just-In-Time debugger setting DbgJITDebugLaunchSetting. The setting is found in the registry at [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework].
Set the value of DbgJITDebugLaunchSetting to 2. If you are using a 64bit operating system then you must also set the same key (DbgJITDebugLaunchSetting) in this folder [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework] to 2. If you run into any issues try running CodeSmith Studio and Visual Studio as an administrator. Now when CodeSmith enters a break point you will see something like this:

SP
Good find but I've managed to solve the issue without changing the value of the keys to 2 (by default its 16)
Dror Helper
+3  A: 

Finally I found the cause of the issue. It's a Vista/Win7 cause:

  1. OPen The Action center control
  2. Goto Action Center settings
  3. Goto Problem Reporting Settings
  4. Choose "Each time a problem occurs, ask me before checking for solution"

Although this is more of IT solution/question I've been plagued with this problem all day and wanted to share the solution with other developers who encounter this problem.

Dror Helper