Exemple #1
0
        /// <summary>
        /// This is called on F5 to return the list of debug targets. What is returned depends on the debug provider extensions
        /// which understands how to launch the currently active profile type.
        /// </summary>
        private async Task <IReadOnlyList <IDebugLaunchSettings> > QueryDebugTargetsInternalAsync(DebugLaunchOptions launchOptions, bool fromDebugLaunch)
        {
            // Get the active debug profile (timeout of 5s, though in reality is should never take this long as even in error conditions
            // a snapshot is produced).
            ILaunchSettings currentProfiles = await LaunchSettingsProvider.WaitForFirstSnapshot(5000);

            ILaunchProfile activeProfile = currentProfiles?.ActiveProfile;

            // Should have a profile
            if (activeProfile == null)
            {
                throw new Exception(VSResources.ActiveLaunchProfileNotFound);
            }

            // Now find the DebugTargets provider for this profile
            IDebugProfileLaunchTargetsProvider launchProvider = GetLaunchTargetsProvider(activeProfile) ??
                                                                throw new Exception(string.Format(VSResources.DontKnowHowToRunProfile, activeProfile.Name));

            IReadOnlyList <IDebugLaunchSettings> launchSettings;

            if (fromDebugLaunch && launchProvider is IDebugProfileLaunchTargetsProvider2 launchProvider2)
            {
                launchSettings = await launchProvider2.QueryDebugTargetsForDebugLaunchAsync(launchOptions, activeProfile);
            }
            else
            {
                launchSettings = await launchProvider.QueryDebugTargetsAsync(launchOptions, activeProfile);
            }

            LastLaunchProvider = launchProvider;
            return(launchSettings);
        }
Exemple #2
0
        /// <summary>
        /// This is called on F5 to return the list of debug targets. What is returned depends on the debug provider extensions
        /// which understands how to launch the currently active profile type.
        /// </summary>
        private async Task <IReadOnlyList <IDebugLaunchSettings> > QueryDebugTargetsInternalAsync(DebugLaunchOptions launchOptions, bool fromDebugLaunch)
        {
            ILaunchProfile?activeProfile = await GetActiveProfileAsync();

            if (activeProfile is null)
            {
                throw new Exception(VSResources.ActiveLaunchProfileNotFound);
            }

            // Now find the DebugTargets provider for this profile
            IDebugProfileLaunchTargetsProvider launchProvider = GetLaunchTargetsProvider(activeProfile) ??
                                                                throw new Exception(string.Format(VSResources.DontKnowHowToRunProfile, activeProfile.Name));

            IReadOnlyList <IDebugLaunchSettings> launchSettings;

            if (fromDebugLaunch && launchProvider is IDebugProfileLaunchTargetsProvider2 launchProvider2)
            {
                launchSettings = await launchProvider2.QueryDebugTargetsForDebugLaunchAsync(launchOptions, activeProfile);
            }
            else
            {
                launchSettings = await launchProvider.QueryDebugTargetsAsync(launchOptions, activeProfile);
            }

            _lastLaunchProvider = launchProvider;
            return(launchSettings);
        }
        /// <summary>
        /// Overridden to direct the launch to the current active provider as determined by the active launch profile
        /// </summary>
        public override async Task LaunchAsync(DebugLaunchOptions launchOptions)
        {
            IReadOnlyList<IDebugLaunchSettings> targets = await QueryDebugTargetsInternalAsync(launchOptions, fromDebugLaunch: true);

            ILaunchProfile activeProfile = LaunchSettingsProvider.ActiveProfile;

            IDebugProfileLaunchTargetsProvider targetProfile = GetLaunchTargetsProvider(activeProfile);
            if (targetProfile != null)
            {
                await targetProfile.OnBeforeLaunchAsync(launchOptions, activeProfile);
            }

            await DoLaunchAsync(targets.ToArray());

            if (targetProfile != null)
            {
                await targetProfile.OnAfterLaunchAsync(launchOptions, activeProfile);
            }
        }
Exemple #4
0
        /// <summary>
        /// This is called on F5 to return the list of debug targets.What we return depends on the type
        /// of project.
        /// </summary>
        public override async Task <IReadOnlyList <IDebugLaunchSettings> > QueryDebugTargetsAsync(DebugLaunchOptions launchOptions)
        {
            // Get the active debug profile
            ILaunchProfile activeProfile = LaunchSettingsProvider.ActiveProfile;

            // Should have a profile
            if (activeProfile == null)
            {
                throw new Exception(VSResources.ActiveLaunchProfileNotFound);
            }

            // Now find the DebugTargets provider for this profile
            var launchProvider = GetLaunchTargetsProvider(activeProfile) ??
                                 throw new Exception(string.Format(VSResources.DontKnowHowToRunProfile, activeProfile.Name));

            var launchSettings = await launchProvider.QueryDebugTargetsAsync(launchOptions, activeProfile).ConfigureAwait(true);

            LastLaunchProvider = launchProvider;
            return(launchSettings);
        }
        /// <summary>
        /// This is called on F5 to return the list of debug targets.What we return depends on the type
        /// of project.
        /// </summary>
        public override async Task <IReadOnlyList <IDebugLaunchSettings> > QueryDebugTargetsAsync(DebugLaunchOptions launchOptions)
        {
            // Get the active debug profile (timeout of 5s, though in reality is should never take this long as even in error conditions
            // a snapshot is produced).
            var currentProfiles = await LaunchSettingsProvider.WaitForFirstSnapshot(5000).ConfigureAwait(true);

            ILaunchProfile activeProfile = currentProfiles?.ActiveProfile;

            // Should have a profile
            if (activeProfile == null)
            {
                throw new Exception(VSResources.ActiveLaunchProfileNotFound);
            }

            // Now find the DebugTargets provider for this profile
            var launchProvider = GetLaunchTargetsProvider(activeProfile) ??
                                 throw new Exception(string.Format(VSResources.DontKnowHowToRunProfile, activeProfile.Name));

            var launchSettings = await launchProvider.QueryDebugTargetsAsync(launchOptions, activeProfile).ConfigureAwait(true);

            LastLaunchProvider = launchProvider;
            return(launchSettings);
        }