#546 – March 02, 2025
Common pitfalls when implementing finalizers
Finalizers are tricker than you think
6 minutes by Sergey Teplyakov
This article discusses common pitfalls when implementing finalizers in C#, illustrated through a file copier example that crashes unexpectedly. Key takeaways include that finalizer execution order is non-deterministic, nullable fields may be null in finalizers despite compiler checks, and classes without unmanaged resources shouldn't implement finalizers at all.
Want API documentation as good as Stripe's? Use Fern
sponsored by Fern
Fern allows developers to auto-generate and maintain API documentation. All you need is an OpenAPI spec to start. Join customers like ElevenLabs, Cohere, and Cartesia who use Fern as their trusted API documentation partner.
OpenTelemetry with ASP.NET Core
6 minutes by Ricardo Peres
The ability to have, in a centralised location, all of the logs, metrics, and traces, of many applications is very powerful and incredibly useful. Long gone are the days of looking at individual log files. This is based on standards and can be used in many different languages and APIs.
Windows 11 Theming for WPF in .NET 9
7 minutes by Thomas Claudius Huber
When you build a new WPF application and run it on Windows 11, it looks not really modern, as it doesn’t use Windows 11’s Fluent theme. But with .NET 9, you get the Windows 11 Fluent theme styles for WPF, and you can use them if you want. Let’s take a look at an example.
ASP.NET Core WebAPI Payload Logging with Serilog
7 minutes by Imran
The article demonstrates how to implement JSON-structured logging for HTTP API request/response transactions in ASP.NET Core Web API using Serilog and Microsoft's HTTP Logging Middleware. It provides a step-by-step guide to create a system that logs API payloads selectively for JSON content while avoiding unnecessary logging of static content, all without writing custom middleware.
Strongly-Typed Markdown for ASP.NET Core Content Apps
4 minutes by Khalid Abuhakmeh
This article explains how to create a custom solution for processing Markdown files with YAML frontmatter in ASP.NET Core applications. Khalid demonstrates how to build a strongly-typed MarkdownObject class that can parse Markdown content and YAML metadata into C# objects using the Markdig and YamlDotNet packages.
And the most popular article from the last issue: