The following code fails with the exception:
MyWindow wnd = new MyWindow(); wnd.Show();
The exception is rather strange, but as I understand it, its error in .net
System.ComponentModel.Win32Exception (0x80004005): The operation completed successfully at MS.Win32.UnsafeNativeMethods.GetDC(HandleRef hWnd) at System.Windows.Interop.HwndTarget..ctor(IntPtr hwnd) at System.Windows.Interop.HwndSource.Initialize(HwndSourceParameters parameters) at System.Windows.Interop.HwndSource..ctor(HwndSourceParameters parameters) 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.Window.Show()
The MyWindow object is a window with some vector graphics inside, but not too much. In addition, this happens when 10-20 MyWindow objects are already open and closed.
Decision. The reason was the leak of GDI objects. They created in my low level error code. Thus, the problem did not concern the MyWindow object.
source share