我创建了一个空白的WPF应用程序
<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">
<Grid>
<WebBrowser Name="WebBrowser1" ></WebBrowser>
</Grid>
</Window>
单击“运行”时,将显示此异常
System.InvalidOperationException:&#39; Dispatcher处理已经完成 暂停,但邮件仍在处理中。&#39;
如果我删除WebBrowser,则App运行时不会出现异常。 它提供了这个Exception,不久之前,我可以运行类似的代码,而不是它给我这个意外的异常,然后现在它坚持这个例外。 怎么解决?
我认为在Visual Studio更新到15.4.0版之后就开始出现此问题。
我的Windows:Microsoft Windows [版本10.0.15063]
堆栈追踪:
System.InvalidOperationException occurred
HResult=0x80131509
Message=Dispatcher processing has been suspended, but messages are still being processed.
Source=<Cannot evaluate the exception source>
StackTrace:
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& 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& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& 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& 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()
我的Visual Studio 2017信息:
Microsoft Visual Studio社区2017版本15.4.0 VisualStudio.15.Release / 15.4.0 + 27004.2002 Microsoft .NET Framework 版本4.7.02046
已安装版本:社区
Visual Basic 2017 00369-60000-00001-AA133 Microsoft Visual Basic 2017
Visual C#2017 00369-60000-00001-AA133 Microsoft Visual C#2017
Visual F#4.1 00369-60000-00001-AA133 Microsoft Visual F#4.1
Visual Studio包8.9.00809.2的应用程序洞察工具 Visual Studio的应用程序洞察工具
ASP.NET和Web Tools 2017 15.0.30925.0 ASP.NET和Web Tools 2017
ASP.NET Core Razor语言服务1.0提供语言服务 用于ASP.NET Core Razor。
ASP.NET Web框架和工具2017 5.2.50921.0有关其他信息 信息,请访问https://www.asp.net/
Azure App Service Tools v3.0.0 15.0.30915.0 Azure App服务工具 V3.0.0
Common Azure Tools 1.10提供Azure使用的公共服务 移动服务和Microsoft Azure工具。
JavaScript语言服务2.0 JavaScript语言服务
JavaScript Project System 2.0 JavaScript项目系统
JavaScript UWP Project System 2.0 JavaScript UWP项目系统
Merq 1.1.17-rc(cba4571)命令总线,事件流和异步管理器 用于Visual Studio扩展。
Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual 2017年工作室 - v2.9.50719.1
适用于Visual Studio 0.3的Microsoft持续交付工具 简化连续构建集成的配置 从Visual Studio IDE中继续构建传递。
Microsoft JVM Debugger 1.0提供对连接的支持 Visual Studio调试器到JDWP兼容的Java虚拟机
基于Microsoft MI的调试器1.0提供对连接的支持 Visual Studio到MI兼容的调试器
Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC 封装
Visual Studio 4.7.4-pre(c2d89eb)的单调调试支持 使用Visual Studio调试Mono进程。
NuGet Package Manager 4.4.0 Visual Studio中的NuGet包管理器。 有关NuGet的更多信息,请访问http://docs.nuget.org/。
SQL Server数据工具15.1.61707.200 Microsoft SQL Server数据工具
TypeScript 2.3.5.0 Visual Studio的TypeScript工具
Visual Studio代码调试适配器主机包1.0互操作层 在Visual Studio中托管Visual Studio代码调试适配器
适用于通用Windows应用程序的Visual Studio工具15.0.27004.2002 适用于通用Windows应用程序的Visual Studio工具允许您构建一个 单一的通用应用体验,可以覆盖每个运行的设备 Windows 10:手机,平板电脑,PC等。它包括微软 Windows 10软件开发工具包。
使用Visual Studio的IoT组件的VisualStudio.IoT 1.0包
适用于Visual Studio的VisualStudio.Mac 1.0 Mac扩展
WebJobs Tools v1.0.0 15.0.30923.0 WebJobs Tools v1.0.0
Xamarin 4.7.10.22(fe36bec)启用Visual Studio扩展 开发Xamarin.iOS和Xamarin.Android。
Xamarin.Android SDK 8.0.0.33(HEAD / 7a6a056e8)Xamarin.Android 参考装配和MSBuild支持。
Xamarin.iOS和Xamarin.Mac SDK 11.2.0.8(9a9f054)Xamarin.iOS和 Xamarin.Mac参考装配和MSBuild支持。
我在这里填写了一个错误曲目https://connect.microsoft.com/VisualStudio/feedback/details/3142780