Buy us Beer
Categories
Pages

Archive for July, 2008

Take that – Toyota Prius!

Inspired by this article in the Telegraph.

  • Share/Bookmark

The strange case of the BackgroundWorker and the disappearing exception

I was recently building a simple GUI in .NET to operate an algorithm as part of a school project, and I encountered a weird problem using BackgroundWorkers. I spent a lot of time debugging it, mainly because the code seemed to be perfect (which was true) but the run-time behavior was so strange…

Anyway, to make my algorithm as weakly-coupled as possible decided not to use BackgroundWorker.ReportProgress‘, because then my algorithm will have to know what a BackgroundWorker is…
I decided to actually fire my own event whenever I wanted to report on the algorithm progress (which is rather lenghty). So I defined my delegate and event inside my one-function class that runs the algorithm:

Read the rest of this entry »

  • Share/Bookmark