Search code examples
debuggingvisual-studio-2017comvstoedit-and-continue

Inspecting COM objects in VS 2017 debugger


I'm currently migranting an VBA powerpoint add-in to VSTO.

For weeks I've been struggling with Visual studio degug for COM objescts. AS you can see on the image below, the object types show {system._ComObject} and object inspection becomes a challenge since one must use the dynamic view, which is quite inconvenient in my opinion.

Debugging COM objects

Looking around I've found a recommendation to activate the option "use managed code compatibility mode" in the general debugging settings, as you can see on Debugging setting I also followed another the recommendation to set the property "Embed interop Types" on all my office related references to false.

After applying these changes. Voilà! The inspection began do work just as I wished to and as you can see here: Debug working properly

I was almost in heaven. My ecstasy lasted till I tried to change some code during debug and was informed by visual studio that "managed compatibility mode does not support edit and continue".

Now I'm back in hell. With edit and continue I miss a decent COM object inspection. With COM inspection I cannot change code during debug.

This situation looks awkward and I would expect more from VS 2017.

Does anybody know how can I get decent COM inspection and edit and continue at the same time?


Solution

  • Does anybody know how can I get decent COM inspection and edit and continue at the same time?

    I am afraid that you cannnot get what you want.

    Since you just debug a com object which is more like optimized, mixed, or SQL Server common language runtime (CLR) integration code(use ), as the official document said, Edit and Continue function does not support it.

    Usually, to debug those mixed codes in VS, you should enable Use Managed Compatibility Mode or enable native code debugging, but those options cannot work well with Edit and Continue as the official document said.

    You can check this document to know unsupported changes or supported changes to code.

    So for your issue, there is no such option to use both of them.

    As a suggestion, you should break the debugging process first, make some changes to your code. Then start Debugging to debug the new changes.

    Besides, if you still want this feature, you could suggest a feature on our User Voice Forum. The Team will check your request carefully and hope they will give you a satisfactory reply.