Gotcha when downgrading ServiceStack.Redis to version 3


It turns out that this is caused by a change of the default behaviour in NuGet 2.8 whereby it now picks the lowest patch version of a package dependency.


You’re probably aware of the announcement that ServiceStack is no longer free from version 4, but if you’ve already installed it, and reflexively clicked the licence agreement, then you probably need to downgrade to the latest of v3.

I discovered the hard way that there’s a mismatch in the versions pulled down from NuGet.  Cryptically, this gives the following error message:

System.TypeLoadException : Method 'get_Db' in type 'ServiceStack.Redis.RedisNativeClient' from assembly 'ServiceStack.Redis, Version=, Culture=neutral, PublicKeyToken=null' does not have an implementation.

If you run the command Install-Package ServiceStack.Redis -Version 3.9.71 then along with ServiceStack.Redis v3.9.71 NuGet pulls down ServiceStack.Common version 3.9.11, which is not compatible (I’ve confirmed this behaviour in a fresh solution).

To solve it, you need to explicitly install version 3.9.71 of ServiceStack.Common:

Install-Package ServiceStack.Common -Version 3.9.71

P.s. don’t forget to set the version constraints in your package.config file.

Roman Numerals Kata

I figured I’d start doing some of the coding Katas, but to add a small twist, I’d only do them in MonoDevelop on Ubuntu in order to get more familiar with Linux and Mono.

My attempt can be found here on github:

I have to say that I found some of the MonoDevelop defaults to be quite irritating.  I prefer the Allman style when it comes to the placement of braces in C#, while MonoDevelop defaulted to K&R style automatically moving my braces and would not allow me to manually alter their position.  I don’t mind that it defaulted to something I’m unaccostumed to, but I found the fact that it ignore my repeated hits on the return key to move it down a line to be extremely frustrating – if you’re going to move my braces, at least let me move them around to my liking!

With some digging around in the preferences, I managed to set up my own custom profile and it finally ceased tampering with my braces. (Edit > Preferences > Code Formatting > C# Source Code > C# Format > Edit > Change ‘Category’ to ‘Braces’ > Change ‘Method Declaration’ to ‘Next Line’.  Simples…)

Another thing I did not like was its habit of inserting spaces between the method name and the brackets to look like:

myMethod (parameter);

This is non-standard in C# and I had to go back and remove all the spaces, at least it let me do this without me having to amend my custom profile.

These complaints may seem trivial, but suppose I was to work in MonoDevelop and the rest of my team used Visual Studio, we’d create messy files with competing formatting – preventing this is why coding standards are employed.  Surely, MonoDevelop should default to the standards of the language being used?

I had no idea how to run my unit tests in MonoDevelop – I wasn’t expecting a test runner, there isnt one in VisualStudio unless you pay for the higher levels, but I was stumped until I discovered that you can install the NUnit gui via apt-get using the following command:

$ sudo apt-get install nunit-gui

I also made a point of not checking any existing completed roman numeral katas, but having looked a couple after I completed it, it seems that that I arrived at a solution very similar to that of other people, which gave me a good sense of validation.

I shall endeavour to complete more katas using MonoDevelop on Ubuntu as I found it to be a fun experience.

Taking over the Gr1d

Ok, so it seems that I have a short attention span and am easily distracted by the next ‘shiny thing’.  The current ‘shiny thing’ with my attention is Gr1d – an RPG for Programmers.  I’m really, really enjoying it.

The concept is that you code some Agents based on a chosen predefined class and these Agents run around the Gr1d claiming nodes.  The more nodes you claim, the more experience you earn and you level up allowing you to use more class skills and deploy more Agent bots at the same time.  You will encounter other Agents on your travels which you can either attack or flee from, depending on how you’ve coded them.

So far I’m a lowly Agent with extremely simple logic, basically crawling around the Gr1d collecting nodes and fleeing as fast as possible from any danger – it’s great fun!

The software is still a little buggy with the Ticks (a timer concept) regularly getting stuck and some people’s poor code bringing the system down, but with each revision the creator ‘root’ improves all of these things.

I’m also hoping to use this little game to learn F#.  So far I have coded my really stupid Agents in F# but have hit a hurdle in that the servers do not have F# installed, yet.  We shall see what happens when I pit my C# and F# Agents against each other 🙂

Give Gr1d a go, it’s great fun and an awesome tool for learning programming or .Net if you’re new to these concepts – there’s nothing quite like a game for making learning fun!