• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

Non pumping wait or processing a very long running operation in .net 2.0

I have a .net app that keeps getting this error.  I am using a for/loop and that I know should run for about 1 min.  It works somtimes and other times I get this error.  This is a console application.  On a form I have used application.doevent() to fix this.  Any way I can fix this?
0
chadmanvb
Asked:
chadmanvb
1 Solution
 
käµfm³d 👽Commented:
You are doing a lengthy process inside of the main loop of you application. The main loop handles the management of your GUI, and when you do lengthy operations on this thread (remember that what seems short to you can be an eternity for a computer), you prevent the GUI from processing its messages (e.g. draw window, display text, move here, etc). You should be spawning a separate thread, using a BackgroundWorker, or using the ThreadPool to perform you lengthy operation. There are dozens of articles describing each option right here on EE.
0
 
chadmanvbAuthor Commented:
I ended up just chaning it to a form appliction and adding the application.doevents.  I think the seperate process would have also worked.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now