<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: chandana pushpakumara</title>
    <description>The latest articles on DEV Community by chandana pushpakumara (@chandana_pushpakumara_4bf).</description>
    <link>https://dev.to/chandana_pushpakumara_4bf</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3818157%2Fc6f94c02-6f13-4934-b70b-31d989e857ce.jpg</url>
      <title>DEV Community: chandana pushpakumara</title>
      <link>https://dev.to/chandana_pushpakumara_4bf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chandana_pushpakumara_4bf"/>
    <language>en</language>
    <item>
      <title>EF Core 10 Performance Issue</title>
      <dc:creator>chandana pushpakumara</dc:creator>
      <pubDate>Mon, 30 Mar 2026 10:12:00 +0000</pubDate>
      <link>https://dev.to/chandana_pushpakumara_4bf/ef-core-10-performance-issue-3p9j</link>
      <guid>https://dev.to/chandana_pushpakumara_4bf/ef-core-10-performance-issue-3p9j</guid>
      <description>&lt;p&gt;The most common performance issue is fetching a list of items and then calling the database again for each child record.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The “Slow” Method(N+1):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;blogs&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Blogs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToListAsync&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 
&lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;blog&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;blogs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;posts&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Posts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;BlogId&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="n"&gt;blog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Id&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;ToListAsync&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The EF Core 10 “Fast” Method(Filtered Include):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;blogs&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Blogs&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Include&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Posts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsPublished&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="c1"&gt;// Filtered Include&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToListAsync&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;EF Core 10 Performance Result&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2d03i8v1ngmjzlk9cl34.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2d03i8v1ngmjzlk9cl34.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here I used 100000 records. My benchmark result shows that the N+1 query problem was over 280x slower than using Include(). However, optimizations like projection AsNoTracking() showed minimal gains in small datasets, highlighting that performance tuning depends heavily on scale.&lt;/p&gt;

&lt;p&gt;I wrote a detailed article about 4 other optimization traps here: &lt;a href="https://csharpcodeexcellent.com/ef-core-10-performance-fixing-5-slow-query/" rel="noopener noreferrer"&gt;EF Core 10 Performance: Fixing 5 Common Slow Queries&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>database</category>
      <category>dotnet</category>
      <category>performance</category>
    </item>
    <item>
      <title>Native AOT in .NET 10: Everything for C# Developers</title>
      <dc:creator>chandana pushpakumara</dc:creator>
      <pubDate>Sun, 22 Mar 2026 10:06:26 +0000</pubDate>
      <link>https://dev.to/chandana_pushpakumara_4bf/native-aot-in-net-10-everything-for-c-developers-2m7e</link>
      <guid>https://dev.to/chandana_pushpakumara_4bf/native-aot-in-net-10-everything-for-c-developers-2m7e</guid>
      <description>&lt;p&gt;Honestly, C# has had an incredible run over the last twenty years. It’s easily one of the most balanced languages out there, but I think people often forget how much of that heavy lifting is actually done by the JIT compiler. The way it optimizes everything on the fly at runtime is really what gives it that performance edge.&lt;/p&gt;

&lt;p&gt;But in 2026, Microsoft introduced Native AOT in .NET 10. The performance floor has shifted. Now that .NET 10 has fully leaned into Native AOT, the trade-offs have changed. In a world of real-time AI and massive container clusters, 'fast enough' doesn't cut it. We need that immediate execution and smaller footprint to stay competitive, especially when you're scaling a thousand instances where every megabyte of overhead adds up.&lt;/p&gt;

&lt;p&gt;This is where Native AOT (Ahead-of-Time compilation) in .NET 10 becomes a game changer.&lt;/p&gt;

&lt;p&gt;Traditional Model (JIT)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code compiled to Intermediate Language (IL)&lt;/li&gt;
&lt;li&gt;JIT compiles IL → machine code at runtime&lt;/li&gt;
&lt;li&gt;Pros: Flexibility, dynamic optimizations&lt;/li&gt;
&lt;li&gt;Cons: Startup delay, higher memory usage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Native AOT Model&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code compiled directly into machine code during publish&lt;/li&gt;
&lt;li&gt;No JIT compilation required at runtime&lt;/li&gt;
&lt;li&gt;Pros: Instant startup, smaller footprint, improved security&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Project: Native AOT vs JIT Performance Benchmark
&lt;/h2&gt;

