19

I have a nasty issue with an object being destroyed in a big project of which I cannot find the place where this happens. In Visual Studio 2008 I would have set a data breakpoint but when trying to do this in 2010 the option New Data Breakpoint is disabled. The project is running and a non data breakpoint is hit. What is going on here? I read about Managed Code. How can I find out if my project uses managed code and if yes, how can I avoid this?

  • 1
    There is some insight in another question. First - about managed code, second - about being in debugging (paused) state. http://stackoverflow.com/questions/243347/how-do-i-set-a-data-breakpoint-in-mixed-c-c-debugging – Steed Jan 21 '15 at 16:17

2 Answers2

7

When you attach to the process (or in your settings) disable Mixed Mode Debugging. In other words, make sure you have "Native code" be the only debugging option that's checked.

AbigailW
  • 79
  • 2
  • 5
    @Ulterior In case someone else finds this useful, you can't set a New Data Breakpoint until you are already in debug mode and stopped or paused during execution (i.e. stopped on a breakpoint). – Eric H May 05 '15 at 20:38
  • @EricH thank you so much. This feature has so many quirks. There should seriously be a definite how to guide with all its gotchas written down. – jcxz Jul 28 '16 at 10:40
1

Just to gather the comment made by Eric H into a more complete answer:

  1. Make sure the debugger is started in "Native code" mode.

  2. Data breakpoints may not be set while the application is running. This means the application should be paused at another (function) breakpoint.

rustyx
  • 80,671
  • 25
  • 200
  • 267