title: System.InvalidOperationException: 'Dispatcher processing has been suspended, but messages are still being processed.'
body: <p>I created a blank WPF Application</p>
  
  <pre><code>&lt;Window x:Class="WpfApp4.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
          xmlns:local="clr-namespace:WpfApp4"
          mc:Ignorable="d"
          Title="MainWindow" Height="350" Width="525"&gt;
      &lt;Grid&gt;
          &lt;WebBrowser Name="WebBrowser1" &gt;&lt;/WebBrowser&gt;
      &lt;/Grid&gt;
  &lt;/Window&gt;
  </code></pre>
  
  <p>When I Click Run, this Exception appears</p>
  
  <blockquote>
    <p>System.InvalidOperationException: 'Dispatcher processing has been
    suspended, but messages are still being processed.'</p>
  </blockquote>
  
  <p>If I remove the WebBrowser, then the App runs without Exception.
  It was giving this Exception, then a few moments ago, I could run similar code, not it is giving me this unexpected Exception, then now it insists with this Exception.
  How to solve it?</p>
  
  <p>I think that this problem started after Visual Studio updated to Version 15.4.0 .</p>
  
  <p>My Windows: Microsoft Windows [version 10.0.15063]</p>
  
  <p>Stack Trace:</p>
  
  <pre><code>System.InvalidOperationException occurred
    HResult=0x80131509
    Message=Dispatcher processing has been suspended, but messages are still being processed.
    Source=&lt;Cannot evaluate the exception source&gt;
    StackTrace:
     at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
     at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
     at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
     at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
     at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
     at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
     at MS.Win32.UnsafeNativeMethods.IOleObject.SetClientSite(IOleClientSite pClientSite)
     at System.Windows.Interop.ActiveXHost.TransitionFromLoadedToRunning()
     at System.Windows.Interop.ActiveXHost.TransitionUpTo(ActiveXState state)
     at System.Windows.Interop.ActiveXHost.BuildWindowCore(HandleRef hwndParent)
     at System.Windows.Interop.HwndHost.BuildWindow(HandleRef hwndParent)
     at System.Windows.Interop.HwndHost.BuildOrReparentWindow()
     at System.Windows.Interop.HwndHost.OnSourceChanged(Object sender, SourceChangedEventArgs e)
     at System.Windows.SourceChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
     at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
     at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
     at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
     at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
     at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
     at System.Windows.PresentationSource.UpdateSourceOfElement(DependencyObject doTarget, DependencyObject doAncestor, DependencyObject doOldParent)
     at System.Windows.PresentationSource.OnVisualAncestorChanged(DependencyObject uie, AncestorChangedEventArgs e)
     at System.Windows.UIElement.OnVisualAncestorChanged(Object sender, AncestorChangedEventArgs e)
     at System.Windows.Media.Visual.ProcessAncestorChangedNotificationRecursive(DependencyObject e, AncestorChangedEventArgs args)
     at System.Windows.Media.Visual.ProcessAncestorChangedNotificationRecursive(DependencyObject e, AncestorChangedEventArgs args)
     at System.Windows.Media.Visual.FireOnVisualParentChanged(DependencyObject oldParent)
     at System.Windows.Media.Visual.AddVisualChild(Visual child)
     at System.Windows.FrameworkElement.set_TemplateChild(UIElement value)
     at System.Windows.Controls.ContentPresenter.UseContentTemplate.BuildVisualTree(FrameworkElement container)
     at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
     at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
     at System.Windows.FrameworkElement.ApplyTemplate()
     at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
     at System.Windows.UIElement.Measure(Size availableSize)
     at System.Windows.Documents.AdornerDecorator.MeasureOverride(Size constraint)
     at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
     at System.Windows.UIElement.Measure(Size availableSize)
     at System.Windows.Controls.Border.MeasureOverride(Size constraint)
     at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
     at System.Windows.UIElement.Measure(Size availableSize)
     at System.Windows.Window.MeasureOverrideHelper(Size constraint)
     at System.Windows.Window.MeasureOverride(Size availableSize)
     at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
     at System.Windows.UIElement.Measure(Size availableSize)
     at System.Windows.Interop.HwndSource.SetLayoutSize()
     at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
     at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
     at System.Windows.Window.SetRootVisual()
     at System.Windows.Window.SetRootVisualAndUpdateSTC()
     at System.Windows.Window.SetupInitialState(Double requestedTop, Double requestedLeft, Double requestedWidth, Double requestedHeight)
     at System.Windows.Window.CreateSourceWindow(Boolean duringShow)
     at System.Windows.Window.CreateSourceWindowDuringShow()
     at System.Windows.Window.SafeCreateWindowDuringShow()
     at System.Windows.Window.ShowHelper(Object booleanBox)
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
     at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
     at System.Windows.Threading.DispatcherOperation.InvokeImpl()
     at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
     at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
     at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Windows.Threading.DispatcherOperation.Invoke()
     at System.Windows.Threading.Dispatcher.ProcessQueue()
     at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
     at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled)
     at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
     at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
     at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
     at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
     at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg)
     at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
     at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
     at System.Windows.Application.RunDispatcher(Object ignore)
     at System.Windows.Application.RunInternal(Window window)
     at System.Windows.Application.Run(Window window)
     at System.Windows.Application.Run()
     at WpfApp4.App.Main()
  </code></pre>
  
  <p>My Visual Studio 2017 Info:</p>
  
  <blockquote>
    <p>Microsoft Visual Studio Community 2017  Version 15.4.0
    VisualStudio.15.Release/15.4.0+27004.2002 Microsoft .NET Framework
    Version 4.7.02046</p>
    
    <p>Installed Version: Community</p>
    
    <p>Visual Basic 2017   00369-60000-00001-AA133 Microsoft Visual Basic
    2017</p>
    
    <p>Visual C# 2017   00369-60000-00001-AA133 Microsoft Visual C# 2017</p>
    
    <p>Visual F# 4.1   00369-60000-00001-AA133 Microsoft Visual F# 4.1</p>
    
    <p>Application Insights Tools for Visual Studio Package   8.9.00809.2
    Application Insights Tools for Visual Studio</p>
    
    <p>ASP.NET and Web Tools 2017   15.0.30925.0 ASP.NET and Web Tools 2017</p>
    
    <p>ASP.NET Core Razor Language Services   1.0 Provides languages services
    for ASP.NET Core Razor.</p>
    
    <p>ASP.NET Web Frameworks and Tools 2017   5.2.50921.0 For additional
    information, visit <a href="https://www.asp.net/" rel="nofollow noreferrer">https://www.asp.net/</a></p>
    
    <p>Azure App Service Tools v3.0.0   15.0.30915.0 Azure App Service Tools
    v3.0.0</p>
    
    <p>Common Azure Tools   1.10 Provides common services for use by Azure
    Mobile Services and Microsoft Azure Tools.</p>
    
    <p>JavaScript Language Service   2.0 JavaScript Language Service</p>
    
    <p>JavaScript Project System   2.0 JavaScript Project System</p>
    
    <p>JavaScript UWP Project System   2.0 JavaScript UWP Project System</p>
    
    <p>Merq   1.1.17-rc (cba4571) Command Bus, Event Stream and Async Manager
    for Visual Studio extensions.</p>
    
    <p>Microsoft Azure Tools   2.9 Microsoft Azure Tools for Microsoft Visual
    Studio 2017 - v2.9.50719.1</p>
    
    <p>Microsoft Continuous Delivery Tools for Visual Studio   0.3
    Simplifying the configuration of continuous build integration and
    continuous build delivery from within the Visual Studio IDE.</p>
    
    <p>Microsoft JVM Debugger   1.0 Provides support for connecting the
    Visual Studio debugger to JDWP compatible Java Virtual Machines</p>
    
    <p>Microsoft MI-Based Debugger   1.0 Provides support for connecting
    Visual Studio to MI compatible debuggers</p>
    
    <p>Microsoft Visual Studio VC Package   1.0 Microsoft Visual Studio VC
    Package</p>
    
    <p>Mono Debugging for Visual Studio   4.7.4-pre (c2d89eb) Support for
    debugging Mono processes with Visual Studio.</p>
    
    <p>NuGet Package Manager   4.4.0 NuGet Package Manager in Visual Studio.
    For more information about NuGet, visit <a href="http://docs.nuget.org/" rel="nofollow noreferrer">http://docs.nuget.org/</a>.</p>
    
    <p>SQL Server Data Tools   15.1.61707.200 Microsoft SQL Server Data Tools</p>
    
    <p>TypeScript   2.3.5.0 TypeScript tools for Visual Studio</p>
    
    <p>Visual Studio Code Debug Adapter Host Package   1.0 Interop layer for
    hosting Visual Studio Code debug adapters in Visual Studio</p>
    
    <p>Visual Studio Tools for Universal Windows Apps   15.0.27004.2002 The
    Visual Studio Tools for Universal Windows apps allow you to build a
    single universal app experience that can reach every device running
    Windows 10: phone, tablet, PC, and more. It includes the Microsoft
    Windows 10 Software Development Kit.</p>
    
    <p>VisualStudio.IoT   1.0 Package with IoT components for Visual Studio</p>
    
    <p>VisualStudio.Mac   1.0 Mac Extension for Visual Studio</p>
    
    <p>WebJobs Tools v1.0.0   15.0.30923.0 WebJobs Tools v1.0.0</p>
    
    <p>Xamarin   4.7.10.22 (fe36bec) Visual Studio extension to enable
    development for Xamarin.iOS and Xamarin.Android.</p>
    
    <p>Xamarin.Android SDK   8.0.0.33 (HEAD/7a6a056e8) Xamarin.Android
    Reference Assemblies and MSBuild support.</p>
    
    <p>Xamarin.iOS and Xamarin.Mac SDK   11.2.0.8 (9a9f054) Xamarin.iOS and
    Xamarin.Mac Reference Assemblies and MSBuild support.</p>
  </blockquote>
  
  <p>I reported this problem here <a href="https://developercommunity.visualstudio.com/content/problem/131554/dispatcher-processing-has-been-suspended-but-messa.html" rel="nofollow noreferrer">https://developercommunity.visualstudio.com/content/problem/131554/dispatcher-processing-has-been-suspended-but-messa.html</a></p>
  
  <p>I filled a bug track here <a href="https://connect.microsoft.com/VisualStudio/feedback/details/3142780" rel="nofollow noreferrer">https://connect.microsoft.com/VisualStudio/feedback/details/3142780</a></p>