Exception.Data信息丢失 [英] Exception.Data info is missing

查看:138
本文介绍了Exception.Data信息丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从扩展属性中获取值

How to fetch he values from extended properties

try
  {
    // ...
  }
  catch (Exception ex)
  {
    ex.Data.Add("Hello", "World");
    throw ex;
  }





正确记录异常,但我无法在日志文件中的任何位置找到添加的数据。



The exception is logged correctly, but I can’t find the added data anywhere in the log file.

推荐答案

它的工作原理



it works

foreach (DictionaryEntry item in ex.Data)
            {
               string exceptionData = item.Key +" "+ item.Value;
            }


这篇关于Exception.Data信息丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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