<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Deep Chaturvedi | Tech]]></title><description><![CDATA[Deep Chaturvedi | Tech]]></description><link>https://deepctech.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Thu, 26 Nov 2026 11:23:09 GMT</lastBuildDate><atom:link href="https://deepctech.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Replay Tests for a .NET Upgrade: Check What Your API Returned Yesterday]]></title><description><![CDATA[A small, runnable sample that tells you when an upgrade or a cleanup changes the responses other people depend on. Unit tests tell you the code still does…]]></description><link>https://deepctech.hashnode.dev/replay-tests-for-a-net-upgrade-check-what-your-api-returned-yesterday</link><guid isPermaLink="true">https://deepctech.hashnode.dev/replay-tests-for-a-net-upgrade-check-what-your-api-returned-yesterday</guid><category><![CDATA[dotnet]]></category><category><![CDATA[c sharp]]></category><category><![CDATA[Testing]]></category><dc:creator><![CDATA[Deep Chaturvedi]]></dc:creator><pubDate>Thu, 26 Nov 2026 03:23:29 GMT</pubDate><content:encoded><![CDATA[<p><em>A small, runnable sample that tells you when an upgrade or a cleanup changes the responses other people depend on.</em></p>
<p>Unit tests tell you the code still does what the code does. They don't tell you the API still returns what a partner's import job expects. A renamed JSON property, a different date format in a nightly CSV, a column in a new position: all of these can pass every unit test and still break someone downstream.</p>
<p>This post shows a small way to catch that. You record real responses from the current system, store them as files, and replay the same requests against the new build. I built a small sample for it, ran it on .NET 8 and .NET 10, and the code below is copied from that sample. It is a made-up orders API, not a real production system.</p>
<h2>The sample</h2>
<p><code>OrdersApi</code> is an ASP.NET Core minimal API with two things a partner might depend on: a JSON endpoint and a CSV export.</p>
<pre><code class="language-csharp">app.MapGet("/orders/{id:int}", (int id) =&gt;
    orders.TryGetValue(id, out var o)
        ? Results.Ok(o)
        : Results.NotFound(new { error = "order_not_found", id }));

app.MapGet("/orders/export.csv", () =&gt;
{
    var sb = new StringBuilder("OrderId,Customer,PlacedOn,Total,Status\n");
    foreach (var o in orders.Values.OrderBy(o =&gt; o.Id))
        sb.Append(string.Create(CultureInfo.InvariantCulture,
            $"{o.Id},{o.Customer},{o.PlacedOn:yyyy-MM-dd},{o.Total:0.00},{o.Status}\n"));
    return Results.Text(sb.ToString(), "text/csv");
});
</code></pre>
<p>The project targets both <code>net8.0</code> and <code>net10.0</code>, so the same code runs on either.</p>
<h2>Step 1: record the current behaviour</h2>
<p>Start the system you trust, which is the version that runs today, and capture the responses. A short script is enough. This one calls each path and writes a JSON file per request:</p>
<pre><code class="language-python">for name, path in cases:
    r = urllib.request.urlopen(base + path)
    body = r.read().decode("utf-8").replace("\r\n", "\n")
    rec = {"name": name, "method": "GET", "path": path, "status": r.status,
           "contentType": r.headers.get_content_type(), "body": body}
    (out / f"{name}.json").write_text(json.dumps(rec, indent=2) + "\n")
</code></pre>
<p>One of the recordings looks like this:</p>
<pre><code class="language-json">{
  "name": "order-1001",
  "method": "GET",
  "path": "/orders/1001",
  "status": 200,
  "contentType": "application/json",
  "body": "{\"id\":1001,\"customer\":\"ACME Ltd\",\"placedOn\":\"2026-03-14T09:30:00Z\",\"total\":1249.50,\"status\":\"SHIPPED\"}"
}
</code></pre>
<p>Note the <code>1249.50</code>. The trailing zero is part of what the API returns today, and a recording keeps it. I'd rather find that out from a file than from a partner.</p>
<h2>Step 2: replay them in a test</h2>
<p>The test host from <code>Microsoft.AspNetCore.Mvc.Testing</code> runs the API in memory, so there is no port to manage. Each recording becomes one test case:</p>
<pre><code class="language-csharp">public class ReplayTests : IClassFixture&lt;WebApplicationFactory&lt;Program&gt;&gt;
{
    private readonly HttpClient _client;

    public ReplayTests(WebApplicationFactory&lt;Program&gt; factory) =&gt; _client = factory.CreateClient();

    [Theory]
    [MemberData(nameof(Recording.LoadAll), MemberType = typeof(Recording))]
    public async Task Response_matches_what_the_old_system_returned(Recording rec)
    {
        var response = await _client.SendAsync(new HttpRequestMessage(new HttpMethod(rec.Method), rec.Path));
        var body = (await response.Content.ReadAsStringAsync()).Replace("\r\n", "\n");

        Assert.Equal(rec.Status, (int)response.StatusCode);
        Assert.Equal(rec.ContentType, response.Content.Headers.ContentType?.MediaType);
        Assert.Equal(rec.Body, body);
    }
}
</code></pre>
<p>It compares the status code, the content type and the exact body. I normalise line endings so the CSV doesn't fail only because of Windows versus Linux.</p>
<h2>Step 3: run it on both versions</h2>
<pre><code class="language-plaintext">dotnet test ReplayTests -f net8.0
dotnet test ReplayTests -f net10.0
</code></pre>
<p>In my run, all four recordings passed on both .NET 8 and .NET 10. For this small API, retargeting changed nothing a partner would see. A real system will have more surface than this, but the check is the same.</p>
<h2>Step 4: see it catch a change</h2>
<p>Upgrades are rarely the only thing that changes. People tidy things while they are in the code. To show what a failure looks like, I made two small "cleanups" on a copy of the sample: a snake_case JSON naming policy, and a different date format in the CSV (<code>dd/MM/yyyy</code> instead of <code>yyyy-MM-dd</code>). Three of the four tests failed on .NET 10:</p>
<pre><code class="language-plaintext">Failed ... (rec: export-csv)
  Expected: ···"tatus\n1001,ACME Ltd,2026-03-14,1249.50,SH"···
  Actual:   ···"tatus\n1001,ACME Ltd,14/03/2026,1249.50,SH"···
Failed ... (rec: order-1001)
  Expected: ···"":"ACME Ltd","placedOn":"2026-03-14T09:30"···
  Actual:   ···"":"ACME Ltd","placed_on":"2026-03-14T09:3"···
</code></pre>
<p>Both changes look harmless in a code review. Neither would fail a typical unit test. Anyone parsing <code>placedOn</code> by name would break.</p>
<h2>When a replay test fails</h2>
<p>A failure doesn't always mean you should revert. It means the contract changed, and someone should decide that on purpose. If the change is intended, tell the consumers, then re-record. If it isn't, fix the code.</p>
<h2>What this doesn't cover</h2>
<p>It is a snapshot of a few requests, so it only protects what you recorded. Things that change between runs, such as timestamps or generated ids, need to be fixed in the test data or masked before comparing. It doesn't test performance, and it doesn't replace testing against real partner systems.</p>
<h2>Take it further</h2>
<ul>
<li>Record more paths from real traffic, with sensitive values removed.</li>
<li>Run the replay in your CI pipeline on every commit.</li>
<li>Keep recordings in the repository, so a change to a response shows up in the pull request.</li>
</ul>
<p>The full sample, with the recording script and both projects, is on GitHub: <a href="https://github.com/chaturvedideep/dotnet-upgrade-replay-tests">dotnet-upgrade-replay-tests</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Upgrading .NET Is Easy. Keeping the Business Running Is the Hard Part.]]></title><description><![CDATA[What I check before any .NET upgrade, from MVC3 to .NET 10.]]></description><link>https://deepctech.hashnode.dev/upgrading-net-is-easy-keeping-the-business-running-is-the-hard-part</link><guid isPermaLink="true">https://deepctech.hashnode.dev/upgrading-net-is-easy-keeping-the-business-running-is-the-hard-part</guid><category><![CDATA[dotnet]]></category><category><![CDATA[c sharp]]></category><category><![CDATA[software architecture]]></category><category><![CDATA[Devops]]></category><dc:creator><![CDATA[Deep Chaturvedi]]></dc:creator><pubDate>Wed, 25 Nov 2026 19:54:53 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b0738777814610426ab752c/75bcdd16-3d8a-497d-b645-df5e74bf63b0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I shipped my first ASP.NET MVC application on MVC3. Since then I've moved banking platforms, oil &amp; gas field software and several startup products through almost every version of .NET: Framework to Core, Core 3.1 to 6, 6 to 8, and now 8 to 10.</p>
<p>The technical side of these upgrades has become much easier over the years. The tooling is better, the migration guides are better, and the framework itself is far more consistent than it used to be. And yet upgrades still go wrong, and in my experience it is rarely because of the framework. It is almost always because of everything around it.</p>
<p>This isn't a step-by-step migration guide; Microsoft publishes good ones. It's what I check now, after enough upgrades to know where the pain usually comes from.</p>
<h2>The dependency list doesn't tell you where the risk is</h2>
<p>Every upgrade starts with the same spreadsheet: NuGet packages, target frameworks, and the WCF service nobody wants to touch. That list is necessary, but it is also the least risky part of the job.</p>
<p>The real risk sits in behaviour that nobody wrote down. The exact shape of a JSON response. The column order in an export that a partner imports every night. A date format someone downstream parses by hand. None of that shows up in a dependency graph.</p>
<p>So I start differently now. Before touching code, I sit with the team and list every consumer of the system, including other services, batch jobs, reports, partner integrations and the operations team's scripts, and we write down what each of them actually expects. In banking, a good part of that list turns out to be audit evidence you needed anyway.</p>
<h2>Put tests at the edges before anything else</h2>
<p>Unit tests tell you the code still does what the code did. They don't tell you the system still keeps its promises to the outside world.</p>
<p>Before migrating, I capture real requests and responses from the existing system and replay them against the new one. For HTTP APIs, recorded request and response pairs running in CI are often enough. For messaging, it means snapshotting the payloads that go onto the bus. It's unglamorous work, and it is the main reason I can sleep the night after a cutover.</p>
<h2>Strangle the old system instead of rewriting it</h2>
<p>A big-bang rewrite is the most expensive way to discover what your old system really did. The approach that has worked reliably for me is the strangler fig pattern: put a routing layer in front of the legacy application, such as YARP or an API gateway, and move one route or module at a time to the new stack. Each slice goes live on its own, behind a switch that can be flipped back.</p>
<p>It also changes the conversation with the business. "We need nine months and a feature freeze" is a hard sell. "The first piece goes live in three weeks, and you'll see progress every sprint" is a much easier one.</p>
<h2>Treat the old system as the specification</h2>
<p>Every team wants to fix things while they are in there: a cleaner schema, better names, a more RESTful API. The instinct is understandable, but during a migration it adds risk that is hard to see.</p>
<p>My rule is that when the old and new systems disagree, the old one is right until someone with business authority says otherwise. Bugs that customers or partners have built workarounds for are, in practice, features. Migrate first and improve afterwards, and never in the same release. It keeps the changes explainable, the testing manageable and the rollback possible.</p>
<h2>Fix the delivery pipeline before the application</h2>
<p>If the build and release process is fragile, an upgrade will expose it. Before moving any production code, I make sure the pipeline (Azure DevOps on most of my projects) can build the old and new stacks side by side, run the edge tests on every commit, and deploy each migrated slice independently. Configuration and feature flags belong in the pipeline and its environments, not on one engineer's machine or a single forgotten server.</p>
<p>Once that foundation is in place, the actual framework upgrade is often the quietest week of the project.</p>
<h2>Why .NET 10 is a sensible target</h2>
<p>.NET 10 is a long-term support release, supported until November 2028. That is long enough to justify the migration effort, and short enough that it's worth planning the next step from the start. Runtime improvements mean many teams see performance gains simply by retargeting, which is worth measuring because it helps make the case for the work. And Aspire is useful for running old and new components together on a developer machine while the monolith is being strangled.</p>
<h2>What I've learned</h2>
<p>Frameworks change every year; MVC3 felt modern once. What carries over from one version to the next is the discipline of understanding what your system actually promises, and protecting those promises while everything underneath them changes.</p>
<p>If you're planning an upgrade this year, three questions are worth asking before you start:</p>
<ol>
<li>Who depends on this system that we haven't spoken to yet?</li>
<li>What could break that no existing test would catch?</li>
<li>How do we roll back if the first slice fails?</li>
</ol>
<p>The answers will tell you more about your timeline than any migration tool.</p>
]]></content:encoded></item><item><title><![CDATA[.NET 8 Is Out of Support: Should You Move to .NET 10 or .NET 11?]]></title><description><![CDATA[What changed on 10 November, and how I'd decide as an architect.]]></description><link>https://deepctech.hashnode.dev/net-8-is-out-of-support-should-you-move-to-net-10-or-net-11</link><guid isPermaLink="true">https://deepctech.hashnode.dev/net-8-is-out-of-support-should-you-move-to-net-10-or-net-11</guid><category><![CDATA[dotnet]]></category><category><![CDATA[c sharp]]></category><category><![CDATA[Azure]]></category><category><![CDATA[software architecture]]></category><dc:creator><![CDATA[Deep Chaturvedi]]></dc:creator><pubDate>Wed, 25 Nov 2026 19:48:27 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6b0738777814610426ab752c/7a15849e-7379-47a8-8666-ec146a05290d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>On 10 November 2026, two things happened on the same day. .NET 8 and .NET 9 reached end of support, and .NET 11 became available. If your systems still run on one of the older versions, the question in your team's chat is probably some version of this: do we move to .NET 10, or skip ahead to .NET 11?</p>
<p>For most business systems, my answer is .NET 10. The rest of this post explains why, and when I'd choose differently.</p>
<h2>What end of support actually means</h2>
<p>According to Microsoft, after 10 November neither .NET 8 nor .NET 9 receives security fixes, servicing updates or technical support. Your applications don't stop working. Nothing breaks on the day.</p>
<p>The risk is a quiet one. The next vulnerability found in the runtime or in ASP.NET Core will be fixed in the supported versions only. In regulated environments, an unsupported runtime also tends to show up as an audit finding sooner or later, because the question "are your platforms still receiving security patches?" has a simple answer.</p>
<p>It also reaches beyond your own code. At least one APM vendor has published an end-of-support notice for its .NET agent that covers .NET 8 and .NET 9, so it's worth checking the monitoring agents, SDKs and build tooling you depend on, not just your own projects.</p>
<h2>The two options side by side</h2>
<p><strong>.NET 10</strong> is a Long Term Support release, out since November 2025. Microsoft's support policy lists it as supported until November 2028.</p>
<p><strong>.NET 11</strong> is a Standard Term Support release, out since 10 November 2026. The same policy page lists its end of support as November 2028 too.</p>
<p>That second point is the one I'd put in front of a decision meeting. Moving to .NET 11 gets you newer features, but not a longer support window than .NET 10. It also means running a release that is days old, while .NET 10 has had a year for libraries, container images, tooling and hosting to catch up.</p>
<h2>What .NET 11 adds</h2>
<p>The headline items in the release coverage are union types in C# 15 with exhaustiveness checking on switch expressions, a Native AOT build of the dotnet CLI host, asynchronous validation and OpenAPI 3.2 generation in ASP.NET Core, and in EF Core a FullJoin operator plus experimental vector search for SQL Server. Runtime Async gets a mention too, but the sources I read disagree on whether it still needs a preview flag, so check its status before relying on it.</p>
<p>These are useful additions. I wouldn't call any of them a reason to rush a line-of-business application onto a new release.</p>
<h2>What to read first if you do go to .NET 11</h2>
<p>Microsoft's breaking changes list for .NET 11 is still a work in progress, so read the current version rather than a summary. A few entries caught my attention because they're behavioural changes. They compile fine and then act differently in production:</p>
<ul>
<li>Dependency injection scope disposal now aggregates exceptions.</li>
<li>Empty strings in chained configuration providers now override values from earlier providers.</li>
<li>IHost.RunAsync and IHost.StopAsync throw when a BackgroundService fails.</li>
<li>Server-side AIA certificate downloads in SslStream are disabled by default.</li>
</ul>
<p>Release coverage also notes that ASP.NET Core generates OpenAPI 3.2 documents by default, that EF Core 11 requires .NET 11, and that the minimum x86/x64 hardware baseline moves up. Anything that consumes your generated OpenAPI document, or runs on older hardware or virtual machine types, deserves a test before the upgrade, not after.</p>
<h2>How I'd decide</h2>
<p><strong>Production systems on .NET 8 or 9, especially business-critical or change-controlled ones.</strong> Move to .NET 10. You get a long support window and a release the ecosystem has already settled around. From .NET 8 it is also a smaller step than going to .NET 11.</p>
<p><strong>A new project starting now.</strong> I'd start on .NET 10 unless the product needs a specific .NET 11 feature. The end date is the same, so being on the newest release on day one gets you little beyond the features themselves.</p>
<p><strong>Teams that upgrade every year, with strong automated tests and a CI pipeline that makes it cheap.</strong> .NET 11 is a reasonable choice. The end date is the same as .NET 10, you get the new features sooner, and your process already absorbs a new release every year.</p>
<p><strong>Systems that can't move before the deadline.</strong> That's a real situation in large organisations. If it's yours, treat it as a risk decision that is written down, with an owner and a date. Don't let it drift as an unspoken exception.</p>
<h2>A sensible order for the upgrade</h2>
<ol>
<li>Inventory what you run and which version each service targets, including build agents and base container images.</li>
<li>Update the third-party packages and tools first, and read their release notes for the target version.</li>
<li>Change the target framework and the SDK version, then fix what the compiler finds.</li>
<li>Run the full test suite, then deploy to a staging environment under realistic load and watch the behavioural changes, not just the errors.</li>
<li>Check that your hosting platform supports the target version before you cut over. The Microsoft pages I read don't state timing for Azure App Service, Functions or AKS, so confirm that in the current documentation.</li>
</ol>
<p>I wrote about the human side of these migrations, the part that tends to take longer than the code changes, in the previous article linked below.</p>
<p>If you're still on .NET 8 or 9, which way are you leaning, and what's holding you back?</p>
<p>Related: <a href="https://medium.com/@chaturvedideep/upgrading-net-is-easy-keeping-the-business-running-is-the-hard-part-0704743ef395">Upgrading .NET Is Easy. Keeping the Business Running Is the Hard Part.</a></p>
<p>I share shorter notes on architecture and .NET on X at @DeepCTech.</p>
]]></content:encoded></item></channel></rss>