Inside a class library of a WPF app I am using the [h]FindRecourse()[/h] method of [h]System.Windows.Application.Current[/h] 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.
Build/Test Issues
System.Windows.Application Not Populated Under NCrunch
Started by CodeAdze on 2,627 views
Remco NCrunch Developer
#12972
22 Dec 2018 23:45 UTC
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.
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.
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.
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.
Post a reply
Log in to reply.