/// <summary>
 /// Executes a delegate, catching any thrown exceptions and converting them to HRESULTs.
 /// </summary>
 private HResult HrInvoke(Func <Task <HResult> > asyncAction, bool registerProjectFaultHandlerService = false)
 {
     return(HResult.Invoke(
                delegate
     {
         return ThreadingService.ExecuteSynchronously(asyncAction);
     },
                Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider,
                registerProjectFaultHandlerService ? ProjectFaultHandlerService : null,
                UnconfiguredProject));
 }
Exemple #2
0
        public CPSProjectManagerI(UnconfiguredProject unconfiguredProject)
        {
            UnconfiguredProject = unconfiguredProject;
            ProjectLockService  = unconfiguredProject.ProjectService.Services.ProjectLockService;
            ThreadingService    = unconfiguredProject.ProjectService.Services.ThreadingPolicy;
            var activeConfiguredProjectSubscription = unconfiguredProject.Services.ActiveConfiguredProjectSubscription;
            var projectSource = activeConfiguredProjectSubscription.ProjectSource;

            ProjectSubscription = projectSource.SourceBlock.LinkTo(
                new ActionBlock <IProjectVersionedValue <IProjectSnapshot> >(ProjectUpdateAsync));

            ThreadingService.ExecuteSynchronously(async() =>
            {
                using (var projectWriteLock = await ProjectLockService.ReadLockAsync())
                {
                    var configuredProject = await UnconfiguredProject.GetSuggestedConfiguredProjectAsync();
                    MSBuildProject        = await projectWriteLock.GetProjectAsync(configuredProject);
                }
            });
        }