public void Stop() { lock (this) { if (service != null) { service.Dispose(); service = null; } if (worker != null) { worker.Dispose(); worker = null; } if (pipeline != null) { pipeline?.Stop(); pipeline = null; } } }