Silverlight Test app required? Test ignored.

Sep 22, 2012 at 8:47 PM

HI,

Just downloaded this along with Resharper 7 (VS2010).  Wrote my first test in a SL5 library project and it worked fine using MSTest and the Resharper test runner.  Added another test class and now both test classes just get all their tests ignored.  So I'm wondering if the first test was just a fluke and I need to create a SL test app to host the tests?

Tried devenv /ReSharper.LogFile "C:\resharper.log" /ReSharper.LogLevel Verbose

Which creates the file, if I attempt to run the test I get this added to the file:

 

20:45:47.148: Thread:1: OnSessionContentsChanged
20:45:47.172: Thread:1: OnSessionStateChanged
20:45:47.172: Thread:1: OnSessionStateChanged
20:45:47.172: Thread:1: OnSessionStateChanged
20:45:47.177: Thread:4: TaskRunner output:
20:45:47.186: Thread:1: SessionStateChanged
20:45:47.197: Thread:1: SessionStateChanged
20:45:47.205: Thread:1: SessionStateChanged
20:45:47.529: Thread:1: PreviewUpdate
20:45:47.589: Thread:1: ExecSessionChange
20:45:47.589: Thread:1: SessionStateChanged
20:45:47.638: Thread:4:
20:45:47.638: Thread:4: TaskRunner output end
20:45:47.638: Thread:4: OnSessionStateChanged
20:45:47.638: Thread:4: OnSessionStateChanged
20:45:47.657: Thread:1: SessionStateChanged
20:45:47.658: Thread:1: Counters not valid
20:45:47.665: Thread:1: SessionStateChanged
20:45:47.813: Thread:1: ExecSessionChange
20:45:47.813: Thread:1: SessionStateChanged
20:45:48.120: Thread:1: PreviewUpdate

Sep 23, 2012 at 7:43 PM

Hi,

Try this build: https://github.com/downloads/sdekock/AgUnit/AgUnit-0.6.1-for-ReSharper-7.0.zip

This should pop up a dialog when you run the tests, showing the exception that caused the testrun to fail.

Hope this solves your problem,

Steven

Oct 16, 2012 at 3:47 PM

I have a similar problem with my tests being ignored. 

I only get this issue if I add nuget package RiaServices.MVVM (Microsoft.Windows.Data.DomainServices.dll) and use the EntityList<> class in any way. The exception data below is from the following test:

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Windows.Data.DomainServices;

namespace AgUnitExample.Test
{
    [TestClass]
    public class BrokenTestExample
    {
        [TestMethod]
        public void RunAnExampleTest_WhereEntityListIsUsedInProject_TestIgnored()
        {
            EntityList<SomeEntity> entityList;

            Assert.AreEqual(1, 1);
        }
    }
}

I downloaded the version above and have the following exception information:

TinyloC.TinyloCResolutionException: Unable to resolve type: StatLight.Core.RunnerExecutionEngine ---> TinyloC.TinyloCResolutionException: 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\ 51\ StatLight\ src\ StatLight.Core\WebServer\AssemblyResolution\AssemblyResolver.cs:line 18 
at StatLight.Core.Configuration.StatLightConfigurationFactoiy.GetStatLightConfigurationFor011(String dllPath) 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\ Configuration\ StatLightConfigurationFactoiy.cs:line 105 
at StatLight.Core.Configuration.StatLightConfigurationFactoiy.d_O.MoveNext() 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\ Configuration\ StatLightConfigurationFactory.csfine 42 
at System.Collections.Generictistl..ctor(lEnumerablel collection) at Systemlinq.Enumerable.ToList(TSource)(1Enumerablel source) 
at StatLight.Core.CurrentStatLightConfiguration..ctor(StatLightConfigurationFactory statLightConfigurationFactoiy) 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\ CurrentStatLightConfiguration.cs:line 35 
--- End of inner exception stack trace --- 
at System.RuntimeMethodHandleinvokeMethod(Object target, Object() arguments, Signature sig, Boolean constructor) 
at System.Reflection.RuntimeConstructorInfoinvoke(BindingFlags invokeAttr, Binder binder, Object() parameters, Culturelnfo culture) 
at System.Reflection.ConstructorInfoinvoke(Object() parameters) 
at TinyloC.TinyloCContainer.ConstructType(Type type, Constructorinfo constructor, NamedParameterOverloads parameters, ResolveOptions options) 
in CAProjects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\TinyloC.cs:line 3139 
--- End of inner exception stack trace --- 
at TinyloC.TinyloCContainer.ConstructType(Type type, Constructorinfo constructor, NamedParameterOverloads parameters, ResolveOptions options) 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\TinyloC.cs:line 3143 
at TinyloC.TinyloCContainer.ConstructType(Type type, Constructorinfo constructor, ResolveOptions options) 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\TinyloC.cs:line 3086 
at TinyloC.TinyloCContainer.SingletonFactory2.GetObject(TinyloCContainer container, NamedParameterOverloads parameters, ResolveOptions options) 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\TinyloC.cs:line 2395 
at TinyloC.TinyloCContainer.Resolvelnternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\TinyloC.cs:line 2881 
at TinyloC.TinyloCContainer.ConstructType(Type type, Constructorinfo constructor, NamedParameterOverloads parameters, ResolveOptions options) 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\ TinyloC.cs:line 3117 
--- End of inner exception stack trace --- 
at TinyloC.TinyloCContainer.ConstructType(Type type, Constructorinfo constructor, NamedParameterOverloads parameters, ResolveOptions options) 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\TinyloC.cs:line 3129 
at TinyloC.TinyloCContainer.ConstructType(Type type, NamedParameterOverloads parameters, ResolveOptions options) 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\TinyloC.cs:line 3091 
at TinyloC.TinyloCContainer.Resolvelnternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\TinyloC.cs:line 2943 
at TinyloC.TinyloCContainer.Resolve(Type resolveType) 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\TinyloC.cs:line 1041 
at TinyloC.TinyloCContainer.Resolve(ResolveType)() 
in C:\ Projects\ GitHub\AgUnit\ sl\ StatLight\ src\ StatLight.Core\TinyloC.cs:line 1160 
at AgUnit.Runner.Resharper61.TaskRunner.UnitTestRunner.Silverlight.SilverlightUnitTestTaskRunner.ExecuteStatLightRun(TinyloCContainer 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[TRActionl 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(Actionl 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 CAProjects\ GitHub\AgUnit\ src\AgUnit.Runner.Resharper61.TaskRunner\UnitTestRunner\ Silverlight\ SilverlightUnitTestTaskRunner.cs:line 46 
I hope this can shed light on the issue. Thanks

Oct 16, 2012 at 4:57 PM
Edited Oct 16, 2012 at 4:58 PM

I've solved my particular problem myself. It appears that I had some dll's missing but I had to work to get that feedback. If you can identify the dll and type that are causing the tests to be ignored I suggest you try the following:

  1. Serialize the offending dll to a Base64 string in a console app. 
    var dllBytes = File.ReadAllBytes("Offending.dll");
    var dllBase64 = Convert.ToBase64String(dllBytes);
    File.WriteAllText("OffendingDll.txt", dllBase64);
    
  2. Copy the entire text of the OffendingDll.txt file and make it a string variable in your test.
    private const String data = @"TVqQAAMAAAAEAAAA//8AALgA..muchmuchmore";
    
  3. Dynamically load the assembly and try to get the offending type.
    var dllByteArray = Convert.FromBase64String(data);
    var dllMemoryStream = new MemoryStream(dllByteArray);
    
    var assemblyPart = new AssemblyPart();
    var assembly = assemblyPart.Load(dllMemoryStream);
    
    try
    {
        var types = assembly.GetTypes().Where(a => a.Name.Contains("EntityList"));
    }
    catch (TypeLoadException typeLoadException)
    {
        
    }
    catch(Exception exception)
    {
        
    }
    
  4. Put breakpoints on the exception handlers and debug the test. You should see good info on why the type can't be used.

In my case I needed to add System.Windows.Data 2.0.5.0.

Oct 16, 2012 at 8:45 PM

It looks like the deserialization of the StatLightException is hiding the original exception.

I'll see what I can do to resolve this ...