Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

[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

There is a strange crash happening only in the following situation:

  1. OS is 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. Account B signs in during the night, works on the PC for a while and then logs off. Account A signs in again in the morning. The app runs but is the UI is frozen/minimized. 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

  • win32 window in WPF
  • https://social.msdn.microsoft.com/Forums/vstudio/en-US/a29b9b58-376c-49b7-a6b7-fba6a510524a/wpf-and-windows-10-crash?forum=wpf
  • http://www.actiprosoftware.com/community/thread/3849/minimize-navbar-floating-window-size-out-of-m

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.

like image 569
phazzy Avatar asked Nov 01 '16 10:11

phazzy


People also ask

Is Microsoft still supporting WPF?

Net Core 3.0. This demonstrates that Microsoft still has faith in WPF as a user interface framework, and the company is still willing to invest in it by updating and integrating it with its new offerings.” “Microsoft released WPF, WinForms, and WinUI on the same day it released.NET Core 3.0 Preview 1.

Does WPF have a future?

This move clearly explains that Microsoft sees a future in WPF and considers it as a UI framework for the . NET platform. Microsoft has really invested a lot in WPF by making it open source and making it work on . NET Core.

Does .NET 5 support WPF?

It has support for all kinds of . NET applications, including the Windows desktop platforms such as WPF, Windows Forms, and WinUI 3.0. In this article, I'll talk about what . NET 5 means for desktop developers and how to migrate your existing applications to .


1 Answers

Seems this is known WPF bug: https://github.com/dotnet/wpf/issues/439 No solution yet on June 3, 2020.

like image 168
hellobody Avatar answered Nov 11 '22 19:11

hellobody