Code Moves Pretty Fast

some musing on life and software engineering with a .Net perspective.


Moving to Azure

After some consideration, and a few faults from my current VM host, I'm moving the blog and a few other little tid bits to Azure.  Hopefully this will be served up from Azure in no time flat.....

Great Learning Site for Children

I have a 7 year old daughter.  She's obviously at school, and I'm always on the lookout for good learning tools for her. She loves just about anything that is electronic in nature, playing with my phone or my wife's phone whenever she can.  She'll spend hours on them.  She loves playing on my laptop when I let her as well.

So, I was delighted to stumble across Khan Acadamy.  There's a fabulous TedTalks video on the site, or you can go straight there

As a parent, you can become a coach, and have your children join as students.  They get badges and rewards, and you get to monitor their progress.  There are interactive exercises for them to complete, as well as nearly 3500 video's to teach them anything from simple addition and subtraction, all the way through to higher school Chemistry and Physics.

Suffice to say, I am looking forward to spending many hours on this site with my daughter, re-learning with her, and helping her develop in the intelligent adult I know she will become.

Node Knockout

Node Knockout is on it's way soon.  I've joined a team, and we will be submitting StemCells as our competition entry.  

Keep up to date here: StemCells the Game

I'll be the only guy running node.js on Windows 8 on a MacBook Pro.  I have had very little trouble with my Win8 Install to date, but this might stretch it a little :-s

.Net 4.0 Inlining and the debug Heisenbug!

Have you ever heard of .ini files for your .Net assemblies?  Neither had I.

It turns out that they do exist, and they have the function of telling the clr how to jit.

I recently ran into a problem at work, where, after upgrading to .Net 4.0, I the application would crash horribly.  I had foolishly gone about some massive refactoring as well, so wasn't really sure whether I'd damaged the application during the refactor, or by doing the .Net upgrade.  What I did know, is that if I ran the application from inside Visual Studio, it worked.  Outside it bombed.  A Heisenbug of frustration.

Thankfully, after a half day of doing my bestest debugging (obviously not good enough, and I hadn't stooped to windebug and sos yet), a colleague offered up a solution.  I've not really had the time to verify this, but I was told that the .Net 4.0 is far more agressive with it's optimisations than previous versions.  As a result, some methods/classes were being inlined that previously had not been.  This caused some reflection based work to return the wrong assembly name for a call, and resulted in the application I work on going bang.  Not being in control of the assemblies that were exhibiting this behaviour, meant that we had to control the optimisation of the assemblies.  Thus, the solution linked above.

Basically, we added a *.dll.ini file for the assemblies we needed to control with the .ini files containing:

[.NET Framework Debugging Control]

This turned off the optimisations that were giving us grief, at the expense of slowing those assemblies down a little.

I wish I could find a more fine tuned way of controlling that optimisation, so that I could for instance, only tell the compiler to not inline certain classes, but for now, this'll have to do.  If you know of any, please let me know.


If you haven't discovered [NCrunch]( yet, you aren't coding to your potential.  NCrunch is one of those tools, that is a must have in every developers arsenal, and rates up there with [ReSharper]( as a must have.

Having said that, depending on how you already code, it's going to change the way you do things.  It kind of replaces the need for ReSharpers superb unit testing console with it's very own \"NCrunch Metrics\" and \"NCrunch Tests\" dockable windows.  I spend most of my time in the metrics making sure the coverage is doing the right thing.  

The beauty of NCrunch is; that you have automatic visual feedback of your coverage and test success in the IDE.  Those little dots down the left side are fantastic feedback on your development state.  And best of all, you don't have to tell Visual Studio or ReSharper or some other tool to run the tests.  Every time you make a change to the solution, NCrunch is busy behind the scenes applying the changes, compiling, figuring out what tests cover that change, and running the tests, and finally updating the UI with those circles.

Visual Studio 2012 partail screenshot showing NCrunch annotations.

In the above screenshot, you can see the little green dots.  They mean, the code is covered by at least one test.  The orange dots mean that the code is as yet uncovered.  Red highlights code that is covered by at least one failing test, and if you hover over the circle, it will even tell you why. (as below)


So why not do yourself a favour, and get on board with NCrunch.  It's in beta at present, and has no associated cost.  This will change in future, as the developer has stated, but the benefit of this tool far outweighs the cost (as long as it remains reasonable).