title: Visual Studio code metrics misreporting lines of code
body: <p>The code metrics analyser in Visual Studio, as well as the code metrics power tool, report the number of lines of code in the <code>TestMethod</code> method of the following code as 8.</p>
  
  <p>At the most, I would expect it to report lines of code as 3.</p>
  
  <pre class="lang-cs prettyprint-override"><code>[TestClass]
  public class UnitTest1
  {
      private void Test(out string str)
      {
          str = null;
      }
  
      [TestMethod]
      public void TestMethod()
      {
          var mock = new Mock&lt;UnitTest1&gt;();
  
          string str;
          mock.Verify(m =&gt; m.Test(out str));
      }
  }
  </code></pre>
  
  <p>Can anyone explain why this is the case?</p>
  
  <p><strong>Further info</strong></p>
  
  <p>After a little more digging I've found that removing the <code>out</code> parameter from the Test method and updating the test code causes LOC to be reported as 2, which I believe is correct. The addition of <code>out</code> causes the jump, so it's not because of braces or attributes.</p>
  
  <p>Decompiling the DLL with dotPeek reveals a fair amount of additional code generated because of the <code>out</code> parameter which could be considered 8 LOC, but removing the parameter and decompiling also reveals generated code, which could be considered 5 LOC, so it's not simply a matter of VS counting compiler generated code (which I don't believe it should do anyway).</p>