title: Not working with vstest.console.exe when .runsettings file is specified - MS Test
body: <p>I am using MSTest project to automate my system. The test project work fine. But I need to run the test project in my production with out installing visual studio. 
  So that I am using VSTest.Console.exe command-line.</p>
  
  <p>My Login method as below</p>
  
  <pre><code>    [TestMethod]
      [TestCategory("SmokeTests")]
      public void Can_login_with_Empty_UserName()
      {             
       Login(TestContext.Properties["UserName"].ToString(), TestContext.Properties["Password"].ToString());                
      }
  </code></pre>
  
  <p>and my vstest.console command as below</p>
  
  <p>vstest.console MyPath\SmokeTests.dll /Tests:Login /Settings: PathToSettingFile\tests.runsettings</p>
  
  <p>when I run this command it will give me
  "System.NullReferenceException: Object reference not set to an instance of an object." Error</p>
  
  <p>But if I change my method like below </p>
  
  <pre><code>    [TestMethod]
      [TestCategory("SmokeTests")]
      public void Can_login_with_Empty_UserName()
      {            
       Login("Admin", "1234");                
      }
  </code></pre>
  
  <p>Above code will work properly. </p>
  
  <p>So the problem is </p>
  
  <p>TestContext.Properties["UserName"].ToString()</p>
  
  <p>When I run the test case through Visual Studio no issues.
  Any idea why  /Settings: PathToSettingFile\tests.runsettings cannot load runsettings file running through the vstest.console command. 
  Thank you.</p>