Simon Cooper

Follow Simon Cooper via

31 May 2011
31 May 2011

Inside Red Gate – Introduction

I work for Red Gate Software, a software company based in Cambridge, UK. In this series of posts, I’ll be discussing how we develop software at Red Gate, and what we get up to, all from a dev’s perspective. Before I start the series proper, in this post I’ll give you a brief background to … Read more
19 May 2011
19 May 2011

Visual Studio vNext

At TechEd this year, there’s only a few sessions and expo booths aimed squarely at devs rather than sysadmins and DBAs, but one of the things I picked up on was what’s going into Visual Studio vNext. There’s no shiny new UI features (that they’ve announced so far…) but they are doing a whole lot … Read more
10 May 2011
10 May 2011

I’ll be at TechEd Atlanta 2011

Just a brief note here – I’ll be going to TechEd Atlanta next week as part of a huge Red Gate contingent. My profile and session schedule is public on the TechEd directory if you want to come find me & have a chat, otherwise I’ll likely be prowling around the C# and .NET talks … Read more
24 March 2011
24 March 2011

Anatomy of a .NET Assembly – Methods

Any close look at the method definitions in a .NET assembly has to start off with the method’s information in the metadata tables – the MethodDef. So lets do that. MethodDef The MethodDef entry for the entrypoint method in my TinyAssembly example used in previous posts has the following bytes: According to the CLR spec, … Read more
16 March 2011
16 March 2011

Anatomy of a .NET Assembly – CLR metadata 1

Before we look at the bytes comprising the CLR-specific data inside an assembly, we first need to understand the logical format of the metadata (For this post I only be looking at simple pure-IL assemblies; mixed-mode assemblies & other things complicates things quite a bit). Metadata streams Most of the CLR-specific data inside an assembly … Read more
13 January 2011
13 January 2011

Subterranean IL: Exception handling

Today, I’ll be starting a look at the Structured Exception Handling mechanism within the CLR. Exception handling is quite a complicated business, and, as a result, the rules governing exception handling clauses in IL are quite strict; you need to be careful when writing exception clauses in IL. Exception handlers Exception handlers are specified using … Read more
30 November 2010
30 November 2010

Subterranean IL: Pseudo custom attributes

Custom attributes were designed to make the .NET framework extensible; if a .NET language needs to store additional metadata on an item that isn’t expressible in IL, then an attribute could be applied to the IL item to represent this metadata. For instance, the C# compiler uses DecimalConstantAttribute and DateTimeConstantAttribute to represent compile-time decimal or … Read more
26 November 2010
26 November 2010

Subterranean IL: Custom modifiers

In IL, volatile is an instruction prefix used to set a memory barrier at that instruction. However, in C#, volatile is applied to a field to indicate that all accesses on that field should be prefixed with volatile. As I mentioned in my previous post, this means that the field definition needs to store this … Read more
17 November 2010
17 November 2010

Subterranean IL: Constructor constraints

The constructor generic constraint is a slightly wierd one. The ECMA specification simply states that it: constrains [the type] to being a concrete reference type (i.e., not abstract) that has a public constructor taking no arguments (the default constructor), or to being a value type. There seems to be no reference within the spec to … Read more