Microsoft fixed my bug
Like a lot of people, when I first began developing on a "proper" Operating System (as opposed to the 8 bit computers I started with), sooner or later I convinced myself I'd found a bug in the operating system.
Of course I'd be wrong, and after suffering the embarrassment of discovering that it was my own stupidity, rather than an OS bug, that was causing the errors, I eventually acquired an automatic reflex to never ever believe that there was a bug in the OS. It had to be a bug in my code. This was a good thing, since I was always right.
Despite this, it seems that I never fully learned this lesson. And so it was that last May I opened a bug report on Microsoft Connect, fully expecting to be gently, but firmly rebuffed, with an explanation of where exactly I'd gone wrong.
The issue that I was facing was in detecting whether a connection to my web application was coming from the local machine (running the web application), or from a remote machine. I was calling the HttpListenerContext.Request.IsLocal method, and it was always returning false, even though the client was definitely local.
A little digging with Reflector showed that the method was implemented using "==" to compare the local address with the remote address, instead of the Equals method. If the "==" operator had been overloaded then it would have worked.
A couple of days ago, I got a message saying that this was indeed a bug, and that it was fixed in version 4.0 of the .NET framework. So it looks like I have finally actually discovered an honest-to-goodness bug.
Or perhaps they are just being kind to me.