如何在生产中默默地停止例外(Excel 2010)。

问题描述:

VBA的一个难点是异常从未提供任何迹象表明他们在何处发生。 只是一个不起眼的错误消息。

One of the pain points of VBA was that exceptions never provided any indication of where they occured.  Just an obscure error message.

默认情况下,VSTO似乎更好。 只是默默地忽略了例外情况! 因此,用户可以报告奇怪的事情可能发生或可能没发生,然后我们必须诊断它。

By default, VSTO seems to go one better.  Exceptions are just silently ignored!  So users can just report that something odd may or may not have happened, and we then have to diagnose that.

设置"显示用户界面错误" Excel中的高级选项似乎
提供了一些消息。 但我不想设置全局设置。 目前还不清楚如何以编程方式设置它。

Setting "Show User Interface Errors" advanced option in Excel seems to provide some messages.  But I prefer not to set global settings.  And it is unclear how to set it programmatically anyway.



显然WPF Application.DispatcherUnhandledException在VSTO中不起作用,因为没有应用程序。  任何人都知道如何使这项工作?


Apparently WPF Application.DispatcherUnhandledException does not work in VSTO as there is no application.  Anyone know how to make this work?

环境变量VSTO_SUPPRESSDISPLAYALERTS有一些东西,但我不想使用用户的全局设置。

There is something about environment variables VSTO_SUPPRESSDISPLAYALERTS, but I do not want to play with user's global settings.

那么有什么替代方法可以将try / catch放在每个事件周围吗? 这很痛苦,但更糟糕的是它不会陷入WPF本身可能抛出的无数异常。

So is there any alternative to just putting try/catch around every event?  This is painful, but worse it will not trap the myriad of exceptions that can be thrown by WPF itself.

我会发现,经过这么多年微软不会知道这种支持和维护总是比开发成本高,所以这很重要。

I would find it surprising that after all these years Microsoft would not know that support and maintenance always costs more than development, and so this is important.

问候,

Anthony

(请注意,这完全是在生产中,而不是在Visual Studio下进行调试。)

(Note that this is all about in production, not about debugging under Visual Studio.)

您好Anthony,

Hi Anthony,

感谢您的帖子。

我们正在处理这个问题,请耐心等待我们提供一些有价值的建议。

We are working on the question, please be patient before We can provide some valuable suggestions.

美好的一天,