locked
ContextSwitchDeadlock was detected

    Question

  • Hi,

    An error "ContextSwitchDeadlock was detected" is thrown while trying to perform the click operations on ultragrid rows.

    The details of error are as follows:

    ContextSwitchDeadlock was detected
    Message: The CLR has been unable to transition from COM context 0x44d3a8 to COM context 0x44d5d0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

    Can anyone help me how to resolve the issues?

     

    Regards,

    Basava Kumar M

    Monday, November 22, 2010 3:28 AM

All replies

  • This may occur if you are running a Coded UI Test in debugging mode. But it will not affect the execution of your test if you disable it. Following is a way to overcome this:

    Disable ContextSwitchDeadlock exception in VS as follows:

    Go to Debug->Exceptions->'Managed Debugging Assistents'. Uncheck the check-box against ContextSwitchDeadlock.

    Monday, November 22, 2010 7:11 AM
  • Deepak,

    The issue is I am trybg to focus the cells inside a ultra grid so whenever i try to click on the records inside a grid its taking a long time and if i try to click on other cell inside a grid then i am getting the error mentioned.

    If I disable the Deadlock error option from debug error then the VS goes idle without executing the script. Can you let m e know the work around for selection of the cells inside the ultra grid.

    Basically I am trying to perform set of actions like verifying the cell values inside a search results grid (Its recorded as UIUltra grid and the records inside it are recorded as Wincells) but, VS fails to perform these actions and gives the deadlock error and if teh error optoin is deselected then VS becomes idle.

    Regards,

    Basava Kumar M

    P.S: VS unable to identify or record the properties of the records in the Search results grid by using UIBuilder or by Win+I. So I am trying to access the records by using the Tables and Cells method. However, ended with no success. Please let me know the workaround for this issue.

    Tuesday, November 23, 2010 5:39 AM
  • Is it a Infragistics grid ? We do not have any inbuilt support for Infragistics controls in the current release. Can you share the logs and the code that you have written to access the cells by referring the following blog post:

    http://blogs.msdn.com/b/gautamg/archive/2009/11/29/how-to-enable-tracing-for-ui-test-components.aspx

    I'll try to see if you can get it working.

    Please mail your files to deepak.singhalATmicrosoft.com

    Tuesday, November 23, 2010 6:34 AM
  • Deepak,

    Below are the error details:

    ContextSwitchDeadlock was detected
    Message: The CLR has been unable to transition from COM context 0x45dfd0 to COM context 0x45e1f8 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

    Thanks & Regards,

    Basava Kumar M

    I have a sent an email to personal email address with script.

    Tuesday, November 23, 2010 7:09 AM