<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Code on Dimitri Laaraybi</title>
    <link>https://www.dimitrilaaraybi.com/tags/code/</link>
    <description>Recent content in Code on Dimitri Laaraybi</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Wed, 24 Dec 2025 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.dimitrilaaraybi.com/tags/code/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Exploring Extension Members in C# 14</title>
      <link>https://www.dimitrilaaraybi.com/blog/extensionmembers/</link>
      <pubDate>Wed, 24 Dec 2025 00:00:00 +0000</pubDate>
      <guid>https://www.dimitrilaaraybi.com/blog/extensionmembers/</guid>
      <description>&lt;p&gt;C# 14 introduces one of the most requested language features in years: &lt;strong&gt;Extension Members&lt;/strong&gt;.&lt;br&gt;&#xA;While C# has long supported extension methods, the new extension member system dramatically expands what developers can add to types they don’t control, enabling us to do pretty much whatever we want with non-user types 🔥&lt;br&gt;&#xA;In this article, we&amp;rsquo;ll try to explain what are those new extension members and how to use it properly, so let&amp;rsquo;s go !&lt;/p&gt;</description>
    </item>
    <item>
      <title>Reducing dependencies with the IServiceUtils&lt;T&gt; pattern</title>
      <link>https://www.dimitrilaaraybi.com/blog/serviceutils/</link>
      <pubDate>Sat, 26 Jul 2025 00:00:00 +0000</pubDate>
      <guid>https://www.dimitrilaaraybi.com/blog/serviceutils/</guid>
      <description>&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;&#xA;&lt;p&gt;In many C#/.NET applications, business services rely on common dependencies like logging, mapping, time management, or database repositories.&lt;br&gt;&#xA;Injecting these repeatedly into every service can lead to boilerplate code, inconsistency and less room for dependancies with relevant business logic value.&lt;br&gt;&#xA;Another drawback of this is that potential code scanners like Sonar could eventually raise some rules errors when some of your constructors injects too much parameters (which is the case by default in Sonar C# rules, 7 max allowed 😉). And this rule break could potentially block your quality gate ❌&lt;/p&gt;</description>
    </item>
    <item>
      <title>Beware of Task.Run() !</title>
      <link>https://www.dimitrilaaraybi.com/blog/bewareoftaskrun/</link>
      <pubDate>Tue, 18 Mar 2025 00:00:00 +0000</pubDate>
      <guid>https://www.dimitrilaaraybi.com/blog/bewareoftaskrun/</guid>
      <description>&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;&#xA;&lt;p&gt;Hey all ! 🫡&lt;/p&gt;&#xA;&lt;p&gt;A little post to share some thoughts about the &lt;strong&gt;Task.Run()&lt;/strong&gt; method, and the problems you could encounter especially in a .NET API using a GlobalExceptionHandler. ❌&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-actually-happen-when-you-need-to-start-a-task-as-fire-and-forget-and-you-have-an-exceptionhandler-configured-globally-&#34;&gt;What actually happen when you need to start a Task as &amp;ldquo;fire and forget&amp;rdquo;, and you have an ExceptionHandler configured globally ?&lt;/h2&gt;&#xA;&lt;p&gt;This kind of case can happen frequently, for example if you need to await a particular business process, and start some tasks after that process that does not need to be awaited by the calling context.&lt;/p&gt;</description>
    </item>
    <item>
      <title>No, FluentAssertions is not the only one... Here is how to switch from FluentAssertions to Shouldly !</title>
      <link>https://www.dimitrilaaraybi.com/blog/migratetoshouldly/</link>
      <pubDate>Sun, 02 Mar 2025 00:00:00 +0000</pubDate>
      <guid>https://www.dimitrilaaraybi.com/blog/migratetoshouldly/</guid>
      <description>&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;&#xA;&lt;p&gt;Hey all ! 🫡&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s talk about another little drama that has been shaking the .NET community during the last weeks.&lt;br&gt;&#xA;When working on unit tests in .NET, developers often rely on assertion libraries to make their tests more readable and expressive.&lt;br&gt;&#xA;Two popular libraries in this space are &lt;strong&gt;FluentAssertions&lt;/strong&gt; and &lt;strong&gt;Shouldly&lt;/strong&gt;. While both libraries serve the same purpose, one of them actually updated its licensing model and frightened the whole community about his new goal, making money 😂 (Well who does not want to) &lt;br&gt;&#xA;And this one is &lt;strong&gt;FluentAssertions&lt;/strong&gt;.&lt;br&gt;&#xA;In fact, it now &lt;a href=&#34;https://www.reddit.com/r/dotnet/comments/1i17jm0/fluentassertions_becomes_paid_software_for/&#34;&#xA;    target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&#xA;  requires a paid licence&#xA;&lt;/a&gt; to be used for commercial use. At least, concerning the 8.x.x version. The developers have stated that the 7.x.x version will be forever free and receive critical fixes, but this strange move from their side may have pushed you to find another library for your assertions, to avoid any problems with the company you work for.&lt;br&gt;&#xA;If that&amp;rsquo;s the case, here is a little tutorial that explains how to migrate from FluentAssertions to Shouldly !&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to switch from Moq to NSubstitute after the SponsorLink scandal ?</title>
      <link>https://www.dimitrilaaraybi.com/blog/moqtonsubstitute/</link>
      <pubDate>Thu, 17 Aug 2023 00:00:00 +0000</pubDate>
      <guid>https://www.dimitrilaaraybi.com/blog/moqtonsubstitute/</guid>
      <description>&lt;p&gt;Hey devs ! 😁&lt;/p&gt;&#xA;&lt;p&gt;If you are a .NET developer who uses the popular mocking library Moq for your unit tests, you may have heard about the recent controversy that erupted when it was revealed that Moq was secretly collecting and sending user email addresses to a third-party service called SponsorLink. This was done &lt;a href=&#34;https://www.reddit.com/r/dotnet/comments/15ljdcc/does_moq_in_its_latest_version_extract_and_send/&#34;&#xA;    target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&#xA;  without the consent or knowledge of the developers who used Moq&#xA;&lt;/a&gt;, and raised serious privacy and security concerns.&lt;br&gt;&#xA;In this post, I&amp;rsquo;ll try to explain in more details what this scandal is all about and how to switch from Moq to NSubstitute if you see fit, but also how to prevent your projects from those vulnerabilities in a DevSecOps way 😉&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
