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

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

IAmTimCorey

6 лет назад

291,840 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Houidi mohamed amin
Houidi mohamed amin - 13.09.2023 00:30

why aren't you using concurrent collections in the parallel.Foreach ? you l=might get errors using lists no ? you might even get wrong progress reports.

Ответить
radiosification
radiosification - 20.08.2023 03:03

In addition to this, there's now a Parallel.ForEachAsync in .NET 6 and newer.

Ответить
Anthony
Anthony - 20.07.2023 14:59

I just signed up for your news letter, thanks. I noticed in this lesson on advanced async that 3 of the 10 test url's cause a redirect error "Too many redirects etc..." If you remove the microsoft, twitter and stack overflow url's the error goes away. I assume that these 3 sites have changed in some way over the years. If I want to include them do I need to add something in order for these to work again? Thanks again.

Ответить
sadyanx
sadyanx - 07.07.2023 00:28

Thanks a lot!!

Ответить
MiraiのChampion
MiraiのChampion - 30.06.2023 13:55

Everytime my lead dev asks me to do smthing confusing im like... "If theres a TimCorey for it im good".
Today was cancelation tokens and logging.

Cheers for saving my bacon again dude.

Ответить
PL93
PL93 - 20.06.2023 13:14

Hi, thanks for the great videos I really learnt a lot. I was wondering if you have any video where you talk about the configureawait method.

Ответить
Kopil Kaiser
Kopil Kaiser - 19.06.2023 02:30

You are the best teacher to teach C# programming tutorials. I really understand your concepts in-depth as you explain with keeping everything in mind. Not too vague, or not too complex. Just enough spices to make the recipe (knowledge) tasty to consume! Aromatic and delightful. Please keep up the hard work. I pray for your wellbeing and may you be blessed with more success. InshaAllah 🤲❤. Lots of love from me brother.

Ответить
mohammad mostajab
mohammad mostajab - 05.06.2023 10:43

It is so helpful

Ответить
Abhishek Jadhav
Abhishek Jadhav - 28.04.2023 18:53

Great video again. It helped me clear in my mind the actual difference between Task.WhenAll and Parallel.ForEach. Hats off to you Tim. Thanks for breaking down tough things in easy to understand manner for us.

Ответить
JerVBear
JerVBear - 04.03.2023 04:56

I am working on some async code communicating with hardware. I am having some trouble with returning when the task has been completed. I am using Task<bool> for each method. I have an await Task.WhenAll(task1, task2, task4). I have a task3 that should execute and complete before task4. Could you please help me identify the best practice and what I am doing wrong?

Ответить
Ivan David Martinez Baron
Ivan David Martinez Baron - 03.03.2023 18:27

Muchas gracias Tim. Que hermosa explicación!

Ответить
Dawid Knaz
Dawid Knaz - 18.01.2023 04:20

What about CancellationTokenSource once it was first cancelled and app is still running and I want to perform operation again? At current state when I order operation second time it gets cancelled immadiately as the token is set to "cancel". What is the convention to "uncancel" it? I was looking for some method to do it and couldn't find it, so I created new CTS instance at the end of the method and it works. The question is -> is it a proper way to create new instance of CTS for next operations or maybe I can uncancel CTS in some "proper" way?

Btw. Great Video! Big Thanks :D

Ответить
Gökalp Ayaz
Gökalp Ayaz - 17.01.2023 00:21

Thanks a lot for another great video.

Ответить
Nina Saabiyeh
Nina Saabiyeh - 13.01.2023 17:06

I placed the cts.ThrowIfCancellationRequested(); statement before the await DownloadWebsiteAsync instead of after it. The behavior changed. The "download cancelled" message was never written to the output.

Ответить
Roman Sidler
Roman Sidler - 10.01.2023 01:47

Thanks Tim for this great video tutorial. This was just helping to point myself into the right direction implementing some code for a massive parallel backup job.

Ответить
Василь Зауличний
Василь Зауличний - 05.01.2023 00:17

Just awesome! I like your pace AND the way you highlight those small details which makes the difference in a real-world intuitive app! Thanks, Tim!

Ответить
luguei
luguei - 02.01.2023 19:43

Hello Tim, thanks for the awesome content, learned a lot from this video. However I did find a bug in your code, and that is, once you hit the Cancel button once to stop the downloading process, the subsequent DownloadAsync button no longer works properly. The problem is that you didn't reinitialize the cts variable, so the IsCancellationRequested remains true. I worked around this by reinialize cts every time DownloadAsync button is clicked. Not sure whether my idea is right, and whether this work around is the best practice, please inform me some more, thanks a lot!

Ответить
Bluzen
Bluzen - 29.12.2022 22:14

Hi, thans alot for maintaining this awesome c# channel. I've learned alot alot from you.
Question, when you name the class "ProgressReportModel", what does the word "Model" mean in this context?

I want to learn how to name my clas clear and precise, but I dont quite understand the use case of the word Model in this context.

Does it mean that everytime I want to make a data container class I shall name it xxxModel ?

Ответить
Richard Aubin
Richard Aubin - 09.12.2022 18:41

Should you lock the progress report within the parallel for each to prevent race issues?

Ответить