fetucine53
fetucine53

Reputation: 501

Getting Line Numbers for Errors Thrown in SQL Server CLR Runtime

I've created a CLR stored procedure that I'm running on SQL 2k5 and I'm wondering if there's any way to get line numbers for exceptions thrown by the .NET code. When an Exception is thrown, I get something along the lines of

Msg 6522, Level 16, State 1, Procedure myProcedure, Line 0 A .NET Framework error occurred during execution of user-defined routine or aggregate "myProcedure": System.Exception: testing exception System.Exception: at DummyDLL.myProcedure (String dummyInput) .

Is there some way I can load the assembly to give me specific line numbers rather than just the function in which the error was thrown? The assembly itself was compiled with a .pdb, but SQL 2k5 doesn't appear to be reading it in when I load the assembly initially.

Thanks!

Upvotes: 2

Views: 1303

Answers (1)

casperOne
casperOne

Reputation: 74530

I'm not sure if registering the PDB as well will give you line numbers (theoretically, it should though).

Are you sure you are registering your PDB correctly? The following tells you how to do so:

http://blogs.msdn.com/ericnel/archive/2005/03/18/398534.aspx

Basically, the syntax is:

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

Upvotes: 4

Related Questions