Command.Wait() inside BackgroundWorker.DoWork() kill the app
See original GitHub issueHi,
I try to run several Command
and it works fine. the problem is i’d like to report progress in a winform using BackgroundWorker for respectful syncing on the UI thread.
But the app crash without respect for any try catch at first Command.Wait() during debug.
Any idea ?
Issue Analytics
- State:
- Created a year ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
c# - Waiting BackgoundWorker.DoWork() to finish
DoEvents() is a nasty hack to allow the RunWorkerCompleted event handler to run. Never write code like this, re-entrancy bugs kill you dead....
Read more >Cancelling the BackgroundWorker
The cancel button simply calls the CancelAsync() method - this will signal to the worker that the user would like to cancel the...
Read more >Thread: Modal Wait Dialogue with BackgroundWorker
You basically write a normal DoWork event handler for a BackgroundWorker, as well as optional ProgresssChanged and RunWorkerCompleted event ...
Read more >C# BackgroundWorker and ProgressBar with Cancellation
Yet background worker provides us with a simple class called background worker that abstracts away the difficulty leaving it fairly simple.
Read more >using a background worker but wait for completion.
Put() method until the background work has finished? I cannot see a "RunWorkerSynch" method, to run it synchronously, so am I using the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This solution did work for a time and it start crashing again. I give up :p There is some random weirdness i can’t comprehend in this and it’s not that necessary. Thanks for your help though.
After my various refacto i didn’t reproduce the crash but i finaly succeed.
This construct by doing a mix of BackgroundWorker and IProgress do work.
Inside
GitAddCommitTagAndPush()
i use theBindingList<>
hook from previous post.I ask
IProgress
to callbackgroundWorker.ReportProgress()
so my underlying layers are agnostic and doesn’t knowSystem.Windows.Form
.Thank you for your help!