Re: UI freeze and thread problems

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On 1 Feb, 15:01, Rohit Kumbhar <rohit.kumb...@xxxxxxxxx> wrote:
Hi,

I am writing a Windows Forms C# application [I am new to C#] for reading
files on the disk. My problem is the UI freezes when restored after
being minimized for a long time [20-30 minutes].

I have a separate thread which does the reading and updates the UI [two
datagridviews, two labels and a button control]. I ran against the cross
thread UI calls when debugging and corrected the error by using
delegates and "InvokeRequired" property.

Running the application in Debug mode and checking for cross thread call
exception is the test I am using for checking this.

Another issue that I am facing is the dieing/killing of the reading
thread. No exceptions. No event logs. The thread just dies, I can't
understand why. The UI freeze and thread dying usually happen together.
I am doing GC.Collect(), Application.DoEvents() and Thread.Sleep(200)
after every file read and processed. For a try, I wrote the handler for
GotFocus event of the form to explicitly invalidate the controls.
Doesn't help.

My biggest problem is all this happens randomly, not for a particular
file or file type.

Using .NET version 2.0 with the latest updates.

What am I missing?

Regards
Rohit

Are you using BeginInvoke when working with the controls on the UI
thread? or just changing properties?

Have you added a a domain unhandled exceptioin handler?

AppDomain.CurrentDomain.UnhandledException+=new
UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);


.



Relevant Pages

  • UI freeze and thread problems
    ... My problem is the UI freezes when restored after being minimized for a long time. ... I have a separate thread which does the reading and updates the UI. ... Running the application in Debug mode and checking for cross thread call exception is the test I am using for checking this. ... No event logs. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: I took your advice, Art
    ... 40 years ago I was working for Johnson Controls in Sacramto ... Life is not always where the money is, ... If you've been reading my snot, ... finance, banking (as relates to the world economy, ...
    (sci.research.careers)
  • Re: pylint -- should I just ignore it sometimes?
    ... pronoun for the caught exception. ... read everything so you're reading through quickly. ... Strictly speaking, actually, no. ... fact natural words, but you're more likely to overlook typos or miss ...
    (comp.lang.python)
  • Re: top 10 reasons emulation is not a good as the real arcade
    ... are better than emulation (besides controls)? ... The history of the actual cab. ... The discovery's made inside the cab; could be a dead rat, ... after reading Al's page on Cap kits - THANKS AL!) ...
    (rec.games.video.arcade.collecting)
  • Re: Ole Automation of Project 2000
    ... > Project and read/save data to Excel for analysis. ... Reading a blank line causes my application to ... > an exception but I have not been able to track down the source of the ... I have experimented with the windows function VarIsEmpty, ...
    (microsoft.public.project.vba)