C# 8.0 Nullable References

February 18, 2019 |

The What and Why of ‘nullable references’

If you ask a developer what kind of exception he most often sees when developing a application its almost certainly the NullReferenceException. Even the best developers will forget a null check sometimes.

Read More

Stackalloc in safe code

January 4, 2019 |

What is the stackalloc keyword in C#?

The keyword ‘stackalloc’ can be used to allocate a block of memory on the stack. The usage looks like the following:

int* block = stackalloc int[length];

The reason you might want to do this is performance related. Allocating on the stack is quite a bit faster and it does not generate any garbage that has to be collected. Additionally it might be better for the cpu cache due to memory locality.

Read More

Singularity and expression trees

November 20, 2018 |

Why write yet another DI container?

Some time ago I was searching for a way to make code that used reflection faster. I came across expression trees which enables you to generate code at runtime thus making it possible to remove most of the overhead from reflection. After fiddling around with expression trees for a bit I wanted to do more with them. As a final experiment I decided to write a DI container. In the end I went a bit further than just a quick experiment and wrote a full DI container and thus Singularity was born.

Read More

Code coverage for your repo

November 7, 2018 |

Which unit tests am I missing?

This was the question I was facing when writing unit tests for Singularity. Since Singularity is a dependency injection container I had to make sure everything works like its supposed to. This automatically means I need to test alot of cases to make sure every one of those cases are not broken before releasing a new version.

Read More

Streamlining releases

November 2, 2018 |

The old release workflow

Last week I was busy streamlining the Singularity repository. One of the things I did was streamlining releasing a new version. Whenever I had to make a new release I had to do the following steps:

  1. Bump the version in appveyor.yml, commit and push it
  2. Create a new tag and push it
  3. Check if the nuget package was really published and I didn’t broke something related to packaging
  4. Write some release notes and make a new github release with the tag we just created
Read More

First blog post and Jekyll

September 21, 2018 |

Woohoo my blog is up and running. At first I thought it would be quite a hassle to setup but in the end it turned out to be extremely simple.

Read More