Recently, I’ve been doing some work involving cryptography, and encountered the standard .NET CryptographicException: ‘Padding is invalid and cannot be removed.’ Searching on StackOverflow produces 57 questions concerning this exception; it’s a very common problem encountered. So I decided to have a closer look. To test this, I created a simple project that decrypts and … Read more
Using locks to implement a thread-safe collection is rather like using a sledgehammer – unsubtle, easy to understand, and tends to make any other tool redundant. Unlike the previous two collections I looked at, ConcurrentStack and ConcurrentQueue, ConcurrentDictionary uses locks quite heavily. However, it is careful to wield locks only where necessary to ensure that … Read more
ConcurrentQueue is, like ConcurrentStack, a lockless collection, in that it is implemented without using any locks at all. However, the semantics required for a queue impose a quite different approach; unlike ConcurrentStack, which has a single point of concurrent contention, a queue can be changed at both the head and tail. This means that at … Read more
As a brief interlude from my Concurrent Collections series, I thought I would give an roundup of how the lean startup experiments have been progressing. As you can expect, there’s been some good aspects and some bad aspects. The experiments so far After lots of discussions, arguments, posing and ruling out hypotheses, we came up … Read more
The first concurrent collection we’ll look at is ConcurrentStack. This is conceptually the same as System.Collections.Generic.Stack, but is geared towards occasional concurrent modifications. Now, in these posts I won’t be looking to explain what every method does; just like my other explorations of various collection types, I’ll be concentrating on the core implementation and concepts … Read more
The concurrent collections, located in the System.Collections.Concurrent namespace, were introduced in .NET 4 as thread-safe collections that could be used without locking, and there are plenty of posts and articles out on the interwebs giving an overview of the collections and how to use them. Instead, I’ll be focusing these posts on how the concurrent … Read more
If you’ve ever had a poke around System.dll or System.Core.dll in Reflector, you may have noticed TypeForwardedToAttributes applied to the assembly: This post has a look at what these are, and how they’re implemented. Type forwards TypeForwardedToAttribute is part of a feature introduced in .NET 2 – Type forwarding. As the documentation says, this is … Read more
Normally, virtual method overrides in .NET are done implicitly; if a subclass has a virtual method with the same name and signature as a virtual method in a base class, then the method in the subclass overrides the method in the base class: This is in contrast to C# and VB, where a ‘base’ virtual … Read more
Over the next few weeks, we’ll be performing experiments on SmartAssembly to confirm or refute various hypotheses we have about how people use the product, what is stopping them from using it to its full extent, and what we can change to make it more useful and easier to use. Some of these experiments can … Read more
There’s a new movement rumbling around Red Gate Towers – the Lean Startup. At its core is the idea that you don’t have to be in a company with single-digit employees to be an entrepreneur; you simply have to (being blunt) not know what you should be doing. Specifically, you accept that you don’t know … Read more
You may have noticed that not a lot has happened to SmartAssembly in the past few months. However, the team has been very busy behind the scenes working on an entirely new version of SmartAssembly. SmartAssembly 6.5 Over the past few releases of SmartAssembly, the team had come to the realisation that the current ‘architecture’ … Read more
Although the collections classes introduced in .NET 2, 3.5 and 4 cover most scenarios, there are still some .NET 1 collections that don’t have generic counterparts. In this post, I’ll be examining what they do, why you might use them, and some things you’ll need to bear in mind when doing so. BitArray System.Collections.BitArray is … Read more
Apart from Dictionary<TKey, TValue>, there’s two other dictionaries in the BCL – SortedDictionary<TKey, TValue> and SortedList<TKey, TValue>. On the face of it, these two classes do the same thing – provide an IDictionary<TKey, TValue> interface where the iterator returns the items sorted by the key. So what’s the difference between them, and when should you … Read more
To many people, System.Collections.Generic.Dictionary<TKey,TValue> is just a useful collection. In this post, I’ll be looking inside that collection and see how it really works. Dictionary is based on a hashtable; for the rest of this post, I’ll assume you know roughly how a hashtable works. The Wikipedia article, as the source of all knowledge algorithmical, … Read more
Developers might write good code, but no matter how good they are the result will always have bugs in it. It’s up to the testers in the team to make sure the final product is as bug-free as it can be. Deciding what to test Within a project there’s normally no official documentation produced, no … Read more
As I discussed in my previous posts, divisions and project teams within Red Gate are allowed a lot of autonomy to manage themselves. It’s not just the teams though, there’s an awful lot of freedom given to individual employees within the company as well. Reasonableness How Red Gate treats it’s employees is embodied in the … Read more
The vast majority of Red Gate is on the first and second floors (the second and third floors in US parlance) of an office building in Cambridge Business Park (here we are!). As you can see, the building is split into three sections; the two wings, and the section between them. As well as being … Read more
In my previous post, I covered how field, method, and other types of signatures are encoded in a .NET assembly. Custom attribute signatures differ quite a bit from these, which consequently affects attribute specifications in C#. Custom attribute specifications In C#, you can apply a custom attribute to a type or type member, specifying a … Read more
Within each division in Red Gate, development effort is structured around one or more project teams; currently, each division contains 2-3 separate teams. These are self contained units responsible for a particular development project. Project team structure The typical size of a development team varies, but is normally around 4-7 people – one project manager, … Read more
When I joined Red Gate back in 2007, there were around 80 people in the company. Now, around 3 years later, it’s grown to more than 200. It’s a constant battle against Dunbar’s number; the maximum number of people you can keep track of in a social group, to try and maintain that ‘small company’ … Read more