title: Adding to a generic dictionary causes IndexOutOfRangeException
body: <p>I'm using a dictionary inside of some Task. </p>
  
  <p>Logically I have set it up so that my Keys will never clash, though sometimes when I am adding to the dictionary I get this Exception.    </p>
  
  <pre><code>Index was outside the bounds of the array.
  at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
     at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
     at Rpc.&lt;MapIntoRpc&gt;b__4[T](Object x) in Rpc.cs:line 113
     at System.Threading.Tasks.Task`1.InvokeFuture(Object futureAsObj)
     at System.Threading.Tasks.Task.InnerInvoke()
     at System.Threading.Tasks.Task.Execute()
  </code></pre>
  
  <p>I understand there can be concurrency issues from trying to remove or add the same Key multiple times, but I have accounted for that algorithmically. </p>
  
  <p>What causes the add to sometimes fail? 
  What is the best way to work around that?</p>