My Playwright session at WebDay 2022

If you understand Italian, the recording of my Playwright session at UGIdotNET’s WebDay 2022 is now available on YouTube1. Playwright is a phenomenal cross-browser, cross-platform, cross-language, single-API, mobile-friendly front-end testing tool. I’m looking forward to giving the same session in English sooner or later, but I should first win my laziness and start looking for exciting events with open CFPs. If you happen to know one, please let me know....

April 1, 2022

Lay Back and Keep Smiling

Tomorrow we’re releasing a major project on which we’ve been working non-stop for two and a half years. No matter how many years in the trenches, release day always makes me a bit nervous. Experience does help. I know there will be problems, and we will solve them. Some customers will complain, and those will be the most vocal. The vast majority of them will appreciate the effort, enjoy the features, and stay silent....

January 23, 2022

My ASP.NET 5 migration to .NET 6

I spent the last few days migrating our ASP.NET REST services, MVC web applications and Blazor server apps to .NET 6. Overall the process was pretty straightforward. The few issues I went through were easy to solve and well documented. Things got more involved with the EF Core 6 transition, especially with the Npgsql Entity Framework Core Provider. The official ASP.NET Core 5.0 to 6.0 migration guide was my first stop....

November 14, 2021

ASP.NET 6 Migration Cheatsheet and FAQ

David Fowler has a very informative gist up on GitHub. It’s titled [Migration to ASP.NET Core. NET6][3] and it’s filled with details, recipes and FAQs on migrating an ASP.NET Core 5 web app to ASP.NET Core 61. The focus is on the new, streamlined hosting model, also known as Minimal APIs2. To be clear, You don’t have to move to the new model. As the FAQ section emphasizes: Do I have to migrate to the new hosting model...

September 23, 2021

Performance improvements in .NET6

I’m pretty psyched about the upcoming .NET6 release. I’ve already touched on ASP.NET 6 Minimal APIs. Continuing on the long-established tradition, the team has also worked hard on the performance side of things. File IO, for example, is seeing impressive gains: For .NET 6, we have made FileStream much faster and more reliable, thanks to an almost entire re-write. For same cases, the async implementation is now a few times faster!...

September 3, 2021

How to read Windows-1252 encoded files with .NETCore and .NET5+

Another day, another lesson learned: modern .NET does not support the Windows-1252 encoding out of the box. Today my colleague was happily porting a legacy NET4+ app to NET6. As usual, the port was super-easy; it would compile and run just fine, so he was surprised when the app crashed reading a few specific XML files. That’s when I was called in. A closer inspection revealed a pattern: all those crashing files were Windows 1252-encoded (the rest, a vast majority, were UTF-8....

August 27, 2021

On GitHub Copilot

Like everyone else on the planet, I’ve been following GitHub Copilot since its launch. It is an impressive achievement and a remarkable milestone for the deep learning industry, that’s for sure. We are obviously at the early stages in deep learning applied to software development, and it is somewhat unsettling to ponder what the future might hold in this field. Like many others, however, I worry about code quality issues and the risk of license infringements1....

July 24, 2021

Will .NET 6 Minimal APIs turn heads?

I am pretty excited about the [Minimal APIs][3] feature that is coming with .NET 6. Three lines of code will be enough to build a fully functional REST microservice1: var app = WebApplication.Create(args); app.MapGet("/", () => "Hello World!"); await app.RunAsync(); If you’re a seasoned ASP.NET MVC/WebApi developer, the snippet caught your attention because, pre-.NET 6, achieving the same result will have you messing with a lot of extra cruft2. I suspect, however, that this feature is not primarily targeted at existing ....

July 14, 2021

Custom default values for not existing dictionary items (and a lesson learned)

When dealing with dictionaries, a typical problem is when an operation attempts to retrieve an element using a key that does not exist in the dictionary. In .NET, a KeyNotFoundException is raised, and that’s the desired behaviour in most circumstances. Sometimes, however, you know that your program will frequently try to retrieve keys that do not exist. In such cases, it is more efficient to use the TryGetValue method: This method returns the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter is returned (source)...

June 11, 2021

On Programming and Writing

My brilliant friend Salvatore Sanfilippo (otherwise known as antirez of Redis fame) has an interesting write-up on his website. How similar is programming to prose writing? After getting his own feet wet with novel writing, he is convinced that the two activities share many common traits. One year ago I paused my programming life and started writing a novel, with the illusion that my new activity was deeply different than the previous one....

May 25, 2021