Question

Is it possible to cancel long running programs that I run in LINQPad? If so, how?

Edit:

LINQPad can become unresponsive for a long time when displaying very big objects. Then you either have to wait or kill LINQPad.

This does not happen in general when running programs that run for a long time.

Was it helpful?

Solution

In my experience there are two main phases where LINQPad might spend significant time when executing your query:

  1. while executing the query against the data context and gathering the data
  2. while retrieving and converting the data into the HTML format for display

While LINQPad is executing your query (phase 1 above), you can cancel the query with Shift-F5.

While LINQPad is building the HTML to display, I unfortunately haven't found a way to cancel the query. What I normally do is either kill LINQPad (through task manager or other means) completely (since it saves queries automatically, you normally don't lose any work) or just let the query run its course. Then I convert my Dump() calls to Dump(0) to ensure I get results more quickly next time.

It certainly would be nice if LINQPad would do a breadth-first approach before expanding to deeper dump levels. Pressing Shift-F5 could in that case simply stop expanding at whatever level it had reached. If you agree, it might be a good enhancement to request on LINQPad's UserVoice site.

OTHER TIPS

Press Shift + F5 to stop the running program. Or from the menu

Query ->Cancel

Use task manager to kill the work process, doesn't work?

As @Frank's answer indicated, the LinqPad GUI becomes unresponsive when it is rendering the HTML output of the .Dump() operation for display in the results panel.

I have already created a request on the LinqPad uservoice site (here), to make this step in running a LinqPad query either cancel-able, or to process it on a background thread.

Feel free to add votes to this feature request to push it up the priority stack.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top