# C\# · Tech watch

[Canonical source](<https://sebastien.rigaux.be/en/tech-watch/tags/c-sharp>)

The .NET language, covering its type system, asynchronous programming and code design.

## [Agent loops in C\# with Microsoft Agent Framework](<https://sebastien.rigaux.be/en/tech-watch/links/agent-loops-in-c-with-microsoft-agent-framework>)

Agent loops combine action, observation, and evaluation to refine an answer or retry an operation until it meets a criterion. Jesse Liberty demonstrates the pattern in C# with Microsoft Agent Framework: a loop agent, an evaluator, and an iteration limit.

The example contrasts a deterministic marker such as `DONE` with a model-based judge, then outlines safeguards to add: timeouts, idempotent calls, logging, and cost tracking. Each iteration adds latency and token usage.

2026-11-02 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/agent-loops-in-c-with-microsoft-agent-framework.md>) · [Original resource](<https://jesseliberty.com/2026/10/26/prompts-are-dead-long-live-loops/>)

## [C\# 15 unions: exhaustive matching, with boxing to consider](<https://sebastien.rigaux.be/en/tech-watch/links/c-15-unions-exhaustive-matching-with-boxing-to-consider>)

C# 15 introduces the `union` keyword to represent a value drawn from several types without forcing them into a base class or losing their type information in `object`. Andrew Lock shows how `switch` expressions enforce handling every case, and how to declare unions such as `Result<T>`.

One performance detail to weigh: the generated implementation stores the value in an `object`, boxing value types. The article demonstrates a custom implementation using `TryGetValue` to avoid boxing in `switch` expressions.

2026-11-01 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/c-15-unions-exhaustive-matching-with-boxing-to-consider.md>) · [Original resource](<https://andrewlock.net/exploring-the-dotnet-11-preview-2-dotnet-gets-union-types/>)

## [Microsoft Agent Framework: choosing where to intercept calls](<https://sebastien.rigaux.be/en/tech-watch/links/microsoft-agent-framework-choosing-where-to-intercept-calls>)

In Microsoft Agent Framework, `ChatClient` middleware intercepts messages exchanged with the LLM, while agent middleware operates on the agent’s overall run, including session, identity, or token-budget management. This distinction helps place logging or modification at the right level.

The C# example adds function-invocation middleware to log calls to the Researcher agent’s Tavily tool, without changing the other agents. The trace shows the function name and its arguments.

2026-11-01 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/microsoft-agent-framework-choosing-where-to-intercept-calls.md>) · [Original resource](<https://jesseliberty.com/2026/08/08/chatclient-middleware-vs-agent-middleware/>)

## [C\#: IfItQuacks turns duck typing into a library](<https://sebastien.rigaux.be/en/tech-watch/links/c-ifitquacks-turns-duck-typing-into-a-library>)

IfItQuacks lets C# code accept objects that match an interface without implementing it or sharing a base class. The `[DuckTyped]` attribute invokes a source generator that checks compatibility at compile time and creates an adapter—without reflection or `dynamic`.

Anonymous types can also act as test stubs: an object such as `{ Name = "Steven", Age = 90 }` can satisfy an `IPerson` interface. Adapters also preserve identity by forwarding `Equals`, `GetHashCode`, and `ToString` to the wrapped instance.

2026-11-01 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/c-ifitquacks-turns-duck-typing-into-a-library.md>) · [Original resource](<https://steven-giesel.com/blogPost/41599817-4457-441e-b874-1a5c67f4e7cc>)

## [.NET range types as first-class domain objects](<https://sebastien.rigaux.be/en/tech-watch/links/net-range-types-as-first-class-domain-objects>)

CodoMetis.ValueRanges offers .NET range types to replace pairs of dates and their scattered logic. Its five variants—finite, unbounded on either side, infinite, and empty—make possible shapes and rules explicit, while operations such as `Contains` and `Overlaps` run in memory.

The companion EF Core package bridges the domain model to PostgreSQL: the same operations are translated into SQL operators through Npgsql. The article also explains the design trade-off: abstract records rather than structs, so each variant can be represented by a type hierarchy.

2026-11-01 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/net-range-types-as-first-class-domain-objects.md>) · [Original resource](<https://dev.to/caffeinatedcoder/the-interval-is-the-thing-modelling-range-types-as-first-class-domain-objects-in-net-3jha>)

## [Metalama generates C\# patterns and enforces architecture at build time](<https://sebastien.rigaux.be/en/tech-watch/links/metalama-generates-c-patterns-and-enforces-architecture-at-build-time>)

Metalama automates cross-cutting C# patterns with aspects that generate code at compile time, while checking architecture rules as you edit. The repetitive implementation stays out of business code and the repository, and one aspect can be applied to a method or to a set of methods selected in code.

For example, an aspect can wrap a method in `try/catch` to log its entry, result, and exceptions. Metalama also lets you preview and debug the transformed code, making those changes inspectable.

2026-10-30 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/metalama-generates-c-patterns-and-enforces-architecture-at-build-time.md>) · [Original resource](<https://postsharp.net/metalama>)

## [Major updates in .NET 11: runtime, libraries and SDK](<https://sebastien.rigaux.be/en/tech-watch/links/major-updates-in-net-11-runtime-libraries-and-sdk>)

This official Microsoft Learn page provides a comprehensive overview of what’s new in .NET 11, currently in release candidate. It details changes in the runtime (performance, native Async, JIT, WebAssembly), libraries (numeric APIs, compression, System.Text.Json, security, LINQ, etc.), SDK (CLI tools, testing, containers, OpenTelemetry), and C# 15 language features. Developers will find a summary of the main improvements, links to updates for ASP.NET Core, EF Core, Windows Forms and WPF, as well as key release dates. Ideal for planning migrations or exploring the new capabilities of the .NET platform.

2026-10-15 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/major-updates-in-net-11-runtime-libraries-and-sdk.md>) · [Original resource](<https://learn.microsoft.com/fr-fr/dotnet/core/whats-new/dotnet-11/overview>)

## [Common pitfalls in asynchronous .NET programming](<https://sebastien.rigaux.be/en/tech-watch/links/common-pitfalls-in-asynchronous-net-programming>)

This guide collects recommendations on async, await, tasks and cancellation. It covers blocking caused by Task.Result or Task.Wait and discusses suitable alternatives.

2025-02-16 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/common-pitfalls-in-asynchronous-net-programming.md>) · [Original resource](<https://github.com/davidfowl/AspNetCoreDiagnosticScenarios/blob/master/AsyncGuidance.md>)

## [Vogen: generate value objects around .NET types](<https://sebastien.rigaux.be/en/tech-watch/links/vogen-generate-value-objects-around-net-types>)

Vogen wraps primitives in generated domain types. Its CustomerId example shows how to obtain comparisons and controlled construction without writing repetitive boilerplate.

2025-02-09 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/vogen-generate-value-objects-around-net-types.md>) · [Original resource](<https://stevedunn.github.io/Vogen/overview.html>)

## [Evaluate C\# test strength with mutation testing](<https://sebastien.rigaux.be/en/tech-watch/links/evaluate-c-test-strength-with-mutation-testing>)

Mutation testing deliberately changes code to check whether tests catch the introduced faults. The article explains the technique as a complement to code coverage.

2024-12-22 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/evaluate-c-test-strength-with-mutation-testing.md>) · [Original resource](<https://daninacan.com/how-and-why-to-write-mutation-tests-in-c/>)

## [A free certification for learning C\# fundamentals](<https://sebastien.rigaux.be/en/tech-watch/links/a-free-certification-for-learning-c-fundamentals>)

Microsoft and freeCodeCamp introduce a C# certification with a 35-hour Microsoft Learn course. It provides a structured path for consolidating language fundamentals.

2023-08-30 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/a-free-certification-for-learning-c-fundamentals.md>) · [Original resource](<https://devblogs.microsoft.com/dotnet/announcing-foundational-csharp-certification/>)

## [Generate .NET builders that guide object construction](<https://sebastien.rigaux.be/en/tech-watch/links/generate-net-builders-that-guide-object-construction>)

This generator creates builders for classes, structs and records. Its steps require mandatory information before optional values while encouraging immutable objects.

2023-08-27 · [Markdown](<https://sebastien.rigaux.be/en/tech-watch/links/generate-net-builders-that-guide-object-construction.md>) · [Original resource](<https://github.com/bnayae/Bnaya.BuilderPatternGenerator>)
