StatLight -c isn't picking updated assembly?

Apr 13, 2011 at 3:35 PM

Hello

I'm trying to run StatLight (with NUnit, if that matters).

My command line:

..\lib\StatLight\StatLight.exe -x="bin\debug\my.xap" -c

The build is triggered when xap is rebuilt, but it looks like the set of tests isn't updated, old tests are run. If I close statlight and launch it again, it picks newest tests from xap as it should.

Using:

  • latest Statlight from github
  • Silverlight NUnit from http://code.google.com/p/nunit-silverlight/  

Is that anything particular that should be done to get it working or looks like a bug?

Thanks!

Coordinator
Apr 13, 2011 at 5:40 PM

This sounds like a bug - I'll have to dig further.

Coordinator
Apr 13, 2011 at 11:32 PM

I pushed up a quick-fix to un-road-block you...

This area of the StatLight codebase needs some cleanup and refactoring and some test coverage, sorry for the inconvenience.

Let me know if this works for you.

Apr 14, 2011 at 9:06 AM

I'm sorry, but now it throws an error when trying to run a very simple test with Statlight (and it works in browser)

Could not locate service StatLight.Client.Harness.Hosts.ITestRunnerHost.


********************* ReflectionTypeLoadException *********************
***** Begin Loader Exception Messages *****
   -  Impossible de charger le fichier ou l'assembly 'Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad
364e35' ou une de ses dépendances. The system cannot find the file specified.
   -  Impossible de charger le fichier ou l'assembly 'Microsoft.Practices.Unity.Silverlight, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf38
56ad364e35' ou une de ses dépendances. The system cannot find the file specified.

***** End Loader Exception Messages *****


A Silverlight MessageBox dialog was automatically closed.
Caption: Unhandled Error in Silverlight Application
Super Secret StatLight Code: 836D4425-DB59-48BB-BA7B-03AB20A57499
Code: 4004
Category: ManagedRuntimeError
Message: System.NullReferenceException: Object reference not set to an instance of an object.
   at StatLight.Client.Harness.Hosts.StatLightSystemBase.b__11(Object sender, OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OnOpenReadCompleted(OpenReadCompletedEventArgs e)
   at System.Net.WebClient.OpenReadOperationCompleted(Object arg)

It looks like it can't find Microsoft.Practices.ServiceLocation & 'Microsoft.Practices.Unity.Silverlight assemblies.

Coordinator
Apr 14, 2011 at 1:42 PM

Could your run it with the --debug option and post the results here?

Apr 14, 2011 at 5:48 PM

Sent it by mail to you.

Hope it helps...

Coordinator
Apr 14, 2011 at 10:22 PM

Thanks, I got it - Took a quick look and didn't see an issue (will look closer when I have time).

Just to eliminate other possibilities. I'm wanting to make sure it's an issue w/ my recent code changes as opposed to an issue on your end.

1. Does it run even once, correctly? Is it only failing on the second run?

2. Does it work in the released version (1.3)?

3. Does it still run-once with your initial build (pre my previous code changes)?

Apr 14, 2011 at 11:31 PM

I'll try to put together a repro tomorrow.

Responding to your questions:

1. It blows up on first test, first run. Even if it's run without "-c" key.

2 & 3 - no, I haven't tried it on previous versions.

Apr 15, 2011 at 9:02 AM
Edited Apr 15, 2011 at 9:12 AM

While trying to reproduce the problem I've observed when this error started to manifest: for a newly created project it's OK. But after I'm adding a reference to my Silverlight project for which I want to write tests StatLight will throw.

My target project doesn't contain a direct reference to Microsoft.Practices.ServiceLocation & Microsoft.Practices.Unity.Silverlight. But probably one of the libs has those references...

Apr 15, 2011 at 10:07 AM

Found the cause of problem: I'm using Clog for some logging and it requires Unity as a dependency but isn't using it. Or at least it doesn't throw any error/warning about missing dependency.

Worked around it by adding reference to Unity package from NuGet to my test project, event if I'm not using it. It works for me now.

I'm not sure what StatLight should do in this situation.

You still need a repro or you got the idea why is it failing?

Coordinator
Apr 17, 2011 at 3:39 PM

Thanks for reporting your issue.

In your case, I think what you did is the only real solution for now... StatLight does some reflection against every assembly in the xap under test. This is because we are looking for test classes/methods in all assemblies to support the case where you may have 2 or 3 test assemblies all referenced into a single xap.

You don't see this error when you run with just the plain browser runner (not statlight) because the microsoft SL testing framework only reflects over the single test assembly.

Happy Testing.