The state machine in C# with async/await
Explains how the C# compiler transforms async/await code into a state machine, detailing the process with a simplified example.
Steven Giesel is a Senior Software Engineer and Microsoft MVP with over 13 years of experience, specializing in .NET and modern backend development. He shares deep technical knowledge across topics such as C#, EF Core, RavenDB, distributed systems, and cloud-native architectures, and is an active speaker in the .NET community.
316 articles from this blog
Explains how the C# compiler transforms async/await code into a state machine, detailing the process with a simplified example.
Analyzes a flawed LinkedIn benchmark on LINQ's 'let' keyword, explaining why the test doesn't measure real performance and how to benchmark correctly.
Explains the new UUID v7 (GUID) generation in .NET 9, highlighting its sortable timestamp structure and usage.
A guide on using GitHub Codespaces to simplify contributor onboarding for .NET open-source projects by setting up pre-configured cloud dev environments.
Introducing the new ReadOnlySet<T> type in .NET 9, explaining its purpose and advantages over existing interfaces and workarounds.
Announcing new features in NCronJob, a .NET job scheduler, including dependent jobs and Minimal API support.
Explains how Entity Framework protects against SQL injection in LINQ queries but warns of risks when using raw SQL, highlighting safer alternatives.
Explains how HttpClient's await behavior works with response headers vs. body, and how to control it using HttpCompletionOption.
Explores StringBuilder performance and memory usage for creating very large strings in C#, comparing it to using a List.
Explains how to cancel a C# task using multiple CancellationToken sources by linking them with CancellationTokenSource.CreateLinkedTokenSource.
Explains why certain exception instances like OutOfMemoryException are pre-allocated in .NET memory dumps, even in simple applications.
Explains the differences between .NET's MemoryCache, DistributedCache, and the new HybridCache, including their use cases and code examples.
A guide on using the httpgenerator tool to automatically create HTTP request files from a Swagger/OpenAPI definition for easier API testing.
Announces major updates to NCronJob, a .NET cron job library, including concurrency control, retry policies, and time zone support.
Explores performance improvements in .NET 9's LINQ methods, including OrderBy.ToList and Chunk, using benchmarks and SIMD optimizations.
A guide to using .NET Analyzers to improve code quality, covering setup, configuration, and enabling them across projects.
Learn how to use the dotnet CLI to check your .NET solution for NuGet packages with known vulnerabilities or that are deprecated.
Explains how C# List<T> detects modifications during enumeration using a version field to throw InvalidOperationException.
Analyzes whether using the 'readonly' modifier in C# leads to performance improvements by examining generated IL and JIT code.
Analyzes the claim that AI will replace human programmers in five years, examining current AI coding benchmarks and limitations.