views:

788

answers:

2

Hello, when running a prorgam, it seems that I am missing a library, when I launch the output of my project I get an exception at startup.

A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll
An unhandled exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll

Additional information: A procedure imported by 'my assembly, Version=xx.1.1.0, Culture=neutral, PublicKeyToken=7292581204d9e04a' could not be loaded.

'ScriptX.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', No symbols loaded.

My question is: how can I determine which library is missing because, at this point, I cannot see the values passed to:

mscorlib.dll!System.AppDomain.ExecuteAssembly(string assemblyFile, System.Security.Policy.Evidence assemblySecurity, string[] args) + 0x3a bytes
+1  A: 

Are you doing any dllimport? - this looks like an issue with an unmanaged dll not being found?

First thing is to ensure that any unmanaged dll's or exe's that you are calling into (via dllimport) are deployed into the same folder as the .Net exe that you are building

If the source of the calling assembly is not available you could try using reflector on that assembly to search for dllimport statements

Other than that you might want to enable the fustion log viewer to trace assembly load issues - see this blog post and msdn page for more details

Richard
Unfortunately I have no access to the source of this DLL. If there is any way to determine what assembly failed to be loaded it would be of a great help.
BlueTrin
Thank you Richard, the two links were very helpful.
BlueTrin
+1  A: 

Implement a handler for the AppDomain.AssemblyResolve event. It tells you which assembly it is looking for with ResolveEventArgs.Name. If this is just an effort to troubleshoot this particular assembly then use Fuslogvw.exe. If the hangup is an unmanaged assembly then DependencyWalker's Profile option can show you what LoadLibrary() call is failing. SysInternals' ProcMon will work too but is a lot noisier.

Hans Passant
Thank you for yoru reply, I chose Richard's reply because I just looked at his posts and managed to use fusiion logs.
BlueTrin