“Java and C# are kind of the same thing, right?”
Josh was a Java developer, but his company was doing a big upgrade of some .NET applications written years earlier by a developer named Ray. Ray had left the company the previous year, and somebody needed to help port his .NET 2.5 code to .NET 4.0 and a new version of IIS. Josh was a team player, and also knew that newer versions of .NET were almost always backwards compatible, so he didn’t expect it to create that much work for him.
Most of the applications transferred to the new servers without any issues. Most. Of course, the one that didn’t transfer was the “mission critical” package. The ERP system didn’t have all the tools the users wanted for manipulating data, so they wanted a tool that could export some records to Excel, where they could edit them, and then reimport the data. The import process was reporting that it was complete, but actually crashed and didn’t finish the job (and for bonus points, left the database in an inconsistent state).
Ray hadn’t implemented any logging, so Josh fired it up on his dev box and fed it an Excel file. The program cheerfully reported what it was up to at each step of the bulk loading process, displaying a message with a throbber image that turned into a check-mark when that step completed. Despite the crash, every message reported success.
- You’re file is on it’s way!
- We have recieved you’re file and are procesing it right now!
- Almoast done!
- Table’s are bieng added to teh system.
- The system is reading teh table!
- You’re procesing is almoast compleeted.
- Congraubullations! You’re file has been procesed!
Ugh. Josh had minored in English, and just seeing those messages gave him a headache. He pushed his annoyance aside- this was cosmetic and not directly relevant to the problem at hand.
With a few breakpoints, it only took Josh a few minutes to identify the problem. Ray’s code was spawning a background thread using the new Thread()
syntax, which was one of the few places where .NET 4.0 made some breaking changes with older versions. Josh whipped up a quick workaround and ran it again- everything worked.
With the real problem solved, Josh tracked down the messages. They were hardcoded strings. He touched up the spelling, checked in his changes, and then let QA know there was a fix they could test.
They replied back minutes later: “The file gets uploaded now, but the screen hangs on the last step. The spinner just sits there.”
- Your file is on its way!
- We have received your file and are processing it right now!
- Almost done!
- Tables are being added to the system.
- The system is reading the table!
- Your processing is almost completed.
- Congratulations! Your file has been processed!
That was strange, since he’d just seen the code run successfully. Well… before he’d fixed the spelling. Could it be? Josh dug through the code that controlled the status display, and found the problem in a file called StatisUpdator.cs
.
if (StatisMesages[i].Contains("Congraubullations"))
{
finished = true; //causes the throbber to turn into a check
}
At least Ray is consistent.