Home

Why the thread running a query is not reused between query executions?

edited December 2014
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

Comments

Sign In or Register to comment.