Welcome to MSDN Blogs Sign in | Join | Help

Debugging Assembly Loading Failures

So...you're seeing a FileNotFoundException, FileLoadException, BadImageFormatException or you suspect an assembly loading failure? Try the steps below to start your debugging process.

First, get the Message property from the exception. If the exception's InnerException property is set, get the Message property from that. If the message is generic, also get the hresult by calling System.Runtime.InteropServices.Marshal.GetHRForException(), passing in the Exception object. If that info is not readily available, you may need to attach a debugger and set it to catch managed exceptions. Then, get the hresult by retrieving the private _HResult field of the managed Exception object.

Retrieving the Fusion log

If the exception message isn t enough for you to determine what the problem is, try getting the Fusion log. It will describe the binding failure (if this is due to an assembly binding failure, instead of a loading failure after the file is found). The exception may already include the log. If not, to get it, run fuslogvw.exe. If you don't have fuslogvw.exe already, install the Framework SDK.

  • For pre-v2.0: click on "Log Failures." If this is an ASP.NET or .NET Windows service app, select the Custom option and using regedit, set [HKLM\Software\Microsoft\Fusion\LogPath] to point to an existing directory (like c:\mylogs, not c:\). If you need to log all binds, not just failing ones, set [HKLM\Software\Microsoft\Fusion\ForceLog] as a DWORD value to 1.
  • For v2: click on "Settings," then choose "Log bind failures to disk" if you only care about the failures or "Log all binds to disk" if you want to see all binding requests.
  • To turn on failure logging during a test run instead of by hand, have your script set [HKLM\Software\Microsoft\Fusion\LogFailures] as a DWORD value to 1 using regedit.

Then, click "OK." Now, re-run the process. Next, click "Refresh" in fuslogvw, and a line should appear for each binding failure (or for each bind, if ForceLog is set). Now, double-click on the line in the "Application" column for the interesting bind, and a web page should come up with the Fusion log.

If the file was found, it was loaded from the last path probed in the log (or from the GAC, if there is no probed path shown).

Note: Unless you are explicitly debugging the failure of a resource to load, you will likely want to ignore failures to find assemblies with the ".resources" extension with the culture set to something other than "neutral". Those are expected failures when the ResourceManager is probing for satellite assemblies.

Troubleshooting Fusion logging

Keep in mind that there may not be any entries if there were no binds or if there were no binding failures (when logging failures only). (And don't forget to restart your application's process after changing logging settings.) If there are not as many entries as you expect, you may need to clear your download cache to make room for them. To do that, in Internet Explorer, choose “Tools“, “Internet Options“, “Delete Files”, “OK“, then re-run your app and finally click “Refresh“ again in fuslogvw.

There is only one Fusion log saved per display name/codebase. So, if the same exact reference is requested twice in the same process, it will only show up once in fuslogvw. To see the duplicate logs, you'll need to stop execution (for example, with breakpoints in your debugger) and then get the log at that time.

For FileNotFoundException:
At the bottom of the log will be the paths that Fusion tried probing for this assembly. If this was a load by path (as in Assembly.LoadFrom()), there will be just one path, and your assembly will need to be there to be found. Otherwise, your assembly will need to be on one of the probing paths listed or in the GAC if it's to be found.

You may also get this exception if an unmanaged dependency or internal module of the assembly failed to load. Try running depends.exe on the file to verify that unmanaged dependencies can be loaded. Note that if you re using ASP.NET, the PATH environment variable it's using may differ from the one the command line uses. If all of them could be loaded, try ildasm.exe on the file, double-click on "MANIFEST" and look for ".file" entries. Each of those files will need to be in the same directory as the manifest-containing file. 

For BadImageFormatException:
Try running peverify.exe on the file. That will give a more specific description about why it s considered a bad image. Keep in mind that modules built against v2 can not be loaded by a pre-v2 CLR.

For SecurityException:
You need Execute permission for loading any assembly. Also, if a codebase was used to load this file, you would need both FileIOPermission.Read and FileIOPermission.PathDiscovery or else WebPermission to the location (depending on whether this is a local file or a URL). Try caspol.exe to check your managed security settings.

For FileLoadException:

For an "Access is denied" message (for hresult E_ACCESSDENIED, 0x80070005):
Run tlist -m on the file to see if another process has the file locked and without share-read access. If not, check the ACLs for the file and its dependencies (especially if you're using impersonation).

For a "The located assembly's manifest definition with name [yourAssembly] does not match the assembly reference" message (for hresult FUSION_E_REF_DEF_MISMATCH, 0x80131040):
The Fusion log will say which part of the assembly reference failed to match what was found. It will be the assembly name, culture, public key (or token) or version (if the found assembly was strongly-named).

For "Unverifiable image [yourAssembly] can not be run" or "Can not run executable [yourAssembly] because it contains relocations" messages (for hresult COR_E_FIXUPSINEXE, 0x80131019):
That image must be run as the process exe or else be compiled as a dll. This is because MC++ has made optimizations for you in your image, based on the assumption that it will be the process exe. If it's not the process exe, it won t be loaded at the expected location, so the assumed offsets will be incorrect. When the CLR sees such a file loaded as a non-process exe, it will reject the load.

Published Thursday, May 29, 2003 2:09 PM by Suzanne Cook

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# RE: Debugging Assembly Loading Failures

Not related in any way to this specific post, Suzanne, but Welcome to the house! Have fun, and will look forward to reading your posts! :)
Friday, June 13, 2003 1:45 PM by Tomas Restrepo

# RE: Debugging Assembly Loading Failures

We I load a newly complied DLL for an ASP.NET application on the server the below is my problem. Do you know how to fix it? For a “The located assembly's manifest definition with name [yourAssembly] does not match the assembly reference" message (for hresult FUSION_E_REF_DEF_MISMATCH, 0x80131040): The Fusion log will say which part of the assembly reference failed to match what was found. It will be the assembly name, culture, public key (or token), or version (if the found assembly was strongly-named).
Saturday, August 16, 2003 2:31 AM by Robert

# RE: Debugging Assembly Loading Failures

Robert: Yes, either change the reference so it matches the found assembly, or copy over the right assembly which matches the reference, so that it will be found instead. For example, if the Fusion log says that the version doesn't match, check against the found assembly's version. In that case, probably the problem is that you've recompiled that assembly with another version. So, then, you may want to update the referencing assembly so that it matches the new version, use config to redirect to the new version, or just not change assembly verson numbers between non-shipping builds (see http://blogs.msdn.com/suzcook/archive/2003/05/29/57148.aspx ).
Monday, August 18, 2003 5:06 PM by Suzanne

# RE: Debugging Assembly Loading Failures

Great post Suzanne. Do you have any links to more information about fusion logs? I was hoping to find something that explained a bit about what was going on for each line in the log. For instance I have a log that ends: LOG: Entering download cache setup phase. ERR: Setup failed with hr = 0x80070005. ERR: Failed to complete setup of assembly (hr = 0x80070005). Probing terminated. So I was hoping to find a description of what is going on during the "download cache setup phase".
Thursday, October 02, 2003 6:16 AM by Antony Perkov

# RE: Debugging Assembly Loading Failures

