title: Extension method throws exception only when debugging
body: <p>I am using the following extension method (<a href="https://stackoverflow.com/questions/438188/split-a-collection-into-n-parts-with-linq">from an existing StackOverflow question</a>) to split an existing enumerable into two:</p>
  
  <pre><code>public static IEnumerable&lt;IEnumerable&lt;T&gt;&gt; Split&lt;T&gt;(this IEnumerable&lt;T&gt; list, int parts)
  {
      int i = 0;
      var splits = from item in list
                   group item by i++ % parts into part
                   select part.AsEnumerable();
      return splits;
  }
  </code></pre>
  
  <p>I am using the method like so:</p>
  
  <pre><code>//accountIds is simply an IEnumerable&lt;string&gt;
  var foo = accountIds.Split(2).ToList();
  </code></pre>
  
  <p>The method seemingly works fine when I run my application.  However, when I debug my application this line of code always throws an exception:</p>
  
  <p><code>Object reference not set to an instance of an object.</code></p>
  
  <p>I am very confused why this method only throws an exception when I am debugging.</p>