4
我搞砸了Visual Studio加載項API,試圖查看我想要做的事情是否可能。有一件事我現在正在做的是一樣的東西:如何在Visual Studio加載項中獲取當前行號/異常情況?
public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
{
_applicationObject.Events.DebuggerEvents.OnExceptionThrown += DebuggerEvents_OnExceptionThrown;
handled = false;
if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
{
if(commandName == "MyAddin1.Connect.MyAddin1")
{
handled = true;
return;
}
}
}
void DebuggerEvents_OnExceptionThrown(string ExceptionType, string Name, int Code, string Description, ref dbgExceptionAction ExceptionAction)
{
//how to get line number here?
}
理想情況下,我希望能夠得到當前函數和行號每當異常由正在調試的程序拋出。這可能嗎?