Breaking on Module Load

Breaking on Module Load

Let’s say we want to break the debugger when a specific dll is loaded, for example I want to enable some SOS commands and clr hasn’t been loaded yet, this is especially useful when you have an exception that happens too early in the program and you can’t rely on manually trying to break at the right time.

For example, right after attaching the debugger to a process I do this, I will get an error since clr hasn’t been loaded yet

0:000> .loadby sos clr

Unable to find module 'clr'

Using the sxe ld command, I can tell the debugger to break when clr is loaded