Hmm, I have no idea why it is causing a problem on my system. It compiles but throws an exception in debug mode. I thought it should certainly work. But The code was cut and pasted and it wasn't working in debug mode of VS2010. I thought I was losing my mind. Glad to know that something else was going on.