Digests » 160
this week's favorite
There are things we don’t want to make public in an ASP.NET project. The best example are the database credentials that we can often find in configuration files as plain text.
The introduction of the .NET Core stack (and .NET Standard) has certainly been accompanied with some growing pains. The most prominent (wildly discussed) example would be the change in project file format from .csproj (XML based) to .xproj (JSON based). And then back to .csproj. The associated tooling has been somewhat rough around the edges (to a certain extent that still holds true today).
No, of course, you don’t want to create a vulnerable JSON API. So when using Json.NET: Don’t use another TypeNameHandling setting than the default: TypeNameHandling.None.
Microsoft and the .NET community have made asynchronous programming very easy with their implementation of async await in C#. The latest versions of ASP.NET heavily utilize it to improve performance. Many performance monitoring and profiling tools struggle to support and visualize the performance of asynchronous C# code.
.NET’s Garbage Collector (GC) implements many performance optimizations. One of them, the generational model assumes that young objects die quickly, whereas old live longer. This is why managed heap is divided into three Generations. We call them Gen 0 (youngest), Gen 1 (short living) and Gen 2 (oldest). New objects are allocated in Gen 0. When GC tries to allocate a new object and Gen 0 is full, it performs the Gen 0 cleanup. So it performs a partial cleanup (Gen 0 only)! It is traversing the object’s graph, starting from the roots (local variables, static fields & more) and marks all of the referenced objects as living objects.