如何检索 LoaderException 属性? [英] How to retrieve the LoaderException property?

查看:16
本文介绍了如何检索 LoaderException 属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在更新我的服务参考时收到一条错误消息:

I get a error message while updating my service reference:

自定义工具警告:无法加载一种或多种请求的类型.检索 LoaderExceptions 属性以获取更多信息.

如何检索 LoaderException 属性?

How can I retrieve the LoaderException property?

更新:当我重新导入域对象项目时,我的错误消失了.我不知道为什么这解决了这个问题,但我很高兴它正在工作.

Update: My errors went away when I reimported the domain object projects. I have no idea why this fixed the issue, but I'm happy it's working.

推荐答案

try
{
  // load the assembly or type
}
catch (Exception ex)
{
  if (ex is System.Reflection.ReflectionTypeLoadException)
  {
    var typeLoadException = ex as ReflectionTypeLoadException;
    var loaderExceptions  = typeLoadException.LoaderExceptions;
  }
}

这篇关于如何检索 LoaderException 属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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