Why the thread running a query is not reused between query executions?
I'm having a problem with a Query that use a COM object.
The same COM object is reused between query executions, but since LINQPad uses STA thread by default and creates a new thread on each execution, the second execution fails with an InvalidComObjectException.
I can workaround the problem by enabling the option "Run Queries in MTA Threads", but this can be annoying since other functionality requiring STA Threads (e.g. DumpLive) will fail.
Is there a good reason not to reuse the same thread for multiple execution of a query?
Thanks,
Jeff Cyr
The same COM object is reused between query executions, but since LINQPad uses STA thread by default and creates a new thread on each execution, the second execution fails with an InvalidComObjectException.
I can workaround the problem by enabling the option "Run Queries in MTA Threads", but this can be annoying since other functionality requiring STA Threads (e.g. DumpLive) will fail.
Is there a good reason not to reuse the same thread for multiple execution of a query?
Thanks,
Jeff Cyr
Comments