Friday, June 6, 2014

Continous Installation : An historical overview

A couple of months ago I posted an update on the installation method I use at work. You can read more about that here
Since those numbers have grown tremendously, I decided to log every install request.
Sadly I do not have the data from the beginning in 2009, only from 2011 onwards.

Since a picture says a thousands words here's a graph :

As you can see, in 2013 there was an explosion of installations, one of the reasons I did not have that much time for CCNet.

I just hope this year the amount of installations is lower again.

We now have about 110 customers, so that's about seven times as much as back in 2009 !

Tuesday, June 3, 2014

Weird problem after upgrading CCNet to .Net 4.5

The problem is a bit weird : after upgrading CCNet to .Net framework 4.5 one test fails, and I do not know what the problem is :-(
  1. is it a breaking change in the .Net framework
  2. is it a different behavior of Nunit (I upgraded Nunit also to the latest version to be able to test .Net 4.5)
  3. something else ...
On using the new NUnit on the 1.8.5 tests, all tests are also green. Below is the test, the bold line is the one that fails, it's one from the dashboard, IO namespace.
        [Test]
        public void NotAvailableNotEvenEqualToItself()
        {
            Assert.AreNotEqual(ConditionalGetFingerprint.NOT_AVAILABLE, ConditionalGetFingerprint.NOT_AVAILABLE);
            Assert.AreSame(ConditionalGetFingerprint.NOT_AVAILABLE, ConditionalGetFingerprint.NOT_AVAILABLE);
        }
As said before that one works in .Net 3.5, but not in .Net 4.5
I've updated the test to the following and still the same bold line breaks.
        [Test]
        public void NotAvailableNotEvenEqualToItself()
        {
            Assert.IsTrue(ConditionalGetFingerprint.NOT_AVAILABLE == ConditionalGetFingerprint.NOT_AVAILABLE);
            Assert.IsTrue(ConditionalGetFingerprint.Equals(ConditionalGetFingerprint.NOT_AVAILABLE, ConditionalGetFingerprint.NOT_AVAILABLE));

            Assert.AreNotEqual(ConditionalGetFingerprint.NOT_AVAILABLE, ConditionalGetFingerprint.NOT_AVAILABLE);
            Assert.AreSame(ConditionalGetFingerprint.NOT_AVAILABLE, ConditionalGetFingerprint.NOT_AVAILABLE);
        }
The same test with the added asserts is still green in .Net 3.5 (with both versions of NUnit).

The code in CCNet uses statements like : (if fingerprint1 == fingerprint2) as far as I could see, so I would guess that the functionality stays the same, but I'm not 100% sure :-(

I understand the difference between the == and the .equals operator
  • == tests for object equivalence
  • .Equals() test that objects represent the same 'value', they may represent different objects but the value of these are considered the same.
That ConditionalGetFingerprint does an override of the Equals method, so that's why the test is there, and it breaks after upgrading.

And now something really weird : If I change the test to just the breaking assert

        [Test]
        public void NotAvailableNotEvenEqualToItself()
        {
            Assert.AreNotEqual(ConditionalGetFingerprint.NOT_AVAILABLE, ConditionalGetFingerprint.NOT_AVAILABLE);
        }
and I change that override equals of the ConditionalGetFingerprint into the following :
        public override bool Equals(object obj)
        {
            Console.WriteLine("Equals method");
            return false;
         }
Result :
  1. In .Net framework 3.5 it passes, and I see the string "Equals method" in the output.
  2. In .Net framework 4.5 it does not pass, and I do NOT see the string "Equals method" in the output
?????????????
--> this leads me to the believe that this is change in the .Net framework or it's compiler. I've found a blog, and at the bottom it says :
In C# 4.0, if the operands to == are "dynamic" then we will do the usual compile-time analysis at runtime based on the runtime types, which effectively does give you something like double-virtual dispatch, at the cost of running the compiler at runtime. We will cache the results of the analysis, so the second time you hit the call site, it should be reasonably efficient.

so does this indeed imply a change in .Net? Any help, guidance, tips are really appreciated !

You can find the source of CCNet in the links below :