////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public DebugLauncherCommon(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException("serviceProvider");
            }

            m_serviceProvider = serviceProvider;

            m_debugConnectionService = m_serviceProvider.GetService(typeof(IDebuggerConnectionService)) as IDebuggerConnectionService;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        public DebugLauncherCommon(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
              {
            throw new ArgumentNullException ("serviceProvider");
              }

              m_serviceProvider = serviceProvider;

              m_debugConnectionService = m_serviceProvider.GetService (typeof (IDebuggerConnectionService)) as IDebuggerConnectionService;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public DebuggerEventListener(EnvDTE.DTE dteService, IVsDebugger debuggerService, IDebuggerConnectionService debuggerConnectionService)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

            m_dteService = dteService;

            m_debuggerService = debuggerService;

            m_debuggerConnectionService = debuggerConnectionService;

            LoggingUtils.RequireOk(m_debuggerService.AdviseDebuggerEvents(this, out m_debuggerServiceCookie));

            LoggingUtils.RequireOk(m_debuggerService.AdviseDebugEventCallback(this));

            //
            // Register required listener events and paired process function callbacks.
            //

            m_eventCallbacks = new Dictionary <Guid, DebuggerEventListenerDelegate> ();

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.SessionCreate)), OnSessionCreate);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.SessionDestroy)), OnSessionDestroy);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.EngineCreate)), OnEngineCreate);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.ProgramCreate)), OnProgramCreate);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.ProgramDestroy)), OnProgramDestroy);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.AttachComplete)), OnAttachComplete);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.Error)), OnError);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.DebuggerConnectionEvent)), OnDebuggerConnectionEvent);

            m_eventCallbacks.Add(ComUtils.GuidOf(typeof(DebugEngineEvent.DebuggerLogcatEvent)), OnDebuggerLogcatEvent);
        }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public DebuggerEventListener (EnvDTE.DTE dteService, IVsDebugger debuggerService, IDebuggerConnectionService debuggerConnectionService)
    {
      m_dteService = dteService;

      m_debuggerService = debuggerService;

      m_debuggerConnectionService = debuggerConnectionService;

      LoggingUtils.RequireOk (m_debuggerService.AdviseDebuggerEvents (this, out m_debuggerServiceCookie));

      LoggingUtils.RequireOk (m_debuggerService.AdviseDebugEventCallback (this));

      // 
      // Register required listener events and paired process function callbacks.
      // 

      m_eventCallbacks = new Dictionary<Guid, DebuggerEventListenerDelegate> ();

      m_eventCallbacks.Add (ComUtils.GuidOf (typeof (DebugEngineEvent.SessionCreate)), OnSessionCreate);

      m_eventCallbacks.Add (ComUtils.GuidOf (typeof (DebugEngineEvent.SessionDestroy)), OnSessionDestroy);

      m_eventCallbacks.Add (ComUtils.GuidOf (typeof (DebugEngineEvent.EngineCreate)), OnEngineCreate);

      m_eventCallbacks.Add (ComUtils.GuidOf (typeof (DebugEngineEvent.ProgramCreate)), OnProgramCreate);

      m_eventCallbacks.Add (ComUtils.GuidOf (typeof (DebugEngineEvent.ProgramDestroy)), OnProgramDestroy);

      m_eventCallbacks.Add (ComUtils.GuidOf (typeof (DebugEngineEvent.AttachComplete)), OnAttachComplete);

      m_eventCallbacks.Add (ComUtils.GuidOf (typeof (DebugEngineEvent.Error)), OnError);

      m_eventCallbacks.Add (ComUtils.GuidOf (typeof (DebugEngineEvent.DebuggerConnectionEvent)), OnDebuggerConnectionEvent);

      m_eventCallbacks.Add (ComUtils.GuidOf (typeof (DebugEngineEvent.DebuggerLogcatEvent)), OnDebuggerLogcatEvent);
    }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        void InitialiseEventListeners()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            //
            // Acquire VisualStudio service references.
            //

            LoggingUtils.PrintFunction();

            EnvDTE.DTE dteService = GetService(typeof(SDTE)) as EnvDTE.DTE;

            IVsShell shellService = GetService(typeof(SVsShell)) as IVsShell;

            IVsDebugger debuggerService = GetService(typeof(IVsDebugger)) as IVsDebugger;

            IVsSolution2 solutionService = GetService(typeof(SVsSolution)) as IVsSolution2;

            IVsMonitorSelection monitorSelectionService = GetService(typeof(IVsMonitorSelection)) as IVsMonitorSelection;

            IDebuggerConnectionService debuggerConnectionService = GetService(typeof(IDebuggerConnectionService)) as IDebuggerConnectionService;

            //
            // Register service listeners.
            //

            if (dteService == null)
            {
                throw new InvalidOperationException("Failed to acquire 'DTE' service");
            }

            if (shellService == null)
            {
                throw new InvalidOperationException("Failed to acquire 'IVsShell' service");
            }

            if (debuggerService == null)
            {
                throw new InvalidOperationException("Failed to acquire 'IVsDebugger' service");
            }

            if (solutionService == null)
            {
                throw new InvalidOperationException("Failed to acquire 'SVsSolution' service");
            }

            if (monitorSelectionService == null)
            {
                throw new InvalidOperationException("Failed to acquire 'IVsMonitorSelection' service");
            }

            m_propertyEventListener = new PropertyEventListener(shellService);

            m_debuggerEventListener = new DebuggerEventListener(dteService, debuggerService, debuggerConnectionService);

            m_solutionEventListener = new SolutionEventListener(dteService, solutionService);

            //
            // Register a new listener to assist finding assemblies placed within the package's current directory.
            //

            m_assemblyResolveListener = new AssemblyResolveListener();
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public DebugLauncherCommon(IServiceProvider serviceProvider)
        {
            m_serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));

            m_debugConnectionService = m_serviceProvider.GetService(typeof(IDebuggerConnectionService)) as IDebuggerConnectionService;
        }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public DebugLauncher (IServiceProvider serviceProvider)
    {
      m_serviceProvider = serviceProvider;

      m_debugConnectionService = m_serviceProvider.GetService (typeof (IDebuggerConnectionService)) as IDebuggerConnectionService;
    }
Beispiel #8
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public DebugLauncher(IServiceProvider serviceProvider)
        {
            m_serviceProvider = serviceProvider;

            m_debugConnectionService = m_serviceProvider.GetService(typeof(IDebuggerConnectionService)) as IDebuggerConnectionService;
        }