ASP.NET Core 8: Better contextual debugging experience
Introduction
ASP.NET Core 8 brings a great improvement on contextual informations. The latter improves debugging experience by implementing new customized attributes on several informations like HttpContext, HttpResponse, Features and more… In this post I will show you the difference ASP.NET Core 8 and previous versions.
Improved debugging experience by example
Before ASP.NET Core 8, the debugging experience wasn’t very informative at first glance, as you can see by debugging the context of an HTTP request through IHttpContextAccessor. The following example is based on authentication with a JWT:
As you can see many information like :
- Connection
- Features
- Items
- Request
- Response
- Session
- User
- WebSocket
are not really helpful. If you take the same HTTP Request with ASP.NET Core 8, it gives the following:
Since ASP.NET Core 8 I still in preview, there are probably some bugs, I’m waiting for an answer why Principal Identity Name debug property is Null when I’m authenticated:
Once I’ll get an answer I will update this post and give more information on this.
UPDATE! (06/20/2023): James Newton-King has pushed a change to this feature. When the Principal Identity Name value is null, the Debugger Display won’t show it: https://github.com/dotnet/runtime/pull/87742