ThreadStateException c#

我有一个ThreadStateException,我需要有STAThread …问题出现昨天,我甚至从我的git repo(100%工作)ckecked以前的版本 – 现在他们不是。

主要代码:

[STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new ClientList()); } 

和ClientList表单方法:

 private void button2_Click(object sender, EventArgs e) { [...] OpenFileDialog ofd = new OpenFileDialog(); DialogResult result = ofd.ShowDialog(); [...] } 

知道为什么STA不能工作吗?

编辑:在新的(测试)应用程序中一切正常。 只有这个项目会在OpenFileDialog上抛出exception。

编辑2: getAppartmentState显示应用程序位于Main的第一行MTA中。 [STAThread]被忽略了吗?