find a location for property in a new city

Wednesday, 8 June 2011

ThreadStateException thown in WatiN with Internet Explorer

I was using NUnit to Assert some responses from a suite of WatiN tests whilst using the IE browser. Running them caused a ThreadStateException with an error message of 'The CurrentThread needs to have its ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer'

Internet Explorer is not thread safe so WatiN should use a single threaded apartment (STA). To ensure you abide by this WatiN will throw a ThreadStateException if it is not. This can be rectified by setting the ApartmentState to ApartmentState.STA as the error message suggests for Internet Explorer.

How set your CurrentThread to ApartmenState.STA for WatiN in NUnit

If you've haven't already create an App.config in your NUnit testing assembly. You will need to add the following to it:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
   <sectionGroup name="NUnit">
    <section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/>
   </sectionGroup>
  </configSections>
  <NUnit>
   <TestRunner>
    <!-- Valid values are STA,MTA. Others ignored. -->
    <add key="ApartmentState" value="STA" />
   </TestRunner>
  </NUnit>
</configuration>

If you are having problems with different runners other than NUnit you can find tips on how to set STA on them too.

Follow britishdev on Twitter

48 comments:

  1. Latest sports news headlines from India and world. Check out today's most recent & up-to-date news coverage, videos & photos at thesportsrumour.com
    sports news

    ReplyDelete
  2. Awesome blog. I would love to see true life prepared to walk, so please share more informative updates. Great work keeps it up. 3313 exam questions answers

    ReplyDelete
  3. Motifz Designer Lawn. 1, 2 & 3 Piece Unstitched Premium Embroidered Lawn 2019, Premium embroidered Lawn, Premium lawn, Premium lawn 2019, Motifz, Premium lawn in Pakistan Summer collection. Shipping worldwide. Stitching option available.

    ReplyDelete
  4. Norton setup has the best products. Norton antivirus provide high security and protects the device from viruses and hackers. You can get the Norton products from Norton setup. If you are facing any problem regarding Norton then use the Norton removal tool. For further information, please visit Norton Setup

    ReplyDelete
  5. Quickbooks is a tech assistant provider company that provides tech assistance for all tech-related issues in Quickbooks books as in case you face any issue in the software you can contact Quickbooks tech support and ask them for Quickbooks support

    ReplyDelete
  6. If you are hoping to be able to use a public network as a solution to cheap wireless internet access then you may want to think again. Firstly your download may be limited. Unlimited wireless internet

    ReplyDelete
  7. Quickbooks Support is one of the best accounting software in United States. if you are facing issue then you can use QuickBooks tech support.

    ReplyDelete


  8. نقل عفش داخل جدة نقل عفش داخل جدة
    دينا نقل عفش جدة دينا نقل عفش جدة
    افضل نقل عفش من جدة الى الرياض افضل نقل عفش من جدة الى الرياض
    نقل عفش من جدة الى دبي شحن عفش من جدة الى الامارات

    ReplyDelete
  9. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free. https://интернет-на-дачу.рф

    ReplyDelete
  10. home wifi Du Home Internet Packages with exciting Offers Staring from AED 270/- High Speed Internet upto 800 MBPS. Du Internet Packages with Free Landline & TV Channels

    ReplyDelete
  11. You may know Gmail is the most used email service with 1 billion users. With a Gmail account, you also have an Google account that give you permission to access all Google products: Google Drive, Google Hangouts, Google Photos, Google Play, Youtube, Blogger... without signing up again with gmail email login

    ReplyDelete
  12. Buy online wholesale printed candle boxes and packaging at easy prices and shipping worldwide, with 24/7 customer support. Get a free custom quote now!!

    ReplyDelete
  13. Buy online wholesale printed custom candle boxes and packaging at easy prices and shipping worldwide, with 24/7 customer support. Get a free custom quote now!!

    ReplyDelete
  14. Blackbird packaging provide you with any size, shape design, custom bath bomb display boxes sooner than any other packaging competitor in the market

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. Blackbird packaging provide you with any size, shape design, essential oil packaging boxes sooner than any other packaging competitor in the market

    ReplyDelete
  17. Blackbird packaging provide you with any size, shape design, custom bottle neckers wholesale sooner than any other packaging competitor in the market

    ReplyDelete
  18. Blackbird packaging provide you with any size, shape design, essential oil packaging boxes sooner than any other packaging competitor in the market

    ReplyDelete
  19. Blackbird packaging provide you with any size, shape design, bath bomb packaging boxes sooner than any other packaging competitor in the market

    ReplyDelete
  20. I noticed a Teaching Assistant encourage a syntax class as of late.Security Cameras

    ReplyDelete
  21. Cool stuff you have got and you keep update all of us. youtube keyword tool

    ReplyDelete
  22. and presently the Internet tycoon's a year actually comprise a significant buzz all over the place. An extraordinary expert internet promoting bring in cash on the web. Internet showcasing can be a rewarding industry, https://www.seoexpertindelhi.in/

    ReplyDelete
  23. Internet showcasing is falling over themselves attempting to move dollars from disconnected to web based advertising. I accept the thought is that organization advertising will give them better to diminish the U.S. dollar in a tight financial returns. https://www.sandeepmehta.co.in/affordable-seo-services-delhi/

    ReplyDelete
  24. This comment has been removed by the author.

    ReplyDelete
  25. Great Blog and Get the traffic count you wished for after joining our esteemed company and experience a lifetime of success on search engines.https://thewebgross.com/seo-services-delhi-india/

    ReplyDelete
  26. Buy sports bra online from ndure at easy prices delivered at your doorstep. Get free shipping

    ReplyDelete
  27. https://www.engineerhammad.com/2017/09/impact-of-technology-on-education.html

    ReplyDelete
  28. https://www.engineerhammad.com/2017/09/impact-of-technology-on-education.html

    Commenting as kousarseo@gmail.com
    Comment as:
    yoyo (Google)
    Notify me

    ReplyDelete
  29. Buy gym trousers for men from Dshred at best prices delivered at your doorstep. Get free shipping

    ReplyDelete
  30. An ever increasing number of individuals and spots all throughout the planet approach the Internet. free helium hotspot miner

    ReplyDelete
  31. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! ios application developer slc

    ReplyDelete
  32. I wish more authors of this type of content would take the time you did to research and write so well. I am very impressed with your vision and insight. ecommerce development salt lake city

    ReplyDelete
  33. host that implements PHP web hosting should succeed fully processed. An advantage is to be noted. PHP hosting has a plenty of versions for programming languages. There are numerous constraints that one has to face when he chooses for PHP web hosting. There are variable types of php web hosting platforms and hosting packages with new technologies. php web hosting is its compatibility and support for different types of databases. Formation WordPress CPF

    ReplyDelete
  34. This increases the threat of Spyware and other malicious programs if you use malicious proxies. straight from the source

    ReplyDelete
  35. This is very significant, and yet necessary towards just click this unique backlink: kündigung

    ReplyDelete

  36. interactive-flat-panel

    Adopt full aluminium alloy panel structure, anodized surface process, ultra-narrow frame, rounded corner design, fashion and beautiful appearance
    4mm tempered glass with anti glare 3.Advanced IR 20 touching technology.
    The OPS host module adopts plug structure design, internal Inter standard 80pin interface, without any external power line and signal line, which is convenient for
    inspection, maintenance and upgrade, and achieves the aesthetic effect of the machine

    ReplyDelete
  37. Good blog. Keep sharing. I love them Are you also searching for ajman assignment help? we are the best solution for you. We are best known for delivering writing services to students without having to break the bank

    ReplyDelete
  38. Good blog. Keep sharing. I love them Are you also searching for Spanish writing help? we are the best solution for you. We are best known for delivering Spanish writing services to students without having to break the bank

    ReplyDelete
  39. In any case, you will likewise have an adverse solution to the accompanying inquiry: what precisely is broadband Internet? Indeed, a many individuals will say that this is the kind of Internet association they have set up at their homes or workplaces, yet this doesn't actually address the inquiry, makes it happen? https://onohosting.com/

    ReplyDelete
  40. written content. I added new knowledge to my database for essay writing skill. best buy

    ReplyDelete
  41. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. Satta king online

    ReplyDelete
  42. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon. company name suggestions

    ReplyDelete
  43. I enjoy it for creating the details, keep up the truly amazing perform continuing creative names for companies

    ReplyDelete
  44. Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. Satta king chart

    ReplyDelete
  45. Very efficiently written information. It will be beneficial to anybody who utilizes it, including me. Keep up the good work. For sure i will check out more posts. This site seems to get a good amount of visitors. name suggestions for company

    ReplyDelete