Winforms application hanging, but only for specific user on specific machine?

Go To


I have a user who can't run a particular part of an application on his machine. It's only on this machine, for this user that the application hangs. The user can run it successfully on other machines under their credentials. Also, other users can run it successfully under their own credentials.

The event log is no help. It just says the application stopped responding. I added some logging to see how far the app gets before it stops recording the logging, but the last logging entry is in a part of the code that is inconsequential (i.e. showing a label).

I know the problem is in a backgroundworker because if I comment out the call to the backgroundworker_DOWORK, the app doesn't hang.

What could be the issue? I have no idea where to even start after trying all this. What types of issues could only to a specific user on a specific machine?

2012-04-04 20:26
by richard
This question is too vague. We need to see the code that is commented out to give you an idea of what could be happening - Josh 2012-04-04 20:36
If it's user-local it's something on his user account. Make him end all unnecessary processes. If it still happens make sure he has up to date .NET framework and such. If he does, then check everything like environmental variables which are local to him to see what's different on his accoun - Ashley Davies 2012-04-04 20:36
Does the application hangs or does it crash? If it crash, you should have some exception information in the event log - Vincent Hubert 2012-04-05 14:57


It was the TableAdapter.Fill methods, filling datasets which were bound to UI controls, filling with data apparently was causing big problems. Why it wasn't doing this for everyone, I have no idea.

See the answer here.

2012-04-12 00:21
by richard


Could be a few things:

  • A corrupted / missing registry key

  • A file permission problem

  • A settings that is saved in the user profile

Two approaches you can use:

  • Use Process Monitor to see if the problem occurs after the same access to some resource

  • Disable part of the background worker to isolate the code that causes the application to hang.

2012-04-04 20:57
by Vincent Hubert


Your question is pretty vague but it reminds of a random crashes I was experiencing using the BackgroundWorker. I sometimes would go weeks and never here of a complaint of the program crashing and on other days I would have 10 or so complaints. It turns out the problem I was experiencing was due to me modifying the UI. Modifying any UI values such as modifying the Text property of a text box is considered an unsafe thread call to the main thread. All UI modifications should be happening on the main thread and not in the DoWork methods. If you need to modify the UI you can use ReportProgress method of the background worker or modify your code that it checks for the InvokeRequired property see below. Reading values from the UI is not a problem it is only when you set/modify them.

private void SetText(string text)
    // InvokeRequired required compares the thread ID of the
    // calling thread to the thread ID of the creating thread.
    // If these threads are different, it returns true.
    if (this.textBox1.InvokeRequired)
        SetTextCallback d = new SetTextCallback(SetText);
        this.Invoke(d, new object[] { text });
        this.textBox1.Text = text;

Refer to

Reread your question and this part sticks out to me.

"it stops recording the logging, but the last logging entry is in a part of the code that is inconsequential (i.e. showing a label)."

If you are modifying the Visible property or modifying the Text of the label in the DoWork event handler this could very will be your problem. Again try moving that code to the ReportProgress event handler or use InovokeRequired method above to get around the issue.

2012-04-04 21:12
by Dan P


"The event log is no help. It just says the application stopped responding."

In these situations where you are getting a second chance exception (a first chance exception the debugger can catch - otherwise its a 2nd chance) simply use DebugDiag (which has many rules that you can run on the memory dump captured at the time of the hang). Alternatively you can use windbg, its pretty hard core but its worthwhile getting to know the basics.

I'm sure you can research more info, here's a start How to Use the Debug Diagnostic Tool

The best website to get more info is Tess Ferrandez:

2012-04-05 06:23
by Jeremy Thompson