I am debugging an assembly loading problem, so I'm looking through fusion logs. Sometimes they confuse me because they begin with indicating a failure, then in the end they say the assembly loads from where I expect it to be loaded.
What does "The operation failed" followed by "IL assembly loaded from..." really mean? Did it fail to load the assembly, or did it succeed?
*** 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\MyApplication126.96.36.199\MyApplication.exe --- A detailed error log follows. === Pre-bind state information === LOG: User = VIRTUALXP-63912\XPMUser LOG: DisplayName = MyCorp.MyApplication.Core, Version=188.8.131.52, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = file:///C:/Program/MyCorp/MyApplication184.108.40.206/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = MyApplication.exe Calling assembly : MyApplication, Version=220.127.116.11, Culture=neutral, PublicKeyToken=null. === LOG: Start binding of native image MyCorp.MyApplication.Core, Version=18.104.22.168, Culture=neutral, PublicKeyToken=null. WRN: No matching native image found. LOG: IL assembly loaded from C:\Program\MyCorp\MyApplication22.214.171.124\MyCorp.MyApplication.Core.dll.
I also see this kind of log for an assembly even when the program exits stating
can't load file or assembly SomeAssembly or one of its dependencies. The assembly in question is loaded according to a log entry similar to the above.
Would this indicate that a native dependency of the assembly was not found? Do I need to change the log settings to see which native dependency failed, or is there something else I can do?
I think it's because the CLR makes some attempts searching the dll so it firstly fail and then Succed. you can bind to the assemblyresolve event and have a look on how it works. if I Remember it search first in the gac then local folder then subfolders...