更新时间:2023-02-13 10:08:57
C#代码如下所示:
无效 字符串 strException)
{
调试程序= _applicationObject.Debugger as Debugger3 ;
例外设置 真 ,es.Item(strException));
}
C# code would look something like the following:
public void BreakWhenThrown(string strException)
{
Debugger3 debugger = _applicationObject.Debugger as Debugger3;
ExceptionSettings es = debugger.ExceptionGroups.Item("Common Language Runtime Exceptions");
es.SetBreakWhenThrown(true, es.Item(strException));
}
我不确定我是否完全遵循您的要求,但是外接程序通常会使用通过OnConnection传入的applicationObject公开的Debugger接口.如果您的加载项需要与VS的另一个实例互操作,则需要通过运行对象表检索该实例,如以下链接中所述:
附加到IDE的特定实例
如何:对DTE和DTE对象的引用
此致,
I'm not sure I completely follow what your requirements are here, but an add-in will typically use the Debugger interface exposed via the applicationObject passed in via OnConnection. If you have an add-in that needs to interop with another instance of VS, then you will need to retrieve that instance via the Running Object Table, as described in the following links:
Attaching to Specific Instances of the IDE
Automating a specific instance of Visual Studio .Net (CodeProject article)
Or have your add-in launch the 2nd instance, so you can readily retrieve it' DTE interface, as described in the following link:
How to: Get References to the DTE and DTE objects
Sincerely,