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

        public override async Task <bool> CanLaunchAsync(DebugLaunchOptions launchOptions)
        {
            LoggingUtils.PrintFunction();

            IDebugLauncher debugLauncher = null;

            try
            {
                debugLauncher = GetDebugLauncher(ServiceProvider);

                return(await System.Threading.Tasks.Task.Run(() =>
                {
                    try
                    {
                        return debugLauncher.CanLaunch((int)launchOptions);
                    }
                    catch (Exception e)
                    {
                        HandleExceptionDialog(e, debugLauncher);
                    }

                    return false;
                }));
            }
            catch (Exception e)
            {
                HandleExceptionDialog(e, debugLauncher);
            }

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

        public override bool CanLaunch(DebugLaunchOptions launchOptions)
        {
            LoggingUtils.PrintFunction();

            IDebugLauncher debugLauncher = null;

            try
            {
                debugLauncher = GetDebugLauncher(ServiceProvider);

                return(debugLauncher.CanLaunch((int)launchOptions));
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                string description = string.Format("'CanLaunch' 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(false);
        }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public static IDebugLauncher GetDebugLauncher (IServiceProvider serviceProvider)
    {
      if (s_debugLauncher == null)
      {
        s_debugLauncher = new DebugLauncherCommon (serviceProvider);
      }

      return s_debugLauncher;
    }
Exemplo n.º 4
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public static IDebugLauncher GetDebugLauncher(IServiceProvider serviceProvider)
        {
            if (s_debugLauncher == null)
            {
                s_debugLauncher = new DebugLauncherCommon(serviceProvider);
            }

            return(s_debugLauncher);
        }
Exemplo n.º 5
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public IDebugLauncher GetDebugLauncher(IServiceProvider serviceProvider)
        {
            if (m_debugLauncher == null)
            {
                m_debugLauncher = new DebugLauncher(serviceProvider);
            }

            return(m_debugLauncher);
        }
 // Token: 0x0600002B RID: 43 RVA: 0x00002881 File Offset: 0x00000A81
 public MonoDebuggerLauncher(IProgress <string> progress, IDebugLauncher debugLauncher = null)
 {
     MonoDebuggerLauncher.tracer.Verbose("Entering constructor for: {0}", new object[]
     {
         this
     });
     this.progress      = progress;
     this.debugLauncher = (debugLauncher ?? new DebugLauncher());
 }
Exemplo n.º 7
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public IDebugLauncher GetDebugLauncher (IServiceProvider serviceProvider)
    {
      if (m_debugLauncher == null)
      {
        m_debugLauncher = new DebugLauncher (serviceProvider);
      }

      return m_debugLauncher;
    }
Exemplo n.º 8
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        private async Task <int> HandleExceptionDialog(Exception e, IDebugLauncher debugLauncher)
        {
            LoggingUtils.HandleException(e);

            string description = string.Format(CultureInfo.InvariantCulture, "[{0}] {1}", e.GetType(), e.Message);

            description += "\nStack trace:\n" + e.StackTrace;

            await debugLauncher?.GetConnectionService().LaunchDialogUpdate(description, true);

            return(VsShellUtilities.ShowMessageBox(ServiceProvider, description, "Android++ Debugger", OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST));
        }
Exemplo n.º 9
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.º 10
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        private void HandleExceptionDialog(Exception e, IDebugLauncher debugLauncher)
        {
            LoggingUtils.HandleException(e);

            string description = string.Format("[{0}] {1}", e.GetType(), e.Message);

            description += "\nStack trace:\n" + e.StackTrace;

            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);
        }
Exemplo n.º 11
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.º 12
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    private void HandleExceptionDialog (Exception e, IDebugLauncher debugLauncher)
    {
      LoggingUtils.HandleException(e);

      string description = string.Format(CultureInfo.InvariantCulture, "[{0}] {1}", e.GetType(), e.Message);

      description += "\nStack trace:\n" + e.StackTrace;

      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);
    }
Exemplo n.º 13
0
 // Token: 0x06000004 RID: 4 RVA: 0x000020F0 File Offset: 0x000002F0
 public DebuggerSession(StartInfo startInfo, IProgress <string> progress, SoftDebuggerSession session, IDebugLauncher debugLauncher = null)
 {
     DebuggerSession.tracer.Verbose("Entering constructor for: {0}", new object[]
     {
         this
     });
     this.progress        = progress;
     this.startInfo       = startInfo;
     this.debuggerSession = session;
     this.debugLauncher   = (debugLauncher ?? new DebugLauncher());
 }
Exemplo n.º 14
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);
        }