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

vs2010 DebugEngine InvalidCastException

$
0
0
Hi, 

I maintain a VS plugin, with associated debug engine written using the MPF. 

I have just implemented a disassembler module for it, but when selecting a disassembler window I get the following Exception: 

An unhandled exception is about to terminate the process. Exception info: 
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Unable to cast object of type 'MyCoLtd.MyPackage.CodeContext' to type 'Microsoft.VisualStudio.Debugger.Interop.IDebugCodeContext2'. 
at System.StubHelpers.InterfaceMarshaler.ConvertToManaged(IntPtr pUnk, IntPtr itfMT, IntPtr classMT, Int32 flags) 
at Microsoft.VisualStudio.Debugger.Interop.Internal.IDebuggerInternal.get_CurrentCodeContext() 
at Microsoft.VisualStudio.Debugger.Utilities.Debugger.DebuggerProperties.get_CurrentCodeContext() 
at Microsoft.VisualStudio.Debugger.DebuggerToolWindows.DisassemblyWindow.Control.OnVisibleChanged(Boolean value) 
at Microsoft.VisualStudio.Debugger.DebuggerToolWindows.DisassemblyWindow.Control.set_Visible(Boolean value) 
at Microsoft.VisualStudio.Debugger.DebuggerToolWindows.DisassemblyWindow.ToolWindow.OnShow(Int32 fShow) 
at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.NotifyOnShow(Int32 frameShow) 
at Microsoft.VisualStudio.Platform.WindowManagement.WindowFrame.OnContentShowing(View view) 
at Microsoft.VisualStudio.Platform.WindowManagement.WindowManagerService.OnViewContentShowing(Object sender, ViewEventArgs args) 

The C# code for the class that VS fails to cast is:
    [ComVisible(true)]
    [Guid(GuidList.guidCodeContextString)]
    public class CodeContext : Microsoft.VisualStudio.Debugger.Interop.IDebugCodeContext2, MemoryContext
    {
        /* implementation */
    }
Given that the CodeContext class is used elsewhere without problem and it's not even reaching the new disassembler code, I'm somewhat stuck as to what to do. 

Any suggestions where the problem might be? 

Thanks, 

Simon.

Viewing all articles
Browse latest Browse all 4410

Trending Articles



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