Jul 25, 2011

Dependency Walker

Conjures up images of ice planet Hoth doesn't it. While it may not be as fearsome as an Imperial Walker the you'll find Dependency Walker to be much more deadly in killing off .DLL problems. If you've ever built an application on your development imagemachine and then had it not run on a target machine, this app needs to be in your arsenal. It's also indispensable for troubleshooting remote debugging and 64/32 bit BadImageFormatExceptions.   There are 32 and 64 bit versions of Dependency Walker available. If you develop on a 64 bit machine download both. If you target anything to a 32 bit machine you'll want to run the 32 bit version against the .exe or .dlls you deploy on the 32 bit machine.

The image shows a few key features. When you load an .exe use the Profile menu and run Start Profiling to check out your delay loaded .DLLs.

Also you'll probably want to run it directly on any .DLLs that are giving you problems. When a .dll not found exception occurs you'll notice the message says either the .DLL or one of its dependencies can't be found. In my experience it's those dependencies that cause all the problems.  You can see from the blue arrow in the image that two .DLLs have yellow icons. In this particular case those two .DLLs aren't a problem, but usually others that show up in yellow very may well be.

Finding 32/64 bit problems is even easier, you can click on the CPU column (shown by the lower green arrow) and then scroll down and if you are trying to deploy on a 32 bit machine and the column has x64 instead of x32 you've found the problem causing .DLL.

You'll probably get some false positives from DW but a few quick web searches will usually let you identify those and focus in quickly on the .DLLs that are causing you grief.

About Me

My photo
Tod Gentille (@todgentille) is now a Curriculum Director for Pluralsight. He's been programming professionally since well before you were born and was a software consultant for most of his career. He's also a father, husband, drummer, and windsurfer. He wants to be a guitar player but he just hasn't got the chops for it.