Пример #1
0
        public DebugModuleQueryHandler(DebugPort debugPort)
        {
            if (debugPort == null)
            {
                throw new ArgumentNullException(nameof(debugPort));
            }

            _debugPort = debugPort;
        }
Пример #2
0
            public DebugSession(DebugPort debugServer,
                                TcpClient tcpClient,
                                IServiceProvider serviceProvider,
                                ILoggerFactory loggerFactory)
            {
                if (debugServer == null)
                {
                    throw new ArgumentNullException(nameof(debugServer));
                }

                if (tcpClient == null)
                {
                    throw new ArgumentNullException(nameof(tcpClient));
                }

                if (serviceProvider == null)
                {
                    throw new ArgumentNullException(nameof(serviceProvider));
                }

                _debugServer     = debugServer;
                _tcpClient       = tcpClient;
                Address          = tcpClient.Client.RemoteEndPoint as IPEndPoint;
                _serviceProvider = serviceProvider;
                _loggerFactory   = loggerFactory;

                _logger = _loggerFactory?.CreateLogger <DebugSession>();
                var streamLogger = _loggerFactory?.CreateLogger <DisposeAwareStream>();

                _stream = new DisposeAwareStream(_tcpClient.GetStream(), OnDebugStreamsCloses, streamLogger);

                _propertiesLazy = new DisposableAsyncLazy <DebugModuleProperties>(
                    factory: CreatePropertiesAsync,
                    disposal: DisposePropertiesAsync,
                    options: DisposableAsyncLazyOptions.Autostart | DisposableAsyncLazyOptions.ExecuteOnCallingThread);

                _proxyHostLazy = new DisposableAsyncLazy <ProxyHost>(
                    factory: CreateProxyHostAsync,
                    disposal: proxyHost => proxyHost.DisposeAsync(),
                    options: DisposableAsyncLazyOptions.Autostart | DisposableAsyncLazyOptions.ExecuteOnCallingThread);
            }