MDA Error : ContextSwitchDeadlock was detected
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: MDA Error : ContextSwitchDeadlock was detected

  1. #1
    Join Date
    Jul 2006
    Posts
    14

    MDA Error : ContextSwitchDeadlock was detected

    Dear All,

    Good night.

    I tried to run a C# code, and i have got the following errors:
    ContextSwitchDeadlock was detected
    Message: The CLR has been unable to transition from COM context 0x1b2008 to COM context 0x1b2178 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.


    My Code :

    FileStream fs = new FileStream(newPath, FileMode.Append, FileAccess.Write);
    StreamWriter sw = new StreamWriter(fs);

    for (int i = 0; i < dsCustInvoice.Tables[0].Rows.Count; i++)

    {


    //i used this code to call http site.
    string url = "XXXXX";





    sw.WriteLine("Test"); // Write to the file

    wc.DownloadString(url); // download URL.

    }



    I hope find any solution.

  2. #2
    Join Date
    Jul 2006
    Posts
    14

    Re: MDA Error : ContextSwitchDeadlock was detected

    Dear ,

    I need help
    at least show me how to use
    ContextSwitchDeadlock.

  3. #3
    Join Date
    Dec 2010
    Posts
    12

    Re: MDA Error : ContextSwitchDeadlock was detected

    Is wc reference of webclient object ?

  4. #4
    Join Date
    Oct 2004
    Posts
    7

    Re: MDA Error : ContextSwitchDeadlock was detected


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center