Better timeout handling with HttpClient
A guide to implementing per-request timeout handling and proper TimeoutExceptions in .NET's HttpClient, addressing its default limitations.
Thomas Levesque is a French software developer and long-time .NET expert with 20 years of experience, specializing in C#, ASP.NET Core, and open-source development. He is a core maintainer of FakeItEasy and a former Microsoft MVP.
109 articles from this blog
A guide to implementing per-request timeout handling and proper TimeoutExceptions in .NET's HttpClient, addressing its default limitations.
Guide to configuring T4 text templates to automatically transform during build in both classic and .NET Core SDK-style projects.
Explains how to use Directory.Build.props in MSBuild to share common properties and package references across .NET projects, simplifying configuration.
How to use Visual Studio's debugger to step into and debug .NET library code while running it from a LINQPad script.
Explores performance improvements in LINQ methods for .NET Core, highlighting specific optimizations and benchmark results.
Introduces Sprache, a C# library for creating text parsers using parser combinators, with an example parsing HTTP WWW-Authenticate headers.
Announcing FakeItEasy 3.0.0, a .NET mocking framework update with .NET Core support, new syntax, and improved features.
How to configure git diff to correctly display C# method signatures, including async and partial methods, in hunk headers.
Explains how to use and extend the HttpClient's message handler pipeline in .NET for custom request/response processing and unit testing.
Explores the new tuple deconstruction feature in C# 7, including syntax and how to deconstruct custom types.
Explains the new tuple syntax and ValueTuple type in C# 7, highlighting performance benefits and named elements over older Tuple classes.
Explains a subtle bug in C# where using 'var' with an async method call without 'await' leads to unexpected behavior, and discusses prevention.
A guide to configuring AppVeyor CI to automatically publish NuGet packages to NuGet.org, eliminating manual uploads.
Exploring new C# 7 features like local functions and ref returns in Visual Studio "15" Preview, with setup instructions and examples.
Explains how to use FakeItEasy's auto-initialization feature to automatically inject fake dependencies in unit tests, reducing boilerplate code.
Explains how to use CancellationTokenSource.CreateLinkedTokenSource in C# to combine multiple cancellation sources for async operations.
Explains how to explicitly switch back to the UI thread in async C# code, especially after using ConfigureAwait(false), with solutions like custom awaiters.
A technical guide on preventing image pasting in a WPF RichTextBox control using the DataObject.Pasting event.
An improved implementation of the weak event pattern in C# to prevent memory leaks, focusing on performance and API design.
Explains how to correctly store and retrieve UTC dates in SQLite using the ADO.NET provider by setting DateTimeKind=Utc in the connection string.