C# Advanced Async - Getting progress reports, cancelling tasks, and more

IAmTimCorey · 313K views · 2018 · 52:22

Open on YouTube

Software practice, open source & careersC, C++, Rust, Go & systems languagestutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about updating a progress bar or reporting status from async operations, and for how to run async work in parallel in C#.

Recommended by 1 people across 1 different months, 2021 to 2022.

What it is

A 52-minute C# tutorial by Tim Corey that extends his intro to async/await. It covers reporting progress from async tasks with IProgress to drive a progress bar, cancelling long-running tasks with cancellation tokens, and comparing foreach versus Parallel.ForEach, including combining both approaches for async work.

What people said

Recommends DevCaf · 2021-04 · Stack Overflow · on “Updating ProgressBar while Async and Await fetching HttpRequest in C# Caliburn Micro WPF”

I used IProgress and send IProgress Status as a Paramter when I call the asynchronize Function. You can get the best solution in @TimCorey's Video. Here is the link. Asyncronize Downloading with ProgressBar Updating [this video] I hope this would help you.

Cites jaybro · 2021-07 · Stack Overflow · on “Multi-threading potentially long running operations”

Per MaxDegreeOfParallelism's documentation [LINK] : " Generally, you do not need to modify this setting . However, you may choose to set it explicitly in advanced usage scenarios such as these: When you know that a particular algorithm you're using won't scale beyond a certain number of cores. You can set the property to avoid wasting cycles on additional cores. When you're running multiple algorithms concurrently and want to manually define how much of the system each algorithm can utilize. You can set a MaxDegreeOfParallelism value for each. When the thread pool's heuristics is unable to determine the right number of threads to use and could end up injecting too many threads. For example,

Cites mech · 2022-08 · Stack Overflow · on “.net MAUI c# Background Task ContinueWith and notification Event”

[EDIT]Solved, see below[/EDIT] this is a newbie-question. I'm just digging in to c# and async and whyt i would like to have: click Button run several tasks in order but in background-thread, one after another running tasks should notifiy their progress if possible right now i can click the botton and start the task-chain, but within the completition event i would like (for testing) show a message-box every time a task has finished. this may lead to a crash (?) and i don't know why since i thought i would be within the ui-thread ... here are some parts of the code: AppViewModel: void handlePhaseCompletedEvent(object sender, SyncPhaseCompletedEventArgs e) { Shell.Current.DisplayAlert("TEST", "