From winerror.h: // Access is denied. #define ERROR_ACCESS_DENIED 5L See my original blog entry for debugging advice about this specific hresult. See http://blogs.gotdotnet.com/alanshi/PermaLink.aspx/d3b8c7d9-b0c6-47fd-8ddf-20db971ba80d for more info about how Fusion has implemented the download cache.
Thursday, October 02, 2003 2:11 PM by Suzanne Cook

# RE: Debugging Assembly Loading Failures

Suzanne, I have read a number of you rposts regarding using the fusion log to debug assembly loading issues, but I just can't get past this, and am hoping you may be able to shed a little light. This issue is regarding using the Microsoft.ApplicationBlocks.ExceptionManagement from the GAC for an ASP.NET application. My CustomPublisher is also in the GAC. I have a windows service that uses the same exception publishing assemblies, and it works beautifully. For whatever reason though, the ASP.NET application always fails. The interesting thing is that it does log the exception to the Windows Event log which means that it IS loading the assembly!!? Following are excerpts from various files to show you what I mean... Web.Config: <configSections> <section name="exceptionManagement" type="Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManagerSectionHandler, Microsoft.ApplicationBlocks.ExceptionManagement, version=1.0.1.0, culture=neutral, publicKeyToken=13da6d3f9482dd92"/> </configSections> <exceptionManagement mode="on"> <publisher mode="on" assembly="Brulant.Library.Exceptions, Version=1.0.1.1, Culture=neutral, PublicKeyToken=13da6d3f9482dd92" type="Brulant.Library.Exceptions.BrulantDatabasePublisher" exclude="" /> <publisher mode="on" assembly="Brulant.Library.Exceptions, Version=1.0.1.1, Culture=neutral, PublicKeyToken=13da6d3f9482dd92" type="Brulant.Library.Exceptions.BrulantTextFilePublisher"/> </exceptionManagement> FUSION LOG: *** Assembly Binder Log Entry (11/7/2003 @ 2:28:16 PM) *** The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v1.1.4322\fusion.dll Running under executable C:\Windows\Microsoft.NET\Framework\v1.1.4322\aspnet_wp.exe --- A detailed error log follows. === Pre-bind state information === LOG: DisplayName = Microsoft.ApplicationBlocks.ExceptionManagement, Culture=neutral, PublicKeyToken=13da6d3f9482dd92 (Partial) LOG: Appbase = file:///c:/inetpub/wwwroot/CORE LOG: Initial PrivatePath = bin LOG: Dynamic Base = C:\Windows\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\core\e5dbef76 LOG: Cache Base = C:\Windows\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\core\e5dbef76 LOG: AppName = c6d4cac7 Calling assembly : (Unknown). === LOG: Processing DEVPATH. LOG: DEVPATH is not set. Falling through to regular bind. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: Microsoft.ApplicationBlocks.ExceptionManagement, Culture=neutral, PublicKeyToken=13da6d3f9482dd92 LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/core/e5dbef76/c6d4cac7/Microsoft.ApplicationBlocks.ExceptionManagement.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/core/e5dbef76/c6d4cac7/Microsoft.ApplicationBlocks.ExceptionManagement/Microsoft.ApplicationBlocks.ExceptionManagement.DLL. LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/CORE/bin/Microsoft.ApplicationBlocks.ExceptionManagement.DLL. LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/CORE/bin/Microsoft.ApplicationBlocks.ExceptionManagement/Microsoft.ApplicationBlocks.ExceptionManagement.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/core/e5dbef76/c6d4cac7/Microsoft.ApplicationBlocks.ExceptionManagement.EXE. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/core/e5dbef76/c6d4cac7/Microsoft.ApplicationBlocks.ExceptionManagement/Microsoft.ApplicationBlocks.ExceptionManagement.EXE. LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/CORE/bin/Microsoft.ApplicationBlocks.ExceptionManagement.EXE. LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/CORE/bin/Microsoft.ApplicationBlocks.ExceptionManagement/Microsoft.ApplicationBlocks.ExceptionManagement.EXE. LOG: All probing URLs attempted and failed. Any help is GREATLY appreciated. Thank you, Phil
Friday, November 07, 2003 3:42 PM by Phil Pastor

# RE: Debugging Assembly Loading Failures

The problem is that the Version isn't fully specified (see the "Partial" in the Fusion log) : LOG: DisplayName = Microsoft.ApplicationBlocks.ExceptionManagement, Culture=neutral, PublicKeyToken=13da6d3f9482dd92 (Partial) Fusion won't check the GAC for the assembly unless the full display name is given (see http://blogs.gotdotnet.com/suzcook/PermaLink.aspx/07954694-ac03-4459-80df-859a31cd76bc ). So, the code with the incomplete reference will need to be updated. It looks like the reference in the web.config is fully-specified, so that wasn't the cause of this failure. That's why the bind for the web.config type seemed successful (it was).
Saturday, November 08, 2003 7:10 PM by Suzanne

# RE: Debugging Assembly Loading Failures

Suzanne, Thanks for the informative blog. I am trying to deploy a windows app. Things were fine until I added an installer to the project to perform some custom actions. Using the fuslogvw I have located the problem. AppBase has been changed to Windows/System32 instead of the application folder. Therefore, when CLR probes for the assembly, it cannot find it and bind it. What would be the solution for this? I want the assemblies to stay where they are and not install it to GAC. Thank you very much for your help. Korhan
Wednesday, November 12, 2003 4:00 AM by Korhan

# RE: Debugging Assembly Loading Failures

Suzaane, Thanks for your reponse regarding my issue with the Microsoft.ApplicationBlocks.ExceptionManagement in the GAC. It turns out that the web.config WAS the issue. Previously I declared the assembly as: <section name="exceptionManagement" type="Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManagerSectionHandler, Microsoft.ApplicationBlocks.ExceptionManagement, version=1.0.1.0, culture=neutral, publicKeyToken=13da6d3f9482dd92"/> ...well, I changed it to: <section name="exceptionManagement" type="Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManagerSectionHandler, Microsoft.ApplicationBlocks.ExceptionManagement, version=1.0.1.0, culture=neutral, publicKeyToken=13da6d3f9482dd92"/> ...and it worked! Notice that I removed the CarriageReturn from the declaration between the end of the assembly name and the word "version." Any idea why this would cause an issue ONLY when the assembly is in the GAC? Thanks again, Phil
Wednesday, November 12, 2003 11:04 AM by Phil Pastor

# RE: Debugging Assembly Loading Failures

Suzanne, I thought you might like to see the error log before answering my above question. Here it goes *** Assembly Binder Log Entry (11/12/2003 @ 3:45:13 PM) *** The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified. Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll Running under executable C:\WINDOWS\System32\MsiExec.exe --- A detailed error log follows. === Pre-bind state information === LOG: DisplayName = cWiz Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null (Fully-specified) LOG: Appbase = C:\WINDOWS\System32\ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = NULL Calling assembly : (Unknown). === LOG: Processing DEVPATH. LOG: DEVPATH is not set. Falling through to regular bind. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Post-policy reference: cWiz Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null LOG: Attempting download of new URL file:///C:/WINDOWS/System32/cWiz Client.DLL. LOG: Attempting download of new URL file:///C:/WINDOWS/System32/cWiz Client/cWiz Client.DLL. LOG: Attempting download of new URL file:///C:/WINDOWS/System32/cWiz Client.EXE. LOG: Attempting download of new URL file:///C:/WINDOWS/System32/cWiz Client/cWiz Client.EXE. LOG: All probing URLs attempted and failed.
Wednesday, November 12, 2003 3:58 PM by Korhan

# RE: Debugging Assembly Loading Failures

sir i have problem whenever calling asp.net pages in the event viewer "aspnet_wp.exe could bot be started . HREHULT for the further 80004005
Friday, November 14, 2003 1:22 AM by sanjeev

# RE: Debugging Assembly Loading Failures

sir i have problem whenever calling asp.net pages in the event viewer "aspnet_wp.exe could bot be started . HREHULT for the further 80004005 please reply me
Friday, November 14, 2003 1:22 AM by sanjeev

# RE: Debugging Assembly Loading Failures

Phil: Pre-v2.0, Fusion didn't ignore newlines in display names. The full display name needs to be (acceptably) specified for binds to the GAC to succeed. So, that's why it failed to load from the GAC. But, partial binds can work in the ApplicationBase, which you've noticed (though they're not recommended).
Thursday, December 04, 2003 11:10 PM by Suzanne

