private void HandleSolutionOpened() { _scriptExecutor.Reset(); // Solution opened event is raised on the UI thread // Go off the UI thread before calling likely expensive call of ExecuteInitScriptsAsync // Also, it uses semaphores, do not call it from the UI thread Task.Run(async() => { UpdateWorkingDirectory(); var retries = 0; while (retries < ExecuteInitScriptsRetriesLimit) { if (_solutionManager.IsAllProjectsNominated()) { await ExecuteInitScriptsAsync(); break; } await Task.Delay(ExecuteInitScriptsRetryDelay); retries++; } }); }