My Worst Bug

The worst bug I’ve ever tracked down and fixed was a system freeze hidden in some 300.000 lines of code. It was only experienced when the device was left untouched for about an hour (typically a lunch break) while mounted in a grader and connected to a high precision GPS. I only had a few days to find and solve it.

This post is a copy of a comment I made to a DZone post asking for the worst bug ever found and solved.

The device used GPS measurements to automatically control the height and angle of the grader’s blade, by connecting to the graders hydraulic system. We’re talking about a system where the data sent out actually did things in the physical world instantaneously.

We had been working on the system for nearly a year and it was during the final field tests that the bug was found. It only occurred once every few days, but it was frequent enough to be a blocker for the release of the product. The large problem was that we were never able to reproduce the bug in a lab with a debugger attached. It only occurred when the device was wired to a proper million dollar machine. Just the GPS receivers cost tens of thousands of dollars.

The code base was large and was completely multi threaded. The only thing I could do was start reading.

Using a Bit of Luck to Track Down CSS Parse Errors in IE7

This post is written by guest blogger Albin Sunnanbo. He’s a great friend and source of inspiration and also one of the best developers I know. It was Albin that first introduced me to LINQ, EF Migrations and jQuery that I now use daily.

Recently I had trouble with Twitter Bootstrap in IE7.

We had recently built a new version of Twitter Bootstrap from less files with Chirpy instead of using the official CSS files and suddenly the whole layout broke down in IE7. All other browsers looked OK, including IE9. At first sight It looked like the CSS files had not loaded at all in IE7.

I started debugging in IE9 by opening the debug tools and switched Document Mode to IE7.

Toggle mode

Now the error occured in IE9 too. When inspecting HTML elements I saw that the elements had some styles from bootstrap.css in IE7 mode, but not all the styles they had in IE9 mode.

Debugging a Windows Service Project

A service project created in Visual Studio cannot be directly started in the debugger. A small tweak enables direct running of the service and gets rid of the need to deploy the service to test it.

From the first time I tried developing a Windows Service in C++ back in the good old days before .NET I’ve always found them awkward to debug. When developing I want to have my environment setup with multiple startup projects so that I can open a solution, hit F5 and have everything required running. If the solution contains a service a tedious compile-install-start service-attach debugger procedure is required.

Last week when I created a service I decided to find a better way, a way that enables the simple “press F5 to get everything running” approach. Since a service project already compiles to an .exe file, it can be changed to check if it is run as a service or interactively during startup. If running interactively, a reflection hack is used to call each service’s OnStart method.

Speed up debugging using the DebuggerDisplayAttribute

Today’s post is written by guest blogger Albin Sunnanbo. He’s a great friend and source of inspiration and also one of the best developers I know. It was Albin that first introduced me to LINQ, EF Migrations and jQuery that I now use daily. In this post Albin shows how to use the [DebuggerDisplay] attributes to make debugging easier.

When debugging an application with lots of data, you often find yourself digging through long lists of data to find a specific item or verifying a specific property of one or more items. When using Data Tips, Watch or Quick Watch in Visual Studio you often find a pretty anonymous list of objects where you need to expand each item in the list until you find an object with the specific properties you need for your debugging scenario.

Here I have a LINQ2SQL context for my AdventureWorks demo database. I have a simple LINQ query for some products in the database and I want to find the product “Blade” that I previously created to verify that all properties was saved correctly to the database.

I brought up the Data Tip for my products list and start expanding/collapsing items. Quite boring work if you ask me.

Fortunately there is a better way: the DebuggerDisplayAttribute.

Software Development is a Job – Coding is a Passion

I'm Anders Abel, a systems architect and developer working for Kentor in Stockholm, Sweden.

profile for Anders Abel at Stack Overflow, Q&A for professional and enthusiast programmers

The complete code for all posts is available on GitHub.

Popular Posts



Powered by WordPress with the Passion for Coding theme.