The curious case of Task.Run

Recently I was confused about the interaction between Task and CancellationToken. In particular I couldn’t remember if a Task which was already running was marked cancelled as soon as the associated CancellationToken was cancelled or if it waited until the Task completed. The documentation wasn’t much help so I decided to write up a quick program to test out the behavior:

Determing MSBuild property values

Debugging MSBuild is usually a three step process:

Looking forward to a better StyleCop

A consistent coding style is one of the most undervalued components of a maintainable code base. Code should always be optimized for readability as developers spend far more time reading code than writing it. Having a consistent style helps here because it establishes conventions and locations for well known programming elements.

A new, yet familiar, adventure

For the last four years I’ve been a part of a research team exploring extensions to the C# language. The effort focussed on adding features that improved the reliability, performance and overall correctness of the language. Like any good research project we had some features that were incredibly successful, some which were so-so and others that … well … they failed spectacularly!

Floating point casts are rarely redundant

Good developers are always on the look out for unnecessary code. Both to avoid in their own code and to help others avoid during code reviews. One such example is redundant casts: a cast where the type of the expression and cast are the same type. For example: