Inspecting COM objects in VS 2017 debugger - debugging

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.
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?

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.

Related

What exactly does Use Managed Compatability Mode disabled

So I've been struggling with visual studio debugger timeout out on large entity framework queries for a while now. Basically sometimes when stepping over a entity framework linq query it would give me this error.
Evaluating the function
'System.Data.Entity.Infrastructure.DbQuery.ToString' timed
out and needed to be aborted in an unsafe way. This may have corrupted
the target process.
If the problem happens regularly, consider disabling the
Tools->Options setting "Debugging->General->Enable property evaluation
and other implicit function calls" or change the code to disable
evaluation of this method. See help for information on doing this.
Once i had the error i would need to restart the debugger to fix it. After a tone of research and hair pulling i came across a suggestion to enable "Use Managed Compatibility Mode". Amazingly this worked and i also noticed a significant increase in the speed that i could step through my code.
The documentation says that this is a legacy debugger and enabling it may disable some debug features.
So what exactly is the feature difference and why does using "Managed Compatibility Mode" improve step speed so much?
What I know that it is a new option from VS2013
https://blogs.msdn.microsoft.com/visualstudioalm/2013/10/16/switching-to-managed-compatibility-mode-in-visual-studio-2013/
In old VS version, C# and VB projects do not have a way to turn off managed debugging.
The option "Managed Compatibility Mode" was used to managed and mixed debugging but not to native-only debugging.
You could get much more detailed information from Hans Passant's suggestion here:
`Use managed compatibility mode` or `Enable native code debugging`?

How do I interact with Visual Studios native debugger when writing my own "mixed mode" debugger?

I've spent the last few days searching google, blogs and MSDN looking for any small scrap of info on how "interop" or "mixed mode" debugging is implemented in Visual Studio.
I'm attempting to implement my own debugger for a custom VM (actually, it gets JIT-ed to native code, which means I'll have to rebuild callstacks for the normal native debugger whenever it enter's the JIT-ed code), but I can't find any info on how you can actually interact with VS's native debugger and do the fancy "native/managed" like transitions that VS's mixed mode debugging pulls off.
So far I've found a few things that provide useful tidbits, but not enough to actually interact with the debugger. The best, most useful articles I've found are:
Mike Stall's various blog posts (mainly these two) while providing useful info and glimpses at the inner workings, they seem to be very heavily tied to .Net debugging.
MSDN's Creating a Basic Debugger gives a nice overview of how MS implements it's debuggers and how you can implement one on the same tech stack. Unfortunately, this doesn't really provide any real info on how to pass data off to VS's native debugger. (Combined with Mike Stall's blogs, it seems like both debuggers would be waiting for the same events, so how do you actually splice the results together in a meaningful way?)
The Debugger Engine API (aka DbgEng) documentation. I found this by running Dependency Walker on VS's native debug engine (NatDbgDE.dll, it seems to export the DebugCreate function which I could only find in this documentation, so it could be related). Unfortunately I've had very little success in even doing any debugging through this and it seems to be poorly documented, although the documentation does seem to indicate this is what I'll probably want to deal with in the end. It also doesn't really say how I can work cooperatively with another debugger and makes no mention of VS's debugger, so I could be going down the wrong path entirely with this anyway.
How can I get started with writing a debugger that will work cooperatively with VS's native debugger?
Thanks!
I'm afraid there's not much documentation on this subject. The resources you mention are all pretty old at this point. My suggestion is to integrate with Visual Studio's newer debug engine (Concord). Concord is used as the debug engine for native debugging from Visual Studio 2012 forward and for all debugging in Visual Studio 2013 forward. One of the design goals of Concord was to simplify mixed mode debugging. It is also designed to be easily extensible.
I created some Concord extensibility documentation that may be of help. It is mainly focused on expression evaluators, but it has some good information for getting started with Concord. Another resource that may be of use is the source code for the Concord-based debugger in Python Tools for Visual Studio. This is a full implementation of a mixed mode debugger that integrates with Concord and allows mixed mode debugging with Python.

How to overcome the lagging of typing in the editor while using ReSharper?

I'm using Visual Studio 2013 with ReSharper 9 on a quite strong computer (16GB RAM, Core i7 CPU, SSD, etc.). Still I experience heavy delays and laggings during typing for example in a C# or Razor source file.
I've noticed that every time I hit a key, the processing immediately starts, and context actions, offering rename refactorings, autocompetion immediatley shows up in the editor. It would make sense to delay these stuff for example so that all of this processing would start only when I finish typing and have some amount of quite milliseconds.
I've browsed through the settings for the third time now, but could not find anything related. Is there anything like this? If yes, where? If no, what else could I do to overcome this lagging? It's really annoying and I don't quite understand it. I can't beleive that such a computer is still not enough.
Disable Bing Developer Assistant extension if you have it by going to 'Tools -> Extension And Updates'.
Disable the Microsoft Git Provider Plugin by going to 'Tools -> Source Control -> Then setting the Plug-In ComboBox to NONE.'
The above has helped me and has improved performance on my PC. Hopefully it will help you too.
You shouldn't be seeing a lag while typing. I'd suggest disabling other extensions to see if there's a clash - something that ReSharper doesn't like being installed at the same time. Alternatively (or better yet, as well) you can profile Visual Studio to see what's going wrong. Go to ReSharper → Help → Profile Visual Studio, and ReSharper will download the profiler, attach to Visual Studio and start to gather info. Once you've demonstrated the problem, click "Get snapshot", and ReSharper will save the snapshot and add it to the dialog as an attachment. You can then describe what you were doing and submit the snapshot and description to the dev team.
I'd also suggest downloading the latest build - the 9.2 EAP has just started, and contains a number of fixes that might help performance under certain circumstances.
Also, what are you typing in - what language, what size file?

Test Impact View does not record data

So i'm getting started a bit with unit testing in C# (using the built in testing tools). The tutorial i was following mentioned the Test Impact View. Told me to just open the window and click the link to enable the feature.
The window says there is no test impact data available and need to run the tests (which i do). But nothing happens then. It keeps giving me that message. I have checked the options to see if the link was just bugging out or so and didn't enable the feature.
So, does anyone know what is going wrong?
You need to have VS2010 Premium or Ultimate, otherwise VS2010 professional only have Unit Testing take a look http://www.microsoft.com/visualstudio/en-us/products/2010-editions/product-comparison

Debugging Office interop assemblies: how to get rid of automatic add-in disable?

I know this is not particularly programming related, but some of you here may know the solution.
I have a project using Excel interop in C#, and C++/CLI wrappers for ugly C++ code, all in the same project. I can debug the whole code nicely by attaching the debugger to Excel.
Now, each time I stop debugging (for whatever reason), Excel hard disables my addin. I must open a fresh excel, do 15 clicks to reenable it to start a new debugging session.
I must add that Excel loading times are pretty high, since we use another team's huge XLL (necessary to run my addin).
This behavior is pretty annoying, I'd like to disable automatic disabling of add ins. Does someone knows how to do ? I have no objection to programmatically set/unset registry keys.

Resources