Unable to cast a WPF window to Core.UIItems.WindowItems.Window

I am trying to cast a window which is derived from a WPF window to Core.UIItems.WindowItems.Window. The compiler takes very long time when it reaches the casting, that I have to break running
the test.