Foreach now captures variables! (Access to modified closure)

Foreach has changed in C# 5.0! Consider the following piece of code in C# < 5.0: public class Test { public static void Main() { var words = new[] { “foo”, “bar”, “baz”, “beer” }; var actions = new List<Action>(); foreach (string word in words) { actions.Add(() => Console.WriteLine(word)); } actions.ForEach(e => e()); } } […]

Your project dependencies matter (when using NuGet)

At work we had the following issue, we had a Silverlight project consuming some NuGet package, this project was being exposed in a Web application. In order to keep our solution clean – we didn’t want an ‘assemblies’ folder – we used NuGet package restore. We did it like the book said, don’t check in […]

Team Foundation 2010: Associate work item with changeset AFTER check in.

Today I was struggling associating a work item with a changeset after a check in. There is however no options for this in the UI. Or is there? Let’s check: Ok, so not through the changeset UI. Let’s check the command line. c:Program Files (x86)Microsoft Visual Studio 10.0VC>tf changeset /? TF – Team Foundation Version […]

Stopping Casini before (re)building website in Visual Studio

Hi ya’ll, I sometimes use Casini to debug local web applications. Casini is easy to configure, no need to create a virtual directory, it’s gone after you close Visual Studio so it’s easy. The problem is that sometimes when changing some code, Casini’s caches aren’t cleared. So you get a stale version of your webpage […]

Visual Studio 2010 PowerTools

Hi All, Since I’ve installed Visual Studio 2010 PowerTools I’ve had the following problem: Entering shift+enter didn’t break the line anymore. This is because of the autocomplete braces function of the PowerTools. You can disable this function by clicking Options in the Tools Menu: And then click ‘Productivity Power Tools’ on the left: In that […]

Visual Studio 2010 Pro Power Tools and closing square bracket problem on AZERTY

There seems to be a problem with the default keyboard mapping of the so called ‘Align Assignments’ found in the Visual Studio 2010 Pro Power Tools. The default shortcut is mapped to Control + Alt + ]. While this is not a problem on a QWERTY these keystrokes are used to type a square bracket […]

Dispose and Finalizing, done the right way

I created this class to make life a little bit easier for me. You are free to use it as you wish! How to use: Override this class, override ReleaseManaged() and ReleaseUnmanaged() with the appropriate code, and you are good to go. namespace SuperDisposeImplementation { using System; /// <summary> /// Override this class for easy […]

Windows Azure SDK: connecting to non SQLExpress Instance

When you want to build an Azure application, but you don’t have SQL Express installed the build action in Visual Studio will fail. You will receive the following message in your output window: Windows Azure Tools: Failed to initialize the Development Storage service. Unable to start Development Storage. Failed to start Development Storage: the SQL […]