I've used BackgroundWorkers quite a bit, but I've never experienced this problem before. My program analyses the output from a logic analyser producing packets, of which there are thousands. To prevent too much delay updating the ListView in my form (I was previously reporting each one as it was found, and the form was completely unrespo...
Hi,
Recently our WPF/Entity Framework 4.0 application has become unstable after we began using backgroundworkers in order to load data from the entity. We were doing so in order to have a 'Please Wait'-spinner graphic running while the BG worker retrieved data from the database, but we began experiencing numerous EF-related connection i...
Hi,
I have written a code to save the image which is generated by the application. The size of image is around 32-35 MB. While saving the image to a bmb file, it is taking long time around 3-5 secs. For the purpose, I have used background worker but when running background worker, it shows an error like..."cant access the object as it i...
I want to run some code from an ASP.NET MVC controller action in a new thread/asynchronously. I don't care about the response, I want to fire and forget and return the user a view while the async method runs in the background. I thought the BackgroundWorker class was appropriate for this?
public ActionResult MyAction()
{
var backgro...
I have a program that uses threads to perform time-consuming processes sequentially. I want to be able to monitor the progress of each thread similar to the way that the BackgroundWorker.ReportProgress/ProgressChanged model does. I can't use ThreadPool or BackgroundWorker due to other constraints I'm under. What is the best way to all...
I am doing little hobby project in C#, a language I do not know well, and have stumbled upon the following:
Suppose you have an asynchronous operation implemented by using BackgroundWorker. Now if there is an exception, event RunWorkerCompleted will be raised and RunWorkerCompletedEventArgs.Error will be non-null.
Is the following the ...
Here is my scenario:
On a form I have list of direcotories, Button and control to display multiline text.
In a loop I try to find all files in each directory and delete them.
When file is deleted i want to add text to multiline control.
My problem is that when text is added I can not do anything else. Form is blocked and if I try do do a...
Hi there
I have a problem with my BackgroundWorker placed in a UserControl.
My WPF application has a navigation on the left and each entry loads its own UserControl where the user can generate a PDF file.
Because the creation of the PDF takes some time I've implemented a BackgroundWorker which does the job and additionally I disable s...
Hi all!
I have WPF application that performs some calculations in BackgroundWorker. The problem is that when I try to update property (which calls NotifyPropertyChanged in setter) in RunWorkerCompleted event handler I get InvalidOperationException - The calling thread cannot access this object because a different thread owns it.
This M...
I have a small form that creates two background worker threads which listen for messages from two separate server processes. When the user attempts to close the form, I handle the OnFormClosing event (or they can click an 'Exit menu item) which calls CancelAsync() on both threads. The form then waits until the IsBusy property for both ...
I need to perform background processing for a Ruby on Rails app. I'd like to use delayed_job but it depends on Daemons which is not Windows compatible (needs the fork() function).
Does anyone have suggestions for an alternative background processing library compatible with Windows that I can use with delayed_job? Or is it best just to u...
I'm using the AsyncDelegateCommand class from this blog post but I'm having trouble knowing what to do with exceptions that occur in my action delegate. I create the following command:
new AsyncDelegateCommand(
readFile, // action to perform
() => shouldReadFile, // can the action be executed?
obj => readFileFinished(true),...
Hi, guys.
Here's my concern.
We have an application in WPF that shows data via ObservableCollection. After 5 minutes, I want to refresh the data.
I thought I could use the System.Timers.Timer object for its Elapsed event and then call a BackgroundWorker to call the method that starts the job. The method is on a ViewModel class.
But i...
I have a legacy .NET 2.0 Windows Form application that contains a form that uses a component model BackgroundWorker component.
The event handler for the DoWork event makes a call to WindowsIdentity.GetCurrent() to retrieve the identity of the user and then utilizes the Name of the identity. Recently, the call to WindowsIdentity.GetCurre...
I have a background thread that is sending data about the application's current status to a server. The thread is supposed to constantly - or at least whenever the status changes - send this data.
The data is coming from the UI and the user is able to change the status any moment (by moving with the finger over the screen), so I need to...
I have experienced an odd behavior of the BackgroundWorker or the .NET framework when rethrowing an Exception in the RunWorkerCompleted event.
Exceptions occuring in the background thread are passed to RunWorkerCompleted. There I do a object temp = e.Result to rethrow the exception. Since this is supposed to happen in the main UI thread...
I am working with a fairly complex GUI and am trying to pass a lot of data from the GUI to a backgroudWorker. The problem I am running into is accessing some of the GUI values from the background worker. For example, if I try to get ComboBox.Text I get a InvalidOperationException due to cross-threading. However, if I say do TextBox.Text,...
hello,
in my class i use a BackgroundWorker. at some point i need to cancel the asynchronous operation that can be in progress and start another one immediately. the code follows. one thing that i am not sure about is the race condition that can occur if the worker completes right before i assign my lambda to RunWorkerCompleted event. i...
I'm trying to figure out the best way to handle a backgroundworker that is triggered off radio button clicks. I created a very simple form with 3 radio buttons and a label. Each of the radio buttons share the same event radioButton_CheckedChanged. If the event completes then I update the label to "Complete". If you click another radio...