Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do NOT reuse query process in LINQPad

Tags:

linqpad

I have "Run each query in its own process" option turned on (default value), but it seems that the process is being reused between query runs (LINQPad.UserQuery.exe keeps running).

Is there a way to avoid this reuse? I need a fresh process every time (due to JVM usage).

Obvious way is

Environment.Exit(0);

but it results in unpleasant "Query ended unexpectedly" message.

like image 788
Pavel Tupitsyn Avatar asked Feb 17 '16 17:02

Pavel Tupitsyn


2 Answers

Try Util.NewProcess = true:

Util.NewProcess = true;
Process.GetCurrentProcess().Id.Dump();

Also you can try option from menu: 'Query' -> 'Cancel All Threads and Reset' (also available via shortcut Shift+Control+F5)

like image 133
Guru Stron Avatar answered Sep 22 '22 05:09

Guru Stron


The option "Run each query in its own process" instructs LINQPad to use process isolation rather than AppDomain isolation. It will still re-use the process if you re-run the same query.

The option you want is "Always use fresh application domains". Set this to true, and you'll get a fresh process/AppDomain with each execution. Or, as the Guru suggested, set Util.NewProcess in your query. This forces the next execution to use a fresh process/domain.

like image 28
Joe Albahari Avatar answered Sep 20 '22 05:09

Joe Albahari