Andrew Lock "Sock"'s Avatar

Andrew Lock "Sock"

@andrewlock.bsky.social

Microsoft MVP and blogger, focused on ASP.​NET Core. Author of ASP.​NET Core in Action (https://mng.bz/5mRz) Blog: https://andrewlock.net Mastadon: @andrewlock@hachyderm.io Twitter: @andrewlocknet

2,388 Followers  |  340 Following  |  899 Posts  |  Joined: 12.10.2023  |  1.7958

Latest posts by andrewlock.bsky.social on Bluesky

Scrolling list of ASP.NET log output

Scrolling list of ASP.NET log output

Show all the routes of a site

Show all the routes of a site

Show all the configuration values for an ASP.NET site and their source

Show all the configuration values for an ASP.NET site and their source

Shows the DI configuration

Shows the DI configuration

If you didn't catch it, this shows the current logs, DI config, environment and ASP.NET routes in the terminal when you do a dotnet run on an ASP.NET app. Combines a bunch of snippets I've borrowed from @meziantou.net and @andrewlock.bsky.social posts and dumping them into the console.

04.02.2026 19:58 — 👍 4    🔁 1    💬 1    📌 0

In this case "better" is just "more like the original source" ☺️ e.g. dotpeek has two nested for loops like the original, where ilspy has a for and a while.

ILSpy pita the label in the right place though 😅

04.02.2026 18:53 — 👍 0    🔁 0    💬 0    📌 0
Preview
Exploring the (underwhelming) System.Diagnostics.Metrics source generators: System.Diagnostics.Metrics APIs - Part 2 In this post I explore the source generators shipped in Microsoft.Extensions.Telemetry.Abstractions, explore the code, and discuss whether I would use them

Blogged: Exploring the (underwhelming) System.Diagnostics.Metrics source generators

andrewlock.net/creating-str...

In this post I explore the source generators shipped in Microsoft.Extensions.Telemetry.Abstractions, explore the code, and discuss whether I would use them

#dotnet

03.02.2026 18:10 — 👍 7    🔁 0    💬 0    📌 0

And thanks to friends in high places (cough @kevingosse.net):

youtrack.jetbrains.com/issue/DOTP-8...

03.02.2026 10:51 — 👍 3    🔁 0    💬 0    📌 0
The source code for MemoryExtensions.TrimEnd, showing the 'Next' label after the break

The source code for MemoryExtensions.TrimEnd, showing the 'Next' label after the break

The source code for the ILSpy-decompiled version, which uses an inner while loop, but contains the IL_0044 (Next) label at the right place

The source code for the ILSpy-decompiled version, which uses an inner while loop, but contains the IL_0044 (Next) label at the right place

The source code for the dotPeek-decompiled version, which uses an inner while loop, but contains the label_8 (Next) label in the _wrong_ place

The source code for the dotPeek-decompiled version, which uses an inner while loop, but contains the label_8 (Next) label in the _wrong_ place

We discovered something interesting... the decompiled output of ILSpy and dotPeek differs. Which is fine...dotPeek does a "better" job in general... except that in this case, the dotPeek code includes an infinite loop bug 😅

1) Original source for MemoryExtensions.TrimEnd()
2) ILSpy
3) dotPeek

03.02.2026 10:16 — 👍 5    🔁 0    💬 2    📌 0
Preview
Recent updates to NetEscapades.EnumGenerators: new APIs and System.Memory support In this post I describe some recent changes to the NetEscapades.EnumGenerators source generator, including support for the System.Memory package and new APIs

Speed up enum ToString and parsing with @andrewlock.bsky.social's latest NetEscapades.EnumGenerators update: disable number parsing, serialize in lower or upper invariant, and get span support via System.Memory on older targets.

#csharp #dotnet

29.01.2026 15:49 — 👍 1    🔁 1    💬 0    📌 0

Yep, easiest way is prob to use the open telemetry Prometheus exporter: learn.microsoft.com/en-us/dotnet...

29.01.2026 02:09 — 👍 2    🔁 0    💬 0    📌 0
Preview
Creating and consuming metrics with System.Diagnostics.Metrics APIs In this post I provide an introduction to the System.Diagnostics.Metrics API, and show how to create a custom metric and read it with dotnet-coutners

Blogged: Creating and consuming metrics with System.Diagnostics.Metrics APIs

andrewlock.net/creating-and...

In this post I provide an introduction to the System.Diagnostics.Metrics API, show how to create a custom metric, and show how to read it with dotnet-counters

#dotnet

27.01.2026 15:26 — 👍 8    🔁 3    💬 2    📌 0
Preview
Writing a .NET Garbage Collector in C#  - Part 6: Mark and Sweep Using NativeAOT to write a .NET GC in C#. In the sixth part, we start implementing the mark phase of the garbage collection.

After a long wait, I've finally published the sixth part in my "Writing a .NET Garbage Collector in C#" series. Today, we start implementing mark and sweep.

