title: ConcurrentDictionary.TryGetValue returns false even though the VS debugger shows that the value is there
body: <p>I have a strange situation. I am using a variant of <code>BiDictionary&lt;mystruct, int&gt;</code> implementation <a href="https://stackoverflow.com/a/268545/3834">here.</a>. I also use the Dictionary type to <code>ConcurrentDictionary</code>  for <code>firstToSecond</code></p>
  
  <p>The problem is that at the code </p>
  
  <pre><code> ConcurrentDictionary firstToSecond;
  
    public IList&lt;TSecond&gt; GetByFirst(TFirst first)
  {
      IList&lt;TSecond&gt; list;
      var myclone=DeepCopy(firstToSecond);
      var res =firstToSecond.TryGetValue(first, out list);
      if (!res)
      {
          return EmptySecondList;
      }
      var doNextThing = DoNextMethod();
      return new List&lt;TSecond&gt;(list); // Create a copy for sanity
  }
  </code></pre>
  
  <p>may sometimes have <code>res=false</code>. When such a condition occurs, I naturally break at the next statement (<code>var doNextThing = DoNextMethod();</code>) in my Visual Studio 2015 debugger to examine the value. I put <code>mydict.TryGetValue(item, out index)</code> in the debugging window and to my puzzlement, now it <strong>does</strong> return a value ( ie: <code>res=true</code>)!</p>
  
  <p>Debugging attempt:</p>
  
  <ol>
  <li><p>I make sure that my key is sane(it is a <code>struct</code>, so it should be of an immutable type with an <code>.Equals()</code> and <code>.GetHashCode()</code> that do repeatable, predictable things). </p></li>
  <li><p>I also deepcopy <code>mydict</code> to another object ( say, <code>myclone</code>) before I carry out the <code>TryGetValue</code> operation. I check the <code>myclone.TryGetValue(item, out index)</code> in the debugger, and it returns true!</p></li>
  <li><p>I suspect this is a multithreading issue, because my code does multithreading. So, I then check whether <code>myDict</code> is being modified by other thread in my code, and I find that it is being instantiated and used inside a class, and inside a private method (<code>firstToSecond</code> is private). It is definitely not a singleton that is accessible from elsewhere, let alone being modified.  </p>
  
  <ol start="4">
  <li><strong>I use <code>ConcurrentDictionary</code> for <code>firstToSecond</code> variable.</strong> </li>
  </ol></li>
  </ol>
  
  <p>My multithreading debugging skill is very limited, so I don't know how else I can test for multithreading issue. Any ideas how I can tackle the issue?</p>
  
  <p><strong>This is not a dupe of <a href="https://stackoverflow.com/q/2940241/3834">this question</a>! For I am aware that there is a <a href="http://msdn.microsoft.com/en-us/library/dd287191.aspx" rel="nofollow noreferrer">ConcurrentDictionary</a>, but how it can be useful?</strong> </p>