本文介绍了System.ComponentModel.Win32Exception未处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时打开应用程序时会出现此错误。日志是

I got this error sometimes when the application is opened. The log is

[案例#1]

System.ComponentModel.Win32Exception未处理

  HResult = -2147467259

 消息=창핸들을만드는동안오류가발생했습니다。

  Source = System.Windows.Forms

  ErrorCode = -2147467259

  NativeErrorCode = 1158

  StackTrace:

       위치:System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)

       위치:System.Windows.Forms.Control.CreateHandle()

       위치:System.Windows.Forms.Control.get_Handle()

       위치:System.Windows.Forms.Control.CreateGraphicsInternal()

       위치:System.Windows.Forms.ThreadExceptionDialog..ctor(例外t)

       위치:System.Windows.Forms.Application.ThreadContext.OnThreadException(例外t)

       위치:System.Windows.Forms.Control.WndProcException(例外e)

       위치:System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(例外e)

       위치:System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)

  InnerException:
[Case #1]
System.ComponentModel.Win32Exception was unhandled
  HResult=-2147467259
  Message=창 핸들을 만드는 동안 오류가 발생했습니다.
  Source=System.Windows.Forms
  ErrorCode=-2147467259
  NativeErrorCode=1158
  StackTrace:
       위치: System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
       위치: System.Windows.Forms.Control.CreateHandle()
       위치: System.Windows.Forms.Control.get_Handle()
       위치: System.Windows.Forms.Control.CreateGraphicsInternal()
       위치: System.Windows.Forms.ThreadExceptionDialog..ctor(Exception t)
       위치: System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
       위치: System.Windows.Forms.Control.WndProcException(Exception e)
       위치: System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(Exception e)
       위치: System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  InnerException:

推荐答案

在堆栈跟踪中:

错误代码1158(0x486):当前进程已使用其窗口管理器对象的所有系统允许句柄。

Error Code 1158 (0x486): The current process has used all of its system allowance of handles for Window Manager objects.

这意味着您的应用程序具有处理泄漏导致超出句柄限制。

Which means that your application have a handle leak cause beyond the limitation of handles.

尝试调试应用程序,找出导致句柄泄漏的原因。例如检查
是否有任何参考未被处置且任何事件不是需要时进行反注册。

Try to debug your application, and find what cause the handle leak. Such as check whetherany reference is not dispose and any event is not Anti-registration when they need to do.

最好的问候,

Bob


这篇关于System.ComponentModel.Win32Exception未处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-17 09:19
查看更多