&lt;p&gt;🧱 Solution Structure&lt;br&gt;
&lt;code&gt;AOTPerformanceDemo/&lt;br&gt;
 ├── JitApp/          (Standard .NET Console App)&lt;br&gt;
 ├── AotApp/          (Native AOT Console App)&lt;br&gt;
 └── BenchmarkRunner/ (Measures performance)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create the Solution&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet new sln &lt;span class="nt"&gt;-n&lt;/span&gt; AOTPerformanceDemo
dotnet new console &lt;span class="nt"&gt;-n&lt;/span&gt; JitApp
dotnet new console &lt;span class="nt"&gt;-n&lt;/span&gt; AotApp
dotnet new console &lt;span class="nt"&gt;-n&lt;/span&gt; BenchmarkRunner
dotnet sln add JitApp
dotnet sln add AotApp
dotnet sln add BenchmarkRunner
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Add Sample Workload (Same Code in Both Apps)&lt;/strong&gt;&lt;br&gt;
Replace Program.cs in JitApp and AotApp:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System.Diagnostics&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"App starting..."&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;sw&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Stopwatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;StartNew&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;HeavyComputation&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="n"&gt;sw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Stop&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"Result: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"Execution Time: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ElapsedMilliseconds&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt; ms"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;long&lt;/span&gt; &lt;span class="nf"&gt;HeavyComputation&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;long&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt; &lt;span class="m"&gt;10_000_000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;++)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="p"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Enable Native AOT (Only for AotApp)&lt;/strong&gt;&lt;br&gt;
Edit AotApp.csproj:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;Project&lt;/span&gt; &lt;span class="na"&gt;Sdk=&lt;/span&gt;&lt;span class="s"&gt;"Microsoft.NET.Sdk"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;  
&lt;span class="nt"&gt;&amp;lt;PropertyGroup&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;OutputType&amp;gt;&lt;/span&gt;Exe&lt;span class="nt"&gt;&amp;lt;/OutputType&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;TargetFramework&amp;gt;&lt;/span&gt;net10.0&lt;span class="nt"&gt;&amp;lt;/TargetFramework&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- Enable Native AOT --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;PublishAot&amp;gt;&lt;/span&gt;true&lt;span class="nt"&gt;&amp;lt;/PublishAot&amp;gt;&lt;/span&gt;    
    &lt;span class="c"&gt;&amp;lt;!-- Reduce size --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;PublishTrimmed&amp;gt;&lt;/span&gt;true&lt;span class="nt"&gt;&amp;lt;/PublishTrimmed&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;InvariantGlobalization&amp;gt;&lt;/span&gt;true&lt;span class="nt"&gt;&amp;lt;/InvariantGlobalization&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/PropertyGroup&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/Project&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Build JIT App&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet build JitApp &lt;span class="nt"&gt;-c&lt;/span&gt; Release
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Publish Native AOT App&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet publish AotApp &lt;span class="nt"&gt;-c&lt;/span&gt; Release &lt;span class="nt"&gt;-r&lt;/span&gt; win-x64
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Benchmark Runner&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="nn"&gt;System.Diagnostics&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;RunTest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"JIT App"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;@"..\JitApp\bin\Release\net10.0\JitApp.exe"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;RunTest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Native AOT App"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;@"..\AotApp\bin\Release\net10.0\win-x64\publish\AotApp.exe"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 

&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;RunTest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"\nRunning &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;..."&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;sw&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Stopwatch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;StartNew&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 

    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;process&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Process&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;StartInfo&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;ProcessStartInfo&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;FileName&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;RedirectStandardOutput&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;UseShellExecute&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;false&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt; 

    &lt;span class="n"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Start&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WaitForExit&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 
    &lt;span class="n"&gt;sw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Stop&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; 

    &lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt; Total Time (including startup): &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ElapsedMilliseconds&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt; ms"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Run Benchmark&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet run &lt;span class="nt"&gt;--project&lt;/span&gt; BenchmarkRunner &lt;span class="nt"&gt;-c&lt;/span&gt; Release
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Find the complete implementation and benchmarking project on &lt;a href="https://github.com/chandana-jagath/AOTPerformanceDemo.git" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F14tkm6hkwd9b8o0h0e1v.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F14tkm6hkwd9b8o0h0e1v.jpg" alt=" " width="680" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12bpyy1ikptojbo67h4h.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12bpyy1ikptojbo67h4h.jpg" alt=" " width="800" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Based on the results shown in my terminal, here is a visual comparison of the performance gap between the standard JIT approach and the new Native AOT in .NET 10.&lt;/p&gt;

&lt;p&gt;The data reflects the following metrics from my run:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JIT App (Standard): 170 ms total execution time.&lt;/li&gt;
&lt;li&gt;Native AOT App: 69 ms total execution time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This represents a ~60% reduction in startup and execution time for the Native AOT version.&lt;br&gt;
If you interesting you can read my &lt;a href="https://csharpcodeexcellent.com/native-aot-in-net-10/" rel="noopener noreferrer"&gt;full article&lt;/a&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>csharp</category>
      <category>dotnet</category>
      <category>performance</category>
    </item>
    <item>
      <title>C# Memory Management: Using Span and Memory for Zero-Allocation</title>
      <dc:creator>chandana pushpakumara</dc:creator>
      <pubDate>Mon, 16 Mar 2026 04:33:32 +0000</pubDate>
      <link>https://dev.to/chandana_pushpakumara_4bf/c-memory-management-using-span-and-memory-for-zero-allocation-38jh</link>
      <guid>https://dev.to/chandana_pushpakumara_4bf/c-memory-management-using-span-and-memory-for-zero-allocation-38jh</guid>
      <description>&lt;h2&gt;
  
  
  Introduction: The Cost of the Garbage Collector (GC)
&lt;/h2&gt;

&lt;p&gt;One of the biggest advantages of modern .NET development is managed memory. Developers do not need to concern about manual memory allocation and deallocation like in C or C++. The .NET Garbage Collector (GC) get that concern on behalf of programmers, it automatically handles memory cleanup, making development safer and more productive. Here is the master class of C# memory management&lt;/p&gt;

&lt;p&gt;However, “managed code” does not mean free performance.&lt;/p&gt;

&lt;p&gt;When applications allocate too many objects on the heap, the Garbage Collector must frequently run to get back memory. This is the reason for several performance challenges:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GC Pressure – Frequent object allocations increase the workload for the garbage collector.&lt;/li&gt;
&lt;li&gt;Stop-the-world pauses – The GC temporarily pauses application threads to get back memory.&lt;/li&gt;
&lt;li&gt;Heap fragmentation – Repeated allocations and deallocations create ineffective memory layouts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In most enterprise applications, this overhead is acceptable. But in low-latency environments, even a small startup can cause a serious problem&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Span and Memory?
&lt;/h2&gt;

&lt;p&gt;Span is one of the most advanced memory allocation method adding to .NET. It represents a lightweight view over contiguous memory.&lt;/p&gt;

&lt;p&gt;Key characteristics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can point to stack memory&lt;/li&gt;
&lt;li&gt;Can point to heap arrays&lt;/li&gt;
&lt;li&gt;Does not allocate memory&lt;/li&gt;
&lt;li&gt;Extremely fast&lt;/li&gt;
&lt;li&gt;Stack-only structure&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Span&amp;lt;int&amp;gt; numbers = stackalloc int[5];&lt;br&gt;
numbers[0] = 10;&lt;br&gt;
numbers[1] = 20;&lt;br&gt;
numbers[2] = 30;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here, we allocate an array directly on the stack. Benifit of this memory allocation does not involve garbage collector allocation. The user can experience faster execution and automatic memory release.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Because Span is stack-only&lt;/strong&gt;, it cannot be used in async methods.&lt;/p&gt;

&lt;p&gt;This is where Memory comes into the picture. Memory Provides a heap-safe wrapper around memory buffers.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Memory&amp;lt;byte&amp;gt; buffer = new byte[1024];&lt;br&gt;
Span&amp;lt;byte&amp;gt; span = buffer.Span;&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Zero-Allocation Patterns: Practical Examples
&lt;/h2&gt;

&lt;p&gt;Now we are going to write a C# code for veryfy how these allocations are working. I create sample .NET console application for expain these zero allocation pattern&lt;br&gt;
Over 15 year experiese, I can say most of the developers create extra allocations when working with strings. This is a way to reduce it.&lt;/p&gt;

&lt;p&gt;The Scenario: Extracting a "Product Code" from a long String&lt;/p&gt;

&lt;p&gt;In traditional C#, developers use .Substring() a method that creates a new string object on the heap every time it is called. If you are processing a 1GB file, this creates massive Garbage Collector (GC) pressure.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Project Setup&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Create a Console Application for your benchmarks. Mixing benchmarks into your main Web API can skew the results due to background service interference.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Create a new console app&lt;br&gt;
dotnet new console -n MyPerformanceLab&lt;br&gt;
cd MyPerformanceLab&lt;br&gt;
Add the BenchmarkDotNet nuget package (the industry standard)&lt;/code&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Designing Your Benchmark Class&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Create a new file called StringPerformance.cs. Use the [MemoryDiagnoser] attribute; this is what adds the high-value "Allocated Memory" column to your results.&lt;/p&gt;

