Debugging CLR Stored Procedures in SQL Server 2005 - don't forget the pdbs!

A year back I catalogued all my C# stored procedures into SQL Server 2005 by hand. A year on and I have become lazy - relying on the tight integration between VS.NET 2005 Beta 1 and SQL Server 2005 Beta 2 to simply publish the C# code into the database. Well today it bit me. I was using a sample that included an install which manually catalogued the stored procedures - and yep, I needed to debug it. The frustration was, no matter many trys I was unable to get the code to stop at my break point in the C# sp.

Then a colleague reminded me of a simple and easily overlooked fact. If you manually catalogue then you must also add in the pdb if you want to debug. Doh! I also recommend you look at https://staff.develop.com/nielsb/PermaLink.aspx?guid=46faa4ec-97c2-4d86-9366-14a1a99a87e4 from Niels.

Syntax is simple:

CREATE ASSEMBLY Asm1
FROM 'MyAss1.dll'
GO
ALTER ASSEMBLY Asm1 ADD FILE FROM 'MyAss1.pdb'
GO