The posted code works for me.

Can you copy and paste here the full contents of the window from when the exception happens?