I am trying to create an add-in in Visual Studio 2012 that will perform operations after a program has been executed. This requires me to know when design mode has been entered. I have the code below that works but it is in C#, and I am working in VB.NET.
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
.
.
.
//Initialize event handlers for host
_debuggerEvents = _applicationObject.Events.DebuggerEvents;
_debuggerEvents.OnEnterDesignMode += new _dispDebuggerEvents_OnEnterDesignModeEventHandler(OnEnterDesignMode);
}
/// <summary>Handles when the host application object's debugger enters design mode (is done debugging).</summary>
/// <param name="reason">The reason that the host application object is entering design mode.</param>
public static void OnEnterDesignMode(dbgEventReason reason)
{
System.Windows.Forms.MessageBox.Show("ADD-IN DEBUG: Debugger enters design mode.");
}
I tried converting it to its VB equivalent which resulted in
Public Sub OnConnection(ByVal application As Object, ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, ByRef custom As Array) Implements IDTExtensibility2.OnConnection
.
.
.
' Initialize event handlers for host
_debuggerEvents = _hostAppObj.Events.DebuggerEvents
_debuggerEvents.OnEnterDesignMode += New _dispDebuggerEvents_OnEnterDesignModeEventHandler(AddressOf _debuggerEvents.OnEnterDesignMode)
End Sub
Public Sub OnEnterDesignMode(ByVal reason As dbgEventReason)
System.Windows.Forms.MessageBox.Show("ADD-IN DEBUG: Debugger enters design mode.")
End Sub
Visual Studio has marked both occurrences of "_debuggerEvents.OnEnterDesignMode" with a note "Late bound resolution; runtime errors could occur." I don't see any runtime errors, but I never see the message box pop up with the notification that design mode has been entered like the C# version does. Any tips?
Thanks.