private void uninstall_cleanup(ChocolateyConfiguration config, PackageResult packageResult)
        {
            _packageInfoService.remove_package_information(packageResult.Package);
            ensure_bad_package_path_is_clean(config, packageResult);
            remove_rollback_if_exists(packageResult);
            handle_extension_packages(config, packageResult);

            if (config.Force)
            {
                var packageDirectory = _fileSystem.combine_paths(packageResult.InstallLocation);

                if (string.IsNullOrWhiteSpace(packageDirectory) || !_fileSystem.directory_exists(packageDirectory))
                {
                    return;
                }

                if (packageDirectory.is_equal_to(ApplicationParameters.InstallLocation) || packageDirectory.is_equal_to(ApplicationParameters.PackagesLocation))
                {
                    packageResult.Messages.Add(
                        new ResultMessage(
                            ResultType.Error,
                            "Install location is not specific enough, cannot force remove directory:{0} Erroneous install location captured as '{1}'".format_with(Environment.NewLine, packageResult.InstallLocation)
                            )
                        );
                    return;
                }

                FaultTolerance.try_catch_with_logging_exception(
                    () => _fileSystem.delete_directory_if_exists(packageDirectory, recursive: true),
                    "Attempted to remove '{0}' but had an error".format_with(packageDirectory),
                    logWarningInsteadOfError: true);
            }
        }
        public ConcurrentDictionary <string, PackageResult> uninstall_run(ChocolateyConfiguration config)
        {
            this.Log().Info(@"Uninstalling the following packages:");
            this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(config.PackageNames));

            var packageUninstalls = _nugetService.uninstall_run(
                config,
                (packageResult) =>
            {
                if (!_fileSystem.directory_exists(packageResult.InstallLocation))
                {
                    packageResult.InstallLocation += ".{0}".format_with(packageResult.Package.Version.to_string());
                }

                _shimgenService.uninstall(config, packageResult);

                if (!config.SkipPackageInstallProvider)
                {
                    _powershellService.uninstall(config, packageResult);
                }

                _autoUninstallerService.run(packageResult, config);

                if (packageResult.Success)
                {
                    //todo: v2 clean up package information store for things no longer installed (call it compact?)
                    _packageInfoService.remove_package_information(packageResult.Package);
                }

                //todo:prevent reboots
            });

            var uninstallFailures = packageUninstalls.Count(p => !p.Value.Success);

            this.Log().Warn(() => @"{0}{1} uninstalled {2}/{3} packages. {4} packages failed.{0}See the log for details.".format_with(
                                Environment.NewLine,
                                ApplicationParameters.Name,
                                packageUninstalls.Count(p => p.Value.Success && !p.Value.Inconclusive),
                                packageUninstalls.Count,
                                uninstallFailures));

            if (uninstallFailures != 0)
            {
                this.Log().Error("Failures");
                foreach (var failure in packageUninstalls.Where(p => !p.Value.Success).or_empty_list_if_null())
                {
                    this.Log().Error(" - {0}".format_with(failure.Value.Name));
                }
            }

            if (uninstallFailures != 0 && Environment.ExitCode == 0)
            {
                Environment.ExitCode = 1;
            }

            return(packageUninstalls);
        }