Problem sorting a treeview control. It blocks the entire application waiting for a COM status change RRS feed

  • Question

  • This is the message I'm getting in express edition (translated from Spanish, but it hope it is understandable in english)

    The CLR could not have realized the transition of the context COM 0x586fe8 to the context COM 0x587158 during 60 seconds. It is probable that the subprocess that contains the context or apartment of destination(destiny) is in wait without providing messages or that it(he,she) tries an operation of very long execution that does not provide messages Windows. Normally, this situation has a negative impact in the performance(yield) and can do that the application does not answer or that it(he,she) accumulates constant the use of the memory(report). To avoid this problem, all the subprocesses of apartments of the only(unique) subprocess (STA) should use primitive(original) of wait that messages provide (as CoWaitForMultipleHandles) and to provide messages regularly during long operations of execution.

    Any ideas? I can't sort a treeview when it has a complex structure. I've even made my own sorting algorithm to see if I could solve it, but no success as I did get the same problem when swaping two tree nodes at a given position.... I'm really stuck at this.
    Manel Ibáñez
    Monday, January 25, 2010 9:59 AM

All replies

  • Hi,
    So, you received an exception when sorting a treeview? or the application hang?
    If it is an exception, could you post the call stack here, as well as the error code for this exception, it will be helpful for further investigations. 


    Please remember to mark helpful replies as answers.
    Tuesday, January 26, 2010 8:17 AM
  • The application hungs. It is like waiting forver in the Tree.Sort instruction. I've seen that if I remove the Tree.BeginUpdate() before the sort call, and the Tree.EndUpdate() after, the application just stops for some seconds and then it continues normally, so it seems like a side effect of the BingUpdate function + sort funtion.
    Don't know exactly what's going on in the background tho,

    Manel Ibáñez
    Tuesday, January 26, 2010 7:05 PM