How to debug LinqPad query in Visual Studio Debugger?

Mesh picture Mesh · Apr 6, 2011 · Viewed 9k times · Source

I can attach the debugger and get it to break - but it has trouble finding the .cs file, I think LinqPad deletes it as part of its build.. 8-(

Answer

Joe Albahari picture Joe Albahari · Apr 6, 2011

If you call

Debugger.Launch();
Debugger.Break(); 

to initiate the breakpoint within your LINQPad script, LINQPad will guess that you want to use VS to debug your script and won't delete the .cs file.