A personal repository of technical notes. - CSC

Debug Class Library Apart From ASP.NET Solution

Steps to Debug a Class Library That is Not Part of a Visual Studio ASP.NET Solution

Prepare Class Library
- Open class library in Visual Studio
- Build class library in debug mode.
- Manually copy new debug DLLs from bin\debug folder of class library to bin folder of ASP.NET application that is using this class library
- Run web site in browser to rebuild with new dlls

Start Debug Session
- Set breakpoints in code of class library
- Select menu item Debug/Attach to Process...
- Transport: Default
- Attach to/Select...: Automatically determine the type of code to debug
- OK
- Available Processes:
    (If using IIS 6) Select aspnet_wp.exe
    (If using IIS 7) Check "Show processes from all users", check "Show process in all sessions", select w3wp.exe
- Note: There may be more than one. Hold mouse over each and select appropriate version.
- Attach

NOTE: if error, "EXECUTE permission denied on object 'sp_sdidebug', database 'master', owner 'dbo'."
-May "Attach to:" "Managed Code" instead of "Automatic: T-SQL code, Managed code".

NOTE: If error, "The breakpoint will not currently be hit. The source code is different from the original version."
-Need to get newer DLLs into web application. Redo steps under "Prepare Class Library"

NOTE: If error, "The breakpoint will not currently be hit. No symbols have been laoded for this document."
-Make sure "Attach to:" is set to one of the appropriate values listed above.
-Make sure class library was built in debug mode. See "Prepare Class Library" above.
-Open or refresh web page in which you are testing class library to rebuild site using new DLLs. See "Prepare Class Library" above.

Updates
2012-08-27 Added IIS 6 and IIS 7 notes.

No comments:

Post a Comment