Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6792191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:56:21+00:00 2026-05-26T17:56:21+00:00

i have a class in c# (.net 3.5 cp, vs2010) which executes complex comuptations

  • 0

i have a class in c# (.net 3.5 cp, vs2010) which executes complex comuptations which ussually take a long time. After a minute there is thrown an exception, that ContextSwitchDeadlock was detected. Exception is localised, to my non english language so i cant copy paste, but meaning is following:
¨
CLR module could not transition from context COM … to context COM … for 60 seconds. Subproces which owns target context/apartment is probably doing a non-pumping wait or processing a very long running operation without pumping Windows system messages.

Basicaly, it looks like my application is computing and not responding to windows for a long time and visual studio shuts it down and reports problable deadlock.

I was trying to do some research and found two solutions:

  1. Disable some option in visual studio debbuger to detect deadlocks. Dost not work for me because it woirks only for debugging purposes.

  2. Call some DoEvents method, but it was for windows forms and not WPF and i am using WPF.

There was also suggestion to create separate thread, but i am complete new to threading and dont know what should i do. Any suggestions please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:56:21+00:00Added an answer on May 26, 2026 at 5:56 pm

    It is just a warning from a Managed Debugging Assistant (MDA). Your code is violating a pretty hard requirement for Single Threaded Apartment (STA) threads, they are not allowed to block for long periods. The warning is real enough, blocking the UI thread can easily cause deadlock. But the explanation in your case is simple, it just goes catatonic because it is busy computing, not because it actually blocked. The MDA can’t tell the difference.

    You can turn off the warning with Debug + Exceptions, open the Managed Debugging Assistants node and untick ContextSwitchDeadlock.

    That still leaves the user with a window on her desktop that is dead to the world, not exactly a great user experience. And it can have side-effects, causing other programs to become unresponsive when they send messages to toplevel windows.

    You do need to use threading to really solve this problem. Have a look at BackgroundWorker, it is well documented in the MSDN Library and many other places.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have .NET project using VS 2010 Pro, Some of the class name in
I have a simple .NET dll built with VS2010 C# that exposes 2 static
Say I have a .NET class like so: public class Person { public string
I am working on a C#.NET class library project in VS2010. In my project
I have a VS2010 solution with a hello world WPF Application and a Class
I have VS2010, MVC3 and ASP.NET 4.0 with a simple test mvc application. The
So I have an ASP.NET web site (not web application) I'm making in VS2010
I have a Console App created in VS 2010 targeting .NET 4.0. According to
can anyone help? I have a solution in vs 2010 which contains a WCF
I have a very simple table in access. The data is stored from VB.NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.