Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Debug Engine: InvalidCastException in Marshal.ReleaseComObject upon sending AD7ProgramCreateEvent

$
0
0

Hi all,

I am working on a custom debug engine and, so far, I am playing with a very minimalistic implementation that is based on the MSDN sample and targets VS 2012 only just to get the basics working.

Now, I am stuck with quite a weird issue that happens only if I am debugging my custom debug engine in an experimental instance of Visual Studio. If I have my debugger configured to break whenever System.InvalidCastException is thrown, it breaks as soon as my code has delivered AD7ProgramCreateEvent to the SDM.

The exception itself is not very descriptive; it just says that the exception originated from Marshal.ReleaseComObject (that's all it has in the stack trace) and the error message reads "Unable to cast object of type 'MyCompany.MyProduct.AD7ProgramCreateEvent' to type 'System.__ComObject'.

However, if I examine the entire call stack in the debugger, I can see that it's Microsoft.VisualStudio.WebClient.Diagnostics.HtmlToolHost.Package.HtmlToolHostPackage.Event that made the call to Marshal.ReleaseComObject

I am pretty sure my implementation of AD7ProgramCreatedEvent is correct (as long as I am to trust the correctness of the MSDN sample, but just in case I've checked several other open source custom debug engines as well), so I have no clue why ReleaseComObject fails here (and why is it at all necessary)

So, I'd really appreciate any hints / ideas. Thanks!



Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>