In all the examples out there to see the SQL generated by a LINQ2SQL query console.out is used, but to monitor the SQL in a debug window we need to write a special text writer implementation

The you can use
datacontext.log = new DebuggerWriter();