Debugging LINQPad execution with ILSpy 2.0

caddzooks
edited April 2012 in Root
Hi.

I found with ILSpy 2.0, it is possible to attach to LINQPad and debug the code
in a LINQPad script. The script assembly can be found by adding this to the
script:

Assembly.GetExecutingAssembly().Location.Dump();

Because the assembly is rebuilt with a different filename each time a
change is made to the script and it is run, you can't change the script
once you've run it to get the filename, until finished debugging.

Comments

  • Have you tried inserting Debugger.Break() or Debugger.Attach() into the script?
  • I use
    if(Debugger.IsAttached) Debugger.Break()
    All the time when I have a long complicated linqpad file and need to debug a portion of the script. Very handy. Just attach to the linqpad process from Visual Studio.