FolderBrowserDialog ThreadStateException

Hello,

I tried to make these codes work, but it always generate the errors:

import System
import System.Collections.Generic
import System.ComponentModel
import System.Data
import System.Drawing
import System.Linq
import System.Text
import System.Threading.Tasks
import System.Windows.Forms

__partial class MainForm : Form {

public init() {

    InitializeComponent()
}

private func select_folder_Bt_Click(_ sender: System.Object!, _ e: System.EventArgs!) {

       var folderBrowserDialog =FolderBrowserDialog();
          if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
        {
            folder_path_tB.Text=folderBrowserDialog.SelectedPath;
        }
}

}

!> Exception of type System.Threading.ThreadStateException on thread 1C24

Why does this simple code needs STAThreadAttribute? And where should I place it?

Thank you.

Hrmm it’s lready there. Somehow the compiler doesn’t pick it up. Logging & fixing.

Thanks, logged as bugs://81844

bugs://81844 got closed with status fixed.