title: .NET Cannot perform this operation while dispatcher processing is suspended
body: <p>I have the following method in a base class that implements System.ComponentModel.INotifyPropertyChanged:</p>
  
  <pre><code>protected virtual void RaisePropertyChangedEventSynchronous(string propertyName)
  {                    
      try
      {
          if (PropertyChanged != null)
          {
              Delegate[] delegates = this.PropertyChanged.GetInvocationList();
              foreach (PropertyChangedEventHandler handler in delegates)
              {                      
                  try
                  {
                      DispatcherObject dispatcherInvoker = handler.Target 
                          as DispatcherObject;
                      if (dispatcherInvoker != null)
                      {                                
                          dispatcherInvoker.Dispatcher.Invoke(DispatcherPriority.Normal, 
                              new Action(delegate
                          {
                              handler(this, new PropertyChangedEventArgs(propertyName));
                          }));
                      }
                      else
                      {
                          handler(this, new PropertyChangedEventArgs(propertyName));
                      }
                  }
                  catch (Exception ex)
                  {                     
                      ExceptionPolicy.HandleException(ex, 
                          ExceptionHandlingPolicyNames.LogPolicy);
                  }
              }
          }
      }
      catch (Exception ex)
      {
           ExceptionPolicy.HandleException(ex, ExceptionHandlingPolicyNames.LogPolicy);
      }
  }
  </code></pre>
  
  <p>On occasion, I would get the following exception logged to file:</p>
  
  <p>Type : System.InvalidOperationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  Message : Cannot perform this operation while dispatcher processing is suspended.
  Source : WindowsBase
  Help link : 
  Data : System.Collections.ListDictionaryInternal
  TargetSite : Void PushFrame(System.Windows.Threading.DispatcherFrame)
  Stack Trace :    at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
     at System.Windows.Threading.DispatcherOperation.Wait(TimeSpan timeout)
     at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
     at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method)
     at OCC600.Infrastructure.Dictionary.BusinessEntities.Observable.RaisePropertyChangedEventSynchronous(String propertyName)</p>
  
  <p>If I use Dispatcher.BeginInvoke to update the UI, I do not get these exceptions. But I have found out that performing updates using BeginInvoke is not reliable as sometimes these changes are not reflected on the user interface.</p>
  
  <p>How do I solve this one?</p>