Caching http requests for faster debugging

When working with an http service, you have to do lots of http requests to the server. This may slow down your tests/debugging experience. There are multiple ways to handle that issue. The first one is to mock the calls and work with fake data. You can easily mock the HttpClient class in C# (see Mocking an HttpClient using an HttpClientHandler), but this requires to do that for each projects and to create… [read more]

Use structures to improve the readability of your code

It's very common to use basic types such as string, int, or long to represent your data. However, sometimes there is a semantic behind the type. For instance, a string can be a file path, a full name, or an id. Also, you need to compare them or pretty-print the value. For instance, the length of a file is a long, but you almost never show the raw information. Instead, you format it as MB or GB. Which one… [read more]

Exploring the MSBuild log using the binary log viewer

Following my previous post about ILRepack, some people asked me where the MSBuild property ReferencePathWithRefAssemblies comes from. Is there a documentation, or something to find properties like this one? The documentation of MSBuild is very useful to understand how it works and the key concepts. However, they cannot document all the properties because there are dependents of the kind of project you… [read more]

How to document an ASP.NET Core Web API using OpenAPI Specification (swagger)

Documenting your API is very important if you want people to be able to consume it. An API documentation should contain the list of accessible endpoints (URL, method), their parameters, and the response (http status code, body). The documentation should be readable by a human, but also by a computer. The later is very useful to generate clients automatically. OpenAPI Specification is the most common way… [read more]