&lt;p&gt;`using BenchmarkDotNet.Attributes;&lt;/p&gt;

&lt;p&gt;namespace MyPerformanceLab&lt;br&gt;
{&lt;br&gt;
    [MemoryDiagnoser]&lt;br&gt;
    [RankColumn]&lt;br&gt;
    public class StringPerformance&lt;br&gt;
    {&lt;br&gt;
        private const string TelemetryData = "ID:9982-XYZ-2026-LOG-DATA";&lt;br&gt;
        private const int Length = 8;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    [Benchmark(Baseline = true)]
    public string UsingSubstring()
    {
        int start = TelemetryData.IndexOf(':') + 1;
        return TelemetryData.Substring(start, Length);
    }

    [Benchmark]
    public ReadOnlySpan&amp;lt;char&amp;gt; UsingSpan()
    {
        ReadOnlySpan&amp;lt;char&amp;gt; span = TelemetryData.AsSpan();
        int start = span.IndexOf(':') + 1;
        return span.Slice(start, Length);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}`&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Triggering the Run&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In your Program.cs, replace the default code with the BenchmarkRunner.&lt;/p&gt;

&lt;p&gt;`using BenchmarkDotNet.Running;&lt;/p&gt;

&lt;p&gt;// This triggers the heavy-duty measurement cycle&lt;br&gt;
var summary = BenchmarkRunner.Run();`&lt;/p&gt;

&lt;p&gt;This is my result. It unbelievable&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmya9oe2d3a4x3lqnqriq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmya9oe2d3a4x3lqnqriq.png" alt=" " width="800" height="173"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Output: You can clearly see that using Span is 3x time faster than using Substring&lt;/p&gt;

&lt;p&gt;You can also download the full source code for these benchmarks on my &lt;a href="https://github.com/chandana-jagath/MyPerformanceLab.git" rel="noopener noreferrer"&gt;GitHub Repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is my &lt;a href="https://csharpcodeexcellent.com/c-memory-management-using-span-and-memory/" rel="noopener noreferrer"&gt;full article&lt;/a&gt;&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
      <category>performance</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>The CommandType Enumeration Value 512 Is Not Supported – Complete Fix in ASP.NET / .NET Framework</title>
      <dc:creator>chandana pushpakumara</dc:creator>
      <pubDate>Thu, 12 Mar 2026 14:54:05 +0000</pubDate>
      <link>https://dev.to/chandana_pushpakumara_4bf/the-commandtype-enumeration-value-512-is-not-supported-complete-fix-in-aspnet-net-framework-k00</link>
      <guid>https://dev.to/chandana_pushpakumara_4bf/the-commandtype-enumeration-value-512-is-not-supported-complete-fix-in-aspnet-net-framework-k00</guid>
      <description>&lt;p&gt;When Developers working with ADO.NET and SQL Server in .NET Framework or ASP.NET applications may get this error: “The CommandType enumeration value 512 is not supported by the .NET Framework SqlClient Data Provider” in their programming life. This error occurs when executing database commands using ADO.NET with an incorrect CommandType. The concern of this, SQL Server provider does not support CommandType.TableDirect (value 512).&lt;/p&gt;

&lt;p&gt;Reason behind this behavior: Supported only by OleDb providers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Error Code
&lt;/h2&gt;

&lt;p&gt;cmd.CommandType = CommandType.TableDirect;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to fix this error
&lt;/h2&gt;

&lt;p&gt;✔ Solution 1 – Use CommandType.Text&lt;/p&gt;

&lt;p&gt;For normal SQL queries:&lt;/p&gt;

&lt;p&gt;cmd.CommandType = CommandType.Text;&lt;br&gt;
cmd.CommandText = "SELECT * FROM Employees";&lt;/p&gt;

&lt;p&gt;✔ Solution 2 – Use StoredProcedure&lt;/p&gt;

&lt;p&gt;For stored procedures:&lt;/p&gt;

&lt;p&gt;cmd.CommandType = CommandType.StoredProcedure;&lt;br&gt;
cmd.CommandText = "GetEmployees";&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>database</category>
      <category>dotnet</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
