title: Updating ObservableCollection on dispatcher thread causes UI to freeze
body: <p>When updating my <code>ObservableCollection</code>, I was getting this error:</p>
  
  <blockquote>
    <p>This type of CollectionView does not support changes to its
    SourceCollection from a thread different from the Dispatcher thread.</p>
  </blockquote>
  
  <p>Using <a href="https://stackoverflow.com/a/4461682/279516">this answer</a> as a guide, I thought this code would work:</p>
  
  <pre><code>private ObservableCollection&lt;string&gt; _userMessages = new ObservableCollection&lt;string&gt;();
  
  public void AddUserMessage(string message)
  {
      lock (_locker)
      {
          Action action = () =&gt;
          {
              this._userMessages.Add(message);
          };
  
          Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal, action);
      }
  }
  </code></pre>
  
  <p>However, my UI now freezes when calling <code>Dispatcher.Invoke()</code>. What am I doing incorrectly?</p>
  
  <p>Note: I needed to do this because I'm (sometimes) updating my <code>ObservableCollection</code> from events.</p>