Wednesday, January 31, 2007

BackgroundWorker and exceptions

Got a bit confused at work today when a piece of software seemingly halted in a place where it should not have been possible.

After looking at the code for a while I found something like the following:

BackgroundWorker bgw = new BackgroundWorker();
+= new DoWorkEventHandler(bgw_DoWork);

where bgw_DoWork was (basically) implemented thusly:

void bgw_DoWork(object sender, DoWorkEventArgs e)
// ...
throw new Exception("things went bad");

If you try it out (outside the debugger) you'll notice that the exception is silently swallowed !?!

The moral of the story:

If you use Background worker, either implement a catch all handler within the DoWork method or, hook the RunWorkerCompleted event and check RunWorkerCompletedEventArgs.Error for non-null value.

Tuesday, January 30, 2007

Browsing old books

Doesn't sound like much fun does it? Well, consider that the books in questions were hand written by Leonardo da Vinci or that one of the books were Alice under ground or something other like that, then it seems much more interesting. The British library has done just that, published a few selected books in a WPF showcase application that feels close to reading a real book. See for yourself!

Prerequisites: .NET 3.0, Internet Explorer and a reasonably modern computer.

Technorati tags: ,

Saturday, January 06, 2007

Anti-commercial for two products..

I have two products that I'm annoyed with from time to time.

1) Samsung CLP-500

It tells me that the waste toner tank is full (now and then) and that I need to replace it. However I can clearly see that it is nowhere near full. The problem seems to be with stupid design, there is an optical sensor right under one of the inlets that detects if it can see through the waste toner tank (made of clear plastic), to make matters worse, it seems that a tiny toner particle in the sensors way and the tank "is full". Samsungs FAQ entry for the error message is also somewhat funny.


"Waste Toner Tank Full/Not Install" is displayed.

First, replace the waste toner tank.  
If the same message is displayed continually after replaced.
- Check whether that replaced waste toner tank is the new.
- If it is the new, the printer may require repair. 

2) Logitech MX-1000

  • Cursor occasionally jumping all over the place
  • Buttons behave if they are pressed
  • Tilt wheel get stuck tilted

..need I say more?

Tuesday, January 02, 2007

Happy New Year, and a late christmas present..

The break is over and tomorrow back to work again. Meanwhile, it seems that I've been a awarded with a 1-year MSDN subscription with all the bells and whistles thanks to my activity at


(The announcement is here)