Windows 上具有 x86 DLL 的 Arm64 项目
我有一个项目作为 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:
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论