.NET 11's library work targets the boilerplate developers keep rewriting: process execution with captured output, full outer joins and tuple joins in LINQ, JSON union and JSON Lines support, plus Zstandard compression. Ottorino Bruni walks through practical examples of each new API.
Key points
- Process.RunAndCaptureTextAsync returns a ProcessTextOutput with stdout, stderr and ExitStatus.ExitCode, reading both streams concurrently.
- New process options include KillOnParentExit, StartDetached and InheritedHandles, plus StartAndForget and ReadAllLinesAsync helpers.
- FullJoin completes the join family after .NET 10's LeftJoin and RightJoin; Join, GroupJoin and both outer joins gain tuple-returning overloads.
- EqualityComparer<T>.Create(p => p.Id) builds a comparer from a key selector, so HashSet<Product> can deduplicate by Id.
- System.Text.Json serializes C# 15 union types and closed hierarchies; InferClosedTypePolymorphism and JsonUnionTypeStructuralClassifier cover ambiguous cases.
- SerializeAsyncEnumerable with topLevelValues: true streams async sequences as JSON Lines without holding the whole set in memory.
Why it matters
Most of these APIs delete code you already own: a ProcessHelper in some shared library, a hand-written full outer join, a custom IEqualityComparer for key-based equality. If you maintain internal utilities, plan to remove them after upgrading instead of keeping both paths alive.
Two things deserve a look before adopting: the union and closed-hierarchy JSON support rides on C# 15, so your serialization stays tied to the language version you target, and the new process helpers change how child processes are terminated, which matters for tools that spawn long-running jobs. Verify platform support for KillOnParentExit and StartDetached in the .NET 11 notes.
Real-world use
- A CLI or DevOps tool that shells out to git and needs stdout, stderr and the exit code without risking a stream deadlock
- Inventory reconciliation between a warehouse list and a shop list where unmatched rows on either side must survive the join
- Deduplicating products in a HashSet by Id when the same product arrives with different names
- Exporting query results or telemetry as JSON Lines for logs, data pipelines and AI training datasets
This summary was generated by the agent from the original post on Ottorino Bruni. The full text and all rights belong to its author and publisher. Go to original