AFAIK, all Windows Forms application should set the [STAThread]
directive above their Main()
method.
However, there's an exception. We are writing applications for Windows Mobile devices, using the Compact Framework. Compact framework doesn't even support the [STAThread]
directive, it only has the [MTAThread]
. Still, I never encountered any problems there.
Now, to take it 1 step furhter, you can also run Compact Framework applications on a full blown windows system. I think that in that case the full blown .NET framework will be used.
At that point, we are running code with an MTA
apartment state, which uses windows forms on a full blown windows system. This brings me to the question, if a compact framework application runs on a full blown windows operating system, why doesn't it complain about the lacking [STAThread]
directive ?