相关疑难解决方法(0)

如何控制触发事件处理程序的顺序?

事件处理程序是否按照它们附加到事件的顺序触发?如果没有,我可以在事件处理程序上强制执行某种顺序,以便按特定顺序调用它们吗?

.net events

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

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

背景:

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

目前的做法:

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

[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 ×2

c# ×1

debugging ×1

events ×1

exception ×1

vb.net ×1