The .NET Stacks #62: 👋 And we're back
Tags: dotnet, csharp, azure
Published: 2021-09-26 14:27:18

---
title: The .NET Stacks #62: 👋 And we're back
published: true
date: 2021-09-19 00:05:00 UTC
tags: dotnet, csharp, azure
canonical_url: https://www.daveabrock.com/2021/09/19/dotnet-stacks-62/
---

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6dnn4qyfnjlp928lmflk.png)

_This is the web version of my weekly newsletter, The .NET Stacks, originally sent to email subscribers on September 13, 2021. Subscribe at [dotnetstacks.com](https://dotnetstacks.com) to get this right away!_

Happy Monday! Miss me? A few of you said you have, but I'm 60% sure that's sarcasm.

As you know, I took the last month or so off from the newsletter to focus on other things. I know I wasn't exactly specific on why, and appreciate some of you reaching out. I wasn't comfortable sharing it at the time, but I needed to take time away to focus on determining the next step in my career. If you've interviewed lately, I'm sure you understand ... it really is a full-time job.  I'm happy to say I've accepted a remote tech lead role for a SaaS company here.

I'm rested and ready, so let's get into it! I'm trying something a little different this week—feel free to let me know what you think.

* * *

## 🔥 My favorite from last week

[**ASP.NET 6.0 Minimal APIs, why should you care?**](https://benfoster.io/blog/minimal-apis-why-should-you-care/)  
**Ben Foster**

We've talked about Minimal APIs a lot in this newsletter and it's [quite the hot topic](https://twitter.com/hashtag/minimalapis) in the .NET community. An alternative way to write APIs in .NET 6 and beyond, there's a lot of folks wondering if it's suitable for production, or can lead to misuse.

Ben notes: "Minimal simply means that it contains the minimum set of components needed to build HTTP APIs ... It doesn’t mean that the application you build will be simple or not require good design."

"I find that one of the biggest advantages to Minimal APIs is that they make it easier to build APIs in an _opinionated_ way. After many years building HTTP services, I have a preferred approach. With MVC I would replace the built-in validation with Fluent Validation and my controllers were little more than a dispatch call to Mediatr. With Minimal APIs I get even more control. Of course if MVC offers everything you need, then use that."

In a similar vein, Nick Chapsas has [a great walkthrough](https://www.youtube.com/watch?v=4ORO-KOufeU) on strategies for building production-ready Minimal APIs. No one expects your API to be in one file, and he shows practical ways to deal with dependencies while leveraging minimal API patterns. Damian Edwards [has a nice Twitter thread, as well](https://twitter.com/DamianEdwards/status/1436740934297784322). As great as these community discussions are, I really think the greatest benefit is getting lost: the performance gains.

* * *

## 📅 Community and events

**[Increasing developer happiness with GitHub code scanning](https://github.blog/2021-09-07-increasing-developer-happiness-github-code-scanning/)  
Sam Partington**

If you work in GitHub, you probably already know that GitHub utilizes code scanning to [find security vulnerabilities and errors in your repository](https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning). Sam Partington writes about something you might not know: they use CodeQL—their internal code analysis engine—to protect themselves from common coding mistakes.

Here's what Sam says about loopy performance issues: "In addition to protecting against missing error checking, we also want to keep our database-querying code performant. N+1 queries are a common performance issue. This is where some expensive operation is performed once for every member of a set, so the code will get slower as the number of items increases. Database calls in a loop are often the culprit here; typically, you’ll get better performance from a batch query outside of the loop instead."

"We created a [custom CodeQL query](https://github.com/github/codeql-go/blob/main/ql/src/experimental/CWE-400/DatabaseCallInLoop.ql) ... We filter that list of calls down to those that happen within a loop and fail CI if any are encountered. What’s nice about CodeQL is that we’re not limited to database calls directly within the body of a loop―calls within functions called directly or indirectly from the loop are caught too."

You can check out the post for more details and learn how to use these queries or make your own.

More from last week:

- Simon Bisson [writes about how to use the VS Code editor in your own projects](https://www.infoworld.com/article/3631383/use-the-visual-studio-code-editor-in-your-own-projects.html).
- The Netflix Tech Blog [starts a series on practical API design](https://netflixtechblog.com/practical-api-design-at-netflix-part-1-using-protobuf-fieldmask-35cfdc606518) and also [starts writing about their decision-making process](https://netflixtechblog.com/decision-making-at-netflix-33065fa06481).
- The .NET Docs Show talks about [micr0 frontends with Blazor](https://www.youtube.com/watch?v=8Ac2QMdusrs).
- For community standups, Entity Framework [talks about OSS projects](https://www.youtube.com/watch?v=lLz5WwZKRW4), ASP.NET [has an anniversary](https://www.youtube.com/watch?v=0wscoCzfIH0), .NET MAUI [discusses accessibility](https://www.youtube.com/watch?v=sm6N4HQ_5iA), and Machine Learning [holds office hours](https://www.youtube.com/watch?v=youpU2MkPPI).

* * *

## 🌎 Web development

**[How To Map A Route in an ASP.NET Core MVC application](https://khalidabuhakmeh.com/how-to-map-a-route-in-an-aspnet-core-mvc-application)  
Khalid Abuhakmeh**

If you're new to ASP.NET Core web development, Khalid put together a nice post on how to add an existing endpoint to an existing ASP.NET Core MVC app. Even if you aren't a beginner, you might learn how to resolve sticky routing issues. At the bottom of the post, he has a nice checklist you should consider when adding a new endpoint.

More from last week:

- Ben Foster [explores custom model binding with Minimal APIs in .NET 6](https://benfoster.io/blog/minimal-apis-custom-model-binding-aspnet-6/).
- Thomas Ardal [debugs System.FormatException when launching ASP.NET Core](https://blog.elmah.io/debugging-system-formatexception-when-launching-asp-net-core/).
- Jeremy Morgan [builds a small web API with Azure Functions and SQLite](https://www.codeproject.com/Articles/5312004/Building-a-Micro-Web-API-with-Azure-Functions-and).
- Ed Charbeneau [works with low-code data grids and Blazor](https://www.telerik.com/blogs/low-code-data-grids-blazor).
- Scott Hanselman [works with a Minimal API todo app](https://www.hanselman.com/blog/a-net-6-minimal-api-todo-example-playground).

* * *

## 🥅 The .NET platform

**[Using Source Generators with Blazor components in .NET 6](https://andrewlock.net/using-source-generators-with-blazor-in-dotnet-6/)  
Andrew Lock**

When Andrew was upgrading a Blazor app to .NET 6, he found that source generators that worked in .NET 5 failed to discover Blazor components in his .NET 6 app because of changes to the Razor compilation process.

He writes: "The problem is that my source generators were relying on the _output_ of the Razor compiler in .NET 5 ... My source generator was looking for components in the compilation that are decorated with `[RouteAttribute]`. With .NET 6, the Razor tooling is a source generator, so there _is_ no 'first step'; the Razor tooling executes at the _same time as my source generator_. That is great for performance, but it means the files my source generator was relying on (the generated component classes) _don't exist_ when my generator runs."

While this is by design, Andrew has a great post underlying the issue and potential workarounds.

More from last week:

- Mark Downie [writes about his favorite improvements in .NET 6](https://www.poppastring.com/blog/favorite-improvements-in-net-6).
- Sergey Vasiliev [writes about optimizing .NET apps](https://dzone.com/articles/optimization-of-net-applications-a-big-result-of-s).
- Paweł Szydziak [writes cleaner, safer code with SonarQube, Docker, and .NET Core](https://developer.okta.com/blog/2021/09/08/sonar-qube-dotnet).
- Sam Basu [writes about how to develop for desktop in 2022](https://www.telerik.com/blogs/how-to-desktop-2022), and also [about developing for .NET MAUI on macOS](https://www.telerik.com/blogs/apples-maui).
- Paul Michaels [manually parses a JSON string using System.Text.Json](https://www.pmichaels.net/2021/09/05/manually-parsing-a-json-string-using-system-text-json/).
- Johnson Towoju [writes logs to SQL Server using NLog](https://code-maze.com/writing-logs-to-sql-server-using-nlog/).
- Andrew Lock [uses source generators with Blazor components in .NET 6](https://andrewlock.net/using-source-generators-with-blazor-in-dotnet-6/).
- Rick Strahl [launches Visual Studio Code cleanly from a .NET app](https://weblog.west-wind.com/posts/2021/Sep/03/Launching-VS-Code-cleanly-from-a-NET-Application).
- Jiří Činčura [calls a C# static constructor multiple times](https://www.tabsoverspaces.com/233870-csharp-static-constructor-called-multiple-times).

* * *

## ⛅ The cloud

**[Minimal Api in .NET 6 Out Of Process Azure Functions](https://adamstorr.azurewebsites.net/blog/minimal-api-in-net6.0-out-of-process-azure-functions)  
Adam Storr**

With all this talk about Minimal APIs, Adam asks: can I use it with the new out-of-process Azure Functions model in .NET 6?

He says: "Azure Functions with HttpTriggers are similar to ASP.NET Core controller actions in that they handle http requests, have routing, can handle model binding, dependency injection etc. so how could a 'Minimal API' using Azure Functions look?"

More from last week:

- Damien Bowden [uses Azure security groups in ASP.NET Core with an Azure B2C identity provider](https://damienbod.com/2021/09/06/using-azure-security-groups-in-asp-net-core-with-an-azure-b2c-identity-provider/).
- Jon Gallant [works with the ChainedTokenCredential in the Azure Identity library](https://blog.jongallant.com/2021/09/azure-identity-301/).
- Adam Storr [uses .NET 6 Minimal APIs with out-of-process Azure Functions](https://adamstorr.azurewebsites.net/blog/minimal-api-in-net6.0-out-of-process-azure-functions).

* * *

## 🔧 Tools

**[New Improved Attach to Process Dialog Experience](https://devblogs.microsoft.com/visualstudio/new-improved-attach-to-process-dialog-experience/)  
Harshada Hole**

With the 2022 update, Visual Studio is improving the debugging experience—included is a new Attach to Process dialog experience.

Harshada says: "We have added command-line details, app pool details, parent/child process tree view, and the select running window from the desktop option in the attach to process dialog. These make it convenient to find the right process you need to attach. Also, the Attach to Process dialog is now asynchronous, making it interactive even when the process list is updating." The post walks through these updates in detail.

More from last week:

- Jeremy Likness [looks at the EF Core Azure Cosmos DB provider](https://devblogs.microsoft.com/dotnet/taking-the-ef-core-azure-cosmos-db-provider-for-a-test-drive).
- Harshada Hole [writes about the new Attach to Process dialog experience in Visual Studio](https://devblogs.microsoft.com/visualstudio/new-improved-attach-to-process-dialog-experience).
- Ben De St Paer-Gotch [goes behind the scenes on Docker Desktop](https://www.docker.com/blog/the-magic-behind-the-scenes-of-docker-desktop/).
- Esteban Solano Granados [plays with .NET 6, C# 10, and Docker](https://stvansolano.github.io/2021/08/02/Playing-with-NET-6-preview-csharp10-docker-containers/).

* * *

## 🏗 Design, testing, and best practices

**[Ship / Show / Ask: A modern branching strategy](https://martinfowler.com/articles/ship-show-ask.html)  
Rouan Wilsenach**

Rouan says: "Ship/Show/Ask is a branching strategy that combines the features of Pull Requests with the ability to keep shipping changes. Changes are categorized as either Ship (merge into mainline without review), Show (open a pull request for review, but merge into mainline immediately), or Ask (open a pull request for discussion before merging)."

More from last week:

- Liana Martirosyan [writes about enabling team learning and boost performance](https://www.infoq.com/articles/team-performance-learning/).
- Sagar Nangare [writes about measuring user experience in modern applications and infrastructure](https://thenewstack.io/measuring-user-experience-in-modern-applications-and-infrastructure/).
- Neal Ford and Mark Richards [talk about the hard parts of software architecture](https://www.infoq.com/podcasts/software-architecture-hard-parts/).
- Derek Comartin [discusses event-sourced aggregate design](https://codeopinion.com/event-sourced-aggregate-design-focus-on-business-logic/).
- Steve Smith [refactors to value objects](https://ardalis.com/refactoring-value-objects/).
- Sam Milbrath [writes about holding teams accountable without micromanaging](https://blog.trello.com/hold-team-accountable-without-micromanaging).
- Helen Scott asks: [how can you stay ahead of the curve as a developer?](https://helenjoscott.medium.com/how-can-you-stay-ahead-of-the-curve-as-a-developer-a27d728980a2)
- Rouan Wilsenach [writes about a ship / show / ask branching strategy](https://martinfowler.com/articles/ship-show-ask.html).
- Jeremy Miller [writes about integration Testing using the IHost Lifecycle with xUnit.Net](https://jeremydmiller.com/2021/09/07/integration-testing-ihost-lifecycle-with-xunit-net/).

* * *

## 🎤 Podcasts and Videos

- Serverless Chats [discusses serverless for beginners](https://www.serverlesschats.com/109/).
- The .NET Core Show [talks about DotPurple With Michael Babienco](https://dotnetcore.show/episode-82-dotpurple-with-michael-babienco/).
- The Changelog [talks to a lawyer about GitHub Copilot](https://changelog.com/podcast/458).
- Technology and Friends [talks to Sam Basu about .NET MAUI](https://www.davidgiard.com/2021/09/06/SamBasuOnNETMAUI.aspx).
- Visual Studio Toolbox [talks about Web Live Preview](https://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Web-Live-Preview).
- The ASP.NET Monsters [talk about new Git commands](https://www.youtube.com/watch?v=QI4nYR_vAXU).
- Adventures in .NET [talk about Jupyter notebooks](https://devchat.tv/adventures-in-dotnet/get-interactive-with-jupyter-notebook-net-085/).
- The On .NET Show [migrates apps to modern authentication](https://www.youtube.com/watch?v=S4tsbjMx2_o) and [processes payments with C# and Stripe](https://www.youtube.com/watch?v=Wl4ybEE4Bxc).