machine / machine.specifications

Machine.Specifications is a Context/Specification framework for .NET that removes language noise and simplifies tests.
MIT License
885 stars 178 forks source link

DevOps / VSTest adapter is throwing due to RemotingException #401

Closed mikeblakeuk closed 4 years ago

mikeblakeuk commented 4 years ago

Using version 1.0.0 with adapter 2.10 DevOps is crashing at random time with a large assembly

    <PackageReference Include="Machine.Specifications" Version="1.0.0" />
    <PackageReference Include="Machine.Specifications.Runner.VisualStudio" Version="2.10.0" />
    <PackageReference Include="Machine.Specifications.Should" Version="1.0.0" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
    <PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="16.5.0" />

Note; PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="3.5.0" is being used

Could this be related to https://github.com/microsoft/testfx/issues/28 ?

Machine Specifications Visual Studio Test Adapter - Error while executing specifications in assembly  - System.Runtime.Remoting.RemotingException: Object '/e7f91710_178b_45e5_9236_c1f0962c2b13/xezfw3bltbfv2avt9likjwow_6.rem' has been disconnected or does not exist at the server.

Server stack trace: 
   at System.Runtime.Remoting.Channels.ChannelServices.CheckDisconnectedOrCreateWellKnownObject(IMessage msg)
   at System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(IMessage msg)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Machine.Specifications.Runner.ISpecificationRunListener.OnFatalError(ExceptionResult exception)
   at Machine.Specifications.Runner.AggregateRunListener.<>c__DisplayClass10_0.<OnFatalError>b__0(ISpecificationRunListener listener)
   at Machine.Specifications.Utility.RandomExtensionMethods.Each[T](IEnumerable`1 enumerable, Action`1 action)
   at Machine.Specifications.Runner.AggregateRunListener.OnFatalError(ExceptionResult exception)
   at Machine.Specifications.Runner.AggregateRunListener.<>c__DisplayClass10_0.<OnFatalError>b__0(ISpecificationRunListener listener)
   at Machine.Specifications.Utility.RandomExtensionMethods.Each[T](IEnumerable`1 enumerable, Action`1 action)
   at Machine.Specifications.Runner.AggregateRunListener.OnFatalError(ExceptionResult exception)
   at Machine.Specifications.Runner.Impl.AssemblyRunner.OnAssemblyEnd(Assembly assembly)
   at Machine.Specifications.Runner.Impl.DefaultRunner.EndRun(Assembly assembly)
   at Machine.VSTestAdapter.Execution.TestExecutor.RunTestsInAssembly(String pathToAssembly, IEnumerable`1 specsToRun, ISpecificationRunListener specificationRunListener)
   at Machine.VSTestAdapter.Execution.TestExecutor.RunTestsInAssembly(String pathToAssembly, IEnumerable`1 specsToRun, ISpecificationRunListener specificationRunListener)
   at Machine.VSTestAdapter.Execution.SpecificationExecutor.RunAssemblySpecifications(String assemblyPath, IEnumerable`1 specifications, Settings settings, Uri adapterUri, IFrameworkHandle frameworkHandle)
   at Machine.VSTestAdapter.MSpecTestAdapterExecutor.RunTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
Machine Specifications Visual Studio Test Adapter - Executing Source Specifications Complete.
robertcoltheart commented 4 years ago

What's your setup? Is this running under Core or Framework?

mikeblakeuk commented 4 years ago

Framework 4.5.2 with yaml using defaultVmImage: 'windows-latest'

mikeblakeuk commented 4 years ago

Any thoughts about this issue or how to tackle it?

robertcoltheart commented 4 years ago

I haven't prioritized it yet, given the situation globally this is pretty low on my schedule. I'm happy to investigate further if you have an example solution you can attach to help debug this issue?

mikeblakeuk commented 4 years ago

No sorry, it's intermittent and using our large (~8,000 test in a single dll) corp suite. Don't think I could reproduce it easily. Just interested to know where to approach it from. Looks like mspec has support for RemotingException / Lifetime override but I guess somewhere is missing it?

mikeblakeuk commented 4 years ago

Possible fix here: https://github.com/machine/machine.specifications.runner.visualstudio/pull/97

robertcoltheart commented 4 years ago

Released as v2.10.1-beta.1, please let me know if it addresses your issue.

mikeblakeuk commented 4 years ago

@robertcoltheart It looks like it has fixed the issue but the logging has broken that beta build. https://github.com/machine/machine.specifications.runner.visualstudio/pull/98 We are currently using 2.10.1-pullrequest0098-11 in production, in DevOps, with Filters. :)

robertcoltheart commented 4 years ago

Released as v2.10.1-beta.2, please try again :)