Jonni Faiga [mailto:[EMAIL PROTECTED]] wrote:

> Is the answer that MTA calling STA is not compatible and,
> since=20 most COM objects are STA, having [MTAThread] would
> cause COM to create a MTA compartment as a proxy to marshal
> calls to the COM STA?

Because odds are today you're going to use a STA threaded COM component (or
ActiveX control) in that EXE. The VS.NET templates make this assumption and
play it on the safe side. If you're 100% positive you won't be using an STA
threaded component, go ahead and remove the attribute all together. Keep in
mind that most UI controls are apartment threaded and if you tried to use
them without a message pump, then you're going to have problems. That said,
most of the time you can remove the attribute on console apps, but rarely
can you remove it on a WinForms app.

HTH,
Drew
.NET MVP

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to