Error when running the tests

Nov 15, 2013 at 9:33 AM
Hi Iam getting the below error when iam running a silverlight unit test .
I copied the Agunit dlls to the Jetbrains plugin folder . Still facing the issue, it looks like exception is getting thrown when trying to load a assembly which it is not able to resolve.
Can u please let me know how to find out for what assembly it is throwing the exception
---------------------------
JetBrains Product – AgUnit: Exception during test run
---------------------------
TinyIoC.TinyIoCResolutionException: Unable to resolve type: StatLight.Core.RunnerExecutionEngine ---> TinyIoC.TinyIoCResolutionException: Unable to resolve type: StatLight.Core.CurrentStatLightConfiguration ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.Serialization.SerializationException: The constructor to deserialize an object of type 'StatLight.Core.Common.StatLightException' was not found.

   at StatLight.Core.WebServer.AssemblyResolution.AssemblyResolverBase.ResolveAllDependentAssemblies(String path)

   at StatLight.Core.WebServer.AssemblyResolution.AssemblyResolver.ResolveAllDependentAssemblies(Boolean isPhoneRun, String fullName) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\WebServer\AssemblyResolution\AssemblyResolver.cs:line 18

   at StatLight.Core.Configuration.StatLightConfigurationFactory.GetStatLightConfigurationForDll(String dllPath) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\Configuration\StatLightConfigurationFactory.cs:line 105

   at StatLight.Core.Configuration.StatLightConfigurationFactory.<GetConfigurations>d__0.MoveNext() in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\Configuration\StatLightConfigurationFactory.cs:line 42

   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)

   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

   at StatLight.Core.CurrentStatLightConfiguration..ctor(StatLightConfigurationFactory statLightConfigurationFactory) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\CurrentStatLightConfiguration.cs:line 35

   --- End of inner exception stack trace ---

   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

  at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)

   at TinyIoC.TinyIoCContainer.ConstructType(Type type, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\TinyIoC.cs:line 3139

   --- End of inner exception stack trace ---

   at TinyIoC.TinyIoCContainer.ConstructType(Type type, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\TinyIoC.cs:line 3143

   at TinyIoC.TinyIoCContainer.ConstructType(Type type, ConstructorInfo constructor, ResolveOptions options) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\TinyIoC.cs:line 3086

   at TinyIoC.TinyIoCContainer.SingletonFactory`2.GetObject(TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\TinyIoC.cs:line 2395

   at TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\TinyIoC.cs:line 2881

   at TinyIoC.TinyIoCContainer.ConstructType(Type type, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\TinyIoC.cs:line 3117

   --- End of inner exception stack trace ---

   at TinyIoC.TinyIoCContainer.ConstructType(Type type, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\TinyIoC.cs:line 3129

   at TinyIoC.TinyIoCContainer.ConstructType(Type type, NamedParameterOverloads parameters, ResolveOptions options) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\TinyIoC.cs:line 3091

   at TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\TinyIoC.cs:line 2943

   at TinyIoC.TinyIoCContainer.Resolve(Type resolveType) in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\TinyIoC.cs:line 1041

   at TinyIoC.TinyIoCContainer.Resolve[ResolveType]() in C:\Projects\GitHub\AgUnit\lib\sl\StatLight\src\StatLight.Core\TinyIoC.cs:line 1160

   at AgUnit.Runner.Resharper61.TaskRunner.UnitTestRunner.Silverlight.SilverlightUnitTestTaskRunner.ExecuteStatLightRun(TinyIoCContainer ioc) in c:\Projects\GitHub\AgUnit\src\AgUnit.Runner.Resharper61.TaskRunner\UnitTestRunner\Silverlight\SilverlightUnitTestTaskRunner.cs:line 83

   at AgUnit.Runner.Resharper61.TaskRunner.UnitTestRunner.Silverlight.SilverlightUnitTestTaskRunner.Execute(SilverlightTask silverlightTask) in c:\Projects\GitHub\AgUnit\src\AgUnit.Runner.Resharper61.TaskRunner\UnitTestRunner\Silverlight\SilverlightUnitTestTaskRunner.cs:line 78

   at AgUnit.Runner.Resharper61.TaskRunner.UnitTestRunner.Silverlight.Execution.TaskNode.Execute[T](Action`1 execute, T task) in c:\Projects\GitHub\AgUnit\src\AgUnit.Runner.Resharper61.TaskRunner\UnitTestRunner\Silverlight\Execution\TaskNode.cs:line 45

   at AgUnit.Runner.Resharper61.TaskRunner.UnitTestRunner.Silverlight.Execution.SilverlightTask.Execute(Action`1 execute) in c:\Projects\GitHub\AgUnit\src\AgUnit.Runner.Resharper61.TaskRunner\UnitTestRunner\Silverlight\Execution\SilverlightTask.cs:line 18

   at AgUnit.Runner.Resharper61.TaskRunner.UnitTestRunner.Silverlight.SilverlightUnitTestTaskRunner.ExecuteSilverlightTasks(TaskExecutionNode node) in c:\Projects\GitHub\AgUnit\src\AgUnit.Runner.Resharper61.TaskRunner\UnitTestRunner\Silverlight\SilverlightUnitTestTaskRunner.cs:line 66

   at AgUnit.Runner.Resharper61.TaskRunner.UnitTestRunner.Silverlight.SilverlightUnitTestTaskRunner.ExecuteRecursive(TaskExecutionNode node) in c:\Projects\GitHub\AgUnit\src\AgUnit.Runner.Resharper61.TaskRunner\UnitTestRunner\Silverlight\SilverlightUnitTestTaskRunner.cs:line 46
Thanks
Coordinator
Nov 15, 2013 at 11:02 AM
Which version of AgUnit and ReSharper are you using?
Nov 16, 2013 at 7:14 AM
Resharper - version - 7.1
Agunit - version -0.8
Visual Studio - VS2012
Coordinator
Nov 16, 2013 at 12:29 PM
AgUnit 0.8 only works with ReSharper 8.
For ReSharper 7 you need AgUnit 0.7.

And according to the stacktrace, you're using AgUnit 0.7 or earlier. Do you have some files left over from a previous installation of AgUnit?
Dec 17, 2013 at 8:46 AM
Edited Dec 17, 2013 at 8:47 AM
I have Resharper 8.0.2 and AgUnit 0.8 and I have the same error.

I notice that in a clean project I can run test with Resahper and AgUnit but when I try to setup in my big project, something is missing.

I need some light in this tunnel please.


Best regards
Paulo Aboim Pinto
Odivelas - Portugal
Coordinator
Dec 17, 2013 at 9:21 AM
AgUnit 0.8 does not have a namespace "AgUnit.Runner.Resharper61" anymore.
This is an indication that there are leftover files from a previous version.

Check the C:\Program Files (x86)\JetBrains\ReSharper\v8.0\Plugins folder and remove any versions prior to 0.8.
If you used the ReSharper extension manager, this folder should be empty and AgUnit will be installed to your AppData folder instead.
Aug 8, 2014 at 7:18 AM
Same exception. Other developer on same project get identical issue.
ReSharper 8.2.0.2160 on Visual Studio 2013 (12.0.30501.0), Windows 8.1 Enterprise.

Got AgUnit in
C:\Program Files (x86)\JetBrains\ReSharper\v8.1\Bin\Plugins\AgUnit-0.8-for-ReSharper-8.0 as well as
..\AppData\Local\Temp\nuget\rul5wlyc.guq\ReSharper\v8.2\plugins
No old files / plugin folders.

In program files StatLight.Core.dll is v 1.6.5055.42168
In AppData however, it is version 1.6.5212.26249

But as said, that's if one is using extension manager, which I am.


Is this just a version issue or is Silverlight Unit Tests (still) a bust?
Coordinator
Aug 19, 2014 at 10:14 PM
Edited Aug 19, 2014 at 10:17 PM
Try upgrading to ReSharper 8.2 and AgUnit 0.9.
AgUnit 0.8 is NOT compatible with ReSharper 8.2.

You should have AgUnit either in program files or appdata, not both!
The extension manager only installs in appdata. Remove the one from program files.

Make sure the correct files are being loaded:
  • Open ReSharper options (RESHARPER > Options...)
  • Go to Environment > Plugins section
  • Press the "Show Additional Developer Information" button
This should list 3 files for AgUnit: AgUnit.Runner.Resharper80.dll, AgUnit.Runner.Resharper80.TaskRunner.dll and StatLight.Core.dll
And state:
"Creating one plugin out of 2 plugin assemblies that have the same plugin title AgUnit and 1 anonymous plugin assemblies that go alongside them."
"Adding 1 plugin(s) from extension 'AgUnit'"
Aug 20, 2014 at 6:42 AM
Thanks for the pointers. I've removed all versions found that was not in
..\AppData\Local\JetBrains\ReSharper\vAny\packages\AgUnit.0.9.0\ReSharper\v8.2\plugins
When I open Visual Studio and check the plugins under Resharper menu > Options > Environment > Plugins
I get a statment similar to the one you post, but there's something amiss with the version numbers.

While the AgUnit folder says 0.9.0 the plugins window says it's 0.8.0. Sure enough, if I check the AgUnit.Runner.Resharper80.dll dll in said folder it's version 0.8.0.

Doesn't seem to add up?

Image
Coordinator
Aug 20, 2014 at 9:51 AM
It seems I forgot to bump the version numbers in the 0.9 release, so this should be correct.
Sep 26, 2014 at 7:23 AM
Edited Sep 26, 2014 at 7:24 AM
I created an isolated environment to reproduce the mentioned issue with AgUnit exceptions.
After googling and testing I finally got Silverlight (including User Controls) testing working now by:

1) Installing
  • Visual Studio 2013 (Update 3)
  • ReSharper 8.2 or newer
    -- R# Extension: AgUnit 0.9.0
2) Creating a Silverlight project - not class library. In this SL project:
  • Adding reference to my main SL project
  • Adding NuGet package SilverlightToolkit-Testing 5.2011
  • Creating a test class with these usings:
    -- using Microsoft.VisualStudio.TestTools.UnitTesting;
    -- using Microsoft.Silverlight.Testing;
    -- Decorating class with [TestClass] and functions with [TestMethod]
Here comes the cruzial part:

3) In my new Silverlight testing project:
  • Open App.xaml.cs
  • Find Application_Startup() function
  • Set RootVisual = UnitTestSystem.CreateTestPage();
  • Run the project to launch the testing page and run tests
I.E don't use VS / R# built in Unit Test browser - those caused above error.


So the question is why using Visual Studio / ReSharper test runner cause exception while SL Toolkit test page works fine?