NOTE: This is the web version of my weekly newsletter, released on May 24, 2021. To get the issues right away, subscribe at dotnetstacks.com or the bottom of this post.
Happy Monday! I hope you're all doing well.
Here's what's going on this week:
- The big thing: Previewing the big week ahead
- The little things: SecureString meeting its demise, the .NET Coding Pack, web dev news
- Last week in the .NET world
The big thing: Previewing the big week ahead
This week will be a big one: we've got Microsoft Build—probably the last virtual one—which kicks off on Tuesday. In what is surely not coincidental timing, .NET 6 Preview 4 should also be released. (And if that isn't enough, The .NET Stacks turns 1 next Monday. Please, no gifts.)
While Build doesn't carry the same developer excitement as it has in the past, in my opinion—the frenetic pace of .NET keeps us busy throughout the year, and, to me, Build has shifted toward a marketing event. Still, it'll be nice to watch some sessions and see where things are going. You can check out the sessions on the Build website. I'll be keeping an eye on a .NET 6 deep dive, microservices with Dapr, and an Ask the Experts panel with many Microsoft .NET folks.
Next week, we'll also see the release of .NET 6 Preview 4 (finally!). While we'll pore over some of it next week when its formally communicated, the "what's new" GitHub issue really filled up this week and has some exciting updates.
New LINQ APIs
.NET 6 Preview 4 will include quite a few new LINQ APIs.
Index and Range updates
LINQ will now see Enumerable support for Index
and Range
parameters. The Enumerable.ElementAt
method will accept indices from the end of the enumerable, like this:
Enumerable.Range(1, 10).ElementAt(^4); // returns 7
Also, an Enumerable.Take
overload will accept Range
parameters, which allows you to slice enumerable sequences easily.
MaxBy and MinBy
The new MaxBy
and MinBy
methods allow you to use a key selector to find a maximum or minimum method, like this (the example here is taken from the issue):
var people = new (string Name, int Age)[] { ("Tom", 20), ("Dick", 30), ("Harry", 40) };
people.MaxBy(person => person.Age); // ("Harry", 40)
Chunk
A new Chunk
method allows you to chunk elements into a fixed size, like this (again, taken from the issue):
IEnumerable<int[]> chunks = Enumerable.Range(0, 10).Chunk(size: 3); // { {0,1,2}, {3,4,5}, {6,7,8}, {9} }
New DateOnly and TimeOnly structs
We talked about this in a past issue, but we'll see some newDateOnly
andTimeOnly
structs that add to DateTime
support and do not deprecate what already exists. They'll be in the System
namespace, as the others are. For use cases, think of DateOnly
for business days and birthdays and TimeOnly
for things like recurring meetings and weekly business hours.
Writing DOMs with System.Text.Json
So, this is fun: Preview 4 will bring us the ability to use a writable DOM feature with System.Text.Json
. There's quite a few use cases here. A big one is when you want to modify a subset of a large tree efficiently. For example, you'll be able to navigate to a subsection of a large JSON tree and perform operations from that subsection.
There's a lot more with Preview 4. Check out the GitHub issue for the full details. We'll cover more next week.
The little things: SecureString meeting its demise, the .NET Coding Pack, general web dev news
The SecureString
API seems great, it really does. It means well. It allows you to flag text as confidential and provide an extra layer of security. The main driver is to avoid using secrets as plain text in a process's memory. However, this doesn't translate to the OS, even on Windows. Except for .NET Framework, array contents are passed around unencrypted. It does have a shorter lifetime, so there's that—but it isn't that secure. It's easy to screw up and hard to get right.
The .NET team has been trying to phase out SecureString
for awhile in favor of a more flexible ShroudedBuffer<T>
type. This issue comment has all the juicy details of the latest updates.
This week, Scott Hanselman wrote about the .NET Coding Pack for Visual Studio Code. The pack includes an installation of VS Code, the .NET SDK (and adding it to the PATH), and a .NET extension. With the .NET Coding Pack, beginners will be able to work with .NET Interactive notebooks to quickly get started.
While we mostly talk about .NET around here, I think it's important to reach outside our bubble and keep up with web trends. I came across two interesting developments last week.
Google has decided to no longer give Accelerated Mobile Pages (AMP) preferential treatment in its search results (and they are even removing the icon from the results page). Whatever the reason—its controversy, lack of adoption, or Google's anti-trust pressure—it's a welcome step for an independent web. (Now, if only they'd bring back Google Reader.)
In other news, StackBlitz—in cooperation with Google Chrome and Vercel—has launched WebContainers, a way to run Node.js natively in your browser. Simply put, it's providing an online IDE. Thanks to the strides WebAssembly has made in the past few years, it's paved a way for a WASM operating system.
Under the covers, it includes a virtualized network stack that maps to the browser's ServiceWorker API, which enables offline support. It provides a leg up over something like Codespaces or various REPL solutions, which typically need a server. I take exception with StackBlitz saying those solutions "provide a worse experience than your local machine in nearly every way" ... but if you do any JavaScript work, this is an exciting development (especially when dealing with JS's notoriously cumbersome tooling and setup demands).
🌎 Last week in the .NET world
🔥 The Top 3
- Jeremy Likness works with Azure Cosmos DB, EF Core, and Blazor Server.
- Matthew MacDonald asks: will Canvas rendering replace the DOM?
- Eve Turzillo organizes and modifies existing HTTP and HTTPS requests with Fiddler.
📢 Announcements
- Tara Overfield discusses the .NET Framework Cumulative Update for May.
- The Azure SDK team recaps the May release.
- Khalid Abuhakmeh writes about dotMemory support for Linux process dumps.
đź“… Community and events
- Microsoft Build kicks off Tuesday. David Ramel previews Build 2021, and Richard Hay links to some digital swag. Also, the Visual Studio team previews their Build sessions.
- The .NET Foundation Outreach Committee announces a new proposal process.
- The .NET Docs Show talks to Steve Gordon about ElasticSearch.NET.
- A busy week with community standups: ASP.NET talks about accessibility, Entity Framework builds modern apps with GraphQL, and .NET Tooling discusses container tools.
🌎 Web development
- Tomasz Pęczek receives JSON Objects Stream (NDJSON) in ASP.NET Core MVC.
- Paul DeVito continues writing about building an event-driven .NET app.
- Anoop Kumar Sharma writes about cookie authentication in ASP.NET Core.
- StackBlitz introduces WebContainers, which provide the ability to run Node.js natively in your browser.
- Adam Storr defines HttpClient test requests by using a bundle.
- Davide Bellone exposes a .NET assembly version from API endpoint routing.
- Kirtesh Shah introduces ASP.NET Core Razor Pages.
- Damien Bowden secures OAuth bearer tokens from multiple identity providers in ASP.NET Core.
- Matthew Jones uses custom user message extension methods in C# and MVC.
🥅 The .NET platform
- Konrad Kokosa asks: why should you care about .NET GC?
- Khalid Abuhakmeh works with .NET console host lifetime events.
- Richard Lander writes about profile-guided optimization (PGO) in .NET 6.
- Nick Randolph writes about the future of Windows development.
â›… The cloud
- Muhammed Saleem creates business workflows with Azure Logic Apps.
- Abhijit Jana explains howto get started with Azure quickly.
- Daniel Krzyczkowski continues his series on Azure Identity.
- John Reilly uses Azurite and Table Storage in a dev container.
đź“” Languages
- Georg Dangl updates the Azure App Service on Linux for Docker with C# webhooks.
- Rick Strahl finds a gotcha with the C# null ? propagator when doing async/await.
- Munib Butt uses Azure Blob Storage in C#.
- Akash Mair writes about data exploration in F#.
🔧 Tools
- Abhijit Jana uses GitHub Actions from Visual Studio.
- Maarten Balliauw writes about the Rider NuGet Credential Provider for JetBrains Space private repos.
- Charles Flatt recaps the git commit/checkout process.
🏗 Design, testing, and best practices
- Dennis Martinez writes about 5 ways to speed up your end-to-end tests.
- Niels Swimberghe bypasses ReCaptcha's in Selenium UI tests.
- Scott Brady writes about authenticated encryption in .NET with AES-GCM.
- Derek Comartin talks about testing your domain when event sourcing.
- Christian Heilmann says you can't automate accessibility testing.
🎤 Podcasts
- Scott Hanselman talks to Rey Bango about developers and security.
- The Azure DevOps Podcast talks to Jeremy Likness about working with data in .NET.
- The .NET Core Show talks about dotnet new3 With Sayed Hashimi.
- The 6-Figure Developer podcast talks to Rich Lander about .NET 6 Preview.
🎥 Videos
- Learn Live continues learning about Git.
- The Let's Learn .NET series talks about building accessible apps.
Top comments (1)
The rest of the news sounds great, but I don't particularly like the idea of deprecating
SecureString
just because some people see the word "Secure" and think it is magic and that they don't have to do anything else to protect the secret. If you handle the secret appropriately, the class does exactly what it is supposed to. I could get behind a shift to a new generic type as replacement, but from reading the discussion it seemsShroundedBuffer<T>
(or whatever they end up calling it) is nothing more than a glorified write only array.