GOPbIHbI4

Joined 9 years ago

Karma
96
Submissions
59
Member since
Feb 1
SDE at MSFT
View on Hacker News

Recent submissions

Comment · 8 months ago
Вue to de-abstraction feature in .NET 10 we can eliminate all the overhead in the existing cases.

For instance, if you have Enumerable.Any with a delegate that captures instance state, the runtime can stack-alloc it, and (if it's small) to inline it. This will achieve the performance of a manual code that obtains span out of a list and "inlines" the delegate logic into the loop itself!

Comment · 9 months ago
I feel we have a cargo cult on using ConfigureAwait without thinking too much.

I've seen cases when the application code was filled with it "to improve performance" or "to avoid deadlocks". And it was very hard to convince that this is not how ConfigureAwait should be used.

The same is true for libraries: if your library is specific to your application then you might decide (like the ASP.NET Core team) to stop using ConfigureAwait completely. It is needed for highly re-uses able libraries that can be used in different contexts, which is quite rare.

In this video I'm covering why we have ConfigureAwait in the first place and how to use it correctly.

P.S. There are lot of discussions how broken ConfigureAwait is and a lot of people propose the fixes - like having a library specific annotation to implicitly add ConfigureAwait(false) to every await, or not depending on the configuration. But those discussions are still opened on GitHub with no plans on fixing it.

P.P.S. Another way is to use runtime code generation like Fody, but most of the people are not going to use them.

Comment · 9 months ago
.NET 10 has quite a few nice features, but probably one of the most impactful ones is de-abtraction: a set of changes in JIT that allows almost completely eliminate the abstraction cost in certain scenarios, like when foreaching over an interface instead of a concreate collection type.
Comment · 1 year ago
ConfigureAwait is one of the most confusing aspects of asynchronous programming in C#. In this episode we'll cover why we ended up having it in the first place and what it does under the hood by debugging the ConfigureAwait with a custom synchronization context.
Comment · 1 year ago
Async/await in C# can feel tricky, but it’s simple when you step through it.

This video shows how to debug async methods line-by-line to understand exactly how async/await works under the hood.

Comment · 1 year ago
Hey folks. I don’t know about you, but I kind of tired of this Dispose(bool disposing) nonsense that is used in vast majority of projects. I don’t think this “pattern” ever made sense to anyone, but I think it’s time to reconsider it and move away from it to a simpler version: never mix managed and native resources, and just clean up managed resources in Dispose method. No drama and no Dispose(boil disposing).
Comment · 1 year ago
If you happen to stuck with .NET Framework (or you have a library that targets .netstandard2.0) you still can use most of the C# language features that were released in the past 10 years or so.

There are a few tricks you can during the build to add custom attributes, or you can use PolySharp.

This video shows some neat recent C# language features and how to use them with .NET Framework or .netstandard.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton