Use CancellationTokens
Explains why and how to use CancellationTokens in .NET APIs to stop long-running operations and free server resources.
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 why and how to use CancellationTokens in .NET APIs to stop long-running operations and free server resources.
Analyzes C# performance benchmarks for slicing lists, comparing Skip/Take, Range operator, and GetRange methods, highlighting a common benchmarking error.
Explains how ToDictionaryAsync in Entity Framework Core retrieves entire database objects, impacting performance, and provides a solution using Select.
A developer shares techniques to improve database performance for large BLOB data retrieval in C#/.NET, including compression and chunking requests.
Explains the performance difference between C# collection expressions and collection initializers, showing how expressions preallocate lists.
Explores two new LINQ extension methods, InfiniteSequence and Sequence, introduced in .NET 10 Preview 6, highlighting their usage and generic math support.
Explains how to bypass Entity Framework's SqlRaw requirement to return all entity properties by explicitly selecting NULL for missing columns.
Explains how to disable thread safety checks in Entity Framework for performance, with warnings about risks and proper usage.
A guide to using architectural unit tests in C#/.NET to enforce CancellationToken usage and sealed classes in controllers.
Explains why C# List foreach loops don't lower to array-style while loops, focusing on version safety and performance semantics.
An update on the performance fix for ToListAsync in Entity Framework Core, addressing slow queries and high allocations when fetching large data.
Explains how to add descriptive names to data-driven test cases in xUnit by overriding the ToString() method in test data records.
Explains a specific edge case where switch expressions fail in Blazor due to parsing conflicts with HTML/razor syntax.
Highlights key performance improvements in .NET 10, including stack allocation optimizations and delegate escape analysis, with benchmark comparisons.
A guide for developers to track upcoming .NET features by exploring GitHub repositories, issues, labels, and milestones.
Explains why iterating over a concrete List<T> in C# is faster than iterating over an IList<T> interface, covering boxing and virtual method overhead.
Explores unsafe C# techniques to access private fields without reflection, using memory layout and pointers for performance, as a fun educational exercise.
Explains how to create custom argument validation guards using the new extension feature in C# 14 and .NET 10.
A guide on how to clear various NuGet caches (global packages, HTTP, temp) using the dotnet CLI to free up disk space.
Analyzes Microsoft's inclusion of GitHub Copilot hints in .NET documentation, questioning if it's advertising and discussing its implications.