本文记录一位用户和我反馈的微信截图开启之后 WPF 应用就会卡住的问题,此时的行为就是任何程序的窗口都无法被激活,只有从任务管理器干掉 WPF 应用的进程才能恢复

我拿了 WPF 应用的堆栈信息如下,看起来是卡在 UXTheme.dll 上,但是不知道里面在执行什么逻辑

> user32.dll!_NtUserMessageCall@28() 
  user32.dll!_RealDefWindowProcW@16()
  uxtheme.dll!DoMsgDefault(struct _THEME_MSG const *)
  uxtheme.dll!_ThemeDefWindowProc(struct HWND__ *,unsigned int,unsigned int,long,int)
  uxtheme.dll!_ThemeDefWindowProcW@16()
  user32.dll!_DefWindowProcW@16()
  user32.dll!_InternalCallWinProc@20() 
  user32.dll!_UserCallWinProcCheckWow@32() 
  user32.dll!_CallWindowProcAorW@24()
  user32.dll!_CallWindowProcW@20() 
  [托管到本机的转换]  
  WindowsBase.dll!MS.Win32.HwndSubclass.DefWndProcWrapper(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) 
  [本机到托管的转换]  
  user32.dll!_InternalCallWinProc@20() 
  user32.dll!_UserCallWinProcCheckWow@32() 
  user32.dll!_CallWindowProcAorW@24()
  user32.dll!_CallWindowProcW@20() 
  [托管到本机的转换]  
  WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) 
  [本机到托管的转换]  
  user32.dll!_InternalCallWinProc@20() 
  user32.dll!_UserCallWinProcCheckWow@32() 
  user32.dll!_DispatchClientMessage@24() 
  user32.dll!___fnDWORD@4()
  ntdll.dll!7728013a() 
  [下面的框架可能不正确和/或缺失,没有为 ntdll.dll 加载符号]  
  [托管到本机的转换]  
  WindowsBase.dll!System.Windows.Threading.Dispatcher.GetMessage(ref System.Windows.Interop.MSG msg, System.IntPtr hwnd, int minMessage, int maxMessage) 
  WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) 
  WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) 
  WindowsBase.dll!System.Windows.Threading.Dispatcher.Run()
  PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore = null) 
  PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window = null)
  PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window = null)
  PresentationFramework.dll!System.Windows.Application.Run() 
  lindexi.dll!Cvte.lindexi.Program.Main(string[] args = {string[2]}) 
  [本机到托管的转换]  
  hostpolicy.dll!542463c4()
  hostpolicy.dll!542465c2()
  hostpolicy.dll!54246d75()
  hostfxr.dll!72bf9ad3() 
  hostfxr.dll!72bfb909() 
  hostfxr.dll!72bfd594() 
  hostfxr.dll!72bfbc98() 
  hostfxr.dll!72bf6f1b() 
  lindexi.exe!003701ed()
  lindexi.exe!0037053a()
  lindexi.exe!0037166c()
  kernel32.dll!765a344d()
  ntdll.dll!772a9802() 
  ntdll.dll!772a97d5() 

换成 QQ 截图没有能够复现问题,期待后续腾讯的伙伴能够帮忙修复


本文会经常更新,请阅读原文: https://blog.lindexi.com/post/%E8%AE%B0%E5%BE%AE%E4%BF%A1%E6%88%AA%E5%9B%BE%E5%AF%BC%E8%87%B4-WPF-%E5%BA%94%E7%94%A8%E5%8D%A1%E4%BD%8F-%E7%AA%97%E5%8F%A3%E6%97%A0%E6%B3%95%E6%BF%80%E6%B4%BB%E9%97%AE%E9%A2%98.html ,以避免陈旧错误知识的误导,同时有更好的阅读体验。

如果你想持续阅读我的最新博客,请点击 RSS 订阅,推荐使用RSS Stalker订阅博客,或者收藏我的博客导航

知识共享许可协议 本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可。欢迎转载、使用、重新发布,但务必保留文章署名林德熙(包含链接: https://blog.lindexi.com ),不得用于商业目的,基于本文修改后的作品务必以相同的许可发布。如有任何疑问,请 与我联系

微软最具价值专家


无盈利,不卖课,做纯粹的技术博客

以下是广告时间

推荐关注 Edi.Wang 的公众号

欢迎进入 Eleven 老师组建的 .NET 社区

以上广告全是友情推广,无盈利