Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more i

通过添加如下的代码catch exception获取具体却是的库的名称:

using System.IO;
using System.Reflection;
using System.Text;

try
{
    //The code that causes the error goes here.
}
catch (ReflectionTypeLoadException ex)
{
    StringBuilder sb = new StringBuilder();
    foreach (Exception exSub in ex.LoaderExceptions)
    {
        sb.AppendLine(exSub.Message);
        FileNotFoundException exFileNotFound = exSub as FileNotFoundException;
        if (exFileNotFound != null)
        {                
            if(!string.IsNullOrEmpty(exFileNotFound.FusionLog))
            {
                sb.AppendLine("Fusion Log:");
                sb.AppendLine(exFileNotFound.FusionLog);
            }
        }
        sb.AppendLine();
    }
    string errorMessage = sb.ToString();
    //Display or log the error based on your application.
}
上一篇:海康大华RTSP安防摄像头web无插件直播流媒体服务器EasyNVR接入设备显示immediate exit requested问题解决方案


下一篇:Client does not support authentication protocol requested by server; consider upgrading MySQL client