使用UnhandledExceptionEventArgs-解析错误的代码示例 [英] Using UnhandledExceptionEventArgs - examples of code that parse errors

查看:435
本文介绍了使用UnhandledExceptionEventArgs-解析错误的代码示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我使用My.Application.UnhandledException捕获程序中发生的任何错误.是否有人有一些代码示例,可用于将信息分解为有助于诊断问题的内容?我已经检查了很多事情,但是发现其他事情令人沮丧.因此,一个很好的例子将不胜感激.

为什么让我感到沮丧的一个例子是下面的代码来获取局部变量:

Hi all,

I use My.Application.UnhandledException to catch any errors that occur in my program.  Does anyone have some examples of code they use to break down the information into something that can help diagnose the problem?  I already check for a number of things, but find others to be frustrating.  So a good example would be greatly appreciated.

An example of why I am frustrated is the following code to get the local variables:

xmlErrVars = _
  <Variables>
  <%= From c In e.Exception.TargetSite.GetMethodBody.LocalVariables _
  Select <Variable>
   <Name><%= c.LocalIndex.ToString %></Name>
   <LocalType><%= c.LocalType.ToString %></LocalType>
 </Variable> %>
</Variables>

产生以下内容的

变量

名称<名称0</名称< LocalType< SystemType.System.Int16</LocalType>

</变量>

但是我找不到一种获取变量名称或值的方法(这会使它更容易一些). < Name>中的值;实际上是一个索引,但我不知道如何使用它来获取名称.

无论如何,这只是一个示例-这就是为什么一些解析错误事件参数的示例代码会这样做的原因是的,非常有帮助.

是的,完成后,数据会记录到日志中,以供技术支持部门的人员找出并解决,因此,提供更多帮助信息的人越好.
/>
,谢谢,

FletcherJ

Which produces:

     <Variable>
        <Name>0</Name>
        <LocalType>System.Int16</LocalType>
      </Variable>

But I can't find a way to get the variable name or value (which would make it a little easier).  The value in <Name> is actually an index, but I can't figure out how to use it to get the name.

Anyway, this is just one example - which is why some sample code that parses out error event parameters would be quite helpful.

And yes, when I am done, the data is recorded to a log for support dept folks to figure out and fix, so the more info to help them, the better.

Thanks,

FletcherJ

推荐答案

不确定,但该代码是vb.net代码吗?还是另一种语言(可能是asp)?
这是Visual Basic General..
trujade.
not really sure, but is that code vb.net code? or another language, asp maybe?
this is Visual Basic General..
trujade.


这篇关于使用UnhandledExceptionEventArgs-解析错误的代码示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