【问题标题】:BadImageFormatException on AppDomain Created Using AppDomain.CreateDomain使用 AppDomain.CreateDomain 创建的 AppDomain 上的 BadImageFormatException
【发布时间】:2015-01-16 17:19:22
【问题描述】:

我正在尝试追查 BadImageFormatException (Index not found.) 异常的原因。在以下代码的第 2 行抛出异常:

AppDomain _trainingDomain = AppDomain.CreateDomain("TrainingDomain");
_trainingDomain.UnhandledException += new UnhandledExceptionEventHandler(AppDomain_UnhandledException);
_trainingDomain.SetData("RemoteDomain", AppDomain.CurrentDomain);
_trainingDomain.DoCallBack(InitializeRemoteDomain);

如果我注释掉第二行代码,第三行执行成功,然后方法在第四行代码再次失败,同样的异常。

此代码包含在一个静态方法中,该方法位于包含 AppDomain_UnhandledException 和 InitializeRemoteDomain 方法的同一个静态类中。解决方案中的所有项目都是使用 x86 标志和 .NET 4.5.1 编译的。该应用程序在我的开发盒(Windows 7 Pro x64)上正常工作,但在生产盒(Windows Embedded Standard x32)上失败。我认为我使用 CreateDomain 方法创建的 AppDomain 将与现有的 AppDomain 具有相同的位数,它首先调用 CreateDomain 方法。

任何帮助将不胜感激!

【问题讨论】:

    标签: c# appdomain badimageformatexception


    【解决方案1】:

    我发现问题是由于我们在构建服务器上使用的 .NET Reactor 版本来混淆代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多