MonoRemoteDebugger.SharedLib.Server.MonoDebugServer.Stop C# (CSharp) Method

Stop() public method

public Stop ( ) : void
return void
        public void Stop()
        {
            cts.Cancel();
            if (tcp != null && tcp.Server != null)
            {
                tcp.Server.Close(0);
                tcp = null;
            }
            if (listeningTask != null)
            {
                try
                {
                    if (!Task.WaitAll(new Task[] { listeningTask }, 5000))
                        logger.Error("listeningTask timeout!!!");
                }
                catch(Exception ex)
                {
                    logger.Error(ex.ToString());
                }
            }

            logger.Info("Closed MonoDebugServer");
        }

Usage Example

コード例 #1
0
ファイル: VSPackage.cs プロジェクト: techl/MonoRemoteDebugger
        private async void StartLocalServer()
        {
            try
            {
                if (server != null)
                {
                    server.Stop();
                    server = null;
                }

                monoExtension.BuildSolution();

                using (server = new MonoDebugServer())
                {
                    server.Start();
                    await monoExtension.AttachDebugger(MonoProcess.GetLocalIp().ToString());
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                if (server != null)
                    server.Stop();
                MessageBox.Show(ex.Message, "MonoRemoteDebugger", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }