void IVsAppContainerProjectDeployCallback.OnEndDeploy(bool successful, string deployedPackageMoniker, string deployedAppUserModelID)
        {
            try
            {
                if (successful)
                {
                    deployPackageMoniker = deployedPackageMoniker;
                    deployAppUserModelID = deployedAppUserModelID;
                    NotifyEndDeploy(1);
                }
                else
                {
                    deployPackageMoniker = null;
                    deployAppUserModelID = null;
                    NotifyEndDeploy(0);
                }
            }
            finally
            {
                IVsDebuggerDeployConnection localConnection = null;

                lock (syncObject)
                {
                    this.appContainerBootstrapperOperation = null;
                    this.appContainerDeployOperation       = null;
                    localConnection = this.debuggerDeployConnection;
                    this.debuggerDeployConnection = null;
                }

                if (localConnection != null)
                {
                    localConnection.Dispose();
                }
            }
        }
        int IVsDeployableProjectCfg.StopDeploy(int fSync)
        {
            IVsTask localAppContainerBootstrapperOperation = null;
            IVsAppContainerProjectDeployOperation localAppContainerDeployOperation = null;

            lock (syncObject)
            {
                localAppContainerBootstrapperOperation = this.appContainerBootstrapperOperation;
                localAppContainerDeployOperation       = this.appContainerDeployOperation;
                this.appContainerBootstrapperOperation = null;
                this.appContainerDeployOperation       = null;
            }

            if (localAppContainerBootstrapperOperation != null)
            {
                localAppContainerBootstrapperOperation.Cancel();
                if (fSync != 0)
                {
                    try
                    {
                        localAppContainerBootstrapperOperation.Wait();
                    }
                    catch
                    {
                    }
                }
            }

            if (localAppContainerDeployOperation != null)
            {
                localAppContainerDeployOperation.StopDeploy(fSync != 0);
            }

            return(VSConstants.S_OK);
        }
Example #3
0
        protected IVsTask RefreshOrAddTasks(IVsTaskItem[] newTasks)
        {
            if (newTasks.Length <= 0)
            {
                return(null);
            }

            // Don't update more than this many items at a time to avoid perf problems
            const int MaxTasksToAddInOneCall = 50;

            if (newTasks.Length <= MaxTasksToAddInOneCall)
            {
                return(_tasklist.RefreshOrAddTasksAsync(_providerCookie, newTasks.Length, newTasks));
            }
            else
            {
                var arraySubset = new IVsTaskItem[MaxTasksToAddInOneCall];

                IVsTask lastTask = null;
                for (int i = 0; i < newTasks.Length; i += MaxTasksToAddInOneCall)
                {
                    var subsetSize = Math.Min(MaxTasksToAddInOneCall, newTasks.Length - i);
                    if (subsetSize > 0)
                    {
                        Array.Copy(newTasks, i, arraySubset, 0, subsetSize);
                        lastTask = _tasklist.RefreshOrAddTasksAsync(_providerCookie, subsetSize, arraySubset);
                    }
                }

                // we only need last task. VS already serialize request internally
                return(lastTask);
            }
        }
