/// <summary> /// Wait for the loop task to complete. /// </summary> public void Dispose() { if (!RunningTask.IsCanceled) { logger.LogInformation("Waiting for {0} to finish.", Name); RunningTask.Wait(); } }