我正在调试程序集加载问题,所以我正在查看融合日志。有时他们会混淆我,因为他们开始表示失败,然后最后他们说装配从我希望装载的地方加载。
“操作失败”后跟“从......加载的IL程序集”是什么意思?它是否无法加载程序集,或者是否成功了?
*** Assembly Binder Log Entry (2012-03-16 @ 10:25:14) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program\MyCorp\MyApplication1.2.0.0\MyApplication.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = VIRTUALXP-63912\XPMUser
LOG: DisplayName = MyCorp.MyApplication.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///C:/Program/MyCorp/MyApplication1.2.0.0/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = MyApplication.exe
Calling assembly : MyApplication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: Start binding of native image MyCorp.MyApplication.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
WRN: No matching native image found.
LOG: IL assembly loaded from C:\Program\MyCorp\MyApplication1.2.0.0\MyCorp.MyApplication.Core.dll.
即使程序退出can't load file or assembly SomeAssembly or one of its dependencies
,我也会看到这种程序集的日志。根据类似于上面的日志条目加载所讨论的程序集。
这是否表示未找到程序集的本机依赖项?我是否需要更改日志设置以查看哪些本机依赖项失败,或者我还能做些什么?
答案 0 :(得分:0)
我认为这是因为CLR尝试搜索dll所以它首先失败然后成功。
您可以绑定到assemblyresolve
事件并查看其工作原理。
如果我记得它首先在GAC中搜索,然后在本地文件夹中搜索子文件夹......