title: WatiN in Visual Studio 2008 - second test method fails
body: <p>When trying to run a very simple WatiN 2.0 (CTP3) test in Visual Studio 2008 I found that the first one always executes fine. The second test method seem to break something in the IE object producing the following exception:</p>
  
  <blockquote>
    <p>Test method
    testProject.WatinTest.testTwo threw
    exception: 
    System.Runtime.InteropServices.InvalidComObjectException:
    COM object that has been separated
    from its underlying RCW cannot be
    used..</p>
  </blockquote>
  
  <p>A sample code is below. Due to the way the initialization method is workin in VS2008 the browser variable has to be defined as <code>static</code> which I believe could be a key to the problem. Unfortunately unless the browser is opened in the common method it means a separate window for every test which is not ideal</p>
  
  <p>I would be very grateful for any ideas on how to fix that.
  Google search and SO search did not produce any useful results so I hope that a good answer to this question will help the community. Many thanks,</p>
  
  <hr>
  
  <pre><code>    private static IE ie
  
      [ClassInitialize]
      public static void testInit(TestContext testContext)
      {
          ie = new IE("http://news.bbc.co.uk");
      }
  
      [TestMethod]
      public void testOne()
      {
          Assert.IsTrue(ie.ContainsText("Low graphics"));
      }
  
      [TestMethod]
      public void testTwo()
      {
          Assert.IsTrue(ie.ContainsText("Low graphics"));
      }
  </code></pre>