【发布时间】:2020-01-30 14:15:59
【问题描述】:
我们遇到了一个与在 Windows 10 版本 1607 机器上启动一些内部开发的 .NET 应用程序有关的问题。有时启动应用程序不会成功。这是因为加载从属 .NET 程序集失败。错误信息是:
System.IO.FileLoadException:无法加载文件或程序集 '[程序集名称],版本=[版本],文化=中性, PublicKeyToken=[publickeytoken]' 或其依赖项之一。数据 传递给系统调用的区域太小。 (HRESULT 的例外情况: 0x8007007A)
在不同的 .NET 应用程序中,大约 10% 的应用程序启动都会出现此问题。它发生在 32 位和 64 位应用程序中。在所有启动过程中,许多其他应用程序也启动正常启动。我想知道为什么我们会收到0x8007007a 错误?也许它是由于之前发生的堆损坏而导致的抵押品?
您可以从下面的 FUSLOGVW 中看到相关的日志记录。文件路径和程序集名称是匿名的。尝试加载的程序集名称很长(59 个字符,不带 .dll 后缀)。作为测试,我们将程序集的名称更改为更短的名称。不幸的是,问题仍然存在。在 exe.config 中添加探测路径也没有解决问题。
此外,Github 上似乎有旧版 Microsoft Assembly Resolver 的代码:https://github.com/fixdpt/shared-source-cli-2.0。我怀疑 adlmgr.cpp 中的 ConstructCodeBaseList 有问题。但我不知道是什么触发了这个问题。
*** Assembly Binder Log Entry (2020/01/30 @ 13:48) ***
The operation failed.
Bind result: hr = 0x8007007a. The data area passed to a system call is too small.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\XXX\XXX\XX.X.X.X\XXX\XXXXXXXXXXXXXX\ApplicationWeWantToStart.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = AnAssem.blyWi.th.AVeryLon.gNameAA.AAAAAAAA.AAAAAAAAAAA.AAAA, Version=13.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/XXX/XXX/XX.X.X.X/XXX/XXXXXXXXXXXXXX/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ApplicationWeWantToStart.exe
Calling assembly : ApplicationWeWantToStart, Version=13.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\XXX\XXX\XX.X.X.X\XXX\XXXXXXXXXXXXXX\ApplicationWeWantToStart.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: AnAssem.blyWi.th.AVeryLon.gNameAA.AAAAAAAA.AAAAAAAAAAA.AAAA, Version=13.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXXX
LOG: GAC Lookup was unsuccessful.
ERR: Error occurred constructing the probing codebase list.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x8007007a).
【问题讨论】:
标签: c# .net binding .net-assembly fusion