Build/Test Issues

Test runner fails to run on v4.3.0.13

Started by shellicar on 2,187 views

Received the following error after updating to 4.3.0.13.

NCrunch: This test was executed on server '(local)'

NCrunch encountered an error while trying to construct an environment to execute this test: nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed
   at nCrunch.Core.ProcessManagement.ExternalProcessManager.(EffectiveProcessorArchitecture , ProcessLoadParameters )
   at nCrunch.Core.ProcessManagement.ExternalProcessManager.LoadExternalProcess(ProcessLoadParameters parameters, GridClientId client)
   at nCrunch.Core.TestManagement.TestRunnerProcess..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Core.TestManagement.TestRunnerProcess.(Nullable`1 , FilePath , GridClientId , CustomVariable[] )
   at nCrunch.Core.TestManagement.TestRunnerProcess..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Core.TestManagement.TestRunnerProcess.LoadTestRunnerProcessForProjectReturningProcessId(SnapshotComponent snapshotComponent, IList`1 componentsInProcess, TestFrameworkDescription[] testingFrameworks, Nullable`1 newProcessTag, FilePath solutionFilePath, GridClientId client, CustomVariable[] customEnvironmentVariables)
   at nCrunch.Core.Processing.TestExecutionTaskLogic.DoProcessTaskAndReturnSuccessFlag()


Uninstalling NCrunch, then reinstalling v4.2.0.7 causes the tests to execute and pass.

Test project details.
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
</Project>

Edited

Hi, thanks for sharing this issue.

Are you able to recreate this problem with a sample solution? It's likely to be dependent on the main structural aspects of your project (i.e. framework, nuget references, etc), as opposed to your actual code.
Sure, I was able to reproduce this by narrowing down to the following two csproj entries.
The Sdk value, and the UseWindowsForms value.
This adds a reference to System.Windows.Forms for dotnet core targeting apps.

Note: In my actual test project, I no longer need a WindowsDesktop style sdk project,
so was able to get my tests working again with the latest version by reverting to a standard Sdk project.

NCrunchIssueRepro.csproj
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

	<PropertyGroup>
		<TargetFramework>netcoreapp3.1</TargetFramework>
		<UseWindowsForms>true</UseWindowsForms>
	</PropertyGroup>

	<ItemGroup>
		<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
	</ItemGroup>

</Project>


UnitTest1.cs
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace NCrunchIssueRepro
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
        }
    }
}



Setting UseWindowsForms to false allows the test runner to run, but causes the following expected errror if any code is executed that references forms.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
File name: 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
   at Library.Class1.Test()
   at NCrunchIssueRepro.UnitTest1.TestMethod1() in C:\Users\Stephen\source\repos\NCrunchIssueRepro\NCrunchIssueRepro\UnitTest1.cs:line 13
Thanks for sharing this. I have a feeling about what may be going on here. We'll take a look and will let you know as soon as we have more information.
I'd like to apologise for the time it's taken for me to get back to you on this issue. The last few weeks have been very interesting for everyone.

I realise that this problem probably doesn't affect you any more, but I've prepared a build containing a fix for it just in case someone else happens to have a test project with the same structure. Naturally, this fix will also be included in the 4.4 release.

NCrunch_Console_4.4.0.9.msi
NCrunch_Console_4.4.0.9.zip
NCrunch_GridNodeServer_4.4.0.9.msi
NCrunch_GridNodeServer_4.4.0.9.zip
NCrunch_LicenseServer_4.4.0.9.zip
NCrunch_VS2008_4.4.0.9.msi
NCrunch_VS2010_4.4.0.9.msi
NCrunch_VS2010_4.4.0.9.zip
NCrunch_VS2012_4.4.0.9.msi
NCrunch_VS2012_4.4.0.9.zip
NCrunch_VS2013_4.4.0.9.msi
NCrunch_VS2013_4.4.0.9.zip
NCrunch_VS2015_4.4.0.9.msi
NCrunch_VS2015_4.4.0.9.msi.7z
NCrunch_VS2015_4.4.0.9.zip
NCrunch_VS2017_4.4.0.9.msi
NCrunch_VS2017_4.4.0.9.msi.7z
NCrunch_VS2017_4.4.0.9.zip
NCrunch_VS2019_4.4.0.9.msi
NCrunch_VS2019_4.4.0.9.msi.7z
NCrunch_VS2019_4.4.0.9.zip
Remco wrote:I'd like to apologise for the time it's taken for me to get back to you on this issue. The last few weeks have been very interesting for everyone.

I realise that this problem probably doesn't affect you any more, but I've prepared a build containing a fix for it just in case someone else happens to have a test project with the same structure. Naturally, this fix will also be included in the 4.4 release.

Thanks so much for taking the time to address this and post a solution in the interim.
Really appreciate it, and I understand that the current circumstances pose additional challenges.

Post a reply

Log in to reply.