diff --git a/src/Interactive/Host/Interactive/Core/InteractiveHost.RemoteService.cs b/src/Interactive/Host/Interactive/Core/InteractiveHost.RemoteService.cs index c338953c5752905f08fe77686157e003fd197fc4..ad50bfebf04df5f2ea123bcb7596233d46219d65 100644 --- a/src/Interactive/Host/Interactive/Core/InteractiveHost.RemoteService.cs +++ b/src/Interactive/Host/Interactive/Core/InteractiveHost.RemoteService.cs @@ -18,6 +18,7 @@ internal sealed class RemoteService public readonly Service Service; private readonly int _processId; private readonly SemaphoreSlim _disposeSemaphore = new SemaphoreSlim(initialCount: 1); + private readonly bool _joinOutputWritingThreadsOnDisposal; // output pumping threads (stream output from stdout/stderr of the host process to the output/errorOutput writers) private InteractiveHost _host; // nulled on dispose @@ -31,10 +32,12 @@ internal RemoteService(InteractiveHost host, Process process, int processId, Ser Debug.Assert(process != null); Debug.Assert(service != null); + Process = process; + Service = service; + _host = host; - this.Process = process; + _joinOutputWritingThreadsOnDisposal = host._joinOutputWritingThreadsOnDisposal; _processId = processId; - this.Service = service; _processExitHandlerStatus = ProcessExitHandlerStatus.Uninitialized; // TODO (tomat): consider using single-thread async readers @@ -140,7 +143,7 @@ internal void Dispose() InitiateTermination(Process, _processId); - if (_host._joinOutputWritingThreadsOnDisposal) + if (_joinOutputWritingThreadsOnDisposal) { try {