m0sa.net

using System;

  • Roslyn Analyzer Performance

    TL;DR Do you write Roslyn analyzers? Ever wondered what impact they have on your compilation times? Here’s how you can get the stats! To get the numbers one can use the ReportAnalyzer MSBuild property, that gets passed in to the C# / VB compilation tasks.

    Read more…
  • Learning about MSBuild Global Properties - The Hard Way

    One of the first steps in the Stack Overflow .NET Core migration was to extract a Common library that would target netstandard. This new project would be referenced in both the old ASP.

    Read more…
  • Getting Stack Overflow Localization Tooling Ready for .NET Core

    By popular demand, this is my writeup of our latest localization tooling refactoring at Stack Overflow

    Read more…
  • So long blogger

    It’s been almost 10 years since my first blog posts, and I’ve totally neglected blogging in the past year. I totally blame blogger for that. I really want to blog more, so I’ve decided to move to a simpler setup, that’ll allow me to blog more quickly, with better tools.

    Read more…
  • Roslyn Adventures: Metaprogramming with StackExchange.Precompilation

    In this article we’ll wrap the [StringBuilderInterpolationOptimizer](https://gist.github.com/m0sa/f086bb0e9f62e05995c6#file- stringbuilderinterpolationoptimizer-cs) from my previous article into an [StackExchange.Precompiltion](https://blog.stackoverflow.com/2015/07/announcing- stackexchange-precompilation/) module, and use it to optimize an existing C# project. First things first, we start off with an empty console project, to which we add some sample StringBuilder.

    Read more…
  • Roslyn Adventures: Optimizing StringBuilder string interpolation

    C# string interpolation is awesome. But we can make it even more awesome by making it less wasteful. Consider this line of code: new StringBuilder().Append($"foo {1}"); Currently Roslyn emits the following IL for this call:

    Read more…
  • Roslyn Adventures: Walk the #line

    With Roslyn, C# developers now have a powerful tool which makes modifying the source code a breeze. At Stack Exchange we’ve invented our own little set of extension to C# for localization purposes, previously described on Matt Jibson’s blog.

    Read more…
  • ZeroMQ XPUB sockets

    I was wlaying around with the new XPUB & XSUB ZeroMQ socket types that allow subscription forwarding, e.g. the producer (XPUB) can track what values he has to produce, which comes in handy when the value production is an expensive operation and the producer cannot afford to produce all values.

    Read more…
  • C# gotcha

    Consider you have the following code: SomeClass reference = null; Console.WriteLine(reference.Echo("echo")); Your first thought might be NullReferenceException. Ha, think again! What if you have an class defining an extension method like this:

    Read more…
  • Async Producer-Consumer with Linq, IEnumerable<T> and Threading.Tasks

    Lately I’ve been dealing a lot with IEnumerableclasses and the yield return keyword. I found it really useful for stream like processing of otherwise really memory consuming operations. The workflow looks like this:

    Read more…