5

Lately I've been having problems running my MSpec tests in the TeamCity build. This is happening on two different (unrelated) projects. Everything will work fine locally, but when the TeamCity build runs I get MissingMethodExceptions for some of the MSpec types.

The build then goes on to run all 5 (so far) of my specs, all of which pass. the build fails though, because the step finishes with an error.

If it makes any difference, I'm targetting .NET 4.5 and using mspec-clr4.exe to run the tests on the TeamCity server. I use MSpec 0.5.9 and use TeamCity's NuGet installer to pull it directly from NuGet. We're on TeamCity 7.1

Here's my build step configuration TeamCity build step configuration for MSpec test runner

An here's a segment of the log file output:

[04:27:12]Step 3/4: Unit test and Code Coverage (MSpec) (47s)
[04:27:12]Starting: C:\BuildAgent\plugins\dotnetPlugin\bin\JetBrains.BuildServer.NUnitLauncher.exe #TeamCityImplicit
[04:27:12]in directory: C:\BuildAgent\work\13af8c5b6a6273c6
[04:27:22]JetBrains dotCover Console Runner v2.0.425.72. Copyright (c) 2009-2012 JetBrains s.r.o. All rights reserved.
[04:27:22]
[04:27:39][JetBrains dotCover] Coverage session started [15/10/2012 04:25:58]
[04:27:45]Running specifications.
[04:27:47]

System.MissingMethodException: No parameterless constructor defined for this object.
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap)
   at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly)
   at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options)
[04:27:48]

System.MissingMethodException: No parameterless constructor defined for this object.
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap)
   at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly)
   at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options)
[04:27:48]

System.MissingMethodException: No parameterless constructor defined for this object.
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap)
   at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly)
   at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options)
[04:27:48]

System.MissingMethodException: No parameterless constructor defined for this object.
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap)
   at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly)
   at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options)
[04:27:48]

System.MissingMethodException: No parameterless constructor defined for this object.
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap)
   at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly)
   at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options)
[04:27:48]

System.MissingMethodException: No parameterless constructor defined for this object.
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Machine.Specifications.Explorers.AssemblyExplorer.CreateContextFrom(Type type)
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source)
   at Machine.Specifications.Runner.Impl.DefaultRunner.StartRun(IDictionary`2 contextMap)
   at Machine.Specifications.Runner.Impl.DefaultRunner.RunAssembly(Assembly assembly)
   at Machine.Specifications.Runner.Impl.AppDomainRunner.AssemblyRunner..ctor(ISpecificationRunListener listener, Assembly assembly, RunOptions options)
[04:27:48]Running specifications in Tigra.Graffiti.Specifications
[04:27:48]Tigra.Graffiti.Specifications (2s)
[04:27:50]CalendarFunctions CSS based formatting, when building calendar day listitem > should produce expected html
[04:27:50]CalendarFunctions CSS based formatting, when building calendar day listitem for event day > should produce html with event date css class
[04:27:51]CalendarFunctions CSS based formatting, when building calendar day listitem for day with events > should produce html with hasEvents css class
[04:27:51]CalendarFunctions CSS based formatting, when building calendar day listitem for day with events and is event date > should produce html with event date css class
[04:27:51]CalendarFunctions CSS based formatting, when building calendar day listitem for day with events and events are included > should produce html with event date css class
[04:27:51]Runner failure: System.Runtime.Serialization.SerializationException: Type is not resolved for member 'Machine.Specifications.Runner.RunOptions,Machine.Specifications, Version=0.5.9.0, Culture=neutral, PublicKeyToken=null'.
[04:27:51]   at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
[04:27:51]   at Machine.Specifications.Runner.Impl.AppDomainRunner.CreateRunnerAndUnloadAppDomain(String runMethod, AppDomain appDomain, Assembly assembly, Object[] args)
[04:27:51]Type is not resolved for member 'Machine.Specifications.Runner.RunOptions,Machine.Specifications, Version=0.5.9.0, Culture=neutral, PublicKeyToken=null'.
[04:27:57][JetBrains dotCover] Coverage session finished [15/10/2012 04:26:16]
[04:27:57][JetBrains dotCover] Analysed application exited with code '-1'
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
Tim Long
  • 13,508
  • 19
  • 79
  • 147
  • Tim, has anything changed with regard to this problem? – Anthony Mastrean Dec 03 '12 at 20:41
  • @AnthonyMastrean - I'm not sure. I've completely rebuilt my development PC based on Windows 8 since I asked the question and I have been working on things other than software development for the last few weeks. I haven't got as far as setting up ReSharper for unit testing yet. I'll let you know if anything else changes. – Tim Long Dec 04 '12 at 04:20
  • I'm having this same issue on another project now. Hmmm.... – Tim Long Jan 16 '13 at 13:35
  • This seems to be related to the use of wildcards when specifying the assemblies containing specifications. If I use a wildcard such as "*.Specifications\bin\Debug\*.Specifications.dll" then I get the error; if I specify the path to the assembly explicitly, then the specs run and pass. I'll raise a ticket with JetBrains and see if they can see any issues. – Tim Long Jan 16 '13 at 14:18
  • Just to close the loop on this, it seems that wildcard specifications can generate unexpected matches. I've learned to be more careful and to specify the assemblies longhand. – Tim Long Apr 13 '13 at 23:49
  • write it up as an answer, wait 2 days, and self-accept. I'll upvote ;) – Anthony Mastrean Apr 15 '13 at 12:55

0 Answers0