<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Maarten Merken on Medium]]></title>
        <description><![CDATA[Stories by Maarten Merken on Medium]]></description>
        <link>https://medium.com/@maartenmerken?source=rss-a385aec9486c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*EXjDF_ziPAB6VBxmMF3hkQ.jpeg</url>
            <title>Stories by Maarten Merken on Medium</title>
            <link>https://medium.com/@maartenmerken?source=rss-a385aec9486c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 06:19:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@maartenmerken/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[M1 Macs and the SSD issue (March 2022)]]></title>
            <link>https://maartenmerken.medium.com/m1-macs-and-the-ssd-issue-march-2022-168e3d1b97a8?source=rss-a385aec9486c------2</link>
            <guid isPermaLink="false">https://medium.com/p/168e3d1b97a8</guid>
            <category><![CDATA[ssd]]></category>
            <category><![CDATA[macbook]]></category>
            <category><![CDATA[m1-chip]]></category>
            <dc:creator><![CDATA[Maarten Merken]]></dc:creator>
            <pubDate>Tue, 15 Mar 2022 17:27:45 GMT</pubDate>
            <atom:updated>2022-03-15T17:27:45.380Z</atom:updated>
            <content:encoded><![CDATA[<h4>Remember <a href="https://www.zdnet.com/article/the-m1-mac-write-issue/">SSD SwapGate</a> ?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wpF9_dZJkOmkLF031oebXQ.jpeg" /></figure><p>Turns out, the <a href="https://medium.com/codex/the-apple-m1-ssd-swapgate-is-a-massive-overreaction-50002ee23d0">hysteria around it was exaggerated</a>, <a href="https://appleinsider.com/articles/21/06/04/apple-resolves-m1-mac-ssd-storage-longevity-issue-in-macos-114-beta">Apple addressed the issue in a later update to Big Sur</a>.</p><p>For reference, I’ve been using this MacBook Air M1 for over a year now, I’ve basically transferred all of my Development workflow onto it and these are my stats:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wUAzRMHKw6QvvMLmg13YoA.png" /></figure><p>When inspecting my workflow, you’ll see that I’m maxing out the memory (16GB) on a daily basis, but for the moment, it does not result in any excessive wear to the SSD.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*hAyLXlgjLYxBY05N8ifIMg.png" /></figure><p>Although I wouldn’t recommend less than 16GB for Software Development, I get by just fine, for now.</p><p>As for performance, the M1 packs more than enough horsepower for my daily workloads, so I’m not too worried.</p><p>Eagerly waiting for that M2, though… 🤪🤩</p><h4>In closing</h4><p>Earlier this year, <a href="https://twitter.com/marcan42/status/1494213862970707969">Hector Martin pointed out that</a>, essentially, the “<strong>data</strong>” that is supposed to be on disk is kept in memory for longer than expected. Meaning, MacOs can cheat its way into performing faster than other systems. So if your device would be to lose power, even when idle, it could result in data loss.</p><p>This isn’t an issue for MacBooks persé, but it sure makes you wonder about the iMac and Mac mini and even, the new Mac Studio Desktop.</p><p>While I’m sure Apple will address these issues at some point in the future, it seems consumers need to be wary of this situation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=168e3d1b97a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[With .NET 6, comes Prise 6 ]]></title>
            <link>https://maartenmerken.medium.com/with-net-6-comes-prise-6-43e7f01037ef?source=rss-a385aec9486c------2</link>
            <guid isPermaLink="false">https://medium.com/p/43e7f01037ef</guid>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[plugin-framework]]></category>
            <dc:creator><![CDATA[Maarten Merken]]></dc:creator>
            <pubDate>Mon, 29 Nov 2021 16:21:36 GMT</pubDate>
            <atom:updated>2021-11-29T16:21:36.724Z</atom:updated>
            <content:encoded><![CDATA[<h3>With .NET 6, comes Prise 6 🎉</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/0*No72ad357gaAuLTh.png" /></figure><p>We’re excited to announce that Prise has been successfully ported to .NET 6, thanks to <a href="https://github.com/tartanlegrand">https://github.com/tartanlegrand</a> for the <a href="https://github.com/merken/Prise/pull/55">Pull Request</a>!</p><p>In this version, the framework has been upgraded to net6.0, at this point, we’re not planning to add any additional features to Prise. We are planning to release an update to the <a href="https://marketplace.visualstudio.com/items?itemName=MRKN.PrisePublishPluginExtension">Visual Studio Publish Plugin Extension</a> for Visual Studio 2022, this is currently being worked on and will release before the end of the year.</p><p>It’s lovely to see that Prise is growing slowly, while the numbers are not mind-blowing, we still are proud to see that our hard work is being consumed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*D9xEiRa7ImqmgnwGT0ybJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-_R1m4lgWLYe6en3zDdQqA.png" /></figure><p>For those who are still unfamiliar with Prise, Prise is a .NET (Core) plugin framework that allows you to truly write a plugin once and inject it forever into your application, due to its guaranteed backwards plugin compatibility.</p><p>Check out our documentation guide: <a href="https://merken.github.io/Prise/#/">https://merken.github.io/Pris</a>e</p><p>Check out the example Weather application: <a href="https://github.com/merken/Weather">https://github.com/merken/Weather</a></p><p>Hope to see you in 2022, cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43e7f01037ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[.Net Development on the M1 Mac]]></title>
            <link>https://maartenmerken.medium.com/net-development-on-the-m1-mac-48d720a5a843?source=rss-a385aec9486c------2</link>
            <guid isPermaLink="false">https://medium.com/p/48d720a5a843</guid>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[m1]]></category>
            <category><![CDATA[microsoft]]></category>
            <dc:creator><![CDATA[Maarten Merken]]></dc:creator>
            <pubDate>Thu, 11 Nov 2021 14:44:28 GMT</pubDate>
            <atom:updated>2021-11-14T21:24:49.374Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*cDTxf41MlVKpsukwnsXvJw.png" /></figure><p>I switched to a MacBook about 2 years ago, I’m a Software Engineer in .NET and Angular.</p><p>Since .NET (Core) is cross-platform, I decided to switch things up a bit, and once Apple introduced their new in-house ARM-based silicon, I was eager to try it out.</p><p>This is how I managed to setup my M1 MacBook Air for .NET and Angular (NodeJS) development.</p><h3>The state of .NET on Apple ARM64</h3><p>When the M1 chip came out, it was already possible to install the runtime (or even the SDK) of .NET Core 3.1 (and lower) and have it compile and run applications. This just worked using Rosetta:</p><pre>dotnet myapp.dll</pre><p>Debugging, however, was an entire different story. The dotnet team and Apple were in close contact in order to smooth out bugs in Rosetta. You could join the Big Sur beta program in order to get these fixes early on.</p><p>The latest Big Sur release fully supports running and debugging .NET Core applications (including .NET 5). The performance of .NET under Rosetta was impressive, <a href="https://www.youtube.com/watch?v=SLSe9mrUz6c">but it wasn’t orders of magnitude faster than running on Intel</a>.</p><p>With .<strong>NET 6 on ARM</strong>, however, we can see <strong>significant improvements</strong> in application <strong>startup times</strong>, ASP.NET <strong>response times</strong> and general test execution times overall.</p><p>When the M1 first came out, Youtuber Alexander Ziskind did <a href="https://www.youtube.com/watch?v=SLSe9mrUz6c">a comparison between .NET 5 on Intel vs M1</a></p><p>The Intel i9 MBP outperformed the M1 by a small margin, keep in mind that .NET 5 was running through Rosetta translation.</p><p>I retried this test on my M1 using .NET 6 on ARM and these are the results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7e71_EB2RBWAEWWrii_B4A.png" /></figure><p>47 seconds consistently, not bad considering that the i9 did about 57 seconds and the M1 did about 60 seconds (using Rosetta).</p><p>For those who are interested in the benchmarking code, here’s the C# 10 variant of it:</p><pre>using System.Runtime.CompilerServices;</pre><pre>using System.Security.Cryptography;</pre><pre>for (int i = 0; i &lt; 100_000_000; i++)</pre><pre>{</pre><pre>    Consume(CryptoConfig.CreateFromName(&quot;RSA&quot;));</pre><pre>}</pre><pre>[MethodImpl(MethodImplOptions.NoInlining)]</pre><pre>static void Consume&lt;T&gt;(in T _) { }</pre><p>So, if your workflow exists of pure .NET Core, or .NET 5 or 6, you’ll be happy using your M1 machine for development.</p><h3>IDE: Integrated Development Environment</h3><p>When the M1 first came out, most of our toolset relied on the Rosetta 2 translation layer in order to run x86-based applications on the ARM architecture.</p><p>This included VS Code, Visual Studio for Mac, JetBrains Rider, Omnisharp, Mono…</p><p><strong>The experience was awful on all of them,</strong> they’d get the job done eventually, but I wasn’t ready to retire my i7 MacBook Pro anytime soon.</p><p>The ARM-based versions of these IDE’s came out gradually, apart from Visual Studio for Mac, <strong>all of my workflow can now be run on Apple Silicon natively</strong>.</p><p>So what’s the status quo for .NET development on M1 in <strong>November 2021</strong>?</p><h4>Visual Studio for Mac</h4><p><em>I mean, it works?</em></p><p>To understand where <a href="https://visualstudio.microsoft.com/vs/mac/">Visual Studio for Mac</a> came from, you must first understand <a href="https://www.monodevelop.com/">MonoDevelop</a>. MonoDevelop is a cross platform IDE for building .NET applications using the Mono framework. It has been around for some time. Visual Studio for Mac is a spin-off this technology. Since there are no plans from Microsoft to port this to native Apple Silicon (ARM64), you’re stuck with Rosetta emulation.</p><p><strong>I’ve tried my best to use Visual Studio for Mac,</strong> I really did. For small projects, sure, you could give it a shot. But for my 40+ project solution, it just was not performant enough.</p><p>However, do not fret, <a href="https://devblogs.microsoft.com/visualstudio/visual-studio-2022-for-mac-preview-3-and-upcoming-native-m1-processor-support/">for support on M1 is coming in the future</a>, stay tuned!</p><h4>VS Code</h4><p><a href="https://code.visualstudio.com/#alt-downloads">VS Code</a> was the first IDE to be ported to ARM64 Apple Silicon, mostly due to it was already ported to Raspberry Pi ARM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*KRl1kLW-FU0CG2dwpu98iA.png" /></figure><p>You can get the Apple Silicon optimised version of VS Code today. Most of the extensions have been ported to ARM64 and most of all, Omnisharp has been ported to darwin-arm64, too!</p><p>VS Code is the <strong>best free alternative</strong> to develop .NET applications on Apple Silicon. However, VS Code is a <strong>code editor</strong>, a <strong>very capable one</strong>. But for professional development you might need an <strong>actual IDE.</strong></p><h4>JetBrains Rider</h4><p>Let me be blunt, <strong>Rider is the best cross-platform IDE for .NET development to date.</strong></p><p>Even on Rosetta emulation, Rider was <strong>far more performant than Visual Studio for Mac.</strong> They were prompt to adopt Apple Silicon, releasing an EAP (early access preview) free of charge in order to test out Rider running natively on ARM64.</p><blockquote>Tip: if you want to download the most <a href="https://www.jetbrains.com/rider/download/other.html">stable build of Rider</a>, add the following to the download URL : ‘-aarch64.dmg’.</blockquote><blockquote>For example: <a href="https://download.jetbrains.com/rider/JetBrains.Rider-2021.2.2-aarch64.dmg">https://download.jetbrains.com/rider/JetBrains.Rider-2021.2.2<strong>-aarch64</strong>.dmg</a></blockquote><p>If you just want to try out Rider, you can get the EAP version here: <a href="https://www.jetbrains.com/rider/nextversion/">https://www.jetbrains.com/rider/nextversion/</a></p><p>Select the Apple Silicon version to download.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/1*JyVT2eug3CHxU4vmbVm3ag.png" /></figure><p>This version of Rider comes with its own version of .NET 6 for ARM, you can still install other .NET Core sdks on your system (like .NET Core 3.1). This will run under Rosetta when debugging, Rider is capable of spawning, attaching and terminating these processes, making this the most flexible IDE for .NET Core development to date!</p><h3>Virtualisation and Emulation: Windows on ARM</h3><p>Sometimes, as .NET developer, you just need to run a <strong>Windows executable on macOS.</strong></p><blockquote>For instance, my workflow contains of running an old x86 executable that was built years ago on Windows. This executable is used throughout the company to transform a file from a legacy format into an xml-based format. Many teams use this executable and is has not been modified for years. Porting it to .NET Core was out of scope.</blockquote><h4><strong>VirtualBox</strong></h4><p>At the moment, there’s no support to run a Virtual Machine through VirtualBox.</p><h4>VMWare</h4><p><a href="https://blogs.vmware.com/teamfusion/2021/09/fusion-for-m1-public-tech-preview-now-available.html?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=fusion-for-m1-public-tech-preview-now-available">VMWare announced a preview version of VMWare Fusion,</a> this allows you to run an ARM-based Virtual Machine. There are some limitations, though. For instance, you can’t get shared networking or shared clipboard to work due to the lack of VMWare Tools for ARM.</p><h4>UTM</h4><p><a href="https://github.com/utmapp/UTM/releases/latest/download/UTM.dmg">UTM</a> is emulation software and runs on top of <a href="https://www.qemu.org/">QEMU</a>.</p><p>Link to tutorial: <a href="https://jensd.be/1533/windows/windows-11-arm-on-m1-based-macs-with-utm">https://jensd.be/1533/windows/windows-11-arm-on-m1-based-macs-with-utm</a></p><h4>Parallels</h4><p><a href="https://www.parallels.com/eu/products/desktop/trial/">Parallels</a> is paid software, but in my opinion, it is worth the money if you need a Windows Virtual Machine on macOS. The performance is industry leading and the integration with macOS is sublime. I encourage you to install the trial and see for yourself.</p><h4>Windows on ARM</h4><p>Once you’ve picked your virtualisation software above, you’re ready to start with Windows on ARM. <a href="https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64">Download the Insider Preview from Microsoft</a> and use that virtual hard disk as the starting point for your VM.</p><p>After installing Windows 11 on ARM, you may want to activate it, you can do this with any valid Windows 10 license key. But first, make sure all your required software runs smoothly!</p><p>x86 applications are emulated on Windows on ARM, so you could technically install Visual Studio for Windows, .NET Framework 3.5 or 4.7, and start developing your WPF applications on that VM. I’ve done this, it works, but it’s <strong>not performant</strong>. However, I mean, if you occasionally need to handle this kind of workflow, sure, you could give it a shot.</p><p>The bottom line is, do not get a Mac for Windows WPF or .NET Framework development.</p><p>What about running a <strong>x86 Virtual Machine under emulation?</strong></p><p>I tried this, using UTM and QEMU, <strong>the experience is not pretty</strong>. I can’t recommend this approach to anyone.</p><h3>Docker</h3><p><a href="https://docs.docker.com/desktop/mac/apple-silicon/">Docker</a> (containerisation) is one the most versatile tools and skill you can learn in this decade, so you’ll be happy to hear that this just works on your Apple M1 machine.</p><h4>Running ARM-based Linux containers</h4><p>There’s <a href="https://hub.docker.com/search?q=arm64&amp;type=image&amp;architecture=arm64">lots of ARM64-based images</a> on Docker hub, mostly thanks to the Raspberry-pi community. Running these containers just work on the M1.</p><h4>Running x86-based Linux containers</h4><p><strong>Most</strong> of the official docker images are supported to run under <strong>AMD64 emulation.</strong> This is basically Docker emulating (using QEMU) the container on ARM64.</p><p>For instance, if you’d like to run the <strong>MySQL x86_64 image</strong> on your M1 you’d use:</p><pre>docker run -<strong>-platform linux/amd64</strong> mysql/mysql-server:latest</pre><p>This will spin up a MySQL server container using emulation.</p><p>Performance may vary, but when possible, try to find an ARM64 based counterpart for this image, if you can find any.</p><p>For MySQL, this is <a href="https://hub.docker.com/r/arm64v8/mariadb/">MariaDB</a></p><p>For MSSQL server, this is <a href="https://medium.com/geekculture/docker-express-running-a-local-sql-server-on-your-m1-mac-8bbc22c49dc9">Azure-Sql-Edge</a></p><h4>Running Windows containers</h4><p>You need a Windows host for this, <strong>I do not recommend nested virtualisation</strong>, like Parallels, for this. If your workflow requires you to spin up these kind of containers, you’re out of luck on Apple Silicon.</p><h3>Memory usage and Swap</h3><p>You might have heard that these M1 ARM chips have got some serious swapping going on, turns out that macOS itself loves to use swap, even if there’s still enough free RAM available.</p><p>Turns out, this was nothing to worry about, since Apple fixed these swapping issues update after update.</p><p>If you do worry about swap and the lifetime of your SSD. I’d say, skip out on the M1 MAX and invest in RAM first, and SSD second when getting a new M1 MacBook Pro.</p><p>Also, try to avoid using apps that require Rosetta translation, this will reduce swap dramatically.</p><h3>In closing</h3><p>I’ve been using my M1 MacBook Air with 16GB RAM for over a year now, it has lately replaced my 16&quot; MacBook Pro 2019 i7 5300M 32GB RAM. I enjoy the aesthetics of the Air and mostly the portability, whilst matching, sometimes excelling the performance of the Intel-based machine. For the moment I get by using 16GB of RAM. Once this falls short, I’ll look into getting an M1 Pro.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48d720a5a843" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apple M1 + VS Code: ARM Template and Template Language Service]]></title>
            <link>https://medium.com/geekculture/apple-m1-vs-code-arm-template-and-template-language-service-bb38bcadc99b?source=rss-a385aec9486c------2</link>
            <guid isPermaLink="false">https://medium.com/p/bb38bcadc99b</guid>
            <category><![CDATA[apple-m1-chip]]></category>
            <category><![CDATA[bicep]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Maarten Merken]]></dc:creator>
            <pubDate>Tue, 04 May 2021 20:09:48 GMT</pubDate>
            <atom:updated>2021-05-04T21:58:55.888Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/256/0*_fAeKf59fOgwjjWV.png" /></figure><p>Azure Bicep is increasing popularity presently, we started adopting this new DSL for Azure ARM some months ago and we have now completely switched over to using Bicep in favour of ARM-based templates.</p><p>After installing the Azure ARM and Bicep extensions on an M1 Mac you might see the following errors:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*0rQ31AEEOEh1xc-a_yLT9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*k1TnTL4C4tcJiW55iCX3Bg.png" /></figure><p>The fix is two-fold, you need to <strong>install</strong> both the 3.1 and 5.0 <strong>dotnet runtime</strong> on your machine using a <strong>Rosetta Terminal, </strong>and you need to <strong>configure the extension </strong>to use that runtime installation</p><h4>Rosetta Terminal</h4><p>If you don’t have a Rosetta Terminal yet, you can make one yourself by copying the <strong>Terminal.app </strong>from the<strong> Applications/Utilities </strong>directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*MKtJHx80HCxGqxTblNKN-A.png" /></figure><p>Select Terminal.app</p><p>⌘ + C</p><p>⌘ + V</p><p>After copying, rename the new <strong>Terminal.app</strong> to <strong>Rosetta Terminal.app</strong></p><p>Right-click the <strong>Rosetta Terminal.app </strong>and select<strong> Get Info.</strong></p><p>Select the checkbox <strong>Open using Rosetta</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*8vyRxT1T5EBCjwlPPE2C0Q.png" /></figure><p>Close the information window.</p><h4>Installing the dotnet runtimes using Rosetta Terminal</h4><p>Launch the new <strong>Rosetta Terminal.app</strong></p><p>Open an ARM template file in VS Code, you will see the following error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*k1TnTL4C4tcJiW55iCX3Bg.png" /></figure><p>Select the .NET Runtime output stream.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oim-la3oekRXHpUEGrxS-Q.png" /></figure><p>Select the installer command that this extension tried to execute:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1qdfY5WnZ4pyylbrPgy3Tw.png" /></figure><p>Paste and run the command you selected above in your <strong>Rosetta Terminal.app.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sY-xYoCfB9Bl-gUmUbTMsQ.png" /></figure><p>Open a Bicep file and your should get the same error on the dotnet 5.0 runtime…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*0rQ31AEEOEh1xc-a_yLT9w.png" /></figure><p>Repeat the previous steps, select the command from the <strong>output</strong> window and paste inside the <strong>Rosetta Terminal.app.</strong></p><h4><strong>Configuring the extensions</strong></h4><p>Now we need to configure these extensions to use the correct dotnet command.</p><p>Open VS Code.</p><p>Press ⌘ + SHIFT +P and type ‘<strong>Open settings</strong>’, select the <strong>Open Settings (JSON)</strong> option:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H72yxoQBVVDMRm18zaX47Q.png" /></figure><p>Add the following to your settings.json file:</p><pre>&quot;dotnetAcquisitionExtension.existingDotnetPath&quot;: [</pre><pre>    {</pre><pre>         &quot;extensionId&quot;: &quot;msazurermtools.azurerm-vscode-tools&quot;,</pre><pre>         &quot;path&quot;: &quot;/usr/local/share/dotnet/dotnet&quot;</pre><pre>    },</pre><pre>    {</pre><pre>        &quot;extensionId&quot;: &quot;ms-azuretools.vscode-bicep&quot;,</pre><pre>        &quot;path&quot;: &quot;/usr/local/share/dotnet/dotnet&quot;</pre><pre>    }</pre><pre>]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GX-kmX0AouX5LlRQQgR6mw.png" /></figure><p>Save and reload, you should be able to launch the <strong>ARM Template</strong> and <strong>Bicep</strong> Language Server now!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb38bcadc99b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/apple-m1-vs-code-arm-template-and-template-language-service-bb38bcadc99b">Apple M1 + VS Code: ARM Template and Template Language Service</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker Express: Running a Local SQL Server on Your M1 Mac]]></title>
            <link>https://medium.com/geekculture/docker-express-running-a-local-sql-server-on-your-m1-mac-8bbc22c49dc9?source=rss-a385aec9486c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bbc22c49dc9</guid>
            <category><![CDATA[sql-server]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[apple-m1]]></category>
            <dc:creator><![CDATA[Maarten Merken]]></dc:creator>
            <pubDate>Wed, 07 Apr 2021 06:38:12 GMT</pubDate>
            <atom:updated>2021-04-07T21:51:03.005Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hPGa1SOR-S5wNkQZ" /></figure><p>About 2 years ago, I wrote on how to run <a href="https://medium.com/agilix/docker-express-running-a-local-sql-server-express-204890cff699">SQL Express in a Docker container using the Microsoft SQL Server for Linux Docker image</a>.</p><p>Now, I find myself in need for the same on my M1 Mac. The original SQL Server for Linux image has not yet been ported to the ARM64 architecture. However, I found that there’s a new database technology, targeted for AI named <a href="https://hub.docker.com/_/microsoft-azure-sql-edge">Azure SQL Edge</a>. This database has been Dockerised and ported to ARM64 and thus <strong>can</strong> run on Docker for M1 on your Mac.</p><p><strong>TL;RD; </strong>This is how to run a Docker SQL instance on M1:</p><pre>docker run -e &quot;ACCEPT_EULA=1&quot; -e &quot;MSSQL_SA_PASSWORD=MyPass@word&quot; -e &quot;MSSQL_PID=Developer&quot; -e &quot;MSSQL_USER=SA&quot; -p 1433:1433 -d --name=sql mcr.microsoft.com/azure-sql-edge</pre><h4>Docker for M1</h4><p>Docker for M1 has come a long way since late 2020, the Docker team’s effort shines in the latest RC version for ARM64, <a href="https://docs.docker.com/docker-for-mac/apple-m1/">which can be found here</a>. You will need to have this latest version (or later) installed to run the SQL container successfully. After installation, run the script mentioned above.</p><h4>Connecting via Azure Data Studio</h4><p>To connect via <a href="https://docs.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver15">Azure Data Studio</a>, you will need to put <strong>127.0.0.1</strong> as <strong>server</strong>, we’re already hosting the Docker container on port <strong>1433</strong>, which is the default port for SQL. Use <strong>SQL Login</strong> and set the user to <strong>sa. </strong>Lastly, set the password you chose, which was <strong>MyPass@word </strong>from the example above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*gNpGgOh_FlFS4zrphakexQ.png" /></figure><p>Hit <strong>Connect</strong> and see if that works! If you have any issues connecting, maybe check to see if the container is actually running:</p><pre>docker ps</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AjvPFaBAMI53SDJUgxCuBg.png" /></figure><p>If not, try starting it manually:</p><pre>docker run sql</pre><h4><strong>Creating a database</strong></h4><p>I recommend not to use the <strong>master</strong> database and simply just create your own, run the following in a <strong>New Query</strong> window in <strong>Azure Data Studio</strong>:</p><pre>USE master</pre><pre>GO</pre><pre>IF NOT EXISTS (SELECT [name]</pre><pre>FROM sys.databases</pre><pre>WHERE [name] = N&#39;TestDb&#39;)</pre><pre>CREATE DATABASE TestDb</pre><pre>GO</pre><p>This script will create a database named <strong>TestDb</strong>, if it doesn’t exist already.</p><p>After running this script, you should see that new <strong>TestDb</strong> in the list of databases:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*1YSXoRERqdUZN86qgL_AEQ.png" /></figure><p>Be sure to select the <strong>correct database</strong> in the dropdown when running any query from now on!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*skROXqa-0hKvm9TZpPVQbw.png" /></figure><h4>Inserting data</h4><p>Now let us put this to the test and insert some data. The script below will <strong>create a table</strong>, <strong>insert one record</strong> and <strong>select that record</strong> from the newly created table:</p><pre>CREATE TABLE MyDto(</pre><pre>Number INT,</pre><pre>Text NVARCHAR(255)</pre><pre>)</pre><pre>GO</pre><pre>INSERT INTO MyDto VALUES (1, &#39;This is from my M1 Mac!&#39;)</pre><pre>GO</pre><pre>SELECT * FROM MyDto</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LFGImG6wJ0_Jk1v7YhxzIA.png" /></figure><p>That’s it! We now have a functional SQL Docker container on Apple Silicon!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bbc22c49dc9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/docker-express-running-a-local-sql-server-on-your-m1-mac-8bbc22c49dc9">Docker Express: Running a Local SQL Server on Your M1 Mac</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quickly Convert a Console App Into a Single-Point Web App in C#]]></title>
            <link>https://medium.com/geekculture/quickly-convert-a-console-app-into-a-single-point-web-app-in-c-29187d555823?source=rss-a385aec9486c------2</link>
            <guid isPermaLink="false">https://medium.com/p/29187d555823</guid>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <dc:creator><![CDATA[Maarten Merken]]></dc:creator>
            <pubDate>Fri, 02 Apr 2021 22:17:56 GMT</pubDate>
            <atom:updated>2021-04-02T23:17:35.942Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*Ql_-pHxkHG7jXq_W3cYagw.png" /></figure><p>I found myself in need of quickly converting my C# Console application into a Web application, primarily, I was asked to expose our Console app’s logic through an API with very little time to manage it.</p><p>This article will cover on how I eventually exposed our Console app on port 5005 of the localhost, our internal network, for bonus, I’ll throw in the containerised Docker version of the app, too!</p><p>Let’s start with a simple console app:</p><pre>mkdir ConsoleToWeb<br>cd ConsoleToWeb<br>dotnet new console<br>dotnet run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T2FC0JPaylw1zPeSMva_bA.gif" /></figure><p>The source of this app will look something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d314cf4e2cef54bd52547c7ee6e678f9/href">https://medium.com/media/d314cf4e2cef54bd52547c7ee6e678f9/href</a></iframe><p>To convert this into a ASP.NET Web App, we need to do 3 things:</p><ul><li>Convert the console project into a web project (csproj)</li><li>Introduce a <a href="https://docs.microsoft.com/en-us/dotnet/core/extensions/generic-host">Generic Host</a> to host our Web App</li><li>Rewrite the Main method to run our WebHost</li></ul><h4>Converting a Console csproj into a Web csproj</h4><p>Our original Console csproj looks something like the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9d4b61ab67a6e5ec6484185ee6812c3/href">https://medium.com/media/c9d4b61ab67a6e5ec6484185ee6812c3/href</a></iframe><p>For a Web project, we need to target a different <strong>SDK</strong>; <a href="https://docs.microsoft.com/en-us/dotnet/core/project-sdk/overview">Microsoft.NET.Sdk.Web</a></p><p>Also, the <strong>OutputType</strong> does not need to be an <strong>Exe.</strong></p><p>Modify the <strong>csproj</strong> file to look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dce8d6daaf1a2246e22a9ad2be7abdca/href">https://medium.com/media/dce8d6daaf1a2246e22a9ad2be7abdca/href</a></iframe><h4>Introduce a Generic Host to host our Web App</h4><p>The <a href="https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host?view=aspnetcore-5.0">IHost</a> class is a class designed for the new app hosting system of .NET. It handles core functionality like Dependency Injection, Configuration, Logging, …</p><p>We will use the HostBuilder to create a <strong>vanilla Web Host</strong> that will have 1 Run method which will call the code from our Console app.</p><p>Add the following code to your Program.cs file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f2751bd5c45c287199662e86fa57962/href">https://medium.com/media/5f2751bd5c45c287199662e86fa57962/href</a></iframe><p>Don’t forget about the necessary using statements:</p><pre>using Microsoft.Extensions.Hosting;</pre><pre>using Microsoft.AspNetCore.Builder;</pre><pre>using Microsoft.AspNetCore.Hosting;</pre><pre>using Microsoft.AspNetCore.Http;</pre><h4>Rewrite the Main method to run our WebHost</h4><p>We’re almost there, we just need to tie it all up in the Main method of the Program.cs:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb8ac4d653a368bfb695d6a1c8bca0c4/href">https://medium.com/media/fb8ac4d653a368bfb695d6a1c8bca0c4/href</a></iframe><p>Let’s examine the full working example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e663bdfcdbc1abb5e60e06e08cce8927/href">https://medium.com/media/e663bdfcdbc1abb5e60e06e08cce8927/href</a></iframe><p>That is it! Now you can run the app using dotnet run and see the result in your browser at <a href="http://localhost:5005/">http://localhost:5005</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xXnGyL0w8EkKJ4sxpHcCTQ.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*9DEH2jSoyW6_rRrESRDtPw.png" /></figure><h3>Dockerize it!</h3><p>Since we’re on a roll here, let’s quickly Dockerize this app so that we can package and ship it.</p><p>Add a <strong>Dockerfile</strong> to the root of the ConsoleToWeb directory.</p><pre>touch Dockerfile</pre><p>The contents of the Dockerfile should be something like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7689d255827301375bf209431a03b92a/href">https://medium.com/media/7689d255827301375bf209431a03b92a/href</a></iframe><p>Now that is done, we can build our image locally and tag it:</p><pre>docker build . -t consoletoweb</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UDnCWnq-bwALJk2OuFjmjg.gif" /></figure><p>After the Docker image is built, we can run the image in a container using docker run -p 5005:5005 consoletoweb</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yse3TF3biW6lXmDoANjekw.gif" /></figure><p>And the effect should be the same on <a href="http://localhost:5005/">http://localhost:5005</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*9DEH2jSoyW6_rRrESRDtPw.png" /></figure><h3><strong>Quickly adding services using FuncR</strong></h3><p>Still going strong now, let’s introduce a service, add some small implementation and have that service injected into our Web App using Dependency Injection!</p><p>Introduce the <strong>IFooService</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/06f60abae0da2e20f6e5e9d3cf06e3c5/href">https://medium.com/media/06f60abae0da2e20f6e5e9d3cf06e3c5/href</a></iframe><p>Now, we could implement this service using a new class, or we could write <strong>just the code we need</strong> for <em>string Foo(int numberOfFoos)</em> method to work using a <strong>function</strong> with <a href="https://medium.com/geekculture/c-interfaces-to-functions-with-funcr-e7ea897ce39"><strong>FuncR</strong></a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/0*AGv65HTMyuluOC3n" /></figure><p>FuncR is a small .NET standard library that enables you to register <strong>functions</strong> against <strong>interfaces</strong> in C#.</p><p>First we need to add FuncR to the project</p><pre>dotnet add package FuncR</pre><p>To use FuncR, add a ConfigureServices method to your Program.cs file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2349c8d914db429c923bb8b479d5c3cf/href">https://medium.com/media/2349c8d914db429c923bb8b479d5c3cf/href</a></iframe><p>In this <strong>ConfigureServices</strong> method, you can register any service agains the DI container of ASP.NET, more concretely, the code above registers a <strong>Proxy</strong> for <strong><em>IFooService</em></strong> and hooks up the <em>string Foo(int numberOfFoos)</em> method to the <strong>function</strong> that is provided on lines <strong>7 and 8</strong>, cool huh!?</p><p>Now we just need to tell the <strong>HostBuilder</strong> to use this method to configure its services and we’re ready to have that service injected:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2fb34ce04172076b5d1404fc0ed6cbc1/href">https://medium.com/media/2fb34ce04172076b5d1404fc0ed6cbc1/href</a></iframe><p>If we now dotnet run and navigate to <a href="http://localhost:5005/">http://localhost:5005</a> we finally see some different output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*iJ0LSpVpVljRt_ONqkYA-g.png" /></figure><p>That’s a lot of Foo’s.</p><p>And naturally, the Docker example also still works after a rebuild and run:</p><pre><br>docker build . --no-cache -t consoletoweb<br>docker run -p 5005:5005 consoletoweb</pre><h3>Wrapping up</h3><p>In this article we saw how easy and quickly a console app can be converted into a ASP.NET web app, and we got an introduction to FuncR to speed up our service implementations. The full code, and more is available through GitHub:</p><p><a href="https://github.com/merken/ConsoleToWeb">https://github.com/merken/ConsoleToWeb</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29187d555823" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/quickly-convert-a-console-app-into-a-single-point-web-app-in-c-29187d555823">Quickly Convert a Console App Into a Single-Point Web App in C#</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[C#: Interfaces to Functions, With FuncR]]></title>
            <link>https://medium.com/geekculture/c-interfaces-to-functions-with-funcr-e7ea897ce39?source=rss-a385aec9486c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7ea897ce39</guid>
            <category><![CDATA[function]]></category>
            <category><![CDATA[interfaces]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[c-sharp-programming]]></category>
            <dc:creator><![CDATA[Maarten Merken]]></dc:creator>
            <pubDate>Tue, 30 Mar 2021 12:55:43 GMT</pubDate>
            <atom:updated>2021-04-01T23:23:37.647Z</atom:updated>
            <content:encoded><![CDATA[<p>I find myself often in need of <strong>extracting a certain method into an entirely new service</strong>. This new service now has the <strong>sole purpose</strong> of housing that method.</p><p>This is mostly the case when working with code that communicates with <strong>infrastructure</strong> (logging, files, network, API’s). This code is mostly static and does not require a whole new service implementation. But, nevertheless a <strong>new class</strong> needs to becreated to hold this functionality.</p><p>I started looking for the <strong>most concise form </strong>of writing that functionality, <strong>without</strong> the need of introducing a new service implementation class, <strong>an interface to a function, </strong>sort of speak…</p><p>The result of this work has been packaged into a small library called <a href="https://github.com/merken/FuncR"><strong>FuncR</strong></a>, allow me to elaborate…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/0*d-kqExgdWSdwg1om" /></figure><p>FuncR is a small .NET standard library that enables you to register <strong>functions</strong> against <strong>interfaces</strong> in C#.</p><p><em>In short, it allows you to go from this:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*Rjxd-YLChNk0vh5TJ2uJpQ.png" /></figure><p><em>Into something like this:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*eLqF3yyFcuipxi3I7v9RQg.png" /></figure><p><strong>FuncR</strong> uses a <strong>DispatchProxy</strong> to generate a <strong>proxy class</strong> that instantiates the interface at runtime and <strong>hooks up </strong>the <strong>registered functions</strong> to the <strong>interface methods.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W5D3nlx5Iu9I2L7ArdxxxQ.png" /></figure><p>This allows you to <strong>inject the interface</strong> into your services and use it like <strong>any other service</strong> in your domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nvdsrt4oAkAngnr0H3-FFQ.png" /></figure><p>Let’s put this all together inside a .NET console app!</p><p>Create a new Console app (in .NET Core 2, 3 or .NET 5):</p><pre>mkdir Your.First.Function<br>cd Your.First.Function<br>dotnet new console</pre><p>Add the FuncR package:</p><pre>dotnet add package FuncR</pre><p>Write the implementation:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e0d7fbc5256148168706036e2048e047/href">https://medium.com/media/e0d7fbc5256148168706036e2048e047/href</a></iframe><p>Run the implementation:</p><pre>dotnet run</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*9OE5aJRciehmTNqR6jV6Qg.png" /><figcaption>dotnet run output</figcaption></figure><h4>Details of the example</h4><p><a href="https://gist.github.com/merken/a3b9ba335a8b3b99e410580d3ba28e1b#file-program-cs-L8">Line #8</a> sets up the stage for our service interface.</p><p><a href="https://gist.github.com/merken/a3b9ba335a8b3b99e410580d3ba28e1b#file-program-cs-L19">Line #19</a> registers the <strong>proxy</strong> for <strong>IFooService</strong></p><p><a href="https://gist.github.com/merken/a3b9ba335a8b3b99e410580d3ba28e1b#file-program-cs-L20">Line #20</a> registers the <strong>function pointer</strong> for the name “<strong>Foo</strong>” on the proxy</p><p><a href="https://gist.github.com/merken/a3b9ba335a8b3b99e410580d3ba28e1b#file-program-cs-L22-L28">Lines #22-28</a> registers the <strong>actual implementation</strong> of the function for the proxy in the form of <strong>&lt;TParameter1Type, TReturnType&gt;</strong>, like any <a href="https://docs.microsoft.com/en-us/dotnet/api/system.func-2?view=net-5.0">C# Func</a></p><p><a href="https://gist.github.com/merken/a3b9ba335a8b3b99e410580d3ba28e1b#file-program-cs-L30">Line #30</a> resolves our registered service from the Dependency Injection container.</p><p><a href="https://gist.github.com/merken/a3b9ba335a8b3b99e410580d3ba28e1b#file-program-cs-L34-L36">Lines #34 and #36</a> call upon the proxy, which will look up the registered function and invoke it.</p><h3>📚Documentation</h3><p>FuncR comes with <a href="https://merken.github.io/FuncR/#/">extensive documentation</a> and sample projects to help you get started!</p><p>This includes, <strong>service resolution</strong> through dependency injection, <strong>async functions</strong> and <strong>nested functions</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7ea897ce39" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/c-interfaces-to-functions-with-funcr-e7ea897ce39">C#: Interfaces to Functions, With FuncR</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing .NET 6 (alpha) on your M1 Mac]]></title>
            <link>https://maartenmerken.medium.com/installing-net-6-alpha-on-your-m1-mac-23a35aa6f02c?source=rss-a385aec9486c------2</link>
            <guid isPermaLink="false">https://medium.com/p/23a35aa6f02c</guid>
            <category><![CDATA[dotnet6]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[apple-m1-chip]]></category>
            <dc:creator><![CDATA[Maarten Merken]]></dc:creator>
            <pubDate>Tue, 19 Jan 2021 14:27:48 GMT</pubDate>
            <atom:updated>2021-04-15T09:49:35.038Z</atom:updated>
            <content:encoded><![CDATA[<h3>Installing .NET 6 on your M1 Mac (manually)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/0*5Jnd2rnDCPTbqVWJ.jpg" /></figure><p>In this short article, I’ll show you how to uninstall any previous dotnet versions on your M1 Mac and install the latest .NET 6.0.200 Preview release to date.</p><blockquote>Microsoft released the <strong>official ARM64 macOS installer</strong>, please refer to <a href="https://dotnet.microsoft.com/download/dotnet/thank-you/sdk-6.0.100-preview.3-macos-arm64-installer">this installer to install the .NET 6 Preview 3</a>. You can continue reading to find out how to install the .NET SDK <strong>manually</strong>.</blockquote><p><a href="https://maartenmerken.medium.com/debugging-net-5-apps-on-your-m1-mac-bcefe0072c1b">Earlier, I wrote about debugging .NET 5 apps on your M1 Mac</a> using the Rosetta 2 translation on macOS Big Sur 11.2 Beta 2. Now, I’m going to show you how to install the latest .NET 6 build onto your M1 Mac.</p><p>Firstly, to avoid conflict, remove all .NET installations from your machine, this is easily done using the dotnet-uninstall-pkgs script found here: <a href="https://github.com/dotnet/cli/blob/master/scripts/obtain/uninstall/dotnet-uninstall-pkgs.sh">https://github.com/dotnet/cli/blob/master/scripts/obtain/uninstall/dotnet-uninstall-pkgs.sh</a></p><p>After downloading this file, make it executable so that you can execute it:</p><pre>cd ~/Downloads<br>sudo chmod +x dotnet-uninstall-pkgs.sh<br>sudo ./dotnet-uninstall-pkgs.sh</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yClDmO_gGBXFnEy1_B5q9g.gif" /><figcaption>dotnet uninstall</figcaption></figure><p>After uninstall, verify that all dotnet installations are removed:</p><pre>dotnet<br>where dotnet</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fYcDufi3Qk_lEfS8BRJQLw.gif" /></figure><p>Download the .NET 6 Alpha 6.0.100 release from here : <a href="https://github.com/dotnet/installer">https://github.com/dotnet/installer</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4do6EZC_6yD-d0iJzoCqCw.png" /><figcaption>Download the tar.gz file</figcaption></figure><p>Or via direct download to the latest version: <a href="https://aka.ms/dotnet/6.0/daily/dotnet-sdk-osx-arm64.tar.gz">https://aka.ms/dotnet/6.0/daily/dotnet-sdk-osx-arm64.tar.gz</a></p><h4>Installing .NET 6 to /usr/local/share/dotnet</h4><p>dotnet installs to /usr/local/share/dotnet when using the pkgs installer, so that’s what we’re going to do also.</p><p>Extract the tar.gz file to disk and examine the contents:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sTHMTOcvzlPZ5KT4wPs7MQ.png" /><figcaption>contents of the .NET 6 tar.gz extraction</figcaption></figure><p>Copy all files to /usr/local/share/dotnet:</p><pre>cd &lt;net-6 directory&gt;<br>cp -a . /usr/local/share/dotnet</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nPAfqwpSdXHZ5nhTTRFvYg.gif" /><figcaption>copy all files to /usr/local/share/dotnet</figcaption></figure><h4>Whitelisting all files from /usr/local/share/dotnet from Apple Quarantine</h4><p>When you try to run the <strong>dotnet</strong> command in your terminal, you will be prompted to allow the execution for each library that the command invokes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*0d6FkDfI03pEaHojyb_92g.png" /><figcaption>Malicious software check</figcaption></figure><p>To avoid this for all files within the /usr/local/share/dotnet directory, you will need to run the following command in terminal:</p><pre>find . -type f -print0 | xargs -0 xattr -d com.apple.quarantine</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JSKdDqkq3l8HAMcvVfFNlg.gif" /><figcaption>unquarantine all files</figcaption></figure><p>After this, you need to create a <strong>symbolic link</strong> to the /usr/local/share/dotnet/dotnet executable.</p><pre>cd /usr/local/bin<br>ln -s /usr/local/share/dotnet/dotnet dotnet</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6VjHM8MUX3ZPbbVpDmNJjg.gif" /><figcaption>symlink to dotnet</figcaption></figure><p>At this point, you can use the dotnet command anywhere on your system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Gh-Fawp4fNxo9Ra3I9_PA.gif" /></figure><h4>Performance</h4><p>Alexander Ziskind did a performance comparison between the M1 Macbook Air and the Intel i9 Macbook Pro 16, <a href="https://www.youtube.com/watch?v=SLSe9mrUz6c">which you can find here</a>.</p><p>I noticed that .NET 6, running natively on the MBA, performs a bit better when running his example cryptography application for 100.000.000 iterations.</p><pre>using System;<br>using System.Runtime.CompilerServices;<br>using System.Security.Cryptography;</pre><pre>namespace ziskindtest<br>{<br>    class Program<br>    {<br>        static void Main(string[] args)<br>        {<br>            for (int i = 0; i &lt; 100_000_000; i++)<br>            {<br>                Consume(CryptoConfig.CreateFromName(&quot;RSA&quot;));<br>            }<br>            Console.WriteLine(&quot;All done MBA on .NET6&quot;);<br>        }</pre><pre>        [MethodImpl(MethodImplOptions.NoInlining)]<br>        private static void Consume&lt;T&gt;(in T _) { }<br>    }<br>}</pre><p>The results on my M1 MBA were promising, it beats the results from the beefy i9 by a slight margin, I ran a <strong>dotnet build -c Release</strong> and <strong>dotnet run</strong> of the published app, and it persisted to run the test in around <strong>53 seconds, which looks like it’s not that big of a performance gain over the 60 seconds running on Rosetta 2.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*MycYGYIW4CuqbieMuvEeJw.png" /><figcaption>The Ziskin-test results on .NET 6</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sTEzlVOwamGYBmlr-RyT4g.png" /></figure><p>Then again, this is .NET 6 Alpha running on macOS Beta…</p><p>It’s still impressive that the M1 chip is able to compete against top-of-the-line Intel processors.</p><blockquote>What this tells me is that <strong>Rosetta 2,</strong> truly is an example of magnificent engineering.</blockquote><h4>Removing the manually installed dotnet 6 Alpha</h4><p>Undoing this installation is quite easy, you just need to delete the <strong>/usr/local/share/dotnet</strong> directory and the <strong>dotnet</strong> symbolic link at <strong>/usr/local/bin.</strong></p><pre>rm -rf /usr/local/share/dotnet<br>rm /usr/local/bin/dotnet</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23a35aa6f02c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging .NET 5 apps on your M1 Mac]]></title>
            <link>https://maartenmerken.medium.com/debugging-net-5-apps-on-your-m1-mac-bcefe0072c1b?source=rss-a385aec9486c------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcefe0072c1b</guid>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[m1]]></category>
            <category><![CDATA[m1-chip]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <dc:creator><![CDATA[Maarten Merken]]></dc:creator>
            <pubDate>Tue, 19 Jan 2021 13:33:20 GMT</pubDate>
            <atom:updated>2021-01-19T14:27:18.988Z</atom:updated>
            <content:encoded><![CDATA[<h3>Debugging .NET 5 apps on your M1 Mac</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/0*VlRM2g7ivCrZlcHy.jpg" /></figure><p>In this short article, I’ll show you how to install .NET 5 on your M1 Mac and demonstrate how to debug your apps using VS Code and VS For Mac.</p><p>With <a href="https://developer.apple.com/documentation/macos-release-notes/macos-big-sur-11_2-beta-release-notes">macOS Big Sur 11.2 Beta 2,</a> Apple fixed some of the bugs related to debugging your .<strong>NET 5 apps on M1 Macs</strong>, this allows you to <strong>debug</strong> .NET applications using VS Code, VS for Mac and even JetBrains Rider through the <strong>Rosetta 2 x86-to-ARM translator</strong>.</p><p>First, your Mac needs to be <a href="https://beta.apple.com/sp/betaprogram/">enrolled into the Beta program</a>. This requires registering your Apple ID and downloading a tool that gives you access to beta builds of Big Sur. After installing that, your M1 Mac should be able to search for updates, on which you should get <strong>11.2 Beta 2.</strong></p><p>After installing the beta, download .NET 5 fro<a href="https://dotnet.microsoft.com/download/dotnet/5.0">m the official website</a> (macOS, x64).</p><p>You should now be able to run and debug .<strong>NET 5 apps</strong> on you M1 machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fY1rSFtwqV_ogogPz6G6bw.gif" /><figcaption>dotnet new on M1 Mac</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DtP0XeZg4Olv422G2HF4sQ.gif" /><figcaption>dotnet run on M1 Mac</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ummP49C5mnWpVnr4vYu9A.gif" /><figcaption>debugging .NET 5 in VS Code</figcaption></figure><p>^ This also works with <a href="https://code.visualstudio.com/insiders/">VS Code insiders built for M1!</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9lwR8UUF27aYKLex5ZYyRA.gif" /><figcaption>debugging .NET 5 in VS for Mac</figcaption></figure><blockquote>Keep in mind that Beta means <strong>Beta. </strong>There are some cases on which the debugger crashes, let’s hope the stable release of Big Sur 11.2 addresses these issues.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcefe0072c1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Prise 2.0 is here ]]></title>
            <link>https://maartenmerken.medium.com/prise-2-0-is-here-ccb57125eea0?source=rss-a385aec9486c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ccb57125eea0</guid>
            <category><![CDATA[plugins]]></category>
            <category><![CDATA[net-core]]></category>
            <category><![CDATA[framework]]></category>
            <dc:creator><![CDATA[Maarten Merken]]></dc:creator>
            <pubDate>Mon, 02 Nov 2020 13:42:03 GMT</pubDate>
            <atom:updated>2020-11-02T13:42:03.737Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*SBDS397krZXtr6_DTGnhAA.png" /></figure><p>Over the past year, I’ve been working on maturing Prise. I can proudly say that the day has come to announce version 2.0 of <strong>Prise, A .NET Plugin Framework</strong>.</p><p>This time around, I’ve heard the community loud and clear 📢, Prise comes with the following new features:</p><ul><li>More tests!</li><li>Support for testing plugins using the <a href="https://www.nuget.org/packages/Prise.testing">Prise.Testing package</a></li><li>Rename of the PluginBridge to <a href="https://www.nuget.org/packages/Prise.ReverseProxy/">ReverseProxy</a></li><li>Support for loading plugins from NuGet Packages!</li><li>More <a href="https://github.com/merken/Prise/tree/master/samples">examples</a>!</li><li>A fresh new documentation page: <a href="https://merken.github.io/Prise/">https://merken.github.io/Prise/</a></li></ul><p>Whilst still working on supporting .NET 5, <strong>Prise</strong> can presently be used in any .NET Core 2.1, 3.1 or NET 5 <strong>preview</strong> project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ccb57125eea0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>