Resetting the engine causes the workspaces to be purged, with new ones created as the projects start getting built. So I don't think it was removing the workspaces that actually solved this.
I think this might actually be something in the source code itself that eventually reset itself, perhaps one of the MSBuild dependency cache files. If you see this again, I'd be interested in knowing whether doing an MSBuild clean then a reset of NCrunch makes it go away.
Ok so I did this.
In Rider, created a solution with 2 test projects
Ran the tests. all ok
Renamed project 2 to project 3 . This made project 3 appear in the test window but project 2 still show with the error:
System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'D:\missingProject\project2'.
at System.Environment.set_CurrentDirectoryCore(String value)
at nCrunch.Compiler.ComponentAnalysisContext.prepareAnalysisContext()
at nCrunch.Compiler.ComponentAnalysisContext..ctor(ComponentLoadParameters loadParameters, IBuildableProject buildableProject, DirectoryPath baseIntermediateOutputPath, DirectoryPath msBuildDirectory)
at nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.processCallMethodMessage(CallMethodMessage callMethodMessage)
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data)
at nCrunch.TaskRunner.Ipc.RemoteProxyCommunicator.readMessage(Byte[] returnedData)
at nCrunch.TaskRunner.Ipc.RemoteProxyCommunicator.Invoke(String methodName, Object[] args)
at nCrunch.Compiler.RemoteBuildRunnerProxy.AnalyseComponentBuild(ComponentLoadParameters parameters)
at nCrunch.Core.BuildManagement.BuildProcessLauncher.<>c__DisplayClass4_0.<AnalyseComponentBuildInExternalProcess>b__0(IRemoteBuildRunner remoteBuildRunner)
at nCrunch.Core.BuildManagement.BuildProcessLauncher.executeTaskUsingExternalProcess(Action`1 task, EffectiveProcessorArchitecture processorArchitecture, GridClientId client, BuildSystemParameters buildSystemParameters, IList`1 customEnvironmentVariables, Nullable`1 taskId, GridClientDescription clientDescription, DotNetCoreSdkVersion dotNetCoreSdkVersion)
at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(ComponentLoadParameters parameters, IList`1 customEnvironmentVariables)
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.analyseComponentBuild(EffectiveProcessorArchitecture buildProcessorArchitecture, String targetFrameworkForMSBuild)
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, IDEVersion ideVersion, BuildEngineId buildEngineId, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFrameworkForMsbuild, String visibleTargetFramework)
From Rider I did a clean, this also rebuit the project.
I pressed the "restart ncrunch" button in test explorer, missing project still showing
Disabled and enabled ncrunch no effect
restart ncrunch no effect
restarted rider, project gone.
Can also confirm this, sometimes NCrunch messes up. Has not the current changes, or projects. Rebuild/Restart from NCrunch does not help; also, disabling and re-enabling NCrunch does not help.
Have to Close Rider and restart. Then it is fine.
Excellent, thanks! This is useful. I suspect there is something going on in our renaming tracking that causes misalignment. Because the project list is held inside the IDE and not in the engine, a reset of NCrunch won't solve it but a restart of the IDE will. I'll take a closer look and see what I can do.