0

I'm trying to debug a CLR User Defined Type in SQL Server 2014 / Visual Studio 2013. I can deploy my UDT to the database and execute the script that calls that UDT in the debugger from within visual studio but it throws an error and doesn't hit my breakpoint. The error happens in the static Parse method on the type.

My DBA thought it might be a permissions issue (preventing me from debugging, not the underlying error) but didn't have time to look into it. Any suggestions on what I need to do to debug my UDT?

The SQL Server is a local instance

Per request, the code of Parse:

public static SqlQueryDescriptor Parse(SqlString s)
{
    if (s.IsNull)
        return Null;
    var queryDescriptor = new JsonSerializer().Deserialize<QueryDescriptor>(s.Value);
    //var queryDescriptor = new QueryDescriptor();
    SortContext sort = new SortContext();
    if (queryDescriptor.Sorts != null)
    {
        foreach (var sortDescriptor in queryDescriptor.Sorts)
        {
            sort.AddSort(sortDescriptor.Property, sortDescriptor.Direction);
        }
    }
    return new SqlQueryDescriptor(sort, queryDescriptor.Filters, queryDescriptor.Page);
}

The error is a NRE in the Json deserialization library, I need to debug to figure out why that is happening as I didn't write that library and imported it from the web. Although the break point still doesn't hit even if I don't use the deserializer (commented out line)

JasonLind
  • 370
  • 2
  • 13
  • a great suggestion would be to do a simple google search here is what I found doing one [Walkthrough Debugging CLR User type](https://msdn.microsoft.com/en-us/library/ms165056%28v=vs.90%29.aspx) – MethodMan Mar 09 '15 at 21:08
  • @MethodMan I am doing exactly that and its not working – JasonLind Mar 09 '15 at 21:09
  • well it's hard to tell what's not working when we can't see code.. what does the code look like that you state here `The error happens in the static Parse method on the type` – MethodMan Mar 09 '15 at 21:10
  • @MethodMan I don't think the code of my internal UDT is relevant to my question but I'll post it anyhow – JasonLind Mar 09 '15 at 21:12

0 Answers0