C# error handling, pinning tests and dump analysis
Coverage includes xUnit behavior checks, memory-leak and deadlock investigations, Excel slicers, union-type discussion, and a string-counting exercise.
Jasen's top three picks
- 1 C# try/catch: Exception Handling in C# with Examples
Khalid Abuhakmeh
A practical tour of try/catch, finally, exception filters, and custom exceptions.
- 2 Pinning Tests: Making Unfamiliar C# Code Safe to Change
C# Corner
Capture current behavior with xUnit before changing code you don’t yet fully understand.
- 3 Finding a memory leak in a .NET dump with an AI agent
Meziantou's blog
A useful diagnostic sequence: inspect the heap, find retention paths, then check for growth.
Editor's note
I’ve kept this issue varied, from everyday C# techniques to production diagnostics. The pinning-tests article offers a practical way to protect unfamiliar behavior before refactoring. I also appreciate the memory-leak investigation’s reminder to establish whether retained objects are actually growing.
Today's articles
C# try/catch: Exception Handling in C# with Examples
Khalid Abuhakmeh
How to handle exceptions in C# with try/catch/finally, throw, custom exceptions, and when filters, with copy-paste examples tested on .NET 10.
Read articlePinning Tests: Making Unfamiliar C# Code Safe to Change
C# Corner
Learn how pinning tests capture existing C# behavior before refactoring, using xUnit cases to detect unintended changes at decision boundaries.
Topics: C# Unit Testing xUnit.net
Read articleFinding a memory leak in a .NET dump with an AI agent
Meziantou's blog
A leak investigation has three questions, in this order: what is on the heap, who keeps it alive, and is it actually growing. Each has its own command, and the third one is the one that gets skipped, ...
Topics: Performance Profiling
Read articleThe Result Pattern in C#: Stop Throwing Exceptions for Things You Expect
Medium
A follow-up to “7 Design Patterns Every .NET Developer Already Uses”: handling expected failures without try/catch gymnastics.
Topics: C# Design Patterns
Read articleHow to Add and Remove Excel Slicers in C# (Tables and PivotTables)
Medium
Excel slicers are visual filtering controls for PivotTables and structured tables. Compared with traditional PivotTable filters, slicers…
Topics: C#
Read articleUnion Types in C# 15: The Most Awaited Feature in 6 Years
Medium
Union types are my favorite feature in C# 15.Continue reading on CodeX »
Topics: C#
Read articleCount Group Occurrences in a String – C# Solution
C# Corner
Learn how to count distinct lowercase characters that occur in exactly k consecutive groups using a C# frequency array in O(n) time and O(1) space.
Topics: C#
Read articleFinding a deadlock in a .NET dump with an AI agent
Meziantou's blog
A hang is the easiest problem to diagnose from a dump and the hardest to diagnose any other way. There is no exception, no log line, and attaching a debugger to a production process is rarely an optio...
Topics: Profiling
Read articleWhat’s New in .NET 11? Five Changes I’d Actually Use in C#
Medium
Whenever a new .NET version comes out, I have the same question.
Topics: C#
Read article