[ACCEPTED]-A procedure imported by {myassembly} could not be loaded-assemblies

Accepted answer
Score: 30

There is in fact a built in mechanism for 9 just these diagnostics.

(1) In your project 8 properties/Debug, make sure 'Enable native 7 code debugging' is checked:

enter image description here

(2) Raise the 6 show-loader-snaps flag - it is a registry key in the IFEO, and 5 is accessible via the 'GlobalFlags' GUI:

enter image description here

(3) Run 4 the app from a debugger - or attach before 3 the load error. Inspect the (very) verbose output 2 pane. You can mostly skip to the end or 1 look for 'ERROR'.

More details here.

Score: 8

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

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

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

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

Score: 6

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

Score: 0

In some cases when using COM, you might 4 just need to unregister and reregister the 3 dll with RegAsm.exe. That is what fixed 2 this issue for me last week, things had 1 gotten out of sync.

More Related questions