Upcoming .NET User Forum Zurich / 6th July 2021

7/1/2021
1 minute read

Agenda

The talk will have the following topics:

  • Asynchronous Programming vs Parallel Programming
  • Deadlock and ConfigureAwait
  • State-Machine (very briefly and over-simplified)
  • Pitfalls & General Tips
  • ValueTask

And here a small teaser:

What do you think is wrong with the following code snippet?:

var ids = new List<int>();
// ...
ids.ForEach(async id => await _myRepo.UpdateAsync(ids));

We could argue that everything will run smoothly, but the problem lies in the defintion of List<T>.ForEach itself:

public void ForEach (Action<T> action);

See MSDN List.ForEach.

As ForEach accepts only Action and Action is not awaitable you can run into big trouble. This would be the same behaviour as public async void.

How can I join 🤷

As this is an online only event, feel free to join: https://www.meetup.com/dotnet-zurich/events/278916769/

All details you will find on the linked page above.

The state machine in C# with async/await

You often here that the async/await keywords leads to a state machine. But what does that mean? Let's discuss this with a simple example.

ASP.NET Core - Why async await is useful

Did you ever wonder why you "should" use async and await in your ASP.NET Core applications? Most probably, you heard something about performance. And there is some truth to it, but not in the way you might think.

So let's discuss this with smaller examples.

Async Await Pitfalls / Guidelines - .NET User Group Zurich Presentation

On 6th of July I had the honor to present some topics about async/await. Mainly:

  • What is asynchronous programming
  • Deadlocks and ConfigureAwait
  • How does the state machine work
  • Pitfalls and general Guidelines
  • ValueTask

You'll find all the slides and the whole talk in the blog.

An error has occurred. This application may no longer respond until reloaded. Reload x