简体   繁体   English

WPF 和 Windows 10 崩溃

[英]WPF and Windows 10 crash

We have a WPF app that need to stay opened for a longer period of time (overnight) with different users that log on and off to the respective PC.我们有一个 WPF 应用程序,它需要与登录和注销相应 PC 的不同用户保持打开更长时间(一夜之间)。

[Update] The WPF app uses Single Instance technique from here: http://blogs.microsoft.co.il/blogs/arik/SingleInstance.cs.txt The single instance feature is not a cause for the bug [更新] WPF 应用程序使用这里的单实例技术: http : //blogs.microsoft.co.il/blogs/arik/SingleInstance.cs.txt 单实例功能不是错误的原因

There is a strange crash happening only in the following situation:只有在以下情况下才会发生奇怪的崩溃:

  1. OS is Windows 10操作系统是 Windows 10

  2. The following sequence of user sign in / sign off must happen:以下用户登录/注销顺序必须发生:

Account A is starting the app and logs off or locks the PC.帐户 A 正在启动应用程序并注销或锁定 PC。 Account B signs in during the night, works on the PC for a while and then logs off.帐户 B 在夜间登录,在 PC 上工作一段时间,然后注销。 Account A signs in again in the morning.帐户 A 在早上再次登录。 The app runs but is the UI is frozen/minimized.应用程序运行,但 UI 被冻结/最小化。 When clicked/ tried to be resized, the following error occurs:单击/尝试调整大小时,出现以下错误:

   System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at System.Windows.Media.Composition.DUCE.Channel.SyncFlush()
   at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
   at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(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)

I already reviewed these posts我已经查看了这些帖子

I tried the suggestions from the above posts with no luck.我尝试了上述帖子中的建议,但没有成功。

Also, I cannot reproduce the problem consistently.此外,我无法始终如一地重现该问题。 It seem that some time needs to pass between the logins so that the problem to appear.似乎需要在登录之间传递一些时间才能出现问题。

Thanks for any suggestion that you may have.感谢您提出的任何建议。

似乎这是已知的 WPF 错误: https : //github.com/dotnet/wpf/issues/439 2020 年 6 月 3 日尚无解决方案。

System.OutOfMemoryException or System.Runtime.InteropServices.COMException in System.Windows.Media.Composition.DUCE.Channel.SyncFlush() are usually caused by GDI objects or User objects leaks. System.Windows.Media.Composition.DUCE.Channel.SyncFlush() 中的 System.OutOfMemoryException 或 System.Runtime.InteropServices.COMException 通常是由 GDI 对象或 User 对象泄漏引起的。

You can monitor these leaks in Task Manager.您可以在任务管理器中监控这些泄漏。 Select "GDI objects" or "User objects" columns for this.为此选择“GDI 对象”或“用户对象”列。 If GDI objects count exceeds limit (10000 is default for windows) you get OutOfMemory exception in your application.如果 GDI 对象计数超过限制(Windows 默认为 10000),您的应用程序中会出现 OutOfMemory 异常。

Check your application for leak of System.Drawing namespace object references, icon handles that you forgot to destroy, etc...检查您的应用程序是否存在 System.Drawing 命名空间对象引用、您忘记销毁的图标句柄等的泄漏...

For more information see https://blogs.msdn.microsoft.com/dsui_team/2013/11/18/wpf-render-thread-failures/有关详细信息,请参阅https://blogs.msdn.microsoft.com/dsui_team/2013/11/18/wpf-render-thread-failures/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM