wpf System.InvalidOperationException:调度程序处理已挂起,但仍在处理邮件

dsekswqp  于 2023-06-24  发布在  其他
关注(0)|答案(1)|浏览(137)

我正在转换一个MFC应用程序在x64。这个应用程序有一些WPF控件/对话框。我遇到的问题是,对于少数用户,显示WPF控件/对话框不起作用。我得到这个例外:

System.InvalidOperationException: Dispatcher processing has been suspended, but messages are still being processed.
   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 MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Threading.WaitHandle.WaitOneNative(SafeHandle waitableSafeHandle, UInt32 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext)
   at System.Threading.WaitHandle.InternalWaitOne(SafeHandle waitableSafeHandle, Int64 millisecondsTimeout, Boolean hasThreadAffinity, Boolean exitContext)
   at System.Windows.Input.PenThreadWorker.WorkerCreateContext(IntPtr hwnd, IPimcTablet pimcTablet)
   at System.Windows.Input.TabletDevice.CreateContext(IntPtr hwnd, PenContexts contexts)
   at System.Windows.Input.TabletDeviceCollection.CreateContexts(IntPtr hwnd, PenContexts contexts)
   at System.Windows.Input.PenContexts.Enable()
   at System.Windows.Input.StylusLogic.RegisterHwndForInput(InputManager inputManager, PresentationSource inputSource)
   at System.Windows.Interop.HwndStylusInputProvider..ctor(HwndSource source)
   at System.Windows.Interop.HwndSource.Initialize(HwndSourceParameters parameters)
   at System.Windows.Forms.Integration.ElementHost.OnHandleCreated(EventArgs e)
   at System.Windows.Forms.Control.WmCreate(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Integration.ElementHost.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

应用程序比挂起几秒钟和崩溃。
有没有人在64位的MFC/WPF中遇到过类似的问题?

9njqaruj

9njqaruj1#

有趣的是你提到64位,因为我刚刚通过启用“首选32位”解决了这个错误。
你有没有更好地理解这一点?嗯,我知道已经10年了,哈哈。

详情请看我的问题。

相关问题