WinForms application hang due to SystemEvents.OnUserPreferenceChanged event

后端 未结 4 1005
情话喂你
情话喂你 2020-11-29 10:48

I\'ve been dealing with a strange application hang in my clients installations. After trying several things i reached the conclusion that without a dump it won\'t work. So I

4条回答
  •  天命终不由人
    2020-11-29 11:32

    Well, you have thee classic problem of control 'creation' on non UI thread.

    • It may be you are creating the control.
    • Access to some property creates a control underneath without you knowing (rare).
    • Access to the Handle property before it is been created (may be indirectly).
    • Fooled by InvokeRequired (ref 1), (ref 2).

    Great read on the subject: (ref 1) (ref 2) and (ref 3).

    I don't know of a way to find the control in a dump (tried myself) but you can try to set a breakpoint in code as described in (ref 4) and (ref 5).

    Cheers.

    Reference:

    1. Mysterious Hang or The Great Deception of InvokeRequired

    2. Control.Trifecta: InvokeRequired, IsHandleCreated, and IsDisposed

    3. .NET 2.0 WinForms multithreading and a few long days

    4. Debugging UI

    5. The case of the leaking thread handles

提交回复
热议问题