3

I'm trying to debug the following exception:-

System.IO.FileLoadException: Could not load file or assembly 'My.Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=........' or one of its dependencies. Access is denied.

The code is impersonated in a COM service, but the assembly is present in the application directory and the impersonated user has read permissions to it. Fusion isn't logging anything for the assembly, and procmon doesn't mention the file or any ACCESS DENIED events at all. Is there any reason other than permissions on the DLL itself that an assembly load might fail as above?

(This isn't a web application, by the way.)

3
  • Is this a "click once" application?
    – dance2die
    Jun 4, 2009 at 15:32
  • 3
    Does somebody have a write-lock on the file? Jun 4, 2009 at 15:32
  • It's not click once. One other application has a handle on it as a loaded assembly, so I guess that is read-only.
    – marijne
    Jun 4, 2009 at 15:40

2 Answers 2

2

Make sure you have access to the assembly and all its assemblies you need.

The other issue is if the assembly it is looking for assumes it is in the GAC then it might not be able to find it. If that is the case you can usually get around it by copying the assembly out to where ever the process needing it is located.

2

If you are using Visual Studio 2012, close the VisualStudio and reopen it . May be this is a bad solution,but it worked for me .

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.