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 1025259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:54:07+00:00 2026-05-16T11:54:07+00:00

I have a multi-threaded application build in C# using VS2010 Professional. It’s quite a

  • 0

I have a multi-threaded application build in C# using VS2010 Professional. It’s quite a large application and we’ve experienced the classing GUI cross-threading and deadlock issues before, but in the past month we’ve noticed the appears to lock up when left idle for around 20-30 minutes.

The application is irresponsive and although it will repaint itself when other windows are dragged in front of the application and over it, the GUI still appears to be locked… interstingly (unlike if the GUI thread is being used for a considerable amount of time) the Close, Maximise and minimise buttons are also irresponsive and when clicked the little (Not Responding…) text is not displayed in the title of the application i.e. Windows still seems to think it’s running fine.

If I break/pause the application using the debugger, and view the threads that are running. There are 3 threads of our managed code that are running, and a few other worker threads whom the source code cannot be displayed for.

The 3 threads that run are:

  1. The main/GUI thread
  2. A thread that loops indefinitely
  3. A thread that loops indefinitely

If I step into threads 2 and 3, they appear to be looping correctly. They do not share locks (even with the main GUI thread) and they are not using the GUI thread at all. When stepping into the main/GUI thread however, it’s broken on Application.Run…

This problem screams deadlock to me, but what I don’t understand is if it’s deadlock, why can’t I see the line of code the main/GUI thread is hanging on?

Any help will be greatly appreciated! Let me know if you need more information…

Cheers,

Roo

—————————————————–SOLUTION————————————————–

Okay, so the problem is now solved. Thanks to everyone for their suggestions! Much appreciated! I’ve marked the answer that solved my initial problem of determining where on the main/UI thread the application hangs (I handn’t turned off the “Enable Just My Code” option).

The overall issue I was experiencing was indeed Deadlock, however. After obtaining the call-stack and popping the top half of it into Google I came across this which explains exactly what I was experiencing…

http://timl.net/

This references a lovely guide to debugging the issue…

http://www.aaronlerch.com/blog/2008/12/15/debugging-ui/

This identified a control I was constructing off the GUI thread. I did know this, however, and was marshalling calls correctly, but what I didn’t realise was that behind the scenes this Control was subscribing to an event or set of events that are triggered when e.g. a Windows session is unlocked or the screensaver exits. These calls are always made on the main/UI thread and were blocking when it saw the call was made on the incorrect thread. Kim explains in more detail here…

http://krgreenlee.blogspot.com/2007/09/onuserpreferencechanged-hang.html

In the end I found an alternative solution which did not require this Control off the main/UI thread.

That appears to have solved the problem and the application no longer hangs. I hope this helps anyone who’s confronted by a similar problem.

Thanks again to everyone on here who helped! (and indirectly, the delightful bloggers I’ve referenced above!)

Roo

—————————————————–SOLUTION II————————————————–

Aren’t threading issues delightful…you think you’ve solved it, and a month down the line it pops back up again. I still believe the solution above resolved an issue that would cause simillar behaviour, but we encountered the problem again.

As we spent a while debugging this, I thought I’d update this question with our (hopefully) final solution:

The problem appears to have been a bug in the Infragistics components in the WinForms 2010.1 release (no hot fixes). We had been running from around the time the freeze issue appeared (but had also added a bunch of other stuff too). After upgrading to WinForms 2010.3, we’ve yet to reproduce the issue (deja vu). See my question here for a bit more information: ‘.NET 4.0 and the dreaded OnUserPreferenceChanged Hang‘. Hans has given a nice summary of the general issue.

I hope this adds a little to the suggestions/information surrounding the nutorious OnUserPreferenceChanged Hang (or whatever you’d like to call it).

Cheers,

Roo

  • 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-16T11:54:08+00:00Added an answer on May 16, 2026 at 11:54 am

    Check where it’s hanging in Application.Run; disable Just My Code in Debugger Options, then look at the call stack.

    I’ve fixed an application that deadlocked in Application.Run because it was trying to remove an event handler from an object that a different thread was locked on. (Until the C# 4.0 compiler, event handler accessors implicitly lock(this))

    However, if you’re using VS2010, that isn’t the exact issue.

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

Sidebar

Related Questions

I have a multi-threaded application that is using pthreads. I have a mutex() lock
I have a multi-threaded application, I'm using pthreads with the pthread_mutex_lock function. The only
I've been ask to build a multi-threaded java application using the java.util.concurrent library. I'm
I have a multi threaded application that writes to a settings xml file using
I have a multi-threaded application in C# which tries to write to a TextBox
I have a multi threaded python application communicating with a separate service trough UDP.
This is the strangest thing! I have a multi-threaded client application written in Python.
To access the properties of windows controls in multi threaded application, I have modified
I have done strace on my multi-threaded c++ application running on linux after couple
i have a multi-threaded application which wants to send a sequence of data to

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.