2012-03-16 33 views
6

我正在調試程序集加載問題,所以我正在通過融合日誌查找。有時候他們會混淆我,因爲他們開始表示失敗,然後最終他們說裝配從我預期的裝載位置加載。Fusion日誌說什麼?

什麼是「操作失敗」,其次是「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

這是整個日誌?從我所看到的,沒有失敗(因爲MyCorp.MyApplication.Core'的'本機映像被發現,被發現一個託管版本被加載。 – Oded 2012-03-16 09:47:12

+0

這是日誌爲一個特定的DLL。這個DLL是一個託管的DLL ,並據我所知成功加載,這就是爲什麼我想知道「失敗」的原因。 – 2012-03-16 10:02:34

+0

查找另一個日誌條目,顯示「其中一個依賴項」的綁定失敗。如果是這個原因,忽略「不匹配的本地映像」,這是正常的。 – 2012-03-16 13:20:31

回答

0

我認爲這是因爲CLR做一些嘗試搜索DLL所以先失敗,然後成功。 您可以綁定到assemblyresolve事件並查看它的工作原理。 如果我還記得它首先搜索在GAC然後再本地子文件夾...

See documentation here.