PostSharp bugs that occur only on a Monday? Really? :(

I thought I'd seen the last of PostSharp issues after upgrading to 2.1, but it's becoming the problem that won't go away... :(

On Monday one of my developers reported a bug to me - she was unable to use even the most basic functionality of our system, with an exception that appeared to be something related to our PostSharp upgrade. I was rather surprised, since I'd certainly tested this functionality at the time I did the work, and when I merged it back in to the main branch...

After a little investigation, I found it to be a bug in PostSharp... Aggressive optimisation was stamping on the return value of methods when calling the base functionality (a significant issue, that really should've been caught by tests?!). I posted it in their forums, requesting a fix:

In the meantime, I put a workaround in our code.

Today, Gael responded saying he'd fixed the bug, and I noticed he'd already deployed a new NuGet package! I quickly opened up my simple test case (console app) to repro the issue once more, then test the update. Strangely, my repro case was now working!

The next few hours was spent furiously trying to figure out what was going on... We tried on different developer machines, and found that some had the issue, and most didn't. I confirmed we were still using the old version, and that nothing was being auto-updated.

I wasn't happy to just update and ignore this, because if the behaviour is intermittent, we could end up with duff builds from our build server at any time. Things were getting desperate, so I cracked out Reflector, and started comparing working and broken builds...

I noticed in some of the metadata output by PostSharp in a working build it said "limitedLicence=true". The builds from machines that reliably reproduced this, did not. This seemed like it might be significant, and was caused because the working machines were on the trial of PostSharp (so it's the Professional functionality) whereas the broken ones were on the free Starter version.

As a joke, one of the devs suggested rolling my date back to Monday since it was broken then. I quickly announced that I'd retire from programming if that caused the bug to reappear on my machine.

In hindsight, that was a silly comment to make...

The repro now started failing in the same way we'd originally seen. I spent the next 10 minutes rolling my system date backwards and forwards, and sure enough, I could 100% reproduce this issue with the date set to Monday.

What. The. Fuck?

Armed with some keywords (postsharp, monday, professional) I came across a post in the forums from Gael saying something was only in the Professional version and therefore would be available on Monday. I wondered if this post was made the week before the Professional version, but a colleague laughed saying "So the professional version only works on Mondays?!"...

Turned out, he wasn't so far off... On Mondays, all free licences get the full Professional functionality. Since this bug was in the Optimiser that's part of the Professional version, it only appeared on a Monday. This explains why I'd never seen the issue when originally upgrading or merging!

Even worse, is that all paying customers got this functionality every day, and so did build servers! I probably don't need to point out how terrible this is :(

I'm so frustrated to have wasted so much time tracking down this issue for what is essentially, a gimmick. Having builds behave differently on different days of the week is terrible default functionality. The cost of debugging PostSharp issues keeps rising, so it's getting closer and closer to being removed from our projects. There has to be a better alternative :(
Shared publiclyView activity