Example #4
0
 public async Task ExplicitVsTaskCreation()
 {
     IVsTask vsTask = VsTaskLibraryHelper.CreateAndStartTask(
         VsTaskLibraryHelper.ServiceInstance,
         VsTaskRunContext.UIThreadNormalPriority,
         VsTaskLibraryHelper.CreateTaskBody(() => Assert.True(ThreadHelper.CheckAccess())));
     await vsTask;
 }
        /// <summary>
        /// Executes a non-cancellable operation in the specified <see cref="VsTaskRunContext"/> and doesn't wait until it is completed
        /// </summary>
        /// <param name="serviceProvider">An instance of <see cref="IServiceProvider"/>. Required.</param>
        /// <param name="context">The <see cref="VsTaskRunContext"/> in which to run the operation</param>
        /// <param name="op">The operation to run</param>
        internal static void BeginTask(IServiceProvider serviceProvider, VsTaskRunContext context, Action op)
        {
            Debug.Assert(serviceProvider != null, "IServiceProvider is required");
            Debug.Assert(op != null, "Action is required");
            IVsTaskSchedulerService taskService = serviceProvider.GetService(typeof(SVsTaskSchedulerService)) as IVsTaskSchedulerService;
            IVsTaskBody             body        = VsTaskLibraryHelper.CreateTaskBody(op);
            IVsTask task = VsTaskLibraryHelper.CreateTask(taskService, context, VsTaskCreationOptions.NotCancelable, body, null);

            task.Start();
        }
        /// <summary>
        /// Executes the cancellable operation in the supplied <see cref="VsTaskRunContext"/>. The result of the operation is of the generic method argument T.
        /// </summary>
        /// <param name="serviceProvider">An instance of <see cref="IServiceProvider"/>. Required.</param>
        /// <param name="context">The <see cref="VsTaskRunContext"/> in which to run the operation</param>
        /// <param name="op">The operation to run</param>
        /// <param name="token">Option cancellation token <see cref="CancellationToken"/></param>
        /// <returns>An await-able object that returns a result</returns>
        internal static async TPL.Task <T> RunTask <T>(IServiceProvider serviceProvider, VsTaskRunContext context, Func <T> op, CancellationToken token)
        {
            IVsTask task = CreateTask <T>(serviceProvider, context, op, token);

            task.Start();
            await task.GetAwaiter();

            Debug.Assert(!task.IsFaulted, "Not expecting to be faulted and reach this far");
            return((T)task.GetResult());
        }
        IVsTask IVsTaskSchedulerService.ContinueWhenAllCompletedEx(uint context, uint tasks, IVsTask[] dependentTasks, uint options, IVsTaskBody taskBody, object asyncState)
        {
            foreach (IVsTask t in dependentTasks)
            {
                if (!t.IsCompleted)
                {
                    t.Start();
                }
            }

            IVsTask task = ((IVsTaskSchedulerService)this).CreateTask(context, taskBody);
            task.Start();
            return task;
        }
Example #8
0
        IVsTask IVsTaskSchedulerService.ContinueWhenAllCompletedEx(uint context, uint tasks, IVsTask[] dependentTasks, uint options, IVsTaskBody taskBody, object asyncState)
        {
            foreach (IVsTask t in dependentTasks)
            {
                if (!t.IsCompleted)
                {
                    t.Start();
                }
            }

            IVsTask task = ((IVsTaskSchedulerService)this).CreateTask(context, taskBody);

            task.Start();
            return(task);
        }
        private void NotifyEndDeploy(int success)
        {
            try {
                foreach (IVsDeployStatusCallback callback in GetSinkCollection())
                {
                    callback.OnEndDeploy(success);
                }
            } finally {
                lock (syncObject) {
                    this.appContainerBootstrapperOperation = null;
                    this.deployOp = null;
                }
            }

            outputWindow = null;
        }
        /// <summary>
        /// Creates a <see cref="IVsTask"/> in the specified <see cref="VsTaskRunContext"/>
        /// </summary>
        /// <param name="serviceProvider">An instance of <see cref="IServiceProvider"/>. Required.</param>
        /// <param name="context">The <see cref="VsTaskRunContext"/> in which to run the operation</param>
        /// <param name="op">The operation to run</param>
        /// <param name="token">Option cancellation token <see cref="CancellationToken"/></param>
        /// <returns>An await-able object that returns a result</returns>
        private static IVsTask CreateTask <T>(IServiceProvider serviceProvider, VsTaskRunContext context, Func <T> op, CancellationToken token)
        {
            Debug.Assert(serviceProvider != null, "IServiceProvider is required");
            Debug.Assert(op != null, "op is required");

            IVsTaskSchedulerService taskService = serviceProvider.GetService(typeof(SVsTaskSchedulerService)) as IVsTaskSchedulerService;
            IVsTaskBody             body        = VsTaskLibraryHelper.CreateTaskBody(() => (object)op());
            IVsTask task = VsTaskLibraryHelper.CreateTask(taskService, context, body);

            if (token != CancellationToken.None)
            {
                task.ApplyCancellationToken(token);
            }

            return(task);
        }
