Posts
Task.Factory.StartNew and long running async tasks
Let’s say you want to implement a Producer-Consumer pattern based on
System.Threading.Channel
to process items asynchronously:You probably should stop using a custom TaskScheduler
If you don’t know what
TaskScheduler
is and you don’t have a custom version of it in your project, you probably can skip this post. But if you don’t know what it is but you do have one or two in your project, then this post is definitely for you.Figuring out mysterious `MissingMethodException` in a simple C# application
As we already know from C# Language Features vs. Target Frameworks you can use most of the latest C# language features targeting .Net Standard or Full Framework. Some features just work with any target frameworks, but some require special attributes or types to be defined during compilation.
C# Language Features vs. Target Frameworks
If you check the official C# language versioning page you might think that there is a very strong relationship between the target framework and the C# language version.
String Interning - To Use or Not to Use? A Performance Question
I recently join a new team and one of the projects was having a high memory footprint issues. There are a few mitigations put in place and one of them was to de-duplicate strings by using string interning.
Classes vs. Structs. How not to teach about performance!
It’s been a while since my last blog post, but I believe it’s better to post late than never, so here I am!
Dissecting Interpolated Strings Improvements in C# 10
There are many interesting features coming into C# 10 and my favorite one is the improvements of interpolated strings. It may sound weird that the #1 feature for me is not a new one but an improvement of an existing one. That’s because I do care a lot about performance and the interpolated string improvements in C# 10 will make my code faster without any changes from my side. But that’s not it. The new design is not only allows creating strings faster, but it also allows skipping the string creation altogether!
Shooting Yourself in the Foot with Concurrent Use of FileStream.Position
Let’s explore the following scenario: you have a service that copies files between machines. And to track the progress there is a special “copy watcher” thread (or task) that logs a current position of the target stream by accessing a
FileStream.Position
property.The Dangers of Task.Factory.StartNew
I’ve faced a very interesting problem recently with one of our production services: the service partially stopped responding to new requests even though some other parts of the service were still working.
subscribe via RSS