Steven's Blog

Just a blog about random things I've learned

Rethrowing exceptions in .NET async methods

There are a lot of cases where we need to perform an async task then rethrow an exception. For example, we want to put a message in the queue when there's a processing failure. This action of queuing a message could be async. Unless you're using C# 6, it's not possible to do await inside a catch block. There are a few wrong approaches that I often see:

Continue reading...

.NET Text File Read Line and Seek Position

As simple as it sound, the .NET framework does not have anything built in that one can use to read each line of a text file, and find the seek position (to determine where the next line starts). In this post, I'll give a little background about the problem I had, or why I needed to do what's described in this post; and the approach I had taken.

Continue reading...