minidump.net/writing-a-ne...

27.01.2026 10:26 — 👍 11    🔁 6    💬 0    📌 0
The book "ASP.NET Core In Action" sitting on a desk. The front cover has an image of a man in a robe with a long beard and a tall hat on his head.

The book "ASP.NET Core In Action" sitting on a desk. The front cover has an image of a man in a robe with a long beard and a tall hat on his head.

So I can learn what I need for both a new job and my game, I'm reading the massive ASP.NET Core In Action by @andrewlock.bsky.social. My roommate called it a magical tome and pointed out: there's even a wizard on the cover!

Anyway, now I imagine I'm reading a magical tome for casting complex spells

20.01.2026 14:30 — 👍 7    🔁 2    💬 0    📌 0

Blogged: Making foreach of an IEnumerable allocation-free, using reflection and dynamic methods

andrewlock.net/making-forea...

In this post I describe why foreach sometimes allocates, and show how you can use DynamicMethod and Reflection.Emit to go allocation-free

#dotnet #csharp

20.01.2026 16:17 — 👍 4    🔁 0    💬 0    📌 0

Gah, sorry about that, that's embarrassing🤦‍♂️Fixed now

15.01.2026 10:13 — 👍 0    🔁 0    💬 1    📌 0
Preview
The Windows File Explorer replacement, File Pilot, is awesome In this post I describe my experience with the Windows File Explorer replacement, File Pilot. It's blazingly fast, feature rich, and has hotkeys everywhere

Blogged: The Windows File Explorer replacement, File Pilot, is awesome

andrewlock.net/windows-expl...

In this post I describe my experience with the Windows File Explorer replacement, File Pilot. It's blazingly fast, feature rich, and has hotkeys everywhere

13.01.2026 19:45 — 👍 20    🔁 2    💬 1    📌 0
Preview
Recent updates to NetEscapades.EnumGenerators: new APIs and System.Memory support In this post I describe some recent changes to the NetEscapades.EnumGenerators source generator, including support for the System.Memory package and new APIs

Blogged: Recent updates to NetEscapades.EnumGenerators: new APIs and System.Memory support

andrewlock.net/updates-to-n...

In this post I describe some recent changes to the NetEscapades.EnumGenerators source generator, including support for the System.Memory package and new APIs

#dotnet

06.01.2026 16:01 — 👍 6    🔁 1    💬 0    📌 0
Preview
HeroDevs Blog | HeroDevs Joins .NET Security Group: Securing the Future of the .NET Ecosystem HeroDevs joins the .NET Security Group alongside Microsoft, Red Hat, and Canonical to deliver synchronized CVE patches and stronger security for end-of-life .NET systems.

HeroDevs has joined Microsoft, Canonical, and Red Hat as a member of the .NET Security Group www.herodevs.com/blog-posts/h...

06.01.2026 00:58 — 👍 5    🔁 5    💬 0    📌 0
[HOWTO] Implement Audit Logging in a .NET Core application using Entity Framework Core and Audit.NET This blog post outlines the implementation of audit logging using Audit.NET in .NET Core applications with Entity Framework Core. It discusses the purpose of audit logs, which enhance traceability and compliance, and details the setup process, including modifying the DbContext, creating tracking properties, and configuring audit data storage in a dedicated entity.

Blogged: [HOWTO] Implement Audit Logging in a .NET Core application using Entity Framework Core and Audit.NET

#dotnet #dotnetcore #efcore #auditdotnet #auditing #auditlog #audittrail #traceability

29.12.2025 07:44 — 👍 2    🔁 2    💬 0    📌 0

@danclarke.com also made the jump recently, in case he has any updates/advice 🙂

27.12.2025 07:18 — 👍 1    🔁 0    💬 1    📌 0
Preview
Migrating comments from Disqus to giscus In this post I describe a .NET script/tool I created to migrate the comments on my blog posts from my legacy Disqus account to GitHub discussions

Also a great follow up :) andrewlock.net/migrating-co...

26.12.2025 20:33 — 👍 3    🔁 1    💬 1    📌 0
Spectre.Console Documentation Documentation for Spectre.Console and Spectre.CLI - rich console UI library and command-line application framework for .NET

The new Spectre.Console (and Spectre.Console.Cli) website is now live! 🎉

This is all courtesy of @philco.bsky.social, who has done an amazing job, just as he did with the previous website.

spectreconsole.net

24.12.2025 18:43 — 👍 45    🔁 13    💬 1    📌 0
https://damienbod.com/2025/12/20/digital-authentication-and-identity-validation/

https://damienbod.com/2025/12/20/digital-authentication-and-identity-validation/

Blogged: Digital Authentication and Identity validation

damienbod.com/2025/12/20/d...

#oidc #identity #iam #swiyu #eid #oauth #dpop #openid #security #ecollecting #authentication #loa #loi #vc #oauth2 #swiss #ch #cybersecurity

20.12.2025 11:36 — 👍 5    🔁 2    💬 0    📌 0
Preview
Investigating a deadlock in Visual Studio A short investigation that showcases one of the most common problem faced when writing a profiler.

Today I ran into a deadlock in VS2026. I debugged it, and it turned out to be a common issue you may run into when writing a profiler.
I wrote a short article about it: minidump.net/investigatin...

17.12.2025 17:55 — 👍 8    🔁 4    💬 0    📌 0
Preview
Creating a .NET CLR profiler using C# and NativeAOT with Silhouette In this post I look at how to create a simple .NET profiler. But instead of using C++, the profiler uses C# and NativeAOT with the Silhouette library

Creating a .NET CLR profiler using C# and NativeAOT with Silhouette | by Andrew Lock

buff.ly/8dnlOXH

#dotnet #programming #csharp #profiler #aot

16.12.2025 19:00 — 👍 6    🔁 3    💬 0    📌 0
Preview
Creating a .NET CLR profiler using C# and NativeAOT with Silhouette In this post I look at how to create a simple .NET profiler. But instead of using C++, the profiler uses C# and NativeAOT with the Silhouette library

Blogged: Creating a .NET CLR profiler using C# and NativeAOT with Silhouette

andrewlock.net/creating-a-d...

In this post I look at how to create a simple .NET profiler. But instead of using C++, the profiler uses C# and NativeAOT with @kevingosse.net's Silhouette library

#dotnet

16.12.2025 18:10 — 👍 13    🔁 3    💬 0    📌 0
Preview
Trying out the Zed editor on Windows for .NET and Markdown In this post I try out Zed on Windows to see if it can replace my VS Code usages for quick edits of .NET projects and writing Markdown documents

Blogged: Trying out the Zed editor on Windows for .NET and Markdown

andrewlock.net/trying-out-t...

In this post I try out Zed on Windows to see if it can replace my VS Code usages for quick edits of .NET projects and writing Markdown documents.

#dotnet

09.12.2025 18:30 — 👍 12    🔁 2    💬 3    📌 0
GitHub Actions Has a Package Manager, and It Might Be the Worst GitHub Actions has a package manager that ignores decades of supply chain security best practices: no lockfile, no integrity verification, no transitive pinning

Kind of scary when you think about it: nesbitt.io/2025/12/06/g...

09.12.2025 03:20 — 👍 11    🔁 6    💬 2    📌 2
Preview
Recent updates to NetEscapades.EnumGenerators: [EnumMember] support, analyzers, and bug fixes In this post I describe some recent changes to the NetEscapades.EnumGenerators source generator, including support for [EnumMember] and new analyzers

Blogged: Recent updates to NetEscapades.EnumGenerators: [EnumMember] support, analyzers, and bug fixes

andrewlock.net/recent-updat...

In this post I describe some recent changes to the NetEscapades.EnumGenerators source generator, including support for [EnumMember] and new analyzers

#dotnet

02.12.2025 17:05 — 👍 4    🔁 0    💬 0    📌 0
screenshot of MSBuild binlog viewer on the Properties and Items tab, the query shows `$property "OutputPath" "UseArtifactsOutput"`

results show a tree where each assignment to OutputPath is highlighted, with the actual value being displayed where an assignment was made

screenshot of MSBuild binlog viewer on the Properties and Items tab, the query shows `$property "OutputPath" "UseArtifactsOutput"` results show a tree where each assignment to OutputPath is highlighted, with the actual value being displayed where an assignment was made

MSBuild tip: if you're working with binlogs, set the environment variable MSBuildLogPropertyTracking=15.

It enables logging of where each property was initially assigned from during evaluation and lights up more features in the binlog viewer.

02.12.2025 06:13 — 👍 29    🔁 8    💬 2    📌 0

And it's up! All together now...

🎶 Somebody told me
the user provider
should use an adaptor
to proxy the query
factory builder... 🎶

www.youtube.com/watch?v=p03o...

28.11.2025 15:15 — 👍 75    🔁 31    💬 4    📌 9
Preview
Exploring the .NET boot process via host tracing In this post we enable host tracing and use that to understand how a .NET app boots up via the dotnet muxer, hostfxr, and hostpolicy.dll

Blogged: Exploring the .NET boot process via host tracing

andrewlock.net/exploring-th...

In this post we enable host tracing and use that to understand how a .NET app boots up via the dotnet muxer, hostfxr, and hostpolicy.dll

#dotnet

25.11.2025 18:39 — 👍 9    🔁 3    💬 0    📌 0
Preview
Converting an xUnit test project to TUnit In this post I discuss the new TUnit testing framework, why I ported one of my libraries to use it instead of xUnit and related issues I had to deal with

If you do, converting an xunit project to TUnit is really slick: andrewlock.net/converting-a...

24.11.2025 20:52 — 👍 4    🔁 1    💬 0    📌 0

@andrewlock is following 20 prominent accounts