System.Threading.ThreadStateException : The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer.
If you are running your tests with MBUnit you can add the following to your TestFixture:
[TestFixture(ApartmentState = ApartmentState.STA)]
But I couldn’t find any similar for NUnit. Instead I changed how SharpDevelop launches it’s tests. Click; Tools / Options / Tools / Unit Tests and deselect Run tests on separate thread. Run the tests again.
And I got the following error:
System.InvalidOperationException : Process has exited, so the requested information is not available.
I tried to disable Protected Mode in Internet Explorer and the tests ran fine.