3

I have a VSTO Excel add-in created using VS2010, and I am using exception handling from Enterprise Library 5.0. It works fine in development, but when I deploy using click once, errors are getting swallowed up by Enterprise Library. I suspect enterprise library is not getting called at all, because I did this:

try {
   //..
}
catch (Exception ex)
{
    Globals.ThisAddIn.Application.Cursor = Microsoft.Office.Interop.Excel.XlMousePointer.xlDefault;
    MessageBox.Show("handle error '" + ex.Message + "' with enterprise Policy");
    exManager.HandleException(ex, "Policy");
} 

And I get the dialog box, but no error gets logged or displayed or re-thrown.

Does anyone know why the enterprise libraries would fail to load? I checked, and they are strong signed.

4

2 回答 2

0

这可能是由于记录器配置有问题,如果不可能,请尝试 Debugger.Break 并进入 exManager.HandleException 调用尝试在 exManager.Handleexception 中弹出消息框并检查其中的参数值

于 2012-05-01T03:42:46.800 回答
0

Keith was right, it seems Excel swallows VSTO errors by default. I had to set the environment variable VSTO_SUPPRESSDISPLAYALERTS to 0.

于 2012-05-01T16:53:13.330 回答