A
Arnie
Posting an issue for a colleague:
They are having an issue w/ making WMI calls from a gui thread. Gui threads
need to be on the STA and there is some speculation that WMI calls need to
be on the MTA, how to mix both?
....
The application is hanging on exit.
When they break into the debugger, the thread on which it is stuck is in a
'WaitOne' call. The call stack is:
mscorlib.dll!System.Threading.WaitHandle.WaitOne() + 0x57 bytes
system.management.dll!System.Management.MTAHelper.WorkerThread() + 0x25
bytes
I searched around a bit on the web, and found this article:
http://discuss.develop.com/archives/wa.exe?A2=ind0306b&L=dotnet-clr&T=0&F=&S=&P=3961
It seems to imply that threads that make WMI calls must be MTA.
And, Paul thinks that GUI threads must be STA. Many .NET controls are just
wrappers on COM controls, which would seem to imply they must be STA.
But, what about threads that are both GUI threads and make WMI calls? Or
are both GUI threads and make MTA-COM calls? They can't be both MTA and
STA...
Any thoughts?
They are having an issue w/ making WMI calls from a gui thread. Gui threads
need to be on the STA and there is some speculation that WMI calls need to
be on the MTA, how to mix both?
....
The application is hanging on exit.
When they break into the debugger, the thread on which it is stuck is in a
'WaitOne' call. The call stack is:
mscorlib.dll!System.Threading.WaitHandle.WaitOne() + 0x57 bytes
system.management.dll!System.Management.MTAHelper.WorkerThread() + 0x25
bytes
I searched around a bit on the web, and found this article:
http://discuss.develop.com/archives/wa.exe?A2=ind0306b&L=dotnet-clr&T=0&F=&S=&P=3961
It seems to imply that threads that make WMI calls must be MTA.
And, Paul thinks that GUI threads must be STA. Many .NET controls are just
wrappers on COM controls, which would seem to imply they must be STA.
But, what about threads that are both GUI threads and make WMI calls? Or
are both GUI threads and make MTA-COM calls? They can't be both MTA and
STA...
Any thoughts?