private async Task CompileAndSave()
        {
            var saveDialog = new SaveFileDialog
            {
                OverwritePrompt = true,
                AddExtension    = true,
                Filter          = "Assemblies|*.dll",
                DefaultExt      = "dll"
            };

            if (saveDialog.ShowDialog(Application.Current.MainWindow) != true)
            {
                return;
            }

            var code = await GetCode(CancellationToken.None).ConfigureAwait(true);

            var results = new ObservableCollection <ResultObject>();

            Results = results;

            HookDumped(results, CancellationToken.None);

            try
            {
                await Task.Run(() => _executionHost.CompileAndSave(code, saveDialog.FileName)).ConfigureAwait(true);
            }
            catch (CompilationErrorException ex)
            {
                foreach (var diagnostic in ex.Diagnostics)
                {
                    results.Add(ResultObject.Create(diagnostic));
                }
            }
            catch (Exception ex)
            {
                AddResult(ex, results, CancellationToken.None);
            }
        }
        private async Task CompileAndSave()
        {
            var saveDialog = _serviceLocator.GetInstance <ISaveFileDialog>();

            saveDialog.OverwritePrompt = true;
            saveDialog.AddExtension    = true;
            saveDialog.Filter          = "Libraries|*.dll|Executables|*.exe";
            saveDialog.DefaultExt      = "dll";
            if (saveDialog.Show() != true)
            {
                return;
            }

            var code = await GetCode(CancellationToken.None).ConfigureAwait(true);

            var results = new ObservableCollection <ResultObject>();

            ResultsInternal = results;

            HookDumped(results, CancellationToken.None);

            try
            {
                await Task.Run(() => _executionHost.CompileAndSave(code, saveDialog.FileName)).ConfigureAwait(true);
            }
            catch (CompilationErrorException ex)
            {
                foreach (var diagnostic in ex.Diagnostics)
                {
                    results.Add(ResultObject.Create(diagnostic));
                }
            }
            catch (Exception ex)
            {
                AddResult(ex, results, CancellationToken.None);
            }
        }