Urgent.News

What's breaking now, across hundreds of outlets.

Tech

This week in Cursor + .NET — 7 rules (week ending November 22, 2026)

Every weekday a single, opinionated rule for senior C#/.NET engineers using Cursor. Here's the full week in one read — canonical posts live on the Agentic Architect blog . 7 daily senior rules Rule 18: WebApplicationFactory for Integration Tests Sun 22 Nov In-memory EF Core providers lie. Use WebApplicationFactory with Testcontainers (SQL Server, Postgres) for real integration coverage. Cursor…

Every weekday, a single opinionated rule guides senior C#/.NET engineers employing Cursor. This week's complete rundown, featuring the official posts on the Agentic Architect blog, is presented in one place. Seven daily senior rules are highlighted:

Rule 18: For integration tests, employ WebApplicationFactory with Testcontainers (SQL Server, Postgres) instead of InMemoryEF Core providers. Cursor's default UseInMemoryDatabase leads to bugs in production.

Rule 17: In libraries (non-ASP.NET code), configure ConfigureAwait false on every awaited Task. ASP.NET Core code should not. Cursor often mixes the two contexts, so detect the project type and enforce the correct default.

Rule 16: Avoid async void outside of event handlers. async void triggers deadlocks and unhandled-exception scenarios everywhere except UI event handlers. The AI frequently recommends it for "fire and forget" situations, but this is incorrect.

Rule 15: Utilize records for value objects (e.g., Money, Address, Coordinates) and classes for entities with identity (Order, Customer). Cursor often combines these incorrectly. Classifying based on the presence or absence of an identity property maintains the distinction clearly.

Rule 14: By default, mark all classes as sealed unless inheritance is explicitly planned. This prevents Cursor from unintentionally creating inheritance hierarchies for flexibility, while also improving performance.

Rule 13: Define strongly-typed IDs, such as OrderId as a record struct OrderId(Guid Value), instead of raw Guids. This prevents the AI from passing a CustomerId where an OrderId is needed—a bug that the compiler can't catch with primitive obsession but detects instantly with domain primitives.

Rule 12: Business code should never call IConfiguration directly. Instead, use strongly-typed IOptions or IOptionsSnapshot bindings. The AI often "just grabs the config value," but this should be avoided in favor of a settings class with validation attributes.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

CSV export for a time card: the format payroll people actually open

When I built the time card calculator on mytimecardcal.com , the export button was an afterthought. The calculator already did the hard work: it added up the hours, split regular time from overtime…

  • CSV export added to mytimecardcal.com calculator
  • CSV file format with clear column headers and rules
  • Download process creates Blob object for CSV string

I Generated 450+ Business Checklist Items with Python (reportlab + One Data Structure)

I sell a bundle of 30 business checklists (~450 items). People assume a team wrote them. No — a Python script did, in an afternoon.

  • Programmer generates 450+ business checklist items using Python script
  • Checklists consist of three sections with 15 items each, totaling 30 checklists
  • Python data structure serves as single source of truth for PDFs, SEO pages, and previews

More from Sunday 22 November →