Pregunta

Possible duplicate of this question.

I have a MFC project that uses /clr switch and some C++/CLI code to use a .Net component. Originally this was on VS2005.

On upgrading to VS2012 Update 2, during debugging, no values or types were shown for native data types. I learned that a new mechanism for native data type visualization (natvis) was introduced in VS2010 and extended / enhanced in VS2012. Following the information on that page, I unchecked Managed C++ Compatibility Mode and C/C++ edit and continue. After this, breakpoints became disabled and stopped being hit. Using "Only Managed" debugger, the breakpoints were hit but no values were shown.

Finally, I used "mixed" debugger and used __debugbreak() to force a break. This resulted in only integer values being shown ONLY if they are local autos; and data types were picked up correctly. However, std::string or CString values are not shown and instead their type is shown in value column. Similarly, pointers, class members, or functions argument values are not shown and type information, Undefined value, or out of scope is shown in the value column.

The behavior is consistent across autos, locals and watch windows as well as mouse hover on symbols.

How do I get the native data types to display their values during debugging in VS2012 mixed mode C++/CLI MFC application.

I have read this question and verified that all symbols have been loaded in modules window.

Apparently, Microsoft is aware of the issue and the upcoming CTP of Update 3 should fix it.

Additionally, why do I need to use __debugbreak()?

¿Fue útil?

Solución

A couple of days ago, Microsoft released a Visual Studio Service Pack 3 RC which may help (installing it myself right now). Here is the link: http://www.microsoft.com/en-us/download/details.aspx?id=38832

Otros consejos

Re-install Visual Studio 2012 and do not apply Service Pack 2.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top