threadstateexception was unhandled
ファイルダイアログを開こうとするたびに表示されます。リリース設定でVisual Studio(2012)を実行しているときにのみ取得し、デバッグに戻すと、すべてが意図したとおりに機能するようです。最後の行でアプリケーションがクラッシュし、ShowDialog();
私は何を間違っていますか?コード エラーがありますか、それとも VS に不足している設定がありますか?
使用しているすべてのサブファイルをデバッグからコピーして、重要なものをリリースしました。この問題を検索しようとしましたが、Google-fu が不足しています。
一部のトリミングされたコード:
[STAThread]
public static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
public static bool compareListViewWithFile(int listViewIndex)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "Comma Separated Value files (.csv)|*.csv|All Files (*.*)|*.*";
openFileDialog1.FilterIndex = 1;
if (currentListView.Items == null || currentListView.Items.Count == 0)
{
openFileDialog1.Title = "Choose first file";
DialogResult userClickedOK = openFileDialog1.ShowDialog();
// etc
}
}