Ben.Demystifier is a .NET library that transforms raw stack traces into modern C# 7+ syntax. It reads compiler-generated frames produced by async methods, iterators, lambdas, local functions, and generic types, then rewrites them to match the original source code, making exception call stacks and debug output immediately readable.
The library resolves common compiler artifacts such as MoveNext frames back into their original async method or iterator names, shows declaring method names and ordinals for lambdas and local functions instead of generated identifiers, and displays resolved generic type parameters and value tuple syntax inside stack frames. It also includes parameter qualifiers like ref, in, and out along with return types in method signatures, and preserves original line numbers and file paths during transformation.
Under the hood, Ben.Demystifier processes stack traces through a pipeline of regex-based token matching, symbol-table resolution, and syntax rewriting, producing immutable output with preserved line numbers. It handles multiple stack trace entries in a single pass to minimise memory allocations. The library is available as a NuGet package and integrates directly into existing .NET debugging workflows.