Happy Monday to you! Here’s what we have for this week:
- How Blazor is drastically improving in preview 8 of .NET 5
- A discussion with Scott Addie
- A trip around the community
In a few weeks, we’ll see preview 8 of .NET 5, the last preview before the release candidates, and it’ll be filled with a ton of Blazor improvements for performance and tooling. In this week’s ASP.NET community standup, the team showed off a lot of these new features that folks have been asking for.
The biggest takeaway is that, with preview 8, Blazor is using the .NET 5 runtime and libraries—and with it, its improvements. Previously, Blazor Web Assembly was using Mono libraries—which seemed a little off, when thinking about the “One .NET” mission of .NET 5. Using the .NET 5 runtime now accounts for a ton of performance gains: the team reports that arbitrary CPU code in .NET 5 is around 30% faster (think dictionaries and string comparisons), JSON serialization and deserialization looks to be about twice as fast, and Blazor component rendering is anywhere from 2x to 4x faster.
Microsoft has traditional C# devs sold on Blazor—one toolchain, one language, much awesomeness. We get it. To really make an impact, and welcome other folks to .NET, Blazor will need to have features that folks demand from their other SPA frameworks and libraries like Angular and React (or other tools in that space). For example, if I ask a JS expert (and .NET outsider) to try a new SPA competitor, and there’s no auto-refresh, it’s hard to be taken seriously.
With preview 8, we’re seeing quite a few of these features. Here’s three of them.
When working with components, the idea is that they can be portable, organized elements. If I have a
<DatePicker> component, for example, I should be able to drop it and its styles wherever I need. Until preview 8, I would have to style my components in some CSS file somewhere else, and bring in that style sheet, and worry about maintaining that and dealing with cascading impacts throughout my site.
No more. Now, with CSS isolation, you can make life easier on yourself. By using a naming convention like
myComponent.razor.css, Blazor will bind the CSS to your component with no imports needed! And since that’s only bound to your component you can simplify your styles. Instead of declaring something like
<table class="myComponentStyle"> just style a
table in your component’s stylesheet and done!
What about JS isolation? It isn’t ready now, but it’s on the way.
Let’s say you have parts of your app that aren’t accessed every time. For example, reporting that’s generally accessed once a month. With lazy loading, you can load any assemblies only when needed. In your routing configuration, you can inject a lazy loading service and specify which assemblies to load and when. No more customized tree shaking.
The instant feedback loop is a big reason why so many people are drawn to front-end development. I can make a change, click Save (or not even Save!) and my changes are reflected immediately. This is thanks for incremental build tooling running in the background.
.NET has its own incremental file watcher,
dotnet watch, that not a lot of people know about. Blazor will use
dotnet watch behind the scenes to provide the auth-refresh capability.
There’s much more coming in preview 8, so definitely check out the video if you’re so inclined—and watch this space for more details when it arrives.
Have you worked in ASP.NET Core? If so, you have surely come across Scott Addie, whether you know about it or not. For over three years, Scott has worked as a content developer at Microsoft—publishing documentation on the framework, APIs, ebooks, blog posts, and Learn modules, and more.
He’s also been active in the developer community—both before and after joining Microsoft—and you can find him as a co-host on The .NET Docs Show, a weekly Twitch stream.
I recently caught up with Scott to talk about his work in the community, his career, .NET 5, and what he’s working on.
Walk us through your role.
For over three years, I’ve been a content developer on the .NET, Web Development, & Languages team of the Developer Relations division. My primary responsibility is to produce technical content focused on teaching ASP.NET Core. I’m provided creative freedom in how to best accomplish that goal. Ultimately, the ability to effectively communicate complex ideas, in both verbal and written forms, is critical to my success in this role.
What kind of projects are you hacking away at now?
Bill Wagner, Maxime Rouiller, and myself have been collaborating on a tool that generates “What’s New” pages for conceptual docsets hosted on docs.microsoft.com. It’s a .NET Core console app written in C# that uses the GitHub GraphQL API to process pull requests. I plan to distribute the tool internally as a .NET Core global tool. The idea is to provide customers with a summary of what changed in a particular product’s documentation during a specific time period. For example, the ASP.NET Core documentation publishes “What’s New” pages on a monthly cadence. At the time of writing, the concept has been adopted for the following products:
I’m actively working with a handful of other teams, including C++, Visual Studio, and SQL, to roll out these pages. There’s a sizeable features backlog for this tool. Some feature ideas include a “What’s New” hub page and an RSS feed.
My approach has always been: hit up the docs for just-in-time knowledge, or quick learning, and Learn modules for in-depth and hands-on content. Is that Microsoft’s approach?
The team offers content for folks at every level in their journey. If you’re a seasoned ASP.NET Core developer, the conceptual content and API reference content are great resources. If you’re new to .NET, the Learn .NET page is a better starting point. If you want to learn more about using ASP.NET Core with Azure, Microsoft Learn is a good place to start. In many Learn modules, an Azure subscription isn’t required to test drive Azure services with .NET. You’re provided an Azure Cloud Shell instance and a set of instructions that can often be completed in under an hour. Gamification is an important aspect of Learn. As you complete modules, you earn achievement badges. Virtual trophies are awarded for the completion of learning paths.
Over at Build, a few folks discussed Learn TV. What is it and what can we expect from it?
Learn TV is a Microsoft-owned video content platform that offers 24 hours of programming, 7 days a week. If you tuned in to the recent .NET Conf: Focus on Microservices event, you may have noticed that it streamed live on Learn TV. Additionally, Learn TV streams live shows from the Developer Relations organization, such as The .NET Docs Show and 92 & Pike. It’s still early days for Learn TV, hence the “preview” label on its landing page. Golnaz Alibeigi is working with a small team of folks to evolve it in to a world-class product. I’ll defer to Golnaz for specific plans.
I know you work on a lot of Learn modules. What are you working on now?
Nish Anil, Cam Soper, and myself are authoring a .NET microservices learning path in Microsoft Learn. The learning path is based on the eBook .NET Microservices: Architecture for Containerized .NET apps and is expected to consist of seven modules. At the time of writing, the following modules have been published:
- Create and deploy a cloud-native ASP.NET Core microservice
- Implement resiliency in a cloud-native ASP.NET Core microservice
Next up is a microservices module focused on DevOps with GitHub Actions. The learning path project board is available for anyone to see.
What is your one piece of programming advice?
My advice is to ask probing questions and challenge the status quo. Regardless of your organizational rank, ask why your team operates the way they do. Ask why certain technology choices were made. The answers might surprise you. Equipped with those answers, you can begin to understand existing processes and formulate improvements. If you have an idea, don’t be afraid to speak up. Everyone brings a unique perspective to the table.
This is just a small portion of my interview with Scott! Head over to my site for more.
- Khalid Abuhakmeh discusses the secrets of a .NET professional.
- Andrew Lock talks about DI scopes in IHttpClientFactory message handlers.
- Damien Bowden does retry error handling for activities and orchestrations in Azure Durable Functions.
- Tara Overfield runs through .NET Framework August 2020 security and quality updates, and Rahul Bhandari discusses August 2020 security updates for .NET Core.
- Microsoft and Chris Pietschmann have released a 2020 developer’s guide to Azure.
- It looks like nuget.org now supports advanced search.
- A very hard day at Mozilla, and the community at large.
- The .NET Docs Show has an amazing conversation with Layla Porter about .NET Core 3.1 and Twilio.
- Two community standups this week: the languages team talks IoT, API analyzers, and more, and ASP.NET talks about Blazor updates in .NET 5.
- Marinko Spasojevic walks through role-based auth with Blazor WebAssembly.
- Both Lee Richardson and Jon Hilton compare Angular with Blazor WASM.
- Hamid Khan works with CORS in .NET Core.
- Over at CodeMaze, how to send client-specific messages using SignalR.
- Derek Comartin migrates to .NET Core.
- David Grace continues logging data changes in EF Core.
- Steve Gordon talks about best practices when integration testing ASP.NET Core apps.
- Karthik Anandan shields an ASP.NET MVC web app with Content Security Policy.
- Jeremy Wells walks through TDD and exception handling with xUnit in ASP.NET Core.
- Mark Seemann writes an ASP.NET Core URL builder.
- Ryan Palmer walks through configuration, secrets, and KeyVault with ASP.NET Core.
- Matthew Soucoup authenticates an ASP.NET Core web app with Microsoft.Identity.Web.
- Jason Farrell uploads a file using Azure Durable Functions.
- Rishit Mishra secures web app secrets through Azure Key Vault.
- Mitch Denny discusses packaging, tools, and repo structure for the Azure SDKs.
- Kevin Griffin redirects with Azure Static Web Apps.
- Abhijeet Jadhav queries the Microsoft Graph API using C#.
- Dave Brock (ahem) learns another few things about C# 9 records.
- Khalid Abuhakmeh builds HTML with C#.
- Vishal Saroopchand compares Go and C#.
- Raymond Chen discusses hidden constraints on the result type in Concurrency Runtime tasks.
- Urs Enzler talks about F# equality and also happy path coding with F#.
- Jonathan Channon discusses F# type aliases.
- Anthony Giretti extends partial methods in C# 9.
- Scott Hanselman shows off free books for learning about cloud-native .NET apps.
- Michael Shpilt offers five Visual Studio productivity tips.
- Josef Ottosson includes referenced projects in dotnet pack.
- Mads Kristensen shows off Presentation Mode in Visual Studio.
- Leomaris Reyes explores the new Xamarin.Forms grid structure and also replicates a streaming UI app.
- Dobrinka Yordanova works on Mobile Blazor Bindings for Xamarin.
- Theodora Tataru builds a college diary in Xamarin.Forms.
- Jake Kirsch talks about the new Xamarin.Forms 4.8 release.
- Nick Randolph discusses the ItemsPanel.
- The Xamarin Podcast discusses brushes, gradients, and shapes.
- The .NET Core Show talks to Luis Quintanilla about ML.NET.