/// <summary>
        /// Initializes a new instance of the DebugService class and uses
        /// the given execution service for all future operations.
        /// </summary>
        public DebugService(
            IInternalPowerShellExecutionService executionService,
            IPowerShellDebugContext debugContext,
            RemoteFileManagerService remoteFileManager,
            BreakpointService breakpointService,
            PsesInternalHost psesHost,
            ILoggerFactory factory)
        {
            Validate.IsNotNull(nameof(executionService), executionService);

            _logger                          = factory.CreateLogger <DebugService>();
            _executionService                = executionService;
            _breakpointService               = breakpointService;
            _psesHost                        = psesHost;
            _debugContext                    = debugContext;
            _debugContext.DebuggerStopped   += OnDebuggerStopAsync;
            _debugContext.DebuggerResuming  += OnDebuggerResuming;
            _debugContext.BreakpointUpdated += OnBreakpointUpdated;
            _remoteFileManager               = remoteFileManager;

            invocationTypeScriptPositionProperty =
                typeof(InvocationInfo)
                .GetProperty(
                    "ScriptPosition",
                    BindingFlags.NonPublic | BindingFlags.Instance);
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the DebugService class and uses
        /// the given PowerShellContext for all future operations.
        /// </summary>
        /// <param name="powerShellContext">
        /// The PowerShellContext to use for all debugging operations.
        /// </param>
        /// <param name="logger">An ILogger implementation used for writing log messages.</param>
        //public DebugService(PowerShellContextService powerShellContext, ILogger logger)
        //    : this(powerShellContext, null, logger)
        //{
        //}

        /// <summary>
        /// Initializes a new instance of the DebugService class and uses
        /// the given PowerShellContext for all future operations.
        /// </summary>
        /// <param name="powerShellContext">
        /// The PowerShellContext to use for all debugging operations.
        /// </param>
        //// <param name = "remoteFileManager" >
        //// A RemoteFileManagerService instance to use for accessing files in remote sessions.
        //// </param>
        /// <param name="logger">An ILogger implementation used for writing log messages.</param>
        public DebugService(
            PowerShellContextService powerShellContext,
            RemoteFileManagerService remoteFileManager,
            BreakpointService breakpointService,
            ILoggerFactory factory)
        {
            Validate.IsNotNull(nameof(powerShellContext), powerShellContext);

            this.logger            = factory.CreateLogger <DebugService>();
            this.powerShellContext = powerShellContext;
            _breakpointService     = breakpointService;
            this.powerShellContext.DebuggerStop    += this.OnDebuggerStopAsync;
            this.powerShellContext.DebuggerResumed += this.OnDebuggerResumed;

            this.powerShellContext.BreakpointUpdated += this.OnBreakpointUpdated;

            this.remoteFileManager = remoteFileManager;

            this.invocationTypeScriptPositionProperty =
                typeof(InvocationInfo)
                .GetProperty(
                    "ScriptPosition",
                    BindingFlags.NonPublic | BindingFlags.Instance);
        }