# RE: Debugging Assembly Loading Failures

Korhan and Sanjeev: Those types of questions are better suited for Microsoft's official technical support channels. They're about MsiExec.exe / ASP.NET specifically, not about the loader. Try http://support.microsoft.com/ .
Friday, December 05, 2003 2:35 PM by Suzanne

# RE: Debugging Assembly Loading Failures

Hi I need help please......... I have developed asp.net web application on 2002 ,Now i have only 2003 in my system and if i am trying to run the web application it is giving error: Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4 for Microsoft (R) .NET Framework version 1.1.4322.573 Copyright (C) Microsoft Corporation 1987-2002. All rights reserved. vbc : error BC32400: Class 'CLSID_CorSymWriter_SxS' could not be created: Class not registered vbc : error BC31019: Unable to write to output file 'C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\webapplication3\4c790788\4b8c4c7\r6vd1nnj.pdb': Class not registered Thanks in adnace
Friday, December 19, 2003 5:07 AM by Sridhar

# RE: Debugging Assembly Loading Failures

Check your registry for that CLSID - sounds like it's not registered. I suspect that you may need to reinstall your v1.1 CLR.
Tuesday, December 30, 2003 6:39 PM by Suzanne

# re: Executing Code in Another AppDomain

Wednesday, January 28, 2004 9:29 PM by Suzanne Cook's .NET CLR Loader Notes

# Debugging a MissingMethodException

Friday, February 13, 2004 7:03 PM by Suzanne Cook's .NET CLR Loader Notes

# ReflectionTypeLoadException

Friday, February 13, 2004 7:45 PM by Suzanne Cook's .NET CLR Loader Notes

# Debugging a MissingMethodException

Friday, February 13, 2004 8:10 PM by Suzanne Cook's .NET CLR Loader Notes

# re: Interop Assembly Loading Failures

Suzanne, thank you for the very infromative blog.

Could you please explain how does the loader work in the following scenario:

- a .net assembly (COM/ActiveX dll, registered for interop) (component 1, located in Folder A on disk)
- is called via COM from an unmanaged COM component (component 2, located in the same folder A on disk)
- This COM component is invoked from an external Windows application (again unmanaged) (component 3, located in Folder B on disk)

Fusion cannot find the .net assembly. The fusion log shows that it is trying to load it from Folder B, the path of component 3, rather than from Folder A.

However, if we eliminate component 3 from the scenario and call the assembly directly from the user interface of component 2, it all works fine.

In COM there used to be the InProcServer32 key that gave the path to the executable, but there is no such equivalent in .net.

Is there a path variable or something that can be set to make the loader locate assemblies like this one?



Wednesday, February 25, 2004 6:04 PM by Soren

# re: Debugging Assembly Loading Failures

Yes, for the failing case, the ApplicationBase is the exe's dir, Folder B. So, it is by design that it is trying to load it from there when loading by display name.

In the success case, I imagine that either the ApplicationBase is Folder A, or the LoadFrom context is being used. (See http://blogs.msdn.com/suzcook/archive/2003/05/29/57143.aspx for info about the LoadFrom context.)

Actually, for .NET, the InProcServer32 key may contain both an Assembly and a CodeBase value. However, please see the link above before relying on the CodeBase - usually the Load context is more appropriate.
Tuesday, March 02, 2004 5:37 PM by Suzanne

# Determining the Referencing Assembly

Friday, April 23, 2004 12:54 AM by Suzanne Cook's .NET CLR Loader Notes

# Assemly Loading Failures using Reflection

Using a reflection based plugin app.

Project A, B, and C are all in the same solution.

Project A is a web app. The web app loads up the assemblies in the bin directory looking for certain types. Project B is a plugin that project A directly references. Project C is a plugin that references project B, but is not referenced by Project A. When the solution is rebuilt (all references are now happy), everything works fine when Project C's assembly is dropped into the bin of the webapp.

When Project A and B are rebuilt, but not project C, the Project C's assembly in the bin folder of the webapp now references assemblies which are no longer there when Project C is loaded up in the reflection phase. What is the proper way to do this if Project C is updated more frequently than Project A or B?

The error we are getting is saying that methods in Project C "does not have an implementation".

Tuesday, April 27, 2004 1:29 PM by Lyle Dodge

# re: Debugging Assembly Loading Failures

It sounds like the error comes from C having an outdated reference to B, because B is strongly-named, and has been rebuilt with a new version. Getting the Fusion log will verify it. See http://blogs.msdn.com/suzcook/archive/2003/05/29/57148.aspx for a discussion about avoiding that problem.
Wednesday, April 28, 2004 4:38 PM by Suzanne

# re: Debugging Assembly Loading Failures


When loading a managed control in IE, the fusion log shows FileNotFound errors for all the assemblies involved, although everything seems to work just fine. Is this normal?

The log errors indicate that the assemblies were searched in localhost and localhost/bin, even though the application is installed in localhost/xx. Perhaps I need to configure something to avoid these messages?

Thank you for your time.
Sunday, May 02, 2004 1:16 PM by Ols Moessian

# re: Debugging Assembly Loading Failures

Sunday, May 02, 2004 5:34 PM by Suzanne

# re: Assemly Loading Failures using Reflection

We kind-of found the problem. Project C's plugin class was abstract, and inheriting from an abstract class. the parent abstract class' method was abstract. when reflecting the abstract parent's abstract method it was erroring out. changing the abstract parent's method to virtual fixed this. basically:

assembly a - class a : abstract
assembly a - class a - method foo : abstract

assembly b - class b : abstract : a.a

assembly c - class c : concrete
assembly c - class c : method foo

reflecting foo in c was erroring out, saying the method a:foo was not implemented. changing a:foo to virtual fixed the problem.

Any thoughts?
Thursday, May 06, 2004 8:08 AM by Lyle Dodge

# re: The located assembly's manifest definition with name xxx.dll does not match the assembly reference

Sunday, May 09, 2004 3:40 AM by Junfeng Zhang's .Net Framework Notes

# re: Debugging Assembly Loading Failures

File or assembly name Microsoft.ApplicationBlocks.ExceptionManagement, or one of its dependencies, was not found.
Tuesday, May 11, 2004 7:25 AM by Vasasnth T T

# Wrong version in assembly manifest

A different sort of assembly reference problem...

My application's assembly manifest is referencing an old version of a dependent .NET DLL. I can't figure out why.

The runtime *finds* the correct version, but *thinks* it's the wrong one.

The application's Reference is to the correct version. No DLLs of the old version exist on the file system or in the GAC. I've rebuilt the app, rebooted, restarted IIS, yelled at my monitor, and pulled out most of my hair.

So when an app is built, where does it get the reference version info that goes in the assembly manifest?

Thanks.


Thursday, May 20, 2004 10:04 AM by Mark

# re: Debugging Assembly Loading Failures

Suzanne , Thanks I had a major problem,I googled and got many tips , Justw ante dto thank you
Tuesday, May 25, 2004 2:15 AM by Rajiv

# coming soon: wix tasks for msbuild

Friday, May 28, 2004 5:46 PM by jeffcal's blogland

# Debugging an InvalidCastException

Wednesday, June 02, 2004 10:05 PM by Suzanne Cook's .NET CLR Loader Notes

# re: Debugging Assembly Loading Failures

Something else that I found also helps, if you are using project references and you get an Assembly Load Failure exception along the lines of:

"The located assembly's manifest definition with name 'xxxx' does not match the assembly reference."

Then check that all projects are selected to be compiled in the active build configuration. So that you re-compile all projects in the solution on the next build.

This is achieved by opening the "Build Configuration" option dialogue on the Build menu and checking all checkbox items.

Hope this helps.

Regards

Simon Geering
Tuesday, June 08, 2004 6:49 AM by Simon Geering

# re: Debugging Assembly Loading Failures

Compiler Error Message: BC31019: Unable to write to output file 'C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files\root\708093bd\6afa7483\acb1iqp0.dll': System Error &H80070005&

please i am sick of this,help me out man.
Thursday, July 08, 2004 12:57 AM by Nedofeang

# re: Debugging Assembly Loading Failures

Close your browser,find your file(acb1iqp0.dll),delete it and
reopen browser.
It maybe because of
-different file version between browser cache and server file.
-setting .NET framework security configuration.

Hope this help.
Wednesday, August 04, 2004 5:28 AM by bardianto.Net-er

# GetAssembly can not find a loaded assembly

I ran into a strange problem. My web app requires certain assemblies and of course when it starts, these assemblies are loaded in the application domain. And I can access them using AppDomain.GetAssemblies but this works only the first time after application load. Next time when web app is reloaded - because project has recompiled the GetAssembly does not show my assembly on the list of loaded assemblies. What’s a strange - fusion log show that the assembly successfully loaded but GetAssembly does not show it on the list.
Friday, April 22, 2005 10:08 AM by Anton Sochenov

# re: Debugging Assembly Loading Failures

You may want to point out that a common cause of "Access is denied" issues when loading an assembly under ASP.NET is documented in http://support.microsoft.com/default.aspx?scid=kb;en-us;329065. The Windows Index service can lock the Temporary ASP.NET Files directory and the symptom is often an assembly load failure.
<BR>
See: PRB: Access Denied Error When You Make Code Modifications with Index Services Running
Article ID : 329065
Wednesday, May 18, 2005 12:54 PM by Michael

# re: Debugging Assembly Loading Failures

I am encountering the Bind result: hr = 0x80070005. Access is denied.
issue. But none of the solutions are working for me.

It works fine on 2000 and XP. But we are testing on 2003 and get the error.
We are Dynamically creating Assemblies and loading them in a seperate app space.

We are using LoadFrom to specify a directory outside the working directory of the current app.

Something intresting that I can't find any info on is this message we seen in the fusion logs on OS's where it works...

WRN: A duplicate assembly was found while copying the assembly item to the cache.

?
Thursday, May 19, 2005 10:27 PM by Adam

# re: Debugging Assembly Loading Failures

Turns out it's just permissions... if i run the Application Pool as an ADmin it goes away.
now to find where the permissions are wrong.

Still intrested in that WRN message?
Thursday, May 19, 2005 10:52 PM by Adam

# re: Debugging Assembly Loading Failures

I noticed the following behaviour of ASP.NET sites: when I start a Web side, Fusion reports bindings for assemblies in the BIN directory twice: first with partial name and then with full name. What happens then is that if later I try to load another assembly using LoadFrom, then if this assembly references those already loaded in ASP.NET cache, they fail to load if they have a different strong version. Basically this means that ASP.NET don't really treat private stong named assemblies as strong named: attempt to load extra plugins from other directories may fail if assembly with different version (but same) name is already in the cache.
Wednesday, May 25, 2005 6:10 AM by Vagif Abilov

# re: Debugging Assembly Loading Failures

Dude, thanks a ton, I was really in a bind. Thankfully all it took was depends.exe to expose the issue.
Sunday, June 05, 2005 7:42 PM by john

# re: Debugging Assembly Loading Failures

We are seeing this when using No Touch Deployment. Our windows .net clients gets dlls from our web server as needed.

Some of the dlls are loaded ok, some of the loads generate a FileNotFoundException. If I look in the IIS Log file, I see a 200 Return code for the dll\file in question so the web server returned the dll. Something on the client side is not 'finding' it or is blocking the return.

We log the details of the exception and I can see what the loader is trying to do:


LOG: Publisher policy file is not found.

LOG: Host configuration file not found.

LOG: Using machine configuration file from
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\config\machine.config.

LOG: Post-policy reference: Janus.Windows.ButtonBar.v2,
Version=2.0.1163.0, Culture=neutral, PublicKeyToken=21d5517571b185bf

LOG: Attempting download of new URL file:///C:/Program Files/Custom
Data Systems/AM.NET/Janus.Windows.ButtonBar.v2.DLL.

LOG: Attempting download of new URL file:///C:/Program Files/Custom
Data Systems/AM.NET/Janus.Windows.ButtonBar.v2/Janus.Windows.ButtonBar.v2.DLL.

LOG: Attempting download of new URL file:///C:/Program Files/Custom
Data Systems/AM.NET/Janus.Windows.ButtonBar.v2.EXE.

LOG: Attempting download of new URL file:///C:/Program Files/Custom
Data Systems/AM.NET/Janus.Windows.ButtonBar.v2/Janus.Windows.ButtonBar.v2.EXE.

LOG: Attempting download of new URL
http://172.16.5.1/AMNETAssemblies/Janus.Windows.ButtonBar.v2.DLL.

LOG: Attempting download of new URL
http://172.16.5.1/AMNETAssemblies/Janus.Windows.ButtonBar.v2/Janus.Windows.ButtonBar.v2.DLL.

LOG: Attempting download of new URL
http://172.16.5.1/AMNETAssemblies/Janus.Windows.ButtonBar.v2.EXE.

LOG: Attempting download of new URL
http://172.16.5.1/AMNETAssemblies/Janus.Windows.ButtonBar.v2/Janus.Windows.ButtonBar.v2.EXE.
Tuesday, July 19, 2005 4:23 PM by Greg Robinson

# Fail To Load Resources From Resource File. Please Check Your Setup

Hi,
I have a windows application using Interop and reflection installed on Win XP & Win2K machine(s). On some machine I get the above message which sometime allows my application to work after the display and sometime it crashes my application. It comes in different contexts and in different scenarios but not reproducable.

Can you help me? What I am doing worng n where?
Friday, September 16, 2005 7:20 AM by Puneet Gupta

# re: Debugging Assembly Loading Failures

Hi. Maybe I'm trying to do the impossible or maybe this is just a BETA issue but I just want an answer either way.

I've got a dll full of horrible, horrible (!) assembly routines. Most of it is SSE stuff and all of it is really useful. I'm trying to add a binding to .NET to my dll and here's what I've done so far.

1. Moved my project to VS.NET 2005 (BETA 2).
2. Added a managed.cpp file to the project which is supposed to serve as the bridge between the managed world and a pile of __asm blocks.
3. On the managed.cpp file ONLY, I have added /clr.
4. Set the linker to FORCE IJW.
5. Added the dll as a reference to a test app written in C#.
6. Hit compile. No errors. No warnings. No trouble with the linker.
7. Called some functions in managed.cpp from my C# app's Main. Note: intellisense had picked up the functions in managed.cpp.
8. Tried to run the program.

I get this every time:

System.IO.FileLoadException was unhandled
Message="Could not load file or assembly 'tnCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. One or more arguments are invalid (Exception from HRESULT: 0x80000003)"
Source="Stormfall"
FileName="tnCore, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"
FusionLog=""
StackTrace:
at Stormfall.Program.Main()

at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)

