public override void Dispose()
        {
            if (this.pipeWriter != null)
            {
                this.pipeWriter.Stop();
                this.pipeWriter.Dispose();
                this.pipeWriter = null;
            }

            base.Dispose();
        }
        void IQueuedPipeStringWriterEventSink.OnStateChanged(
            QueuedPipeStringWriter writer,
            QueuedPipeStringWriterState state,
            Exception exception)
        {
            switch (state)
            {
            case QueuedPipeStringWriterState.Failing:
                this.RaiseListenerFailure(exception?.ToString());
                break;

            case QueuedPipeStringWriterState.Healthy:
                this.RaiseListenerRecovery();
                break;
            }
        }
        private TelemetryDaemonEventListener(
            string providerName,
            string enlistmentId,
            string mountId,
            string pipeName,
            IEventListenerEventSink eventSink)
            : base(EventLevel.Verbose, Keywords.Telemetry, eventSink)
        {
            this.providerName = providerName;
            this.enlistmentId = enlistmentId;
            this.mountId      = mountId;
            this.vfsVersion   = ProcessHelper.GetCurrentProcessVersion();

            this.pipeWriter = new QueuedPipeStringWriter(
                () => new NamedPipeClientStream(".", pipeName, PipeDirection.Out, PipeOptions.Asynchronous),
                this);
            this.pipeWriter.Start();
        }