So, what do you think? I changed newsletter providers and got a new look (thanks to @comfycoder for the logo help). I hope you like it. It works on my machine, and I hope it works on yours too. 😎
Any suggestions? Hit me up on Twitter or just reply to this e-mail. I’m all ears on what content you’d like—I want to make this the best part of your Monday!
This week we’re talking about debugging async with Coyote, an exciting new Razor editor in Visual Studio, a fun look at unit testing, and more!
Debug async issues faster with Coyote
Isn’t async programming fun? It’s so much fun, you can probably relate to this. (If you’ve spent months on a single concurrency issue, it might also make you cry.)
Roses are red— I Am Devloper (@iamdevloper) February 14, 2019
And so are you
Violets are blue
Asynchronous operations are great
All jokes aside, it’s a concurrent world and we just live in it. Our customers demand it. In this microservice-friendly, cloud-first world, we want things fast and efficient at the lowest cost possible. In the cloud, minimizing cost requires high throughput, which requires high concurrency. If you haven’t pulled your hair out from a concurrency/threading issue, to that I say: welcome to our field. I hope you had a nice graduation party.
We know this is hard, and that’s why we rely on the .NET framework to handle most of the magic for us. With the Task Parallel Library (TPL) and async/await, we don’t have to worry about thread scheduling, state management, or other hard low-level details.
However, we also get flexibility with APIs like Task.Run that give us the power to queue work—if we don’t know exactly what we’re doing, we can get in loads of trouble. Even with high code coverage, powerful integration testing, and stress testing, we still know we’re not too far from a concurrency issue that will cost our customers (and our employers) tons of time and money.
Meet Coyote, a set of tools that help you find these seemingly impossible-to-reproduce bugs quicker. (It is an evolution of the P# project, and is moving out of research mode.)
How does this work? After you write code that uses the Coyote programming model—the familiar task-based model in in preview—you can run
coyote test, where the magic begins. When you run this, Coyote manages task scheduling and explores all the complexities of your code. Coyote runs tests repeatedly with “different scheduling choices” each time. If a bug is found, Coyote reports a reproducible bug trace, which can be replayed until you find the bug.
Coyote has been put through its paces for various Azure services and promises integration with unit testing frameworks and minimal overhead. Is it worth it for internal CRUD apps? Maybe not. But if you are operating at tremendous scale where concurrency issues keep you up at night, it might be a game-changer.
There’s so much to take in! Check out the resources for more details on Project Coyote.
- Project Coyote site
- Extreme programming meets systematic testing using Coyote
- GitHub repo
- ON.NET - Reliable Async Systems with Coyote
New Razor editor for Visual Studio in preview
It seems like we’re constantly getting news of a new Visual Studio preview feature, and this week is no exception. If you download Visual Studio 2019 16.7 Preview 4 (got all that?) you can use a brand new Razor editor to assist your local development with Blazor, MVC, and Razor Pages.
Most of us know Razor but if you don’t: it’s a templating language (using HTML and, most frequently, C#) you use to define how you dynamically render content in your ASP.NET app. With Blazor, you can reuse UI components using .razor files. Razor in Visual Studio comes with IntelliSense, completions, and the like. Why a new editor, then?
Today, Visual Studio does a lot of tricks behind the scenes with projection buffers for the different languages it supports. For example, if you have C# and HTML in a Razor file, Visual Studio reads the Razor file from disk, sends the code to a Razor buffer, a C# buffer, and an HTML buffer. Finally, each buffer uses its own independent language service for each language you use. Oof.
Why should you care? If you’ve signed a lifetime contract to use Visual Studio and you’re a team of one, fine—but if you want extensibility with Codespaces or Live Share in VS, you’re in trouble. All these dependencies require a lot of work to coordinate and can hinder the speed of future improvements.
To address this, Microsoft has been working on a Razor Language Server that implements the features you know and love through a common protocol. Wherever the extension exists (VS, VS Code, wherever), it coordinates with the Razor Language Server.
This solution is currently used for Razor support in VS Code, and will be used for Codespaces and LiveShare for Visual Studio. And now, you can try the VS implementation today (in preview). It has some rough edges, but I look forward to see how it performs. I do know Razor mostly works well but can exhibit some inconsistent performance. Will this help?
🌎 Last week in the .NET world
I’m trying a new format this week so you can sift through the links easier.
🔥 The Top 3
- Michael Shpilt discusses how assemblies load in C# and .NET.
- Daniel Roth discusses a new experimental Razor editor for Visual Studio.
- Steve Gordon looks at how the ASP.NET Core middleware pipeline is built.
- Microsoft announces the release of WinUI 3 Preview 2.
- Take a look at the .NET Core and .NET Framework security updates for July 2020.
- We have a new version of the Azure CLI, v 2.9.
- Microsoft introduces Coyote.
- Microsoft introduces C# markup for Xamarin.Forms.
- Ruben Rios walks through authentication experience improvements in Visual Studio 2019 16.6.
- Stephen Toub does a rundown of performance improvements coming in .NET 5.
📅 Community and events
- All the .NET Foundation nominees were interviewed this week.
- The .NET Conf - Focus on Microservices event is on July 30, and the sessions and speakers are live.
- The DotNet Docs Show talks to Jeremy Sinclair.
- Two standups this week: Visual Studio and ASP.NET.
- Marco Dalla Libera walks through the MVVM pattern in Blazor for state management.
- Marinko Spasojevic walks through Blazor WASM searching with ASP.NET Core web API, as well as pagination.
🚀 .NET Core
- David Grace creates CRUD API endpoints with ASP.NET Core and Entity Framework.
- Neel Bhatt offers a primer on built-in dependency injection in ASP.NET Core.
- The Pro Code Guide discusses microservices with ASP.NET Core 3.1 and reads configuration values in ASP.NET Core.
- Michal Bialecki adds EF Core 5 to an existing database.
- Jason Farrell uses the Management API with .NET Core 3.1.
- Khalid Abuhakmeh sorts data with ASP.NET Core and query strings.
- Rick Strahl handles SPA fallback paths in a generic ASP.NET Core server.
- A nice discussion on some Entity Framework 3.1 gotchas.
⛅ The cloud
- Steve Gordon pushes a .NET Docker image to Amazon ECR.
- Aaron Powell starts a series on GraphQL on Azure.
- Daniel Krzyczkowski discusses async messaging with Azure Service Bus.
- Ed Freeman uses Azure Key Vault for encryption in C#.
- Dave Brock talks about target typing and covariant returns in C# 9, and answers some C# 9 questions.
- Jay Krishna Reddy has some tips to write clean C# code.
- Matthias Koch bypasses polymorphism with reflection in .NET.
- Ian Griffiths discusses DisallowNull in C# 8.
- Urs Enzler discusses his journey to learning F# basics.
- Ian Russell begins a series on web programming in F#.
- Patrick Smacchia offers his 10 Visual Studio navigation productivity tips.
- Adam Bertram customizes the Microsoft Terminal.
- Leomaris Reyes learns about SwipeView.
- David Ortinau discusses new app themes.
- Delpin Susai Raj debugs WebView.
- Selva Ganapathy Kathiresan discusses the Xamarin.Forms signature pad control.
- Leomaris Reyes replicates real estate property details.
- Mark Allibone creates a login flow with Xamarin Forms Shell.
- Brandon Minnick improves CollectionView scrolling.
- Daniel Hindrikes builds a styleable content button using PancakeView and releases a new version of TinyMvvm.
- The Stack Overflow Podcast asks: is Scrum making you a worse engineer?
- The .NET Rocks podcast discusses C# 9 with Mads Torgersen.
- The .NET Core Podcast talks with Alexey Golub about integrating with external APIs.
- Data Exposed discusses Azure SQL and IoT.
- ON.NET discusses reliable async systems with Coyote in two parts.
- The ASP.NET Monsters discuss record types in C# 9.
- Data Exposed talks about Advanced Threat Protection in Azure SQL.