Andrew Lock | .NET Escapades
1,737 FOLLOWERS
Andrew Lock is Software developer, C# lover, blogger, focused on ASPNET. Author or ASP. NET Core in Action.
Andrew Lock | .NET Escapades
2h ago
In this post I discuss some lesser known HTML elements: the MathML (and MathMLCore) specification, and show how these can be used to render math equations in HTML. Finally I discuss the AsciiMath language for an easier way of writing math in Markdown documents.
What is MathML?
I've written a couple of algorithm/data structure related posts recently, such as this one on PriorityQueue, and this one on using it to implement Dijkstra's shortest-path algorithm. In those posts I wanted to provide some big O complexity estimates for the behaviour, which meant potentially needing mathematical notatio ..read more
Andrew Lock | .NET Escapades
2w ago
In this post I show how you can work on a git branch with a repository checked out in Windows, and then sync that branch to another git folder in WSL, without having to push to a remote server like GitHub. I start by discussing why you might want to do that, and then show how to make it work!
Why would you want to do that?
This post was driven from a colleague asking me how to do the following (paraphrased):
I have a git repository checked out in Windows that I'm working on in Visual Studio. I want to work on the branch in Windows and then sync it to Windows Subsystem for Linux (WSL) to buil ..read more
Andrew Lock | .NET Escapades
3w ago
In a previous post I provided an introduction to the generic heap data structure and how it's used by the .NET PriorityQueue type. In the subsequent post I discussed the implementation of some important methods on PriorityQueue. In this post, we look at the Remove() method, which was added in .NET 9 (preview 1), and show how you can use it to implement Dijkstra's algorithm for finding the shortest path between two nodes.
The rationale for adding PriorityQueue.Remove()
The PriorityQueue type introduced in .NET 6 supports most of the common operations you'd expect from a priority queue, with on ..read more
Andrew Lock | .NET Escapades
1M ago
In this post I describe Unix domain sockets, what they are, the scenarios where they're useful, how to use them with ASP.NET Core, and how to call a UDS ASP.NET Core app using HttpClient. For those who read my previous post, this post is going to be very familiar!
What are Unix Domain Sockets?
A Unix domain socket (UDS) is an endpoint for communication between processes on the same host. It's very similar to an IP socket that you'd use for normal internet traffic, but communication happens entirely on one host, inside the operating system's kernel. As the name suggests, UDS is a standard part ..read more
Andrew Lock | .NET Escapades
2M ago
In this post I describe Windows named pipes, what they are, the scenarios where they're useful, how to use them with ASP.NET Core, and how to call a named pipe ASP.NET Core app using HttpClient.
What are Windows named pipes?
Windows named pipes provide a named, one-way or duplex pipe for communication between a client and a server. They provide a way to communicate between different processes, typically on the same machine.
Named pipes support calling remote servers by network name too, though that seems less common from what I understand.
You can think of a duplex named pipe as being simil ..read more
Andrew Lock | .NET Escapades
2M ago
By default, without additional configuration in .NET 8, ASP.NET Core apps listen on the URL http://localhost:5000. In this post I show 8 different ways to change this URL. This is an update to a post I wrote three years ago called “5 ways to set the URLs for an ASP.NET Core app”. This post is similar but covers some additional ways! ?
There are multiple ways to set the URLs that ASP.NET Core binds to on startup. I have a very old post about the options available in ASP.NET Core 1.0, and my previous post applies to .NET Core 3.x. The options available in ASP.NET Core 8 are similar, with a coup ..read more
Andrew Lock | .NET Escapades
2M ago
In this post I show an example of how the C# 8 feature, default interface methods, can be used to improve performance. I describe a pull request to ASP.NET Core that shows a way for implementations to optimise specific usages of the interface.
Default interface methods
In my previous post I described how default interface methods can be used to allow you to evolve an interface by adding members without breaking consumers of the interface. The feature requires that you provide a method body for your implementation, which implementers can override, but which is used when no alternative is provi ..read more
Andrew Lock | .NET Escapades
2M ago
In this post I provide an introduction to default interface methods, how they work at a high level, and their typical uses. Finally, I discuss some of the sharp edges on the feature: things to watch out for, compiler errors you could run into, and caveats about where you can use them. In my next post, I discuss a use case where default interface methods were used to improve the performance of ASP.NET Core.
Understanding default interface methods
Default interface methods were introduced in C# 8, primarily as a way to make it easier to evolve an interface without breaking people that have impl ..read more
Andrew Lock | .NET Escapades
3M ago
This is the tenth post in the series: Creating a source generator.
Part 1 - Creating an incremental generator
Part 2 - Testing an incremental generator with snapshot testing
Part 3 - Integration testing and NuGet packaging
Part 4 - Customising generated code with marker attributes
Part 5 - Finding a type declaration's namespace and type hierarchy
Part 6 - Saving source generator output in source control
Part 7 - Solving the source generator 'marker attribute' problem - Part 1
Part 8 - Solving the source generator 'marker attribute' problem - Part 2
Part 9 - Avoiding performance pitfalls in i ..read more
Andrew Lock | .NET Escapades
3M ago
This is the ninth post in the series: Creating a source generator.
Part 1 - Creating an incremental generator
Part 2 - Testing an incremental generator with snapshot testing
Part 3 - Integration testing and NuGet packaging
Part 4 - Customising generated code with marker attributes
Part 5 - Finding a type declaration's namespace and type hierarchy
Part 6 - Saving source generator output in source control
Part 7 - Solving the source generator 'marker attribute' problem - Part 1
Part 8 - Solving the source generator 'marker attribute' problem - Part 2
Part 9 - Avoiding performance pitfalls in i ..read more