at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

at System.Threading.ThreadHelper.ThreadStart()

It's the same outside of the debugger, only without the Microsoft.VisualStudio.HostingProcess bits.

The semi-managed dll loads into ILDASM or Reflector (latest version) without any errors. I can browse around its functions and look at their IL without any errors from either program.

The fusion log doesn't even mention my dll. It stops logging after the exe loads.

What gives? How is it that VS.NET (references window, intellisence), ILDASM, and Reflector, all recognize the dll as a valid CLR image while it keeps failing to load?

Is the loader detecting SSE instructions and killing the whole thing (because that just makes no sense at all)? Is this a BETA thing? Am I just doing something that's impossible by design (i.e. give up now and write a seperate wrapper dll or lots of little P/Invoke stubs)?

Any help would be more than appreciated.
Wednesday, September 21, 2005 2:50 AM by Phill Djonov

# re: Debugging Assembly Loading Failures

Sorry for posting here. Thought this was a loader bug/limitation. It isn't. The bug belongs to the VC++ compiler team.

For anyone that googled their way onto this or are interested, the VC++ (BETA 2, anyway) compiler/linker will generate a bad image if any file in the project is not compiled with /clr (much help that is with asm routines). #pragma unmanaged can then be used to, etc, etc, etc...

Sorry again.
Wednesday, September 21, 2005 3:46 AM by Phill Djonov

# re: Debugging Assembly Loading Failures

In my case Fusion is not showing any log.In registry I created a new key LogPath in HKLM/Softwarre/Microsoft/Fusion and set its default value to H:\temp\fusion

but when I press refresh nothing happens and when i press View Log it says Error: Unable to open cache file!
Wednesday, October 19, 2005 1:47 AM by Haris

# re: Debugging Assembly Loading Failures

Thanks for the info! Not sure if in my case I have a special issue or if I'm just not fully understanding troubleshooting assemblies. I created a WinForm app simply named, compiled, installed, running in production. Recently decided to strong-name the entire VS solution, compiles fine, but does run due to "The located assembly's manifest definition...does not match the assembly reference." When I check the Fusion log it's indicating that a prior version of the .exe is being executed. All updated dependent assemblies show correctly - new ver., pub key, paths, names, etc. It seems something somewhere is trying to run the old .exe (in the new .exe path no less) despite the new application manifest being seemingly correct. What implications are there from going from a simply named to strong named code base?
Tuesday, January 10, 2006 12:26 AM by Robert S.

# re: Debugging Assembly Loading Failures

Hi Suzanne

Thanks for your informative blog.

I am trying to write a windows service that copies assemblies from a central server and executes them dynamically. It seems to work fine using a separate app domain to load the assembly to be executed. I then reload the domain when I have a new version or whatever.

My problem is that when I try and add a new assembly (for copying locally) that is referenced by the assembly (again that is copied locally) I am executing, I get the following fusion error:

LOG: Entering run-from-source setup phase.
WRN: Comparing the assembly name resulted in the mismatch: NAME
ERR: The assembly reference did not match the assembly definition found.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

The referenced assembly I am using is one created by adding a reference to a com object that I know exists on all machines involved.

Prior to dynamic execution the referenced assembly should not exist on any of the client machines hence I don't know what the "assembly definition" that is not matching refers to.

Any ideas?

Many Thanks

Sacha
Tuesday, January 31, 2006 9:08 AM by Sacha

# executable with fixups (IAT with more than 2 sections or a TLS section.)

Dear Madam,
thanks for the only explantion of this error, which I found in internet.
#his is because MC++ has made optimizations
Do you know is it possible to switch this optimizations off? Which compiler setting is it?
Thanks,
Boni
Friday, February 10, 2006 11:57 AM by Boni

# re: Debugging Assembly Loading Failures

Suzanne, Thanks a lot for the post; it solved a problem that I've been having for hours on end.

But in my case, it turned out there was a missing assembly, but the exception message said a type could not be loaded from an assembly that existed. Maybe loading this assembly triggered an attempted load of the non-existent one, but in that case, why doesn't the exception message say so? Why should I have to run fuslogvw?
Sunday, February 19, 2006 1:08 PM by Kartik Vaddadi

# re: Debugging Assembly Loading Failures

Great blog entry.
Using the log solved a problem I was stuck on
since yesterday.
Saturday, March 04, 2006 6:11 PM by cool

# re: Debugging Assembly Loading Failures

Hello Maam,
I have this strange problem while re-running any of C# assemlies more than once.
mid-way while running my application which references a assembly, i get this error :
Access is denied
After around 5 mins when i refresh the page it gets loaded.
i doubt some problem of history or garbage collection.
Can u please help me on this?
Thursday, March 23, 2006 12:22 AM by daisy

# re: Debugging Assembly Loading Failures

Thanks for your blog. It helped me fix my managed file load problem.
Tuesday, March 28, 2006 4:22 PM by Les

# re: Debugging Assembly Loading Failures

I am having a problem loading the following MS Enterprise Library assembly.  I have tried many of the fixes on this blog (I think) below is the information from the fusion log:

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
Running under executable  C:\Documents and Settings\kwenyon\My Documents\Visual Studio 2005\Projects\RetailBeerSystems\RetailBeerSystems\bin\Debug\RetailBeerSystems.vshost.exe
--- A detailed error log follows.

=== Pre-bind state information ===
LOG: User = STRATISINC\kwenyon
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Data, Version=1.1.0.0, Culture=neutral, PublicKeyToken=db1db703afa726aa
(Fully-specified)
LOG: Appbase = file:///C:/Documents and Settings/kwenyon/My Documents/Visual Studio 2005/Projects/RetailBeerSystems/RetailBeerSystems/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.Practices.EnterpriseLibrary.Configuration, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Documents and Settings\kwenyon\My Documents\Visual Studio 2005\Projects\RetailBeerSystems\RetailBeerSystems\bin\Debug\RetailBeerSystems.vshost.exe.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.Practices.EnterpriseLibrary.Data, Version=1.1.0.0, Culture=neutral, PublicKeyToken=db1db703afa726aa
LOG: Attempting download of new URL file:///C:/Documents and Settings/kwenyon/My Documents/Visual Studio 2005/Projects/RetailBeerSystems/RetailBeerSystems/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Data.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Can you please help me with this??
Thursday, March 30, 2006 9:12 PM by Ken

