Exemplo n.º 1
0
 public object GetValue(string name)
 {
     try
     {
         return(_registryKey.GetValue(name));
     }
     catch (SecurityException ex)
     {
         // If the user doesn't have access to the registry, then we'll return null
         ExceptionHelper.WriteErrorToActivityLog(ex);
         return(null);
     }
 }
Exemplo n.º 2
0
        public IRegistryKey OpenSubKey(string name)
        {
            try
            {
                var key = _registryKey.OpenSubKey(name);

                if (key != null)
                {
                    return(new RegistryKeyWrapper(key));
                }
            }
            catch (SecurityException ex)
            {
                // If the user doesn't have access to the registry, then we'll return null
                ExceptionHelper.WriteErrorToActivityLog(ex);
            }

            return(null);
        }
Exemplo n.º 3
0
        public void RestorePackages(Project project)
        {
            try
            {
                var solutionDirectory   = _solutionManager.SolutionDirectory;
                var nuGetProjectContext = new EmptyNuGetProjectContext();

                // We simply use ThreadHelper.JoinableTaskFactory.Run instead of PumpingJTF.Run, unlike,
                // VsPackageInstaller and VsPackageUninstaller. Because, no powershell scripts get executed
                // as part of the operations performed below. Powershell scripts need to be executed on the
                // pipeline execution thread and they might try to access DTE. Doing that under
                // ThreadHelper.JoinableTaskFactory.Run will consistently result in a hang
                NuGetUIThreadHelper.JoinableTaskFactory.Run(() =>
                                                            _restoreManager.RestoreMissingPackagesInSolutionAsync(solutionDirectory,
                                                                                                                  nuGetProjectContext,
                                                                                                                  CancellationToken.None));
            }
            catch (Exception ex)
            {
                ExceptionHelper.WriteErrorToActivityLog(ex);
            }
        }