A middleware to provide specific html pages for some error and default one for others while returning correct http error code as status: Re-execute the middleware pipeline with the StatusCodePages Middleware to create custom error pages.

We can also want to know the original path that actually caused the error: pretty easy using Request Features in ASP.NET Core and querying for IStatusCodeReExecuteFeature. In fact, current implementation of this interface also provides error query string (but it will not be reflected into interface before .Net 2.0): Retrieving the path that generated an error with the StatusCodePages Middleware

ReadLine comes to .Net (Core and full)

ReadLine is a GNU Readline like library built in pure C#. It can serve as a drop in replacement for the inbuilt Console.ReadLine() and brings along with it some of the terminal goodness you get from unix shells, like command history navigation and tab auto completion.

An AutoCompletionHandler callback  can be used to provide an array of suggestion.

tsolarin/readline: A GNU-Readline like library for .NET/.NET Core

How to disable hardware rendering for a WPF process

Apparently, my customers do not have the WPF black screen bug (Video Rendering Issues for WPF Windows – Rick Strahl’s Web Log) but the solution is elegant enough to be noted.

With some video card/drivers, WPF’s main window (and more particularilly MahApps main window) can be completly black. This seems to be an hardware rendering problem. Good news, a per processs solution exist:


that can be set at startup to SoftwareOnly. Good to know!

Impacts of new() contraint in C#

“Disecting the new() constraint” is very instructive: new() constraint has a big performance impact and we must know its implementation to understand why ctor exceptions are wrapped to a TargetInvocationException.

Dissecting the new() constraint in C#: a perfect example of a leaky abstraction – Dissecting the code

By the way, in same blog post, I’ve discovered that some well known static functions can be custom replaceable. It means you can locally redefined them. System.Activator.CreateInstance<T> is replaced by a faster one.

Beware, this is a completly not documented behavior than can be theoretically remove any time. Just to mitigate previous remark, this undocumented behavior is so important survived the Roslyn transition.