private void Terminate() { if (InterpreterManager.IsRunning) { InterpreterManager.CancelRunningExtension(); } if (DriverManager.IsRunning) { DriverManager.CancelRunningExtension(); } if (tokenSource != null && !tokenSource.IsCancellationRequested) { tokenSource.Cancel(); } isRunning = false; }