Relative Content

Tag Archive for c#async-await

Task.WhenAll is not waiting

I have below code, which should wait 10seconds. Problem is that it completes immediately, the WhenAll method is not working – what am I doing wrong here?

Curious about differences between two versions of code using await Task.Delay

The two code segments below lead to different outcomes – they’re intended to wait for a long-running task to complete. Completion of the task is signaled by the function ‘taskCompleted’. The task is not under direct control of the code that is waiting for it.
The intention is to just wait, while not locking up the UI.

Why does Channel work but BlockingCollection not?

As part of a much larger solution, I have a solution for the producer-consumer pattern in .NET. It uses a System.Threading.Channels.Channel for receiving messages from a WebSocket and allowing it to be processed as the messages arrive.

Run multiple HTTP requests in parallel from a C# web API

I have a React page that shows a list of Azure resources. The data is retrieved by calling a C# controller. For each resource it takes around 30s to get all the related data. So if there are 10 resources on the page it takes 5min to load, which is too much.