Sources

DV DEV Community: #csharp
RSS

19stories
1 d agolatest
C# 14
Silent shadowing
DVDEV Community: #csharp Adrián Bailador 1 d ago

C# 14 extension members: the shadowing bug the compiler won't warn you about

C# 14's extension member syntax now covers properties and static members, not just methods, yet a type's own member still silently wins over an identically named extension member. The author reproduces this against the .NET 10 SDK with eight tests: the build reports zero warnings and zero errors while every call site quietly switches to new logic.

AI
AI

LLM tokens measured in C#: why AI can't count the R's in strawberry

The model's failure on the "strawberry" question isn't a counting problem: it never sees letters, only numeric pieces called tokens. Using Microsoft.ML.Tokenizers 2.0.1 and the gpt-5 tokenizer, the author measures this from C# and shows that the word alone is a single token with ID 101830, so the r's inside it stay out of reach. The piece also covers how token cost varies by language, by numbers, and by random text such as GUIDs, plus how to count tokens in .NET.

NebulaGraph
Duplicate-free graph loads
DVDEV Community: #csharp Mehdi Mohseni 3 d ago

Idempotent NebulaGraph bulk ingestion from .NET using deterministic VIDs

NebulaGraph has no unique indexes, so duplicates in a graph load usually come from unstable vertex IDs and edge ranks. The author shows how to derive deterministic VIDs from business keys with FNV-1a and pin edge rank, which makes repeated loads safe. A batched .NET ingestion pipeline with checkpoints and retries is included.

C# 15
Add your own indexer

C# 15 Extension Indexers: Add [] Syntax to Types You Don't Own

C# 15 lets you declare indexers inside extension blocks, so types you don't own can support square-bracket access. Adding Count and Slice also unlocks index-from-end, ranges, and list patterns. The feature was tested on the .NET 11 RC 1 SDK, and the article lists its gotchas: real indexers win silently, arrays and strings are excluded, and expression trees reject it.

Steam achievements
Batch unlocks, owned DLC
DVDEV Community: #csharp zevnda 3 d ago

Steam achievement sets: batched unlocks fail on unowned DLC

Valve's Achievement Sets beta lets Steam games group achievements by base game, DLC and other sets. Steam refuses unlocks for DLC the account doesn't own or for archived sets, and one rejected item can fail an entire batch write. A C# developer maintaining an achievement manager explains the schema changes, the parsing code and the ownership-check fix.

EF Core 10
Database blocks overlaps
DVDEV Community: #csharp Ricardo Groß 3 d ago

Booking cottages with range types in .NET 10: no double bookings via PostgreSQL

CodoMetis.ValueRanges 10.4 and EFCore.ComplexIndexes are used to build a holiday-cottage booking API end to end. Date ranges are modelled as single values, overlapping bookings are blocked by a PostgreSQL exclusion constraint, and free nights are computed in one query. A practical example for EF Core developers working with PostgreSQL.

MCP + C#
Single-use approval
DVDEV Community: #csharp Martin Pisacreta 5 d ago

A C# MCP Server with Single-Use Order Approvals

Martin Pisacreta built a small .NET 8 MCP server where the order cancellation tool requires a separately recorded, single-use, expiring approval instead of trusting the model's confirmation. The article walks through the claim-before-use approval store, the tool contract and the limits of the design, backed by 12 passing tests.

Stripe webhooks
Stop double payments
DVDEV Community: #csharp Martin Pisacreta 5 d ago

Making Stripe webhooks idempotent in ASP.NET Core

The author explains an inbox pattern that stops a Stripe webhook from applying a payment twice when deliveries repeat or overlap. The sample verifies the raw body, claims events with a unique-key insert, and commits the claim together with the local payment change. Its 38-test suite exercises duplicates, rollback and retries, making it a concrete reference for payment flows in ASP.NET Core.

.NET regresyon
Row-level diffs
DVDEV Community: #csharp Youssef Bouha Oct 26

Comparing two million-object lists for regression testing with Xero.DataComparer

Xero.DataComparer is a small, dependency-free .NET library for non-regression testing of pricing and risk engines. Instead of a boolean verdict, it reports which rows differ, on which properties, and which rows are missing on either side. The author says it compares two lists of one million objects in about 0.7 seconds, and explains the design choices behind that speed.

BenchmarkDotNet
Measure before optimizing
DVDEV Community: #csharp Henrique Mauri Oct 25

Measuring .NET performance with AI help using BenchmarkDotNet

The author optimizes a .NET reporting method step by step with BenchmarkDotNet, measuring each change separately. The final version drops from about 1.55 s to 11.9 ms and allocations fall from 33.1 MB to 0.23 MB. It is a useful case for anyone who wants to check AI-proposed optimizations with benchmarks and output comparisons before merging them.

EF Core 11
One config file for commands
DVDEV Community: #csharp Mikhail Nefedov Oct 24

EF Core 11 adds .config/dotnet-ef.json for dotnet ef defaults

EF Core 11 lets the dotnet ef command-line tool read default options from a .config/dotnet-ef.json file. When your DbContext lives outside the startup project, you no longer need to repeat --project and --startup-project on every migration or database command. The tool finds the nearest config by walking up the folder tree, and explicit command-line flags still take precedence.

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message