The guard clauses remind me of the compile-time verification done by Microsoft's Spec#[0] compiler, which included non-null types, checked exceptions and throws clauses, method contracts and object invariants. Some of those saw the light of day with C#, like the non-nulls, but whatever happened to the rest?
Once I tried to use them, but forgot what was the issue... first of all - couldn't easily google on how to use it and then I think some legacy stuff was there that couldn't be used in .NET 4.7
> Code contracts aren't supported in .NET 5+ (including .NET Core versions). Consider using Nullable reference types instead.
Yep, it has been effectively deprecated for a while, and now gone in new .NET versions. But when it was there, there was a static checker that you could run, and I thought that's where all the Spec# bits ended up in.
.NET 5+ basically doesn't have anything like contracts out of the box anymore.
[0] http://www.rosemarymonahan.com/specsharp/papers/ECOOPTutoria...