Hacker News new | past | comments | ask | show | jobs | submit login

This is my favorite issue at the moment.

It's something that is completely unintuitive because MS wants you to use as much async as possible, provides an async API but is not fixing the damn issue for years. Most senior devs will not know about this, use the methods and probably won't even notice it in most production scenarios. At least not until it's hits them like a ton of bricks.

Another favorite .NET tidbit of mine is the existence of Microsoft.VisualStudio.Threading. If you use a lot of async code with UI you will eventually run into deadlocks. MS noticed that, too, and wrote this library for Visual Studio (hence the name) to work around that and then released it to the public.

Or:

  enumerable.Single(predicate) // slow
  enumerable.Where(predicate).Single() // faster
Also fun (but understandable why they don't fix it) BUT with VS2019 they included a new "code fix"/analyzer that very annoyingly tells you to convert the latter into the former for "code readability", making you code slower.

Don't get me wrong, I like .NET a lot but it has quite a few footguns.




Why is the latter faster than the former?


The latter has a fast path for arrays and lists, the former doesn't.

For Entity Framework (Core) and LINQ to SQL it doesn't matter, though.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: