Sergiy Teplyakov
steplyakov.bsky.social
Sergiy Teplyakov
@steplyakov.bsky.social
Software Engineer at MSFT. Opinions are my own.
Hey #dotnet people. First milestone for Dissecting the Code YouTube channel - 1k subscribers!

Thanks a lot everyone for your support and warm feedback that I'm getting!
October 6, 2025 at 2:51 PM
Hey #dotnet people!

Just published another episode on Dissecting the Code channel: How Google Broken the Internet and Why It Took 3 Hours to Recover?

It's about null pointer bugs, retry logic and a bit of .NET Aspire used for visualizing the metrics.

Please share and sub!
June 26, 2025 at 7:57 PM
TIL about ValueTask.Preserve() helper method that returns a value task that may be used at any point in the future.

ValueTasks are tricky and they can't be stored in a field, or awaited multiple times. Preserve "fixes" that by allocating Task<T> under the hood.
June 19, 2025 at 9:03 PM
Hey #dotnet people:)
Just published another episode on Dissecting the Code YouTube channel - "Can Tiered Compilation Cause Memory Leaks in .NET".

This video is about a change in behavior between full framework on .net 9 in respect to GCInfo and how it affect memory usage.
June 6, 2025 at 9:13 PM
Just added a rule to ErrorProne.NET to detect simple recursive calls.

This may sound too simplistic, but I've seen such code being checked in by an accident. And I've faced StackOverflowException because of that in my tests before myself as well.
June 3, 2025 at 9:05 PM
Hey #dotnet people:)

Just published another episode on Dissecting the Code YouTube channel - "Dissecting Memory Leaks in .NET".

How global events, hidden static collection and timers can cause memory leaks and the ways to avoid it.

Link in the comment below.
May 30, 2025 at 12:57 AM
Hey #dotnet people! I've launched my YouTube channel: "Dissecting the Code".

It's going to be very similar to my blog with a lot of deep dives into #dotnet, #csharp etc.

I've already published the first two videos:
➡️ Episode 0: What You'll Learn Here
➡️ Episode 1: Dissecting Variable Lifetime
May 22, 2025 at 8:33 PM
Do you know that CA2241 analyzer (for correct args to formatting methods) is very extensible?
It supports:
* built-in methods
* StringSyntaxAttribute
* Methods listed in .editorconfig

Try to run it in your codebase, you might be surprised, how many violations do you have!
May 2, 2025 at 5:34 AM
Ok, this is not magic. Its possible when the instance method can be inlined and it doesn't touch the instance state itself.

Here is the code:
April 24, 2025 at 6:45 PM
Ok, here is a thing. "We all know" that a managed instance can be collected during the method call.

But do you know that an instance can be GCed **before** the instance method is called?

This works in Release mode only due to the tracking the JIT does via GCInfo.

#dotnet
April 24, 2025 at 6:44 PM
Hot take: in some cases it is useful to profile an app in debug mode.

Was helping in a performance analysis and it was not clear where the time is spent exactly. Re-ran profiler in debug build to see that it was a property getter that was used in a hot loop!
April 14, 2025 at 7:52 PM
Just FYI.
If you need to check if a char is within a string, using 'str.IndexOf(c) != -1' is way more efficient than using 'str.Contains(c)' which is a call to 'Enumerable.Contains(string, c)'.

Actually the IndexOf version is way more efficient!
(the results for full framework)
March 18, 2025 at 9:20 PM
Blogged: Finalizers are tricker than you might think, Part 1.

The post is very close to a 5 Why type of postmortem we use internally for the incidents where I cover an investigation of crashes caused by NullReferenceExceptions from the finalizers.

#dotnet
February 26, 2025 at 7:07 PM
A bunch of awesome stuff is coming to .net10!
One notable thing: lack of enumerator boxing allocations when iterating over an array via `IEnumerable`. This is awesome!

The link to github: github.com/dotnet/runti...
January 30, 2025 at 9:40 PM
Blogged: "The Dangers of Async Void".

The gif from amazing @kirillosenkov.com is the best way to visualize the issues with async void. Kind of - ¯\_(ツ)_/¯.

The link to the blog post: sergeyteplyakov.github.io/Blog/csharp/...

#dotnet, #csharp
January 29, 2025 at 5:09 AM
Please, measure the results of your optimizations!

Just saw that a custom enum to string conversion was quite expensive. Added a new version and compared the optimization with just 'enum.ToString'

The old "optimization" was 5x slower and was allocating way more memory!
January 26, 2025 at 12:50 AM
The evolution of string.Split
#dotnet #benchmarking
January 7, 2025 at 6:22 PM