Window Cast Exception in WPF app test

Apr 28, 2008 at 10:23 PM
I am running a very simple WPF application test which works perfectly when run from VS2008. However, when I run the following line from the same code but with my Continuous integration setup I get a windows cast exception

WPFWindow window = (WPFWindow)WpfApp.GetWindow("MainWindow", InitializeOption.NoCache);

throws the following exception
Unable to cast object of type 'Core.UIItems.WindowItems.Win32Window' to type 'Core.UIItems.WindowItems.WPFWindow'.Unable to cast object of type 'Core.UIItems.WindowItems.WPFWindow' to type 'Core.UIItems.WindowItems.Win32Window'.

Am I missing a configuration? or is this normal when running the tests from NUnit 2.4.6? I have tried both nunit.exe and nunit-console.exe
Apr 28, 2008 at 10:25 PM
Sorry all it is only the first error message (the second was me trying the other cast)

Message is :

Unable to cast object of type 'Core.UIItems.WindowItems.Win32Window' to type 'Core.UIItems.WindowItems.WPFWindow'

Apr 28, 2008 at 10:56 PM
I managed to work around the issue by casting to Window (which works in both scenarios). Hopefully I will not miss out on any functionality by using this.
Apr 29, 2008 at 8:49 AM
WPFWindow is internal to white and you should be using the Window class.
I think I should document this clearly in the NDoc. I would do this in the next release.
Thanks for pointing.