# re: Debugging Assembly Loading Failures

I found the problem, it was a namespace or scope issue in my config file.
Wednesday, April 05, 2006 1:19 PM by Ken

# re: Debugging Assembly Loading Failures

Hello Suzanne - I have a factory that will get all files in the bin folder, load the assembly using Assembly.LoadFrom method and check if it supports a particular interface before creating an instance of the same. My problem is everything works fine when the ASPNET user is a member of the Administrators. Once i remove it from administrators then it fails with Access denied message. Any pointers, ideas is appreciated. Thanks
Thursday, April 06, 2006 4:55 PM by Balaji

# re: Debugging Assembly Loading Failures

Hi Suzane,

I am trying to Xcopy the ASP.NET application from my local machine (Windows XP) to a development server (Win 2003). I am using the Enterprise library for dalaBase access, Logging, Exception handling etc. The application runs fine in my local machine (I have complete suite of .Net and other tool in my local machine)

But When I Xcopy the files and set up the IIs WebServer, my enterrprise library would not load. We have Integrated Windows authentication for our application. Could you please help me solve this problem??

Thanks :)

I am getting the following error:

Server Error in '/ConferenceRoomScheduler' Application.
--------------------------------------------------------------------------------

Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common' or one of its dependencies. Access is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common' or one of its dependencies. Access is denied.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.Practices.EnterpriseLibrary.Common' could not be loaded.


=== Pre-bind state information ===
LOG: User = Unknown
LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Common
(Partial)
LOG: Appbase = file:///C:/SourceCenter/ITSApplications/DotNETApplications/CodeCenter/UserExperience/Applications/ConferenceRoomScheduler/WebApplication/
LOG: Initial PrivatePath = C:\SourceCenter\ITSApplications\DotNETApplications\CodeCenter\UserExperience\Applications\ConferenceRoomScheduler\WebApplication\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\SourceCenter\ITSApplications\DotNETApplications\CodeCenter\UserExperience\Applications\ConferenceRoomScheduler\WebApplication\web.config
LOG: Using host configuration file: \\?\c:\windows\microsoft.net\framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/conferenceroomscheduler/acb5f87b/720897aa/Microsoft.Practices.EnterpriseLibrary.Common.DLL.
LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/conferenceroomscheduler/acb5f87b/720897aa/Microsoft.Practices.EnterpriseLibrary.Common/Microsoft.Practices.EnterpriseLibrary.Common.DLL.
LOG: Attempting download of new URL file:///C:/SourceCenter/ITSApplications/DotNETApplications/CodeCenter/UserExperience/Applications/ConferenceRoomScheduler/WebApplication/bin/Microsoft.Practices.EnterpriseLibrary.Common.DLL.
LOG: Using application configuration file: C:\SourceCenter\ITSApplications\DotNETApplications\CodeCenter\UserExperience\Applications\ConferenceRoomScheduler\WebApplication\web.config
LOG: Using host configuration file: \\?\c:\windows\microsoft.net\framework\v2.0.50727\aspnet.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
ERR: Failed to complete setup of assembly (hr = 0x80070005). Probing terminated.



Stack Trace:


[FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common' or one of its dependencies. Access is denied.]

[FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.]
  System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
  System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211
  System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141
  System.Reflection.Assembly.Load(String assemblyString) +25
  System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +32

[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.]
  System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +596
  System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +3479049
  System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +46
  System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +177
  System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +180
  System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +347
  System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +125
  System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +378

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.]
  System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +57
  System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +612
  System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +456

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied.]
  System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +3426855
  System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88
  System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +149


Tuesday, April 18, 2006 6:17 PM by Valar Manickam

# re: Debugging Assembly Loading Failures

Hi Suzanne,

I am trying to do setup and deployment using Visual Studio 2005. I have the plug-in
Add Web Deployment Project...
that generates a .dll file for
my web application and puts it
in a bin subdirectory. Next, I
build the setup and deployment project and try to install the
app on my machine as test case.
My web app gets installed at
c:/Inetpub/wwwroot/[name of app]
and the .dll file for my web app
is installed at
c:/Inetpub/wwwroot/[name of app]/bin
However when I try to browse my web
app I get the following error:
"Could not load the assembly...
Make sure that it is compiled before
accessing the page."
and it shows the first line of the
.aspx file I am browsing:
inherits="Login, Membership"
Login being the class name of the code-behind file associated with the .aspx file. Membership being the name of the .dll file.
What am I doing wrong?
Friday, May 05, 2006 3:59 PM by Eddie Chin

# .NET Resources

The following links to .NET resources have been collated over time with the assistance of colleagues.&amp;nbsp;...
Saturday, May 06, 2006 4:30 AM by mattonsoftware.com

# Good reference document for debugging assembly loading errors

I ran across a blog post from Suzanne Cook this past&amp;nbsp;weekend that has been around for a while, but...
Monday, May 08, 2006 8:44 PM by Aaron Stebner's WebLog

# re: Debugging Assembly Loading Failures

We have an issue using the hosting APIs from unmanaged C++ app.  When calling pAppDomain->ExecuteAssembly_3 (...) the application runs if it is a C# application.  If it is created with MC++, we get the COR_E_FIXUPSINEXE, which you cited above.  So far so good.

Our problem now is we are hosting C# app which references a MC++ assembly.  When the type from the MC++ assembly is used, we see COR_E_BADIMAGEFORMAT thrown.  Is there any workaround for this problem?

We are using ICorRuntimeHost interface on the CLR v2.0.  
Thursday, May 11, 2006 10:30 PM by Stefan Larimore

# re: Debugging Assembly Loading Failures

I am running into one of those Bind erros:  result: hr = 0x80070002. The system cannot find the file specified.

I cannot figure it out... grrr...

It works when deployed on one server, but fails on another.

It is a windows forms dll being downloaded from a windows client app using Assembly.Load with a version number and a strong name.  Prior to using the strong name I was using LoadFrom and got the same error.

The dll references a web service and some standard .net things like system...
Tuesday, May 23, 2006 3:47 PM by Brad

# re: Debugging Assembly Loading Failures


I am facing the same problem but I didn't find any useful help to resolve this problem. Could you please send me the pointers to resolve this issue.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=81140&SiteID=1

Thanks,
Kanna
Friday, June 02, 2006 4:15 PM by Kanna

# I can&#8217;t remember where I read it&#8230;. &raquo; Fusion Log Viewer

# re: Debugging Assembly Loading Failures

I'm trying to create my own Interop.Scripting Dll. I tlpimp no problem, runs locally fine
if I move the dll to the server and regasm I get this error

Any help would be appreciated

