Roundup #72: Succinct C#, IHostedService Shutdown Timeout, try-convert, Coupling, Cohesion, and Microservices

Writing More Succinct C#

When looking at a lot of C# code nowadays, I find myself thinking “wow, that code could be made SO MUCH SMALLER!”. C# is a very flexible language, allowing you to write clean and functional code, but also very bloated code.

Link: https://www.danclarke.com/2020-more-succinct-csharp

Extending the shutdown timeout setting to ensure graceful IHostedService shutdown

I was seeing an issue recently where our application wasn’t running the StopAsync method in our IHostedService implementations when the app was shutting down. It turns out that this was due to some services taking too long to respond to the shutdown signal. In this post I show an example of the problem, discuss why it happens, and how to avoid it.

Link: https://andrewlock.net/extending-the-shutdown-timeout-setting-to-ensure-graceful-ihostedservice-shutdown/

try-convert

This is a simple tool that will help in migrating .NET Framework projects to .NET Core.

This tool is for anyone looking to get a little help migrating their projects to .NET Core (or .NET SDK-style projects).

As the name suggests, this tool is not guaranteed to fully convert a project into a 100% working state. The tool is conservative and does as good of a job as it can to ensure that a converted project can still be loaded into Visual Studio and build. However, there are an enormous amount of factors that can result in a project that may not load or build that this tool explicitly does not cover. These include:

Complex, custom builds that you may have in your solution

API usage that is incompatible with .NET Core

Unsupported project types (such as Xamarin, WebForms, or WCF projects)

If the bulk of your codebase is generally capable of moving to .NET Core (such as lots of class libraries with no platform-specific code), then this tool should help quite a bit.

Link: https://github.com/dotnet/try-convert

Build Stuff #6 e-Meetup – Sam Newman – Coupling, Cohesion, and Microservices

The terms coupling and cohesion come from the world of structured programming, but they are also thrown about in the context of microservices. In this session, I look at the applicability of these terms to a microservice architecture and also do a deep dive into the different types of coupling to explore how ideas from the 1970s still have a lot of relevance to the types of systems we build today.

Link: https://www.youtube.com/watch?v=s_bAC_X57MA

Enjoy this post? Subscribe!

Subscribe to our weekly Newsletter and stay tuned.

Roundup #71: C# Source Generators, MsQuic, CoreBoy, Channels

Introducing C# Source Generators

We’re pleased to introduce the first preview of Source Generators, a new C# compiler feature that lets C# developers inspect user code and generate new C# source files that can be added to a compilation. This is done via a new kind of component that we’re calling a Source Generator.

Link: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/

MsQuic is Open Source

Microsoft is open sourcing our QUIC library, MsQuic, on GitHub under an MIT license. MsQuic is a cross-platform, general-purpose library that implements the QUIC transport protocol. QUIC is being standardized by the Internet Engineering Task Force (IETF). MsQuic is a client and server solution optimized for multiple usage patterns and is used by multiple Microsoft products and services. MsQuic is currently in preview and supports Windows and Linux.

Link: https://techcommunity.microsoft.com/t5/networking-blog/msquic-is-open-source/ba-p/1345441

CoreBoy

Link: https://github.com/davidwhitney/CoreBoy

Working with Channels in .NET

Channels enable a producer to safely pass data over to a consumer along with the appropriate notifications in both directions.

In this episode, Stephen Toub chats with Rich about the what, why and how of using the System.Threadding.Channels library. They walk us through a simple demo of using channels and also discuss the various strategies at our disposal.

Link: https://www.youtube.com/watch?v=gT06qvQLtJ0

Enjoy this post? Subscribe!

Subscribe to our weekly Newsletter and stay tuned.

Roundup #70: Coyote, DetectDuplicates, YARP, .NET 5, Lambda?

Coyote: Making it easier for developers to build reliable asynchronous software

For developers, writing bug-free software that doesn’t crash is getting difficult in an increasingly competitive world where software needs to ship before it becomes obsolete. This challenge is especially apparent with online cloud services, which are often dictated by aggressive shipping deadlines. Cloud services are distributed programs comprising multiple back-end systems that continuously exchange asynchronous signals while responding to incoming web requests. They are complex by nature, hard to get right, and require protection from failures that could jeopardize client data or halt key services.

Link https://www.microsoft.com/en-us/research/blog/coyote-making-it-easier-for-developers-to-build-reliable-asynchronous-software/

DetectDuplicates

A .NET Global tool that scans csproj files for duplicate package references

Link: https://github.com/jchannon/DetectDuplicates

YARP project (Reverse Proxy)

YARP (which stands for “YARP: A Reverse Proxy”) is a project to create a reverse proxy server. We found a bunch of internal teams at Microsoft who were either building a reverse proxy for their service or had been asking about APIs and tech for building one, so we decided to get them all together to work on a common solution, this project.

Link: https://github.com/microsoft/reverse-proxy

The Most Exciting Promise of .NET 5

It’s hard to believe that .NET only came out in 2002. There are so many versions of the framework, rapidly changing the places a C# developer could create and support. The entire ecosystem just turned 18, and it has been confusing at times with versioning. I fell in love with how powerful the platform was, but often, choosing to upgrade to the latest major or minor version proved difficult. How much actual value would I get from upgrading?

Link: https://developer.okta.com/blog/2020/04/17/most-exciting-promise-dotnet-5

Lambda? You Keep Using that Letter – Kevlin Henney

Lambdas. All the cool kid languages have them. But does ‘lambda’ mean what C#, Java, Python, C++, etc. mean by ‘lambda’? Where did lambdas come from? What were they originally for? What is their relationship to data abstraction?

In this session we will into the history, the syntax and the uses of lambdas and the way in which lambda constructs in various languages do (or do not) match the original construct introduced in lambda calculus.

Link: https://www.youtube.com/watch?v=Y7StjYhXvpE

Enjoy this post? Subscribe!

Subscribe to our weekly Newsletter and stay tuned.