Why is Linq.Enumerable.Count() throwing `InvalidOperationException`
<p>Why it does not understand that an exception has occurred in this area.
I tested. However, it does not occur.</p>

<p>If modified as follows: Would it solve?</p>

<pre><code>if (items != null &amp;&amp; items.Count() &gt; 0) &gt;&gt;&gt; if(items.Any())
</code></pre>

<p><strong>Exception Message:</strong></p>

<blockquote>
  <p>System.InvalidOperationException: Collection was modified; enumeration operation may not execute.<br>
  &nbsp;&nbsp;&nbsp;at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)<br>
  &nbsp;&nbsp;&nbsp;at System.Collections.Generic.List`1.Enumerator.MoveNextRare()<br>
  &nbsp;&nbsp;&nbsp;at System.Collections.Generic.List`1.Enumerator.MoveNext()<br>
  &nbsp;&nbsp;&nbsp;at System.Linq.Enumerable.WhereListIterator`1.MoveNext()<br>
  &nbsp;&nbsp;&nbsp;at System.Linq.Buffer`1..ctor(IEnumerable`1 source)<br>
  &nbsp;&nbsp;&nbsp;at System.Linq.OrderedEnumerable`1.d__0.MoveNext()<br>
  &nbsp;&nbsp;&nbsp;at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)</p>
</blockquote>

<p><strong>Exception Code:</strong></p>

<pre><code>var items = this._dataManager.LotList
                  .Where(lot =&gt; lot.LOT_ID == (string)cpVals[6] &amp;&amp; lot.ADDRESS.ToString() == (string)cpVals[3])
                      .OrderByDescending(lot =&gt; lot.CREATE_TIME);
if (items != null &amp;&amp; items.Count() &gt; 0)
{
</code></pre>

<p><strong>Testing Code:</strong></p>

<pre><code>        List&lt;User&gt; Users = new List&lt;User&gt;();
        Users.Add(new User());
        Users[0].Name = "Kim";
        Users[0].Age = 1;
        Users.Add(new User());
        Users[1].Name = "Kim";
        Users[1].Age = 2;

        var items = Users.Where(u =&gt; u.Name == "Kim").OrderByDescending(u =&gt; u.Age);
        Users.Clear();
        if (items != null &amp;&amp; items.Count()&gt;0)
        {
            User a = items.ElementAt(0);
        }

public class User
{
    public User()
    {
    }

    public string Name;
    public int Age;
}
</code></pre>