示例#1
0
        private static EventPipeSession CreateSessionFromResponse(IpcEndpoint endpoint, ref IpcResponse?response, string operationName)
        {
            try
            {
                DiagnosticsClient.ValidateResponseMessage(response.Value.Message, operationName);

                long sessionId = BitConverter.ToInt64(response.Value.Message.Payload, 0);

                var session = new EventPipeSession(endpoint, response.Value, sessionId);
                response = null;
                return(session);
            }
            finally
            {
                response?.Dispose();
            }
        }
示例#2
0
        protected virtual void Dispose(bool disposing)
        {
            // If session being disposed hasn't been stopped, attempt to stop it first
            if (!_stopped)
            {
                try
                {
                    Stop();
                }
                catch {} // swallow any exceptions that may be thrown from Stop.
            }

            if (!_disposedValue)
            {
                if (disposing)
                {
                    _response.Dispose();
                }
                _disposedValue = true;
            }
        }