Does Dependency Walker work with managed apps? I've downloaded the latest and tried profiling the app, but it just exits without much of an explanation. If it doesn't work with .NET, then is there some other tool that would help me debug a run-time DLL loading issue?
Dependency walker works on normal win32 binaries. All .NET dll's and exe's have a small stub header part which makes them look like normal binaries, but all it basically says is "load the CLR" - so that's all that dependency walker will tell you.
To see which things your .NET app actually relies on, you can use the tremendously excellent .NET reflector from red gate.
Load your DLL into it, right click, and chose 'Analyze' - you'll then see a "Depends On" item which will show you all the other dll's (and methods inside those dll's) that it needs.
It can sometimes get trickier though, in that your app depends on X dll, and X dll is present, but for whatever reason can't be loaded or located at runtime.
To troubleshoot those kinds of issues, Microsoft have an Assembly Binding Log Viewer which can show you what's going on at runtime
Thanks Orion, I managed to find the Assembly Binding Log Viewer, but nothing shows up in the viewer, even when I set it to "Log all binds to disk", even after re-running my app. Is there something else I need to do to get binding information to show up in the log? I should add that the View Log button is disabled for some reason.
Enable assembly binding logging set the registry value EnableLog in HKLM\Software\Microsoft\Fusion to 1. Note that you have to restart your application (use iisreset) for the changes to have any effect.
Tip: Remember to turn off fusion logging when you are done since there is a performance penalty to have it turned on.
It appears that there is a bug with the Assembly Binding Log Viewer, which keeps it from displaying any entries if there are a certain number (too many?) files in the IE temp cache folder. I purge my cache, and it works fine. Here's the post I found on the topic. I didn't have to change that registry value, it appears that the settings behind the Settings button do that for you.
To do static dependencies evaluation of .NET code, you can use the tool NDepend. It comes with a dependency matrix, some graph and also a language dedicated to get information from your code base. See more info here.
Another handy Reflector add-in that I use is the Dependency Structure Matrix. It's really great to see what classes use what. Plus it's free.