Exemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public override IDebugLaunchSettings [] QueryDebugTargets(DebugLaunchOptions launchOptions)
        {
            LoggingUtils.PrintFunction();

            IDebugLauncher debugLauncher = null;

            try
            {
                debugLauncher = GetDebugLauncher(ServiceProvider);

                debugLauncher.PrepareLaunch();

                DebugLaunchSettings debugLaunchSettings;

                Dictionary <string, string> projectProperties = DebuggerProperties.ProjectPropertiesToDictionary();

                projectProperties.Add("ConfigurationGeneral.ProjectDir", Path.GetDirectoryName(DebuggerProperties.GetConfiguredProject().UnconfiguredProject.FullPath));

                LaunchConfiguration launchConfig = debugLauncher.GetLaunchConfigurationFromProjectProperties(projectProperties);

                LaunchProps [] launchProps = debugLauncher.GetLaunchPropsFromProjectProperties(projectProperties);

                if (launchOptions.HasFlag(DebugLaunchOptions.NoDebug))
                {
                    debugLaunchSettings = (DebugLaunchSettings)debugLauncher.StartWithoutDebugging((int)launchOptions, launchConfig, launchProps, projectProperties);
                }
                else
                {
                    debugLaunchSettings = (DebugLaunchSettings)debugLauncher.StartWithDebugging((int)launchOptions, launchConfig, launchProps, projectProperties);
                }

                return(new IDebugLaunchSettings [] { debugLaunchSettings });
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                string description = string.Format("'QueryDebugTargets' failed:\n[Exception]{0}", e.Message);

#if DEBUG
                description += "\n[Exception] Stack trace:\n" + e.StackTrace;
#endif

                if (debugLauncher != null)
                {
                    LoggingUtils.RequireOk(debugLauncher.GetConnectionService().LaunchDialogUpdate(description, true));
                }

                VsShellUtilities.ShowMessageBox(ServiceProvider, description, "Android++ Debugger", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }

            return(null);
        }
Exemplo n.º 2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public override async Task <IReadOnlyList <IDebugLaunchSettings> > QueryDebugTargetsAsync(DebugLaunchOptions launchOptions)
        {
            LoggingUtils.PrintFunction();

            IDebugLauncher debugLauncher = null;

            DebugLaunchSettings debugLaunchSettings = new DebugLaunchSettings(launchOptions);

            try
            {
                debugLauncher = GetDebugLauncher(ServiceProvider);

                await debugLauncher.PrepareLaunch();

                Dictionary <string, string> projectProperties = await DebuggerProperties.ProjectPropertiesToDictionaryAsync();

                projectProperties.Add("ConfigurationGeneral.ProjectDir", Path.GetDirectoryName(DebuggerProperties.GetConfiguredProject().UnconfiguredProject.FullPath));

                LaunchConfiguration launchConfig = debugLauncher.GetLaunchConfigurationFromProjectProperties(projectProperties);

                ICollection <LaunchProps> launchProps = debugLauncher.GetLaunchPropsFromProjectProperties(projectProperties);

                if (launchOptions.HasFlag(DebugLaunchOptions.NoDebug))
                {
                    debugLaunchSettings = await debugLauncher.StartWithoutDebugging((int)launchOptions, launchConfig, launchProps, projectProperties);
                }
                else
                {
                    debugLaunchSettings = await debugLauncher.StartWithDebugging((int)launchOptions, launchConfig, launchProps, projectProperties);
                }
            }
            catch (Exception e)
            {
                HandleExceptionDialog(e, debugLauncher);
            }

            return(new IDebugLaunchSettings [] { debugLaunchSettings });
        }
Exemplo n.º 3
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public IEnumerable <IDebugLaunchSettings> PrepareLaunch(DebugLaunchOptions launchOptions, IDictionary <string, string> projectProperties)
        {
            LoggingUtils.PrintFunction();

            IDebugLauncher debugLauncher = null;

            try
            {
                debugLauncher = GetDebugLauncher(ServiceProvider);

                debugLauncher.PrepareLaunch();

                DebugLaunchSettings debugLaunchSettings = null;

                Project startupProject = GetStartupSolutionProject(ServiceProvider, (Dictionary <string, string>)projectProperties);

                if (startupProject == null)
                {
                    throw new InvalidOperationException("Could not find solution startup project.");
                }

                LoggingUtils.Print("Launcher startup project: " + startupProject.Name + " (" + startupProject.FullName + ")");

                LaunchConfiguration launchConfig = debugLauncher.GetLaunchConfigurationFromProjectProperties(projectProperties, startupProject);

                LaunchProps [] launchProps = debugLauncher.GetLaunchPropsFromProjectProperties(projectProperties, startupProject);

                if (launchOptions.HasFlag(DebugLaunchOptions.NoDebug))
                {
                    debugLaunchSettings = (DebugLaunchSettings)debugLauncher.StartWithoutDebugging((int)launchOptions, launchConfig, launchProps, projectProperties);
                }
                else
                {
                    debugLaunchSettings = (DebugLaunchSettings)debugLauncher.StartWithDebugging((int)launchOptions, launchConfig, launchProps, projectProperties);
                }

                if (debugLaunchSettings == null)
                {
                    throw new InvalidOperationException("Could not evaluate valid launch settings.");
                }

                return(new IDebugLaunchSettings [] { debugLaunchSettings });
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                string description = string.Format("'PrepareLaunch' failed:\n[Exception] {0}", e.Message);

#if DEBUG
                description += "\n[Exception] Stack trace:\n" + e.StackTrace;
#endif

                if (debugLauncher != null)
                {
                    LoggingUtils.RequireOk(debugLauncher.GetConnectionService().LaunchDialogUpdate(description, true));
                }

                VsShellUtilities.ShowMessageBox(ServiceProvider, description, "Android++ Debugger", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }

            return(null);
        }