In Visual Studio 2012 the native debugger significantly improved with the addition of native visualizers (natvis) as part of a major debug engine overhaul. Adding C++/CLI code to your project would trigger the debugger to use our old debugging infrastructure as the new debugging infrastructure lacked support for C++/CLI. We’ve heard your feedback and we’re happy to announce the first preview of the new debugging experience in Update 2 that can be enabled by setting a regkey described below.
Here is an example of how the debugging experience has improved for a managed object containing a native object with a std::vector
Visual Studio 2015 Update 1 and earlier
Notice that expanding a managed object containing a native object leads to a very poor experience: std visualizers are ignored and container members are not expanding as they would in pure native application. This is a severe limitation since it prevents easy linear viewing of any container elements and viewing meaningful data values requires multiple expansions. The vector object below is expanded multiple times and still shows no elements, values, or even the size of the container.
Visual Studio 2015 Update 2 (after enabling in registry)
Now the same variables in the watch window will show the proper container and member expansions as defined in the natvis visualizers. The std::vector correctly shows its member expansions and inspecting the objects feels natural just like with pure native code, listing the size, capacity, and each element’s value.
How to Try It Out
We are hoping to get as much feedback as possible from C++/CLI users to make sure this improved debugging experience meets your needs. We’d love for you try kick the tires on this greatly improved debugging experience and let us know how it’s working for you!
[HKEY_CURRENT_USER\Software\Microsoft\Visual Studio\14.0_Config\AD7Metrics\ExpressionEvaluator\{3A12D0B7-C26C-11D0-B442-00A0244A1DD2}\{994B45C4-E6E9-11D2-903F-00C04FA302A1}]
Value Name: LoadInShimManagedEE
0 means new MC++ EE is ENABLED
1 means new MC++ EE is DISABLED (default value)
Note: having Managed Compatibility Mode enabled will default to the old EE.
Closing Remarks
We look forward to having this as the default experience in the future and would love to hear your feedback. Please leave comments or feel free to shoot me an email: vsdbgfb@microsoft.com if you run into any issues.