System.ComponentModel.Win32Exception: The operation completed successfully

前端 未结 8 1458
無奈伤痛
無奈伤痛 2020-12-04 22:20

I am getting this exception sometimes while running my Windows Forms app for a long time:

System.ComponentModel.Win32Exception: The operation completed succe         


        
8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 22:39

    Windows has a hard limit of 10000 handles per process. The rather unhelpful exception "The operation completed successfully" might indicate that this limit was reached.

    If this happened because of a resource leak in your code, then you are in luck, as you at least have the opportunity to fix your code.

    Unfortunately, there is scarcely little you can do about handles created internally by WinForms. For example, the prolific creation of font handles by TreeView control makes it hard to use in a scenario where very large tree needs to be represented in UI.

    Some useful links:

    http://support.microsoft.com/kb/327699 http://nomagichere.blogspot.com/2008/03/systemcomponentmodelwin32exception-is.html

提交回复
热议问题