/// <summary> /// This will be called before Activate() /// cObjects will be 0 on clean up. /// </summary> public void SetObjects(uint cObjects, object[] ppunk) { if (cObjects > 0) { // satisfy mef imports IComponentModel host = ServiceProvider.GlobalProvider.GetService(typeof(SComponentModel)) as IComponentModel; if (host != null) { host.DefaultCompositionService.SatisfyImportsOnce(this); } foreach (IVsBrowseObject obj in ppunk.OfType <IVsBrowseObject>()) { if (obj.GetProjectItem(out IVsHierarchy vsHierarchy, out uint _) == VSConstants.S_OK && vsHierarchy is IVsProject) { _projectGuid = Utils.GetProjectGuid(vsHierarchy); } } if (_snapshotDebugConfigManager != null && _projectGuid != Guid.Empty) { _propertyPageControl.Initialize(_projectGuid, _snapshotDebugConfigManager); SnapshotDebugConfig config = _snapshotDebugConfigManager.GetConfiguration(_projectGuid); _propertyPageViewModel = new PropertyPageViewModel(config); _propertyPageControl.DataContext = _propertyPageViewModel; _snapshotDebugConfigManager.ConfigurationChanged += SnapshotDebugConfigManager_ConfigurationChanged; } } }
public int DebugLaunch(uint grfLaunch) { if (_snapshotDebugConfigManager != null) { SnapshotDebugConfig config = _snapshotDebugConfigManager.GetConfiguration(_projectGuid); if (config == null) { config = _snapshotDebugConfigManager.CreateNewConfiguration(_projectGuid); } if (config != null) { IProductionDebuggerInternal debugger = ServiceProvider.GlobalProvider.GetService(typeof(SVsShellDebugger)) as IProductionDebuggerInternal; Task.Run(async() => { string token = await config.GetBearerToken(); if (!string.IsNullOrEmpty(token)) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); debugger?.LaunchProductionDebugWithAzureTools2(config.ResourceId, config.WebsiteName, token); } }); } } return(VSConstants.S_OK); }