Win32Exception: Operation completed successfully

后端 未结 2 1712
温柔的废话
温柔的废话 2020-12-18 05:46

The following code crashes with an exception :

MyWindow wnd = new MyWindow();
wnd.Show(); //here an exception occurs

Exception is rather s

相关标签:
2条回答
  • 2020-12-18 06:17

    We have this problem in our project too...

    we were putting all view and view models to stack and then showing one by one them. Solution was to show elements one by one without making the stack.

    0 讨论(0)
  • 2020-12-18 06:36

    It doesn't bomb on a winapi error code, the actual error code is E_FAIL, a COM error code. Which is very unhelpful to diagnose anything, it doesn't mean anything more than "couldn't do it, no idea why". How GetDC() can produce that error code is very hard to guess, I suspect it is environmental with something hooking the winapi function. Perhaps something similar to remote desktop or a screen recorder. Do try running this on another machine.

    The "normal" reason for GetDC() failure is a handle leak. Windows stops giving a process more handles when it has consumed 10,000 of them already. Something you can diagnose with TaskMgr.exe, Processes tab. View + Select Columns and tick Handles, USER Objects and GDI Objects. First check the list of processes and verify that you don't have a process that consumes a lot of them. The total number of GDI Objects for all processes in a session is limited by the session pool size. Next run your program and keep an eye on the values for your process.

    0 讨论(0)
提交回复
热议问题