Tuesday, May 26, 2009

Debugging W3WP with “Attach to Process”

When trying to load SOS.dll while the debugger is attached to the w3wp process, if you encounter the following message.

SOS not available while Managed only debugging.  To load SOS, enable unmanaged debugging in your project properties.

Then, stop the debugging session and in the “attach to process” dialog, select your process and click on the “select” button. Then you can pick what kind of debugging sessions would you like to permit.

image

By default, the code to debug is automatically determined in which case only Managed and T-SQL debugging is enabled.

Another useful feature would be using “New Breakpoint” functionality. This would be useful when you are using  Attach to Process and do not have the source code opened as a project. In this case, you can go to Debug->New Breakpoint-> Break at function.

image

Once you are in this window, give the function name where you want to break and then click OK. Ignore any warning messages that it gives and then it would hit the breakpoint if the function you named would be executed. I will be posting more as I learn more about using SOS.dll with W3WP.

1 comment:

Anonymous said...

Thanks a lot for your hint! This was exactly what I was looking for :)