Debugging SSAS .Net Stored Procedures

Having written quite a few .Net Stored Procedures for the Analysis Services Stored Procedure project, I have often needed to debug into these stored procedures and it is pretty much second nature. But I had a question about this recently which made me realise that getting this working is not really well documented. There is a page in the product documentation which probably has enough information to get you going, but to my mind some of the steps are in the wrong order - and there are no pictures :)

I like to start by deploying the assembly. If you are accessing any of the ADOMDServer objects this code can only be executed in the context of an SSAS server, so you can't really run it using an external harness or testing framework.

I usually use SSMS for this as the CREATE/ALTER assembly command embeds the compiled dll as a base64 encoded string and SSMS does this work for you. You can also create a project reference to your assembly in the same solution as your SSAS database and the assembly will get deployed along with your database.

With SSMS you simply right-click on the server or database and choose the option to add an assembly.

 

Then in Visual Studio.Net set one or more breakpoints in your code.

Then select the Debug -> Attach to Process... option

And attach to the msmdsrv.exe process, making sure that the option to attach to Managed Code is selected.

Finally you just need to run some code that will call the stored proc, either an MDX query or refreshing a pivot table.

And you should find VS.Net breaks in the code and you can then debug as you would any other .Net code.

enjoy!

Print | posted on Tuesday, May 22, 2007 3:51 PM

Comments on this post

# re: Debugging SSAS .Net Stored Procedures

Requesting Gravatar...
Here are some other articles on SSAS Stored Procedures: http://ssas-wiki.com/w/Articles#.Net_stored_procedure
Left by Sam Kane on Feb 24, 2011 6:40 AM

Your comment:

 (will show your gravatar)