相关疑难解决方法(0)

用户活动记录、遥测(以及全局异常处理程序中的变量)

背景:

我正在处理一个非常旧的应用程序,它很少并且非常间歇性地生成异常。

目前的做法:

通常我们程序员使用全局异常处理程序处理罕见的未知数,连接如下:

[STAThread]
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlAppDomain)]
private static void Main()
{
    Application.ThreadException += new ThreadExceptionEventHandler(UIThreadException);
    Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); 
    AppDomain.CurrentDomain.UnhandledException +=
        new UnhandledExceptionEventHandler(UnhandledException);

    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new OldAppWithLotsOfWierdExceptionsThatUsersAlwaysIgnore());
}

private static void UIThreadException(object sender, ThreadExceptionEventArgs t)
{
    //-------------------------------
    ReportToDevelopers("All the steps & variables you need to repro the problem are: " + 
    ShowMeStepsToReproduceAndDiagnoseProblem(t));
    //-------------------------------

    MessageToUser.Show("It’s not you, it’s us. This is our fault.\r\n Detailed information about this error has automatically been recorded and we have been notified.Yes, we do look at …
Run Code Online (Sandbox Code Playgroud)

.net c# vb.net debugging exception

1
推荐指数
1
解决办法
4744
查看次数

标签 统计

.net ×1

c# ×1

debugging ×1

exception ×1

vb.net ×1