Cannot see the contents of a variable when debugging C ++ code from a managed application

I have some native C DLL files that I call from the Managed C ++ class library ("Rem"). In the "Rem" class library, I have one native C ++ class (api) and one managed C ++ class (API).

A managed class (API) is now called from a C # console application (will later be used in a web application).

When debugging, I can just execute my own code.

My problem is that when I debug, I do not see the values ​​of any variables except simple types declared locally.

Function parameters are not available in the debugger, and if I try to add them as Watch, it just says: "error: identifier" schema_name "out of scope" ("schema_name" is the name of the variable)

Any structures simply show the value "{...}", both in the fast watch and in the Watch-window. enter image description here

If I try to add a clock to a field in the structure, I get the value "error:" entryList.numItems "does not exist"

The material I tried:

  • I tried to create a console application in Managed C ++ and debug the same from it.

  • I tried unchecking the Tools-> Options-> Debugging-> General-> Managed C ++ Compatibility Mode checkbox, then I couldn’t enter the code at all (for breakpoints no characters were loaded)

  • In the C # console application project, I went to Properties-> Debug and checked the “Enable native code debugging” checkbox (and unchecked)

  • In the C ++ class library, I went to "Properties-> Debugging-> Type of debugger and tried" Mixed "," Native "," Managed "and" Auto ".

Any suggestions on what I'm doing wrong?

+7
source share
1 answer

I assume that you are using Visual Studio 2012 2 update. In this case, this is a known bug with Update 2:

https://connect.microsoft.com/VisualStudio/feedback/details/783004/children-cannot-be-evaluated-on-c-cli-after-vs2012-update-2

Be careful though, the “workaround” when uninstalling Update 2 will leave you with a broken Visual Studio, as seen from this error report (yes, Update 2 does not work):

https://connect.microsoft.com/VisualStudio/feedback/details/785396/uninstalling-vs2012-update-2-and-repair-of-vs-results-in-atl-files-missing

If you are not using Update 2, this may not be the correct answer, but it may help others who are experiencing exactly this problem using Update 2.

+2
source

All Articles