System.ArgumentException on some tests

Jul 21, 2011 at 3:15 PM

We are getting the following exception consistently on a couple of our xap file that have silverlight unit tests.  Any idea what might be wrong here?  All tests run when we launch the unit test project and let them run in the browser-based unit tester.

************* Unexpected Error *************
System.ArgumentException: Must be defined
Parameter name: unitTestProviderType
   at StatLight.Core.Configuration.ClientTestRunConfiguration..ctor(UnitTestProviderType unitTestProviderType, IEnumerable`1 methodsToTest, String tagFilters, Int32 numberOfBrowserHosts, WebBrowserType webBrowserType, Boolean showTestingBrowserHost, String entryPointAssembly)
   at StatLight.Core.Configuration.StatLightConfigurationFactory.GetStatLightConfigurationForXap(UnitTestProviderType unitTestProviderType, String xapPath, Nullable`1 microsoftTestingFrameworkVersion, Collection`1 methodsToTest, String tagFilters, Int32 numberOfBrowserHosts, Boolean isRemoteRun, String queryString, WebBrowserType webBrowserType, Boolean forceBrowserStart, Boolean showTestingBrowserHost)
   at StatLight.Console.CommandLineExecutionEngine.Run()
   at StatLight.Console.Program.Main(String[] args)

Jul 22, 2011 at 5:51 AM

Could you please use the --debug option and repost?

Jul 22, 2011 at 4:22 PM

Command line - privatized

"C:\Program Files (x86)\StatLight\StatLight.exe" -x="R:\........Controls.Silverlight.UITest.xap" --debug -r="R:\.....Controls.Silverlight.UITest.xap.xml"

 Spew - privatized - path lenghts are all less than 128 characters, quoted file names

StatLight - Version 1.4.4147
Copyright (C) 2009 Jason Jarrett
All Rights Reserved.

DiskXapHostFileLoader cannot find file - C:\Program Files (x86)\StatLight\StatLight.Client.For.December2008.xap
DiskXapHostFileLoader cannot find file - C:\Program Files (x86)\StatLight\StatLight.Client.For.March2009.xap
****************** Input options as configured ******************
ContinuousIntegrationMode          : False
Dlls                               : IEnumerable<string>
ForceBrowserStart                  : False
IsRequestingDebug                  : True
MethodsToTest                      : IEnumerable<string>
MicrosoftTestingFrameworkVersion   :
NumberOfBrowserHosts               : 1
OutputForTeamCity                  : False
QueryString                        :
ShowHelp                           : False
ShowTestingBrowserHost             : False
StartWebServerOnly                 : False
TagFilters                         :
TFSGenericReport                   : False
UnitTestProviderType               : Undefined
UseRemoteTestPage                  : False
WebBrowserType                     : SelfHosted
XapPaths                           : IEnumerable<string>
XmlReportOutputPath                : R:\.........Controls.Silverlight.UITest.xap.xml
RunnerType = OneTimeConsole
Starting configuration for: R:\.......Controls.Silverlight.UITest.xap
XapItems.FilesContainedWithinXap = AppManifest.xaml
XapItems.FilesContainedWithinXap = GalaSoft.MvvmLight.SL4.dll
XapItems.FilesContainedWithinXap = ........Common.dll
XapItems.FilesContainedWithinXap = ........Controls.dll
XapItems.FilesContainedWithinXap = ........Controls.MockModel.dll
XapItems.FilesContainedWithinXap = ........Controls.MockViewModel.dll
XapItems.FilesContainedWithinXap = ........Controls.Silverlight.UITest.dll
XapItems.FilesContainedWithinXap = System.ComponentModel.DataAnnotations.dll
XapItems.FilesContainedWithinXap = System.Windows.Controls.Data.Input.dll

Usage: statlight -x="PathTo/UnitTests.xap" [OPTIONS]

More documentation:

a big snip

then the exception message already listed.

Jul 22, 2011 at 5:52 PM

Does it have a reference to "Microsoft.Silverlight.Testing.dll"? It doesn't appear to be there.

StatLight will attempt to determine what version of the Microsoft.Silverlight.Testing.dll you have, it appears it can't figure it out.

If you're not using the Microsoft.Silverlight.Testing.dll, what other test provider are you using?

Aug 2, 2011 at 12:02 AM

Sorry for the delay in replying.  Adding the reference does not appear to make any difference.  However it looks like our project is turning a different direction so I will not be pursuing this fix.

Mar 9, 2013 at 1:47 AM
I've just experienced this happen with StatLight v1.6.4375.31943-f03a896 if the xap file specified does not exist.

For some reason, StatLight does not throw a FileNotFoundException for example.
Aug 14, 2014 at 12:46 PM
Sorry for bringing up the old post, but the same thing just happened to me and I wanted to share my solution of the problem.

It turned out that there were references to Microsoft.Silverlight.Testing.dll and Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll, however the flag "Copy Local" was not set for them. Therefore, those files were not existing in the .xap and the test couldn't run.

Setting "Copy Local" to true for both of those references fixed the problem.