Access to modified closure in Resharper/C#

We all know that Resharper complains about modified closure when you write something like this: static void Main(string[] args) { Action action = () => Console.WriteLine(0); for (int i = 0; i < 10; i++) { if (i == 1) action = () => Console.WriteLine(i); } action(); } But it stops, once you write it… Read more

Fun with pure C# and monads

We are all fascinated by pure languages like Haskell, but unfortunately have to code in C#. We could complain to our neighbor all day, but instead, what if we could also do something really pure in C#. Actually we can, it’s called LINQ: var sum = from a in new[] { 1 } from b… Read more

Fun with ConfigureAwait, and deadlocks in ASP.NET

Coworker and I investigated a cool issue with deadlocks we found some time ago when porting some async code from one service to another. The difference was that one was written with async/await down to the controller, and the other follows legacy Task.Run model. When trying to code like this we encountered a deadlock: public… Read more