views:

402

answers:

2

Hi all,

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!

+2  A: 

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
casperOne
While this allowed me to actually step in to the CLR stored procedure with the debugger, unfortunately I still don't get line numbers in exceptions. But still +1 for the tip since now at least I can use the debugger.
DrJokepu
A: 

Try this video:

http://hotfile.com/dl/35297326/1a6bd9a/ObtenerLineaErrorCLRStoredProcedure.zipx.html

Is in spanish; I'm from LatinAmerica; but I hoppe that helps to somebody. Use Winzip 14 to uncopress the .zipx file inside exist a .wmv video.

atte.,

James

jamesV