Are private members a part of the API surface?

A reference assembly is a slimmed down version of an implementation assembly that contains the API surface but no real code. A program can reference these assemblies at compile time but cannot run against them. Instead at deploy time programs are paired with the original implementation assembly.

Observing a null this value

One of my favorite bits of .NET trivia is whether or not it is possible to observe a null value for this? Most developers I ask either say no, or yes but it requires incorrect IL / unsafe code. Since I’m writing this post you can probably guess that the answer is actually yes, this can indeed be null.

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.