Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

System.Windows.Application Not Populated Under NCrunch
CodeAdze
#1 Posted : Saturday, December 22, 2018 6:22:49 AM(UTC)
Rank: Member

Groups: Registered
Joined: 9/3/2014(UTC)
Posts: 10
Location: Australia

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Inside a class library of a WPF app I am using the FindRecourse() method of System.Windows.Application.Current class. The code compiles and runs fine but NCrunch is reporting a NullReferenceException on this line. It would appear that System.Windows.Application isn't populated under Ncrunch execution. Would this be correct, and if it is how can I work around it?

Thanks for your help.
Remco
#2 Posted : Saturday, December 22, 2018 11:45:16 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,671

Thanks: 737 times
Was thanked: 944 time(s) in 899 post(s)
Hi, thanks for posting.

Have you tried this code using any other test runner? My understanding is that usually the application object itself would be populated by the application bootstrap routine (i.e. Program.Start). You might need to add special setup code to your automated test to allow your code to work.
CodeAdze
#3 Posted : Sunday, December 23, 2018 4:59:40 AM(UTC)
Rank: Member

Groups: Registered
Joined: 9/3/2014(UTC)
Posts: 10
Location: Australia

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi Remco,
Thanks for your prompt reply. I tried running the tests with the NUnit test runner and got the same problem, the Application object wasn't populated and it threw the same NullReferenceException. I will try and find a solution for this.

Thanks again.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.022 seconds.