Example #11
0
        public void UpdateSolution_QueryDelayBuildAction(uint dwAction, out IVsTask pDelayTask)
        {
            if (!_isMEFInitialized)
            {
                ThreadHelper.JoinableTaskFactory.Run(async() =>
                {
                    var componentModel = await _serviceProvider.GetComponentModelAsync();
                    componentModel.DefaultCompositionService.SatisfyImportsOnce(this);
                });

                _isMEFInitialized = true;
            }

            pDelayTask = SolutionRestoreWorker.Value.JoinableTaskFactory.RunAsyncAsVsTask(
                VsTaskRunContext.UIThreadBackgroundPriority, (token) => RestoreAsync(dwAction, token));
        }
        public FullyLoadedStatusContainer(
            ExtensionStatusContainer esc
            )
        {
            if (esc is null)
            {
                throw new ArgumentNullException(nameof(esc));
            }

            _esc = esc;

            _task = ThreadHelper.JoinableTaskFactory.RunAsyncAsVsTask <int>(
                VsTaskRunContext.UIThreadBackgroundPriority,
                ReadFullyLoadStatusAsync
                );
        }
Example #13
0
        private int Deploy()
        {
            try {
                foreach (IVsDeployStatusCallback callback in deployCallbackCollection)
                {
                    callback.OnEndDeploy(1);
                }
            } finally {
                lock (syncObject) {
                    appContainerBootstrapperOperation = null;
                    deployOp = null;
                }
            }

            this.outputWindow = null;

            return(VSConstants.S_OK);
        }
