10 April 2008 Debugging, HowTo, LINQ, LINQ to SQL Robert Muehsig

I`m working on a project where I use LINQ to SQL. It´s very cool (and sometimes tricky ;) ), but what if I need deeper information about the "LINQ to SQL magic" - how can I debug the LINQ to SQL stuff?

1. Option: Visual Studio

The simplest option is of course Visual Studio itself. Just checking the objects - very easy.

If you want to know which SQL statement is send to the SQL Server you need another tool:

2. Option: LINQ to SQL Debug Visualizer

A powerful tool: LINQ to SQL Debug Visualizer. I can´t understand why Microsoft hide this handy tool.

3. Option: DataContext.Log

A build-in option for logging is the DataContext.Log property. It is very useful in a consol application - but not in a class library. I found a very smart "Output Logger" class on this blog: Sending the LINQ To SQL log to the debugger output window. Each generated sql statement will be send to the output window.

This are my "debugging" tools - maybe could "LinqPad" another nice tool.

Any other suggestion? Feel free to comment (you can even comment my english ;) ).

Written by Robert Muehsig

Software Developer - from Saxony, Germany - working on primedocs.io. Microsoft MVP & Web Geek.
Other Projects: KnowYourStack.com | ExpensiveMeeting | EinKofferVollerReisen.de