diff --git a/UIX/Microsoft/Iris/Application.cs b/UIX/Microsoft/Iris/Application.cs index cebd981..a7fe10d 100644 --- a/UIX/Microsoft/Iris/Application.cs +++ b/UIX/Microsoft/Iris/Application.cs @@ -186,6 +186,7 @@ namespace Microsoft.Iris if (debuggerFactory != null) { Debugger = debuggerFactory(); + Debugger.Start(); DebuggerServerReady?.Invoke(Debugger, EventArgs.Empty); } diff --git a/UIX/Microsoft/Iris/Debug/SystemNet/NetDebuggerClient.cs b/UIX/Microsoft/Iris/Debug/SystemNet/NetDebuggerClient.cs index a646825..c796d99 100644 --- a/UIX/Microsoft/Iris/Debug/SystemNet/NetDebuggerClient.cs +++ b/UIX/Microsoft/Iris/Debug/SystemNet/NetDebuggerClient.cs @@ -4,6 +4,7 @@ using System.Collections.Concurrent; using System.Net; using System.Net.Sockets; using System.Runtime.Serialization; +using System.Threading; namespace Microsoft.Iris.Debug.SystemNet; @@ -35,11 +36,7 @@ public class NetDebuggerClient : IDebuggerClient, IRemoteDebuggerState, IDisposa public event Action InterpreterStateChanged; public event Action Connected; - public NetDebuggerClient(string connectionUri) : this(connectionUri is null ? null : new Uri(connectionUri)) - { - } - - public NetDebuggerClient(Uri connectionUri) + public NetDebuggerClient(Uri connectionUri = null) { ConnectionUri = connectionUri ?? DebugRemoting.DEFAULT_TCP_URI; _socket = new(SocketType.Stream, ProtocolType.Tcp); @@ -48,7 +45,7 @@ public class NetDebuggerClient : IDebuggerClient, IRemoteDebuggerState, IDisposa public void Start() { - System.Threading.Thread connectThread = new(ConnectLoop) { IsBackground = true }; + Thread connectThread = new(ConnectLoop) { IsBackground = true }; connectThread.Start(); } @@ -149,20 +146,22 @@ public class NetDebuggerClient : IDebuggerClient, IRemoteDebuggerState, IDisposa private void ConnectLoop() { + var endpoint = new IPEndPoint(IPAddress.Parse(ConnectionUri.Host), ConnectionUri.Port); while (!_socket.Connected) { try { - var endpoint = new IPEndPoint(IPAddress.Parse(ConnectionUri.Host), ConnectionUri.Port); _socket.Connect(endpoint); } catch { } + + Thread.Sleep(500); } Connected?.Invoke(this, _socket); - System.Threading.Thread receiveThread = new(MessageReceiveLoop) { IsBackground = true }; - System.Threading.Thread sendThread = new(MessageSendLoop) { IsBackground = true }; + Thread receiveThread = new(MessageReceiveLoop) { IsBackground = true }; + Thread sendThread = new(MessageSendLoop) { IsBackground = true }; receiveThread.Start(); sendThread.Start(); } diff --git a/UIX/Microsoft/Iris/Debug/SystemNet/NetDebuggerServer.cs b/UIX/Microsoft/Iris/Debug/SystemNet/NetDebuggerServer.cs index 3b1ef75..b72cb63 100644 --- a/UIX/Microsoft/Iris/Debug/SystemNet/NetDebuggerServer.cs +++ b/UIX/Microsoft/Iris/Debug/SystemNet/NetDebuggerServer.cs @@ -32,15 +32,11 @@ public class NetDebuggerServer : IDebuggerServer, IRemoteDebuggerState, IDisposa } } - public NetDebuggerServer(string connectionUri) : this(new Uri(connectionUri)) - { - } - - public NetDebuggerServer(Uri connectionUri) + public NetDebuggerServer(Uri connectionUri = null) { ConnectionUri = connectionUri ?? DebugRemoting.DEFAULT_TCP_URI; - _listener = TcpListener.Create(connectionUri.Port); + _listener = TcpListener.Create(ConnectionUri.Port); _listener.Start(); _formatter = DebugRemoting.CreateBsonFormatter();