Debugging Spatial Tools

Mar 20, 2010 at 12:19 AM


I'll try to be brief...I tried to step through (debug) the spatial tools code.  

First thing I noticed the project wasn't like a typical SQL Project (couldn't add a Test Script), and therefore had no entry point.  So I created a SQL Project, added all the files from the source code I downloaded to my new project, and tried to debug.  

First error was MaxByteSize' property specified was not found. SQLSpatialTools; I changed it from -1 to 8000, and that seemed to fix it.  

Next error, "Column, parameter, or variable #0: Cannot find data type SqlGeometry.  Parameter or variable '' has an invalid data type.", but I had a reference set to Microsoft.SqlServer.Types (I didn't change anything other than the MaxByteSize in the original source files). 

Does anyone have any suggests on how I can either debug the original project without making any changes or fix the problem in the new project I created?



Mar 20, 2010 at 8:43 AM

This might be a deployment bug in Visual Studio. You probably should leave MaxByteSize as -1. This 8000 byte restriction was removed in Sql Server 2008. Unfortunately you will need to deploy manually or write your own script to do so.

 More info here: -

Mar 20, 2010 at 2:13 PM

I am able to deploy manually.  It is a VS deployment bug.  Is it possible to debug (step through) the code after manually deploying?




Mar 21, 2010 at 9:13 PM

Does anyone else have any suggestion on how to go about debugging (stepping through in Visual Studio) the SpatialTools project as it exists as a download from this site (that is without the ability to add a Test Script as a starting point), or debugging user defined aggregates created as a SQL Project in Visual Studio.

Thanks again,


Mar 21, 2010 at 9:25 PM

You should be able to attach your debugger remotely to a running instance of Sql Server and add a breakpoint in your code.

It's wise not to do this on a production database.

Mar 21, 2010 at 9:54 PM

Thanks bsdz, I'll try to figure it out.