VS2010 Addin DebuggerEvent 未触发
我正在尝试为 VS2010 开发一个插件来捕获 DebuggerEvents.OnExceptionThrown 事件,但由于某种原因它永远不会被处理。下面是一些不起作用的简单代码:
private DebuggerEvents debuggerEvents;
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
//Boilerplate code snipped out
if (debuggerEvents == null)
{
//This fails whether the cast is there, or if I just let it use DebuggerEvents
debuggerEvents = (DebuggerEventsClass)_applicationObject.Events.DebuggerEvents;
debuggerEvents.OnExceptionThrown += new _dispDebuggerEvents_OnExceptionThrownEventHandler(handler);
}
}
public void handler(string etype, string name, int code, string desc, ref dbgExceptionAction eAction)
{
Trace.WriteLine("here");
}
方法处理程序永远不会被调用。
我尝试了几种不同的方法来执行上述操作,但似乎都不起作用。我做错了什么吗?这是VS2010的一个bug吗?
编辑:我应该注意,使用完全相同的方法适用于其他 DebuggerEvent,例如 OnEnterBreakMode。
I am trying to develop an addin for VS2010 that catches the DebuggerEvents.OnExceptionThrown event, but for some reason it never gets handled. Here is some simple code that does not work:
private DebuggerEvents debuggerEvents;
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
//Boilerplate code snipped out
if (debuggerEvents == null)
{
//This fails whether the cast is there, or if I just let it use DebuggerEvents
debuggerEvents = (DebuggerEventsClass)_applicationObject.Events.DebuggerEvents;
debuggerEvents.OnExceptionThrown += new _dispDebuggerEvents_OnExceptionThrownEventHandler(handler);
}
}
public void handler(string etype, string name, int code, string desc, ref dbgExceptionAction eAction)
{
Trace.WriteLine("here");
}
The method handler never gets called.
I have tried several different methods of doing the above, but none of them seem to work. Is there something that I am doing wrong? Is this a bug in VS2010?
EDIT: I should note that using this exact same method works for other DebuggerEvents such as OnEnterBreakMode.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论