Migrating a TFVC shelveset to Git with Git-Tfs

You’ve migrated your code base (or as much of it as you can) from TFVC and now a user just realised they need some super important code from a shelveset. How does one go about migrating this? As far as I see it, you have three options.

  1. Manually copy the changes over.
  2. Unshelve the changes, commit to the branch and pull in to the Git repository.
  3. Use the git-tfs unshelve command.

In my case the shelve was too big for option 1 and too old / contained breaking changes for 2, leaving option 3.

One thing to note that when migrating a shelve from TFS, it will create a new branch against master. In my case, I wanted a new branch against a development branch.

What I want:

                   _shelveset branch

What git-tfs does:

 _shelveset branch

But hey, this is Git, so it’s no problem!!

# Get the shelveset from TFS and stick it in to a new branch
git tfs unshelve -u="Shelveset Owner Name" "Shelveset Name" TargetBranchName_TEMP

# Checkout that new branch
git checkout TargetBranchName_TEMP

# Get the hash for the head of the new branch
git log --pretty=format:%h -n 1

# Now switch to your dev branch
git checkout development

# Create a new branch for the shelveset
git branch TargetBranchName
git checkout TargetBranchName

# Merge the temp shelveset branch in to it's final location
git cherry-pick HASH

# You might have some things to merge now.
git commit -m "Migrated shelveset 'Shelveset Name'"

ASP.Net Cookies[FormsAuthentication.FormsCookieName] always null

Now and then you forget some small detail that has you running in circles trying to figure something out. In my case it was an authentication cookie not being persisted. After trying a few options, I realised that a list of claims were being persisted in the user data parameter! Of course, a cookie can only be 4096 bytes 😉

Azure Storage Explorer – Crash When Removing Account

The Azure Storage Explorer tool is great for when you need to work with an Azure Storage Account. I’m running version 6, preview 3 ( and recently ran in to a problem.

Having deleted and re-created a storage account in a new subscription, I needed to update the access key in Storage Explorer. Pretty simple right? There’s certainly a missing ‘Manage Connections’ view, or perhaps there is and I wasn’t able to find it yet.

First you have to select the storage account to remove, wait for it to fail to connect, then click on the ‘Remove’ button. The trouble is that once you click on ‘Remove’ the app quits. Hmmm.

It turns out that the storage accounts are stored in a single file:


NOTE: You should probably take a backup of this file before attempting to remove it / change it.

I didn’t have the time to figure out if I could edit this file to remove the troublesome string, so took the nuclear option and deleted it. On starting the app I was now back to an empty connection list! Superb! Whilst I had to add all of my account details in again, I was at least able to continue on my merry way.

If you have a neater way of handling this, please share it with me!

Xamarin: XLabs 2.0 iOS IGeolocator Woes

Having completed an Android app using Xamarin.Forms, I was tasked with making the iOS counterpart. Well it’s Xamarin so ‘write once, run everywhere’ right? Haha, ok sure.

This particular issue was pretty confusing but was related to changes in the XLabs breaking changes introduced in v2, in particular this inconspicuous line:

You will have to use DependencyService.Register<>() on your platforms packages to register XLabs Services.

Add this to your app delegate and you should be good to go:

DependencyService.Register<IGeolocator, Geolocator>();

There’s also this issue to watch out for too: https://github.com/XLabs/Xamarin-Forms-Labs/issues/657

Xamarin: aapt.exe exited with code 1

After adding the powered-by-google-on-white.png images to a project I’m working on, I’m suddenly hit with ‘aapt.exe exited with code 1’ whilst building. Did Google just give me some bad images? Nope!


It’s because of the use of the hyphens (-) in the filename. Remove them, rebuild and off you go!


After adding Google Maps support to your Xamarin.Forms solution, you try to build and receive this really helpful error. This seems to be triggered by the addition of the Google Play Services framework. It’s almost as helpful as ‘An Exception Occured’, another one of my favourites.

Luckily for this problem there’s a simple solution, increasing the Java heap size.

In Visual Studio open the project properties for your Android project and navigate to:

Android Options -> Advanced

Set the value of

Java Max Heap Size

to 1G.

P.S. Don’t forget to set this for each of your build configurations, otherwise come release time you’ll be scratching your head again. Or maybe that’s just me…In VS

Cocos2d-js v3.2 – Run on iPhone / Simulator

Just to be clear, this is for Cocos2d-js v3.2. Not Cocos2d-x.

Having built and tested your game locally, you want to run it on your iPhone or Android device, or maybe even in a simulator. How the hell do you do that? I have to say that the documentation is severely lacking here with lots of outdated advice.

Ignore anything that tells you to build for different targets from Bash. All of the code for each project type (iOS, Android, Mac, Win32) is sitting in your project folder already, albeit a little hidden.


You’ll see a few folders there, one for each platform. Inside the proj.ios_mac folder there’s an XCode project file which you can open up and build the app with.

The framework takes a few minutes to build, at least on my late 2010 MacBook Air so be patient.

Now I just need to solve the EXC_BAD_ACCESS when trying to run the damn thing…


My EXC_BAD_ACCESS is resolved and everything is running perfectly. I was being a bit naughty and taking advantage of Javascript’s lack of access modifiers.

I sub-class the PhysicsSprite object and during set up, I was setting the physics body of the sprite using the _body member. Of course when this is run in obj-C, the _body member isn’t accessible so boom! Instead I switched to using the PhysicsSprite.getBody() and setBody() methods, as I should’ve done in the first place…


this._body = new cp.Body(10, cp.momentForBox(Infinity, contentWidth, contentHeight));


this.setBody(new cp.Body(10, cp.momentForBox(Infinity, contentWidth, contentHeight)));

Revised: WPF Elliptical Layout Control – 3D!

The post WPF Elliptical Layout Control – 3D! was way more popular than I ever could have imagined with people still viewing and downloading the code daily. Not bad for a post that’s 6 years old! However, as you can imagine the code and solution are pretty outdated now with a few unresolved issues. Given the amount of views it still gets, I decided it was time to revisit it and see if I can bring it up to date.


Continue reading

Visual Studio Crashes and How to Recover a Corrupted .cs File

In spite of using source control, sometimes it’s still possible to lose work due to the quirks of computers. At least you can mitigate this and only suffer losing a few hours of work, but still, when those few hours were a stroke of genius, the likes of which cannot be reproduced, you can’t help but shed a tear when all is lost. But fear not, here are 4 techniques that you can try to recover your code with before crying.

Continue reading

ILoveToCode has a new Home (and name)

When I received an email from my hosting company that the domain samnoble.co.uk had expired, I realised I had completely forgotten I even owned this domain. I took it as an opportunity to finally put it to use, hosting my development blog.

I decided to go the self host route so that I’d have all the flexibility that comes with it, with no restrictions on plugins and themes etc. The free hosting on wordpress.com has been fantastic and served me well, but it’s time to move on!

After wondering if I should think up a new witty and creative name for the blog, I realised that there was no need. It’s my blog, on my domain so lets just leave it at that. Welcome to the old ILoveToCode and the new samnoble.co.uk.