Type library exporter warning: Referenced type is defined in managed component,
which is imported from a type library that could not be loaded because it was no
t registered (type: 'ADODB.Recordset'; component: 'C:\WINNT\assembly\GAC\ADODB\7
.0.3300.0__b03f5f7f11d50a3a\ADODB.dll').
RegAsm : error RA0000 : Type library exporter encountered an error while process
ing 'rsEventLog.clsEventLog+_clsEventLog.getRSEventsEx(#0), rsEventLog'. Error:
Type library exporter cannot load type 'Scripting.Dictionary' (error: System.IO.
FileLoadException: Could not load file or assembly 'Interop.Scripting, Version=1
.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The lo
cated assembly's manifest definition does not match the assembly reference. (Exc
eption from HRESULT: 0x80131040)
File name: 'Interop.Scripting, Version=1.0.0.0, Culture=neutral, PublicKeyToken=
null'
Thursday, June 22, 2006 11:46 AM by Rpaul

# re: Debugging Assembly Loading Failures

Hi Suzanne,

Great info, but not quite what I need after reading everything. I am trying to install .NET 2.0 and I keep getting these messages in the windows installer logs for a number of assembly files.

07/07/06 00:16:50 DDSet_Status: LANGID: 1033
07/07/06 00:16:50 DDSet_Entry: ConfigureNativeImage started
07/07/06 00:16:50 DDSet_Status: Deferred or Commit action for NGEN
07/07/06 00:16:50 DDSet_Status: CustomActionData: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ngen.exe install "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /NoDependencies /nologo;4308992
07/07/06 00:16:50 DDSet_Status: Running Command Line: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ngen.exe install "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /NoDependencies /nologo
07/07/06 00:16:50 DDSet_Status: LANGID: 1033
Installing assembly mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
You must have administrative credentials to perform this task. Contact your system administrator for assistance.
07/07/06 00:16:50 DDSet_Status: Process returned -1
07/07/06 00:16:50 DDSet_Status: Incrementing progress bar based on filesize of: 4308992
07/07/06 00:16:50 DDSet_CARetVal: 0
07/07/06 00:16:50 DDSet_Entry: ConfigureNativeImage ended successfully

However, I can run gpresult /z and it clearly shows I am a member of the Domain Admins group.

Looking in the windows\assembly folder, mscorlib is there and it is the 2.0 version.

This is not the only assembly that gets the access denied message, there are others and they are interspersed with successful ones.

I have tried with domain admin accounts as well as local admin accounts. Any ideas would be gratefully appreciated.

Thanks,

Mike Finney
Friday, July 07, 2006 1:50 PM by MikeFinney

# Why the "Partial" bind in asp.net

When I look at the fuslogvw window I see there are two entries for each assembly.  From what I can tell the first entry is the result of a "partial bind" and all of the useful information is in there.  The second entry shows the result of the subsequent "full bind" request and is useful for showing which assembly is requesting the bind.

My question is why is it loading on partial and then loading on fully-specified right afterwards?  Should it matter to us in our asp.net application?  Would we be better off changing to force the fully-specified be used only (i.e., through a vs reference rather than LoadFrom(..) )?

Jeff
Thursday, July 13, 2006 3:02 PM by kendo_dragon

# Assembly loading failure logging

This is basically a reminder post, but you might find it useful.
In the development I have been doing...
Thursday, July 13, 2006 7:36 PM by Rory Primrose

# Debugging a .NET InvalidCastException

Thanks to Suzanne Cook for this one. &amp;quot;First, obviously, find the two types for which the cast failed,
Tuesday, August 15, 2006 10:07 PM by Stale DNA - all things Cappy Popp

# re: Debugging Assembly Loading Failures

Dear Suzanne, I am with .NET C# 2003. I have Web app and 2 Class Library compiled as dll in one solution(datalayer and business layer) . It was all OK, maybe I rebuild my DLLs and something was done wrong.

I created [HKLM\Software\Microsoft\Fusion\LogPath] pointed to C\mylogs.txt and I have
[HKLM\Software\Microsoft\Fusion\LogFailures] set to 1 as you recommended

Assembly binding log give me an error when I clickc "View Log" button "Error:Unable to open cache file!" So I failed to see the log and I am having hard time to fix the problem:


Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Access is denied: 'PCTracker.DataObjects'.

Source Error:


Line 196: <add assembly="System.EnterpriseServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 197: <add assembly="System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
Line 198: <add assembly="*"/>
Line 199: </assemblies>
Line 200: </compilation>


Source File: c:\winnt\microsoft.net\framework\v1.1.4322\Config\machine.config    Line: 198

Assembly Load Trace: The following information can be helpful to determine why the assembly 'PCTracker.DataObjects' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = PCTracker.DataObjects
(Partial)
LOG: Appbase = file:///c:/inetpub/wwwroot/PCTracker
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: PCTracker.DataObjects
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/pctracker/ae1e1489/30fd1387/PCTracker.DataObjects.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/pctracker/ae1e1489/30fd1387/PCTracker.DataObjects/PCTracker.DataObjects.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/PCTracker/bin/PCTracker.DataObjects.DLL.



Saturday, September 16, 2006 3:02 PM by Natasha

# re: Debugging Assembly Loading Failures

I am getting this error in the event view when i run my application. could you please help me see figure this out.

Event Type: Warning

Event Source: AdBankError

Event Category: None

Event ID: 0

Date: 11/8/2006

Time: 4:40:30 PM

User: N/A

Computer: TPTTDLAP015598

Description:

System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

File name: 'Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'

  at Trader.AdBank.Data.SqlClient.SqlMessageQueueProviderBase.GetByBrokerName(TransactionManager transactionManager, String broker, String name, Int32 start, Int32 pageLength, Int32& count)

  at Trader.AdBank.Data.Bases.MessageQueueProviderBaseCore.GetByBrokerName(String broker, String name) in C:\Trader\AdBank\Version\3.0\Trader.AdBank.Data\Bases\MessageQueueProviderBaseCore.generated.cs:line 858

  at Trader.AdBank.Messaging.MsmqClient.get_Entity() in C:\Trader\AdBank\Version\3.0\Trader.AdBank.Messaging\MsmqClient.cs:line 608

  at Trader.AdBank.Messaging.MsmqClient.Recieve() in C:\Trader\AdBank\Version\3.0\Trader.AdBank.Messaging\MsmqClient.cs:line 347

=== Pre-bind state information ===

LOG: User = NT AUTHORITY\SYSTEM

LOG: DisplayName = Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null

(Fully-specified)

LOG: Appbase = file:///C:/Trader/AdBank/Version/3.0/Trader.AdBank.Services.MessageImporter/bin/Debug/

LOG: Initial PrivatePath = NULL

Calling assembly : Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null.

===

LOG: This bind starts in default load context.

LOG: Using application configuration file: C:\Trader\AdBank\Version\3.0\Trader.AdBank.Services.MessageImporter\bin\Debug\Trader.AdBank.Services.MessageImporter.exe.config

LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Attempting download of new URL file:///C:/Trader/AdBank/Version/3.0/Trader.AdBank.Services.MessageImporter/bin/Debug/Microsoft.Practices.EnterpriseLibrary.Common.DLL.

WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN

ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

thanks

Wednesday, November 08, 2006 5:20 PM by TraderPub

# re: Debugging Assembly Loading Failures

Hi,

Could you help me on something a bit different?

I have an unmanaged control (MFC) I want to use in IE. This is using several Dlls managed and unmanaged.

The only way I set it to work is when I copied the managed assemblies to the IE dir. But they still need to be at the OCX dir for registration to work. Why?

I also tried to load the managed assembly with LoadFrom, but it doesn't seam to change the IE context.

I tried to sign the assemblies but now the ocx is not registering, when I specify the publicKey in the dependency.

Thanks a lot...

Sandra

Monday, November 13, 2006 4:26 PM by Sandra

# re: Debugging Assembly Loading Failures

Could this same information be included in exception messages when loads fail? It is rare for a fusion log to be enabled on a machine, and having to enable it and then try to recreate an error is 1) tedious internally, 2) untenable externally (ever try to get an end-user to enable a fusion log). This information is exactly what a developer expects to see in an exception message.

Saturday, December 23, 2006 2:40 PM by Jim

# re: Debugging Assembly Loading Failures

We spent two days tracking down the cause of HRESULT: 0x8013141A. The fusion log didn't help. The problem was ultimately tracked to calling LoadFrom with an assembly's full pathname that was not in the build path or GAC, where the assembly being loaded and the assembly doing the loading were both delay signed, and skip verification had not been run. Googling for the answer to the problem was futile, because there were too many false positives. It would be very helpful to have a table available online that lists each of the loader error codes, and every known possible cause of each error. This blog might be a good place to start such a table.

Saturday, December 23, 2006 3:07 PM by jshowalter

# re: Debugging Assembly Loading Failures

We have delay-signed assemblies on a test machine. Skip verification has been run. We can load an assembly from the build output directory using Assembly.LoadFrom, but the fusion log consistently displays a load failure for XmlSerializers, an assembly that exists nowhere on our machine. We think it is something that .NET generates. We have disabled all "Generate serialization assembly" dropdowns in all of our projects, and that seems to have no effect. There are numerous posts online about this bind failure and XmlSerializers, but no answers to the problem. Can you explain what is happening, whether that can cause loads to fail (it does in our case if we disable skip verification), and how to make it stop? Here is the fusion log:

*** Assembly Binder Log Entry  (12/26/2006 @ 8:57:50 AM) ***

The operation failed.

Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll

Running under executable  C:\Program Files\TestDriven.NET 2.0\ProcessInvocation.exe

--- A detailed error log follows.

=== Pre-bind state information ===

LOG: User = XYZ\testuser

LOG: DisplayName = TestProject.XmlSerializers, Version=2.1.3.0, Culture=neutral, PublicKeyToken=7ce6deabcb36a8ea, processorArchitecture=MSIL

(Fully-specified)

LOG: Appbase = file:///C:/BuildOutput/assemblies/Debug

LOG: Initial PrivatePath = NULL

LOG: Dynamic Base = NULL

LOG: Cache Base = C:\Documents and Settings\testuser\Local Settings\Temp\TestDrivenShadowCopy\633027202692884393

LOG: AppName = domain-nunit.addin.dll

Calling assembly : System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.

===

LOG: This bind starts in default load context.

LOG: Using application configuration file: BuildOutput\assemblies\Debug\TestProject.dll.config.temp

LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.

LOG: Post-policy reference: TestProject.XmlSerializers, Version=2.1.3.0, Culture=neutral, PublicKeyToken=7ce6deabcb36a8ea, processorArchitecture=MSIL

LOG: GAC Lookup was unsuccessful.

LOG: Attempting download of new URL file:///C:/BuildOutput/assemblies/Debug/TestProject.XmlSerializers.DLL.

LOG: Attempting download of new URL file:///C:/BuildOutput/assemblies/Debug/TestProject.XmlSerializers/TestProject.XmlSerializers.DLL.

LOG: Attempting download of new URL file:///C:/BuildOutput/assemblies/Debug/TestProject.XmlSerializers.EXE.

LOG: Attempting download of new URL file:///C:/BuildOutput/assemblies/Debug/TestProject.XmlSerializers/TestProject.XmlSerializers.EXE.

LOG: All probing URLs attempted and failed.

Tuesday, December 26, 2006 12:07 PM by jshowalter

# re: Debugging Assembly Loading Failures

I have an issue that is related to the IE7 installation on XP. The system MPR and SHLWAPI DLLs have been updated during IE7 install and now attempt to load DWMAPI.DLL (a Vista only DLL).

My problem is when I create an application that runs as a Windows Service using .NET and VS2005 C#.

I have a utility .NET Class project (DLL) that specifically uses the System.Net assemblies and is called by my Windows Service assembly. I also have another non-Windows Service application that also uses the utility class.

The non-service application uses the same code in the Window Service version and it runs fine. It loads the utility class DLL without crashing even though I've used the Depends tool to verify that there is a problem finding the missing DWMAPI.DLL.

The Windows service version of my application however crashes with a "Could not load file or assembly" error when accessing my utility DLL.

Apparently whatever missing code is in DWMAPI.DLL is not really accessed by my utility DLL since all functionality is there in my non-service application. It is just the Service application that bails out on the loading of the DLL.

What is the difference between dynamic assembly loading for a .NET Windows Service application and a standard .NET Windows Application?

Is there a way for me to set a config switch or add some code to my utility DLL so that dynamic assembly loading doesn't crash the service app during load time?

My other only recourse is to move the code from my utility DLL and place it directly into each of the applications.

Thanks,

GQ

Wednesday, January 17, 2007 1:58 PM by GQ

# Assembly loading failure logging

This is basically a reminder post, but you might find it useful. In the development I have been doing

Tuesday, January 30, 2007 12:24 AM by Rory Primrose

# re: Debugging Assembly Loading Failures

   hi i am running my asp.net ajax application in windows 2003 server with iis6 but everything is working fine in all the browsers but i am getting following error in Internet Explorer 7….

   MissingMethodException: Method not found

   any help?.

   thanks in advance.

   Yoganand

Wednesday, February 14, 2007 12:54 AM by Yoganand

# re: Debugging Assembly Loading Failures

Hi Suzanne,

Again and again and again I've been plagued by assembly binding failures "The located assembly's manifest definition with name [yourAssembly] does not match the assembly reference" or MissingMethodExceptions. After using fuslogvw and whatever, I still could not find any error on my side. I am having strongly-named assemblies and I am exclusively using project references in my solution; and there is no reason why references should break from time to time. (VS 2005 SP1 was no remedy, by the way.)

--> There is something very intersting I found out today, which I haven't found in any blog so far, and which I wanted to share with you and all others who are facing the same problem. I found that the defective solution without any modifications would compile and run perfectly, when I rename the base folder which contains it, or when I copy it into another folder, or when I run it on a different machine. The funny thing is, when I rename the folder back to the old names, the reference breaks again.

Even though fuslogvw states to have loaded all current assembly versions, and even though all assembly versions in my bin folder are up-to-date, an older copy is loaded from somewhere, and I assume this happens after a file had been locked (an assumption based on when it happens).

--> If anybody has an idea, especially if there might be another way like clearing a cache or whatever instead of renaming the solution folder (which isn't best practice of solving this issue I believe), please let me know.

oliver.hausler AT hausler.info

Saturday, February 24, 2007 4:29 PM by Oliver Hausler

# re: Debugging Assembly Loading Failures

Suzanne stated in another thread, that strongly-named assemblies aren't upda