Example #14
0
        public int StopDeploy(int fSync)
        {
            IVsTask bootstrapOp = null;
            IVsAppContainerProjectDeployOperation deployOp = null;
            int result = VSConstants.S_OK;

            lock (syncObject) {
                bootstrapOp = appContainerBootstrapperOperation;
                deployOp    = this.deployOp;
                appContainerBootstrapperOperation = null;
                this.deployOp = null;
            }

            if (bootstrapOp != null)
            {
                bootstrapOp.Cancel();
                if (fSync != 0)
                {
                    try {
                        bootstrapOp.Wait();
                    } catch (Exception e) {
                        if (outputWindow != null)
                        {
                            outputWindow.OutputString(e.ToString());
                        }
                        result = VSConstants.E_FAIL;
                    }
                }
            }

            if (deployOp != null)
            {
                deployOp.StopDeploy(fSync != 0);
            }

            return(result);
        }
        private static T RunInContext <T>(IServiceProvider serviceProvider, VsTaskRunContext context, Func <T> op, T faultedResult)
        {
            bool executeOperationDirectly = context == VsTaskRunContext.CurrentContext || ThreadHelper.CheckAccess() == VsTaskLibraryHelper.IsUIThreadContext(context);

            if (executeOperationDirectly)
            {
                return(op());
            }
            else
            {
                T         result = faultedResult;
                Exception fault  = null;
                IVsTask   task   = CreateTask <T>(serviceProvider, context, () =>
                {
                    try
                    {
                        return(result = op());
                    }
                    catch (Exception ex)
                    {
                        fault = ex;
                        throw;     // VS doesn't bubble up the exception
                    }
                }, CancellationToken.None);

                task.Start();
                task.Wait();
                Debug.Assert(!task.IsFaulted, "Not expecting any faults");
                if (fault != null)
                {
                    throw new Exception(string.Empty, fault);
                }

                return(result);
            }
        }
        void IVsAppContainerProjectDeployCallback.OnEndDeploy(bool successful, string deployedPackageMoniker, string deployedAppUserModelID)
        {
            try
            {
                if (successful)
                {
                    deployPackageMoniker = deployedPackageMoniker;
                    deployAppUserModelID = deployedAppUserModelID;
                    NotifyEndDeploy(1);
                }
                else
                {
                    deployPackageMoniker = null;
                    deployAppUserModelID = null;
                    NotifyEndDeploy(0);
                }
            }
            finally
            {
                IVsDebuggerDeployConnection localConnection = null;

                lock (syncObject)
                {
                    this.appContainerBootstrapperOperation = null;
                    this.appContainerDeployOperation = null;
                    localConnection = this.debuggerDeployConnection;
                    this.debuggerDeployConnection = null;
                }

                if (localConnection != null)
                {
                    localConnection.Dispose();
                }
            }
        }
        private int PhoneDeploy()
        {
            IVsAppContainerBootstrapper3 bootstrapper = (IVsAppContainerBootstrapper3)ServiceProvider.GlobalProvider.GetService(typeof(SVsAppContainerProjectDeploy));

            string projectUniqueName = GetProjectUniqueName(); 
             IVsTask localAppContainerBootstrapperOperation = bootstrapper.BootstrapAsync(projectUniqueName,
                                                                                            DeviceIdString,
                                                                                            packagesToDeployList.Length,
                                                                                            packagesToDeployList,
                                                                                            optionalPackagesToDeploy.Length,
                                                                                            optionalPackagesToDeploy,
                                                                                            this);

            lock (syncObject)
            {
                this.appContainerBootstrapperOperation = localAppContainerBootstrapperOperation;
            }

            ThreadHelper.JoinableTaskFactory.RunAsync(async () =>
            {
                IVsAppContainerBootstrapperResult result = null;
                try
                {
                    object taskResult = await localAppContainerBootstrapperOperation;
                    result = (IVsAppContainerBootstrapperResult)taskResult;
                }
                finally
                {
                    this.OnBootstrapEnd(DeviceIdString, result);
                }
            });

            return VSConstants.S_OK;
        }
        private int RemoteDeploy()
        {
            IVsAppContainerBootstrapper4 bootstrapper = (IVsAppContainerBootstrapper4)ServiceProvider.GlobalProvider.GetService(typeof(SVsAppContainerProjectDeploy));
            BootstrapMode bootStrapMode = BootstrapMode.UniversalBootstrapMode;

            VsDebugTargetInfo2[] targets;
            int hr = QueryDebugTargets(out targets);
            if (ErrorHandler.Failed(hr))
            {
                NotifyEndDeploy(0);
                return hr;
            }

            string projectUniqueName = GetProjectUniqueName();
            IVsTask localAppContainerBootstrapperOperation = bootstrapper.BootstrapAsync(projectUniqueName,
                                                                                         targets[0].bstrRemoteMachine,
                                                                                         bootStrapMode,
                                                                                         packagesToDeployList.Length,
                                                                                         packagesToDeployList,
                                                                                         optionalPackagesToDeploy.Length,
                                                                                         optionalPackagesToDeploy,
                                                                                         this);

            lock (syncObject)
            {
                this.appContainerBootstrapperOperation = localAppContainerBootstrapperOperation;
            }

            ThreadHelper.JoinableTaskFactory.RunAsync(async () =>
            {
                IVsAppContainerBootstrapperResult result = null;
                try
                {
                    object taskResult = await localAppContainerBootstrapperOperation;
                    result = (IVsAppContainerBootstrapperResult)taskResult;
                }
                finally
                {
                    this.OnBootstrapEnd(targets[0].bstrRemoteMachine, result);
                }
            });

            return VSConstants.S_OK;
        }
 private void NotifyEndDeploy(int fSuccess)
 {
     try
     {
         foreach (IVsDeployStatusCallback callback in GetSinkCollection())
         {
             callback.OnEndDeploy(fSuccess);
         }
     }
     finally
     {
         lock (syncObject)
         {
             this.appContainerBootstrapperOperation = null;
             this.appContainerDeployOperation = null;
         }
     }
 }
 public void UpdateSolution_QueryDelayBuildAction(uint dwAction, out IVsTask pDelayTask)
 {
     pDelayTask = SolutionRestoreWorker.Value.JoinableTaskFactory.RunAsyncAsVsTask(
         VsTaskRunContext.UIThreadBackgroundPriority, (token) => RestoreAsync(dwAction, token));
 }
Example #21
0
        private int Deploy() {
            try {
                foreach (IVsDeployStatusCallback callback in deployCallbackCollection) {
                    callback.OnEndDeploy(1);
                }
            } finally {
                lock (syncObject) {
                    appContainerBootstrapperOperation = null;
                    deployOp = null;
                }
            }

            this.outputWindow = null;

            return VSConstants.S_OK;
        }
Example #22
0
        public int StopDeploy(int fSync) {
            IVsTask bootstrapOp = null;
            IVsAppContainerProjectDeployOperation deployOp = null;
            int result = VSConstants.S_OK;

            lock (syncObject) {
                bootstrapOp = appContainerBootstrapperOperation;
                deployOp = this.deployOp;
                appContainerBootstrapperOperation = null;
                this.deployOp = null;
            }

            if (bootstrapOp != null) {
                bootstrapOp.Cancel();
                if (fSync != 0) {
                    try {
                        bootstrapOp.Wait();
                    } catch (Exception e) {
                        if (outputWindow != null) {
                            outputWindow.OutputString(e.ToString());
                        }
                        result = VSConstants.E_FAIL;
                    }
                }
            }

            if (deployOp != null) {
                deployOp.StopDeploy(fSync != 0);
            }

            return result;
        }
 /// <inheritdoc />
 public void AddDependentTask(IVsTask pTask)
 {
     // We run everything on a threadpool so we ignore this
 }
Example #24
0
        public int StartDeploy(IVsOutputWindowPane pIVsOutputWindowPane, uint dwOptions) {
            outputWindow = pIVsOutputWindowPane;

            if (!NotifyBeginDeploy()) {
                return VSConstants.E_ABORT;
            }

            VsDebugTargetInfo2[] targets;
            int hr = QueryDebugTargets(out targets);
            if (ErrorHandler.Failed(hr)) {
                NotifyEndDeploy(0);
                return hr;
            }

            string projectUniqueName = this.GetProjectUniqueName();

            IVsAppContainerBootstrapper4 bootstrapper = (IVsAppContainerBootstrapper4)ServiceProvider.GlobalProvider.GetService(typeof(SVsAppContainerProjectDeploy));
            VsBootstrapperPackageInfo[] packagesToDeployList = new VsBootstrapperPackageInfo[] {
                new VsBootstrapperPackageInfo { PackageName = "EB22551A-7F66-465F-B53F-E5ABA0C0574E" }, // NativeMsVsMon
                new VsBootstrapperPackageInfo { PackageName = "62B807E2-6539-46FB-8D67-A73DC9499940" } // ManagedMsVsMon
            };
            VsBootstrapperPackageInfo[] optionalPackagesToDeploy = new VsBootstrapperPackageInfo[] {
                new VsBootstrapperPackageInfo { PackageName = "FEC73B34-86DE-4EA8-BFF4-3600A0443E9C" }, // NativeMsVsMonDependency
                new VsBootstrapperPackageInfo { PackageName = "B968CC6A-D2C8-4197-88E3-11662042C291" }, // XamlUIDebugging
                new VsBootstrapperPackageInfo { PackageName = "8CDEABEF-33E1-4A23-A13F-94A49FF36E84" }  // XamlUIDebuggingDependency
            };

            BootstrapMode bootStrapMode = BootstrapMode.UniversalBootstrapMode;
            
            IVsTask localAppContainerBootstrapperOperation = bootstrapper.BootstrapAsync(projectUniqueName,
                                                                            targets[0].bstrRemoteMachine,
                                                                            bootStrapMode,
                                                                            packagesToDeployList.Length,
                                                                            packagesToDeployList,
                                                                            optionalPackagesToDeploy.Length,
                                                                            optionalPackagesToDeploy,
                                                                            this);

            lock (syncObject) {
                this.appContainerBootstrapperOperation = localAppContainerBootstrapperOperation;
            }

            ThreadHelper.JoinableTaskFactory.RunAsync(async () => {
                IVsAppContainerBootstrapperResult result = null;
                try {
                    object taskResult = await localAppContainerBootstrapperOperation;
                    result = (IVsAppContainerBootstrapperResult)taskResult;
                } finally {
                    this.OnBootstrapEnd(projectUniqueName, result);
                }
            });

            return VSConstants.S_OK;
        }
        int IVsDeployableProjectCfg.StartDeploy(IVsOutputWindowPane pIVsOutputWindowPane, uint dwOptions)
        {
            outputWindow = pIVsOutputWindowPane;

            if (!NotifyBeginDeploy())
            {
                return(VSConstants.E_ABORT);
            }

            IVsAppContainerBootstrapper4 bootstrapper = (IVsAppContainerBootstrapper4)ServiceProvider.GlobalProvider.GetService(typeof(SVsAppContainerProjectDeploy));

            VsBootstrapperPackageInfo[] packagesToDeployList = new VsBootstrapperPackageInfo[] {
                new VsBootstrapperPackageInfo {
                    PackageName = "D8B19935-BDBF-4D5B-9619-A6693AFD4554"
                },                                                                                      // ScriptMsVsMon
                new VsBootstrapperPackageInfo {
                    PackageName = "EB22551A-7F66-465F-B53F-E5ABA0C0574E"
                },                                                                                      // NativeMsVsMon
                new VsBootstrapperPackageInfo {
                    PackageName = "62B807E2-6539-46FB-8D67-A73DC9499940"
                }                                                                                      // ManagedMsVsMon
            };
            VsBootstrapperPackageInfo[] optionalPackagesToDeploy = new VsBootstrapperPackageInfo[] {
                new VsBootstrapperPackageInfo {
                    PackageName = "FEC73B34-86DE-4EA8-BFF4-3600A0443E9C"
                },                                                                                      // NativeMsVsMonDependency
                new VsBootstrapperPackageInfo {
                    PackageName = "B968CC6A-D2C8-4197-88E3-11662042C291"
                },                                                                                      // XamlUIDebugging
                new VsBootstrapperPackageInfo {
                    PackageName = "8CDEABEF-33E1-4A23-A13F-94A49FF36E84"
                }                                                                                       // XamlUIDebuggingDependency
            };

            BootstrapMode bootStrapMode = BootstrapMode.UniversalBootstrapMode;

            VsDebugTargetInfo2[] targets;
            int hr = QueryDebugTargets(out targets);

            if (ErrorHandler.Failed(hr))
            {
                NotifyEndDeploy(0);
                return(hr);
            }

            string  projectUniqueName = GetProjectUniqueName();
            IVsTask localAppContainerBootstrapperOperation = bootstrapper.BootstrapAsync(projectUniqueName,
                                                                                         targets[0].bstrRemoteMachine,
                                                                                         bootStrapMode,
                                                                                         packagesToDeployList.Length,
                                                                                         packagesToDeployList,
                                                                                         optionalPackagesToDeploy.Length,
                                                                                         optionalPackagesToDeploy,
                                                                                         this);

            lock (syncObject)
            {
                this.appContainerBootstrapperOperation = localAppContainerBootstrapperOperation;
            }

            ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
            {
                IVsAppContainerBootstrapperResult result = null;
                try
                {
                    object taskResult = await localAppContainerBootstrapperOperation;
                    result            = (IVsAppContainerBootstrapperResult)taskResult;
                }
                finally
                {
                    this.OnBootstrapEnd(targets[0].bstrRemoteMachine, projectUniqueName, result);
                }
            });

            return(VSConstants.S_OK);
        }
Example #26
0
        public int StartDeploy(IVsOutputWindowPane pIVsOutputWindowPane, uint dwOptions)
        {
            outputWindow = pIVsOutputWindowPane;

            if (!NotifyBeginDeploy())
            {
                return(VSConstants.E_ABORT);
            }

            VsDebugTargetInfo2[] targets;
            int hr = QueryDebugTargets(out targets);

            if (ErrorHandler.Failed(hr))
            {
                NotifyEndDeploy(0);
                return(hr);
            }

            string projectUniqueName = this.GetProjectUniqueName();

            IVsAppContainerBootstrapper4 bootstrapper = (IVsAppContainerBootstrapper4)ServiceProvider.GlobalProvider.GetService(typeof(SVsAppContainerProjectDeploy));

            VsBootstrapperPackageInfo[] packagesToDeployList = new VsBootstrapperPackageInfo[] {
#if DEV15
                new VsBootstrapperPackageInfo {
                    PackageName = "8B426345-3B98-4111-819A-46533C393CE5"
                },                                                                                      // NativeMsVsMon
                new VsBootstrapperPackageInfo {
                    PackageName = "973CA972-0C5F-4F19-B436-814CF773A102"
                }                                                                                       // ManagedMsVsMon
#elif DEV14
                new VsBootstrapperPackageInfo {
                    PackageName = "EB22551A-7F66-465F-B53F-E5ABA0C0574E"
                },                                                                                      // NativeMsVsMon
                new VsBootstrapperPackageInfo {
                    PackageName = "62B807E2-6539-46FB-8D67-A73DC9499940"
                }                                                                                      // ManagedMsVsMon
#else
                #error Unsupported version of Visual Studio
#endif
            };
            VsBootstrapperPackageInfo[] optionalPackagesToDeploy = new VsBootstrapperPackageInfo[] {
#if DEV15
                new VsBootstrapperPackageInfo {
                    PackageName = "92063DB3-36E3-434E-840C-DEE8DA2AD4B7"
                },                                                                                      // NativeMsVsMonDependency
#elif DEV14
                new VsBootstrapperPackageInfo {
                    PackageName = "FEC73B34-86DE-4EA8-BFF4-3600A0443E9C"
                },                                                                                      // NativeMsVsMonDependency
#else
                #error Unsupported version of Visual Studio
#endif
                new VsBootstrapperPackageInfo {
                    PackageName = "B968CC6A-D2C8-4197-88E3-11662042C291"
                },                                                                                      // XamlUIDebugging
                new VsBootstrapperPackageInfo {
                    PackageName = "8CDEABEF-33E1-4A23-A13F-94A49FF36E84"
                }                                                                                       // XamlUIDebuggingDependency
            };

            BootstrapMode bootStrapMode = BootstrapMode.UniversalBootstrapMode;

            IVsTask localAppContainerBootstrapperOperation = bootstrapper.BootstrapAsync(projectUniqueName,
                                                                                         targets[0].bstrRemoteMachine,
                                                                                         bootStrapMode,
                                                                                         packagesToDeployList.Length,
                                                                                         packagesToDeployList,
                                                                                         optionalPackagesToDeploy.Length,
                                                                                         optionalPackagesToDeploy,
                                                                                         this);

            lock (syncObject) {
                this.appContainerBootstrapperOperation = localAppContainerBootstrapperOperation;
            }

            ThreadHelper.JoinableTaskFactory.RunAsync(async() => {
                IVsAppContainerBootstrapperResult result = null;
                try {
                    object taskResult = await localAppContainerBootstrapperOperation;
                    result            = (IVsAppContainerBootstrapperResult)taskResult;
                } finally {
                    this.OnBootstrapEnd(projectUniqueName, result);
                }
            });

            return(VSConstants.S_OK);
        }
        int IVsDeployableProjectCfg.StopDeploy(int fSync)
        {
            IVsTask localAppContainerBootstrapperOperation = null;
            IVsAppContainerProjectDeployOperation localAppContainerDeployOperation = null;
            lock (syncObject)
            {
                localAppContainerBootstrapperOperation = appContainerBootstrapperOperation;
                localAppContainerDeployOperation = deployOp;
                appContainerBootstrapperOperation = null;
                deployOp = null;
            }

            if (localAppContainerBootstrapperOperation != null)
            {
                localAppContainerBootstrapperOperation.Cancel();
                if (fSync != 0)
                {
                    try
                    {
                        localAppContainerBootstrapperOperation.Wait();
                    }
                    catch
                    {
                    }
                }
            }

            if (localAppContainerDeployOperation != null)
            {
                localAppContainerDeployOperation.StopDeploy(fSync != 0);
            }

            return VSConstants.S_OK;
        }
 /// <summary>Adds the specified task to the task completion sources dependent task list. Then if <see cref="M:Microsoft.VisualStudio.Shell.Interop.IVsTask.Wait" /> is called on <see langword="IVsTaskCompletionSource.Task" />, the UI can be unblocked correctly.</summary>
 /// <param name="pTask">The task to add to the list.</param>
 public void AddDependentTask(IVsTask pTask) => throw new NotSupportedException();
 IVsTask IVsTaskSchedulerService.ContinueWhenAllCompleted(uint context, uint tasks, IVsTask[] dependentTasks, IVsTaskBody taskBody)
 {
     return ((IVsTaskSchedulerService)this).ContinueWhenAllCompletedEx(context, tasks, dependentTasks, 0, taskBody, null);
 }