.NET Toolbox
Let's start the new year with a bang: I created a new tool called "Toolbox" to offer some helpful tools for your everyday .NET life. Totally free, open-source and everything client-side!
Hey, I'm Steven a .NET Developer in Switzerland. I am a Microsoft MVP. Also, this blog is open source on GitHub.
Let's start the new year with a bang: I created a new tool called "Toolbox" to offer some helpful tools for your everyday .NET life. Totally free, open-source and everything client-side!
Task.Delay fails if you wait longer than 49.7 days. So something like: await Task.Delay(TimeSpan.FromDays(50)); will fail. But why and should you care?
Short question, and a short answer: ToListAsync - but why?
I saw mutliple places where people use GitHub runners to do some benchmarking. That can be a tricky thing to do.
New helper will be available with .NET 11: MediaTypeMap.GetMediaType and MediaTypeMap.GetExtension which makes the web-development a bit easier!
.NET 9 introduced Guid.CreateVersion7() / Guid.CreateVersion7(DateTimeOffset) methods to create sortable UUIDs / GUIDs based on the time of their creation. This can be particularly useful in databases where you want to maintain a chronological order of records (plus some perf benefits).
Currently, there is no native way to configure Entity Framework to use these methods when generating new GUIDs for primary keys. But we can do this on our own.
If you are using API Tests with the WebApplicationFactory you might did something like this to have a public Program class:
public partial class Program;
No more!
In xUnit v2 ITraceOutputHelper was needed (and injected) to make the console output inside your production code visible inside a test - in v3 it is easier: CaptureConsoleAttribute
Many benchmarks that are using ArrayPool, or more specificly ArryPool<T>.Shared, are not actually measuring a "real" scenarion or the benchmark is flawed in some way. Let's examine a bit on what is going on.
You need some advice around Random? Sure there is something on LinkedIn for that. Let's have a look.