Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

IpcConnectionClosedException unable to find Ben.Demystifier
lukesch
#1 Posted : Monday, March 21, 2022 7:25:36 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/10/2014(UTC)
Posts: 13

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I'm having trouble running netcore unit tests. The error complains about Ben.Demystifier on the ncrunch taskrunner. I've tried adding this as a reference in my test project with no luck. The problem disappears if I specify "Copy referenced assemblies to workspace." Can anything be done to avoid needing to set this property on all of my netcore test projects?

Code:
NCrunch encountered an error while trying to construct an environment to execute this test: The NCrunch task process failed to correctly initialise with the following exception: nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The NCrunch task process was unexpectedly terminated.  For information on how to troubleshoot this problem, please see https://www.ncrunch.net/documentation/troubleshooting_process-terminated-unexpected-error
   at nCrunch.TaskRunner.Ipc.Fast.IpcReader.Initialise()
   at nCrunch.TaskRunner.Ipc.Fast.IpcStream.Connect(String ipcName, Boolean isHost)
   at nCrunch.TaskRunner.Ipc.Fast.FastIpcClient.Connect(String ipcName)
   at nCrunch.Core.ProcessManagement.DefaultProcessLoader.ConnectToProcess(ExternalProcess externalProcess, ProcessLoadParameters parameters, Action`1 outOfBandMessageHandler)
   at nCrunch.Core.ProcessManagement.ExternalProcessManager..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Core.ProcessManagement.ExternalProcessManager.(EffectiveProcessorArchitecture , ProcessLoadParameters , Boolean )

The trace output for the process is as follows: 
Error:
  An assembly specified in the application dependencies manifest (nCrunch.TaskRunner.DotNetCore.20.x64.deps.json) was not found:
    package: 'Ben.Demystifier', version: '0.1.2'
    path: 'lib/netstandard2.0/Ben.Demystifier.dll'


My project looks like this:

Code:
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AssemblyName>Internal.OSS.AdoAdapterCoreTests</AssemblyName>
    <RootNamespace>Internal.OSS.AdoAdapterCoreTests</RootNamespace>
    <NoWarn>NU1605</NoWarn>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="FluentAssertions" />
    <PackageReference Include="HtmlAgilityPack" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" />
    <PackageReference Include="Microsoft.VisualStudio.Services.Client" />
    <PackageReference Include="Microsoft.VisualStudio.Services.Governance.Client" />
    <PackageReference Include="Microsoft.VisualStudio.Services.InteractiveClient" />
    <PackageReference Include="Microsoft.VisualStudio.Services.Release.Client" />
    <PackageReference Include="Microsoft.VisualStudio.Services.ServiceHooks.WebApi" />
    <PackageReference Include="MSTest.TestAdapter" />
    <PackageReference Include="MSTest.TestFramework" />
    <PackageReference Include="NSubstitute" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\..\..\dev\Common\src\AdoAdapterCore\AdoAdapterCore.csproj" />
    <ProjectReference Include="..\..\..\..\dev\Common\src\Logger\GenericLogger.csproj" />
    <ProjectReference Include="..\..\..\..\dev\Common\src\SecureStringUtils\SecureStringUtils.csproj" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AdoAdapterFactoryTests.cs" />
    <Compile Include="AdoAdapterTests.cs" />
    <Compile Include="Proxy\GraphHttpClientProxyTests.cs" />
    <Compile Include="Proxy\IdentityHttpClientProxyTests.cs" />
    <Compile Include="Proxy\ProxyTestBase.cs" />
    <Compile Include="Throttling\ConcurrentRequestLimiterTests.cs" />
    <Compile Include="Throttling\ExecuteWithRetriesExecutorTests.cs" />
    <Compile Include="Throttling\ExecuteWithRetriesFactoryTests.cs" />
    <Compile Include="Throttling\ServiceThrottlingStatusTests.cs" />
    <Compile Include="Throttling\ThrottlingConfigurationTests.cs" />
    <Compile Include="Throttling\VsoTraceEventTests.cs" />
    <Compile Include="Throttling\VstsRequestExecutorFactoryTests.cs" />
    <Compile Include="Throttling\VstsRequestExecutorTests.cs" />
  </ItemGroup>
</Project>
Remco
#2 Posted : Monday, March 21, 2022 7:57:07 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,571

Thanks: 862 times
Was thanked: 1176 time(s) in 1097 post(s)
Hi, thanks for sharing this issue.

The package in question (Ben.Demystifier) is not used by NCrunch. My suspicion is that this package is a dependency of one of the other packages or projects referenced by your project, and that for a reason I presently can't identify, the runtime expects it to exist in the build output directory.

I've tried building a replicate project using the info you've given me, but it seems that I'm missing a critical package (Microsoft.VisualStudio.Services.Governance.Client) which doesn't seem to be available on Nuget right now. The latest NSubstitute also gives me some complaints about compatibility with netcoreapp3.1.

My expectation is that this dependency configuration is always going to require the 'Copy referenced assemblies to workspace' to be turned on, because something in the referenced code set expects the environment to be that way. You might be able to narrow down which dependency is causing the problem by taking a copy of your project and stripping it down until the error goes away.
lukesch
#3 Posted : Monday, March 21, 2022 8:17:10 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/10/2014(UTC)
Posts: 13

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
It looks like Ben.Demystifier is used by Microsoft.VisualStudio.Services.InteractiveClient. What can I do with this information?
Remco
#4 Posted : Tuesday, March 22, 2022 6:56:44 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,571

Thanks: 862 times
Was thanked: 1176 time(s) in 1097 post(s)
lukesch;16038 wrote:
It looks like Ben.Demystifier is used by Microsoft.VisualStudio.Services.InteractiveClient. What can I do with this information?


Most likely, very little. We can try and dig a bit deeper to see if we can find out why the platform expects the assembly to be copied to local, but the most likely scenario is the one in which 'Copy referenced assemblies to workspace' needs to be left on.

We've tried in many cases to rig NCrunch so that you don't need to turn on this setting, but there are serious limits to what we can feasibly do when the build and runtime system itself is working against us.

I wasn't able to produce the problem when creating a project referencing the Microsoft.VisualStudio.Services.InteractiveClient package, so there must be more to this than just a simple dependency. Can you confirm whether you have the required version of the missing package inside the Nuget packages directory under your user profile?
lukesch
#5 Posted : Tuesday, March 22, 2022 3:56:03 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/10/2014(UTC)
Posts: 13

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
While I investigate that, let me ask a different question. Is there a way for ncrunch to detect this is a netsdk/netcore style test project and automatically turn this 'Copy referenced assemblies to workspace' setting on?
Remco
#6 Posted : Tuesday, March 22, 2022 10:32:37 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,571

Thanks: 862 times
Was thanked: 1176 time(s) in 1097 post(s)
lukesch;16042 wrote:
While I investigate that, let me ask a different question. Is there a way for ncrunch to detect this is a netsdk/netcore style test project and automatically turn this 'Copy referenced assemblies to workspace' setting on?


In the current build of NCrunch, there is no config setting that will do this for you. You can, however, set the 'Copy referenced assemblies to workspace' setting at a higher level in your configuration so that it applies to all projects and solutions.

In terms of modifying NCrunch so that it will do this in general, there are no plans to do this, as the majority of netcore projects can build without the setting enabled and therefore would perform better.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.041 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download