473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

A simple thread freezes between DoWork and RunWorkerCompleted

I am running an application that, when not used, just sits there firing a
BackgroundWorker every 20 seconds. Every now and then, the BackgroundWorker
freezes between the DoWork and RunWorkerCompleted procedures. My simplified
procedures are shown below. They endlessly write messages to a text file.
At some point it never moves from DoWork to RunWorkerCompleted. I do have
services such as Outlook and Norton SystemWorks running in the background.
Any ideas why the BackgroundWorker freezes between these procedures for no
apparent reason. Could it be some other background service causing the
problem? It has never ran a complete day without freezing.

Each of these procedures has error trapping that shows a message if there is
an error. I never see the message indicating that whatever is happening is
not caused by a trappable error.

Private Sub BackgroundWorker1_DoWork(XXXX) Handles BackgroundWorker1.DoWork
C.DoMsg(Now & " BackgroundWorker1_DoWork -2")
C.DoMsg(Now & " BackgroundWorker1_DoWork Finish")
End Sub

Private Sub BackgroundWorker1_RunWorkerCompleted(XXXX) Handles
BackgroundWorker1.RunWorkerCompleted
C.DoMsg(Now & " BackgroundWorker1_RunWorkerCompleted Start")
C.DoMsg(Now & " BackgroundWorker1_RunWorkerCompleted Finish")
End Sub

Friend Sub DoMsg(ByVal psMsg As String)
Debug.Print(psMsg)
Dim oSW As StreamWriter = New StreamWriter("C:\Temp\AppMsg.txt", pbAppend)
oSW.WriteLine(psMsg)
oSW.Close()
End Sub

My code in the timer is:

If Not BackgroundWorker1.IsBusy Then
Me.BackgroundWorker1.RunWorkerAsync()
End If

********Sample log.
6/14/2006 1:13:39 AM BackgroundWorker1_RunWorkerCompleted Finish
tmrAutoRecover_Tick
6/14/2006 1:13:39 AM BackgroundWorker1_DoWork -2
6/14/2006 1:13:39 AM BackgroundWorker1_DoWork Finish
6/14/2006 1:13:39 AM BackgroundWorker1_RunWorkerCompleted Start
6/14/2006 1:13:39 AM BackgroundWorker1_RunWorkerCompleted Finish
tmrAutoRecover_Tick
6/14/2006 1:13:51 AM BackgroundWorker1_DoWork -2
6/14/2006 1:13:51 AM BackgroundWorker1_DoWork Finish
6/14/2006 1:13:51 AM BackgroundWorker1_RunWorkerCompleted Start
6/14/2006 1:13:51 AM BackgroundWorker1_RunWorkerCompleted Finish
tmrAutoRecover_Tick
6/14/2006 1:14:07 AM BackgroundWorker1_DoWork -2
6/14/2006 1:14:07 AM BackgroundWorker1_DoWork Finish
********Log stops at this point, Application is frozen.

Jun 14 '06 #1
0 2650

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Pieter | last post by:
Hi, I'm having some weird problem using the BackGroundWorker in an Outlook (2003) Add-In, with VB.NET 2005: I'm using the BackGroundWorker to get the info of some mailitems, and after each item...
3
by: Ryan Pedersen | last post by:
I have a small program that executes a single very long running background thread today. The scope of all variables in the method that is running in this thread today are all local to the...
7
by: Tommaso Caldarola | last post by:
How to I can know the UI thread? I need to do a switch context before to read/write some data. Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
3
by: John Wright | last post by:
I have a background worker thread that scans the network listing computers that are connected. I have a delegate that I call that invokes a procdure that loads a dataset with computer names and...
8
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
9
by: Pubs | last post by:
Hi all, I want to call a function with some intial parameters with in a thread. At the end of the function execution it should return a value to the caller. Caller is outside the thread. ...
2
by: vapordan | last post by:
Can someone spot the issue in this background thread implementation? The docs say, the RunWorkerCompleted must fire irrespective of exception. It does so on my machine when there is no loop. When...
9
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I've got a routine that builds a table using different queries, different SQL Tables, and adding custom fields. It takes a while to run (20 - 45 seconds) so I wrote a thread to handle the table...
2
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
Using Visual Studio 2005 Professional: I have two thread routines in one project at this time. One came from me dropping a BackgroundWorker component on my form and setting the properties for...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.