Build/Test Issues

macOS and IpcConnectionClosedException

Started by hhoangnl on 2,419 views

I tried running nCrunch 4.15.0.4 on the following setup:
- Macbook M1 Max
- macOS
- Parallels
- Windows 11 VM
- Visual Studio 2022 Community

I get the following error even with the simplest code possible:

An error occurred while analysing this project after it was built: NCrunch encountered an unexpected error occurred while building an environment to analyse an assembly: 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 )


public class Test
{
    [Fact]
    public void Foo()
    {
    }
}

Edited

Hi, thanks for sharing this.

Can you clarify for me whether NCrunch itself is running inside the Win11 VM? We don't support macOS, but if you're in a VM running Windows, in theory it should work.

If you are inside the VM, could you submit a bug report after you've had this happen to you? The report contains a log that might yield the underlying error. I think there is an installable component that is missing on your system (probably a .NET SDK).
Thanks for sending through the bug report. There is a rather interesting error in the log:

[PID:7380 00:45:43.5887 ProcessOutputRedirectionErr-35] Process 20700: Unhandled exception. System.BadImageFormatException: Could not load file or assembly 'C:\Users\____\AppData\Local\NCrunch\7380\3\Test\bin\Debug\net6.0\nCrunch.TaskRunner.DotNetCore.20.x64.dll'. An attempt was made to load a program with an incorrect format.

Is this a 32-bit VM? Or are you working in a 32-bit environment? Usually this error is related to inconsistencies in build or host configuration in regards to CPU architecture.
Ah, I'm running Visual Studio Community 2022 (ARM 64-bit).

The nCrunch processes are running on x64 architecture, though (according to the Task Manager).

Edited

It does work with .NET Framework projects, though. Just not with .NET 6 and 7.
I managed to get nCrunch working by setting the nCrunch configuration of the unit test project to x86.
Both the Autodetect and x64 values were causing the IpcConnectionClosedException.

Hope this helps others too.
Is there any plans to make NCrunch cross-platform or it's core functionality is tied to Windows OS ?
Hi,

There are no firm plans for this at the moment. The project was started in 2009, when the whole idea of a cross platform .NET seemed unthinkable, so it was never a design consideration.

It's not impossible. It's just not something that I can commit to at this stage.

Post a reply

Log in to reply.