Пример #1
0
        public void GotInvokeResponse(ulong sessionID, InvokeResponse response)
        {
            //TODO:考虑线程池执行
            //Log.Debug($"收到调试调用结果: {response.Result}");

            DebugService ds = null;

            lock (sessions)
            {
                sessions.TryGetValue(sessionID, out ds);
            }
            if (ds == null)
            {
                Log.Warn("收到调试调用结果时找不到相应的调试会话");
                return;
            }

            //把结果转发至前端
            //TODO: 暂转换一下
            using var ms = new System.IO.MemoryStream(512);
            response.Result.SerializeAsInvokeResponse(ms, 0, response.Error != InvokeResponseError.None);
            string resData   = System.Text.Encoding.UTF8.GetString(ms.ToArray());
            var    eventBody = string.Format("{{\"Type\":\"Result\",\"Data\":{0}}}", resData);

            ds.ForwardEvent(eventBody);

            //终止调试器进程
            Log.Debug("收到调试调用结果,终止调试器...");
            ds.StopDebugger();
        }
Пример #2
0
        private bool disposedValue; // To detect redundant calls

        void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    if (_debugService != null)
                    {
                        _debugService.StopDebugger(force: true);
                        _debugService = null;
                    }
                    TypeSystem?.Dispose();
                }

                disposedValue = true;
            }
        }