Windows 上具有 x86 DLL 的 Arm64 项目

发布于 2025-01-15 13:17:26 字数 1628 浏览 3 评论 0原文

我有一个项目作为 ARM64 变体(以及 x64 和 x86)发布,但用户在加载应用程序时遇到错误。

An attempt was made to load a program with an incorrect format. (0x8007000B)
System.BadImageFormatException
 at MS.Win32.PresentationCore.UnsafeNativeMethods.MilCoreApi.RenderOptions_ForceSoftwareRenderingModeForProcess(Boolean fForce)
 at System.Windows.Media.RenderOptions.set_ProcessRenderMode(RenderMode value)
 at Myapp.App.App_Startup(Object sender, StartupEventArgs e) in App.xaml.cs:line 156
 at System.Windows.Application.OnStartup(StartupEventArgs e)
 at System.Windows.Application.<.ctor>b__1_0(Object unused)
 at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
 at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

触发问题的行调用了 Util.dll 来加载和解析设置,其中包含一堆 Type.GetType()Activator.CreateInstance()调用,但异常没有在那里触发。

我的发布设置是这样的:

在此处输入图像描述

在此处输入图像描述

在检查每个已发布的 DLL 时,我注意到并非所有都是 ARM64:

  • MyApp.exe(以及其他DLLs): Arm64
  • MyApp.dll: x86 (这是自动生成的)
  • SharpDX.DXGI.dll: x86 (安装的唯一 nuget 包)
  • Accessibility.dll: x86 (来自 .NET)
  • mscorlib.dll: x86
  • netstandard.dll:x86

据我了解,ARM64 设备应该毫无问题地加载 x86 DLL。 是这样吗?

如何检测触发此问题的原因?

I have a project that I'm publishing as ARM64 variant (along with x64 and x86) but users are getting an error when loading the app.

An attempt was made to load a program with an incorrect format. (0x8007000B)
System.BadImageFormatException
 at MS.Win32.PresentationCore.UnsafeNativeMethods.MilCoreApi.RenderOptions_ForceSoftwareRenderingModeForProcess(Boolean fForce)
 at System.Windows.Media.RenderOptions.set_ProcessRenderMode(RenderMode value)
 at Myapp.App.App_Startup(Object sender, StartupEventArgs e) in App.xaml.cs:line 156
 at System.Windows.Application.OnStartup(StartupEventArgs e)
 at System.Windows.Application.<.ctor>b__1_0(Object unused)
 at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
 at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

The line that triggers the issue has a call to the Util.dll to load and parse settings, which contains a bunch of Type.GetType() and Activator.CreateInstance() calls, but the exception is not triggered there.

My publishing settings are this:

enter image description here

enter image description here

When checking each published DLLs, I noticed that not all are ARM64:

  • MyApp.exe (and other DLLs): Arm64
  • MyApp.dll: x86 (this one is automatically generated)
  • SharpDX.DXGI.dll: x86 (the only nuget package installed)
  • Accessibility.dll: x86 (from .NET)
  • mscorlib.dll: x86
  • netstandard.dll: x86

As far as I understand, an ARM64 device should load x86 DLLs without issues.
Is that right?

How can I detect what's triggering this issue?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文