public override void Attach(Response response, dynamic args) { _attachMode = true; // validate argument 'address' var host = getString(args, "address"); if (host == null) { SendErrorResponse(response, 3007, "Property 'address' is missing or empty."); return; } // validate argument 'port' var port = getInt(args, "port", -1); if (port == -1) { SendErrorResponse(response, 3008, "Property 'port' is missing."); return; } IPAddress address = Utilities.ResolveIPAddress(host); if (address == null) { SendErrorResponse(response, 3013, "Invalid address '{address}'.", new { address = address }); return; } Debugger.Connect(address, port); SendResponse(response); }
public override void Attach(Response response, dynamic args) { _attachMode = true; SetExceptionBreakpoints(args.__exceptionOptions); // validate argument 'address' var host = getString(args, "address"); if (host == null) { SendErrorResponse(response, 3007, "Property 'address' is missing or empty."); return; } // validate argument 'port' var port = getInt(args, "port", -1); if (port == -1) { SendErrorResponse(response, 3008, "Property 'port' is missing."); return; } IPAddress address = Utilities.ResolveIPAddress(host); if (address == null) { SendErrorResponse(response, 3013, "Invalid address '{address}'.", new { address = address }); return; } var delay = getInt(args, "delay", 0); if (delay > 0) { System.Threading.Thread.Sleep(delay); } var maxConnectionAttempts = getInt(args, "maxConnectionAttempts", MAX_CONNECTION_ATTEMPTS); var timeBetweenConnectionAttempts = getInt(args, "timeBetweenConnectionAttempts", CONNECTION_ATTEMPT_INTERVAL); Connect(address, port, maxConnectionAttempts, timeBetweenConnectionAttempts); SendResponse(response); }
public override async void Attach(Response response, dynamic args) { Console.WriteLine("Attach"); var xamarinOption = CreateFromArgs(args); _attachMode = true; SetExceptionBreakpoints(args.__exceptionOptions); // validate argument 'address' var host = getString(args, "address"); if (host == null) { SendErrorResponse(response, 3007, "Property 'address' is missing or empty."); return; } // validate argument 'port' var port = getInt(args, "port", -1); if (port == -1) { SendErrorResponse(response, 3008, "Property 'port' is missing."); return; } IPAddress address = Utilities.ResolveIPAddress(host); if (address == null) { SendErrorResponse(response, 3013, "Invalid address '{address}'.", new { address = address }); return; } Connect(xamarinOption, address, port); await LaunchiOS(xamarinOption, port); SendResponse(response); }
public override async void Launch(Response response, dynamic args) { _attachMode = false; SetExceptionBreakpoints(args.__exceptionOptions); var launchOptions = new LaunchData(args); var valid = launchOptions.Validate(); _hotReloadManager?.SetLaunchData(launchOptions); if (!valid.success) { SendErrorResponse(response, 3002, valid.message); return; } int port = launchOptions.DebugPort; // Utilities.FindFreePort(55555); var host = getString(args, "address"); IPAddress address = string.IsNullOrWhiteSpace(host) ? IPAddress.Loopback : Utilities.ResolveIPAddress(host); if (address == null) { SendErrorResponse(response, 3013, "Invalid address '{address}'.", new { address = address }); return; } if (launchOptions.ProjectType == ProjectType.Android) { var r = LaunchAndroid(launchOptions, port); if (!r.success) { SendErrorResponse(response, 3002, r.message); return; } //Android takes a few seconds to get the debugger ready.... await Task.Delay(3000); } if (launchOptions.ProjectType == ProjectType.iOS || launchOptions.ProjectType == ProjectType.MacCatalyst) { port = Utilities.FindFreePort(55555); } Connect(launchOptions, address, port); //on IOS we need to do the connect before we launch the sim. if (launchOptions.ProjectType == ProjectType.iOS || launchOptions.ProjectType == ProjectType.MacCatalyst) { var r = launchOptions.ProjectType == ProjectType.iOS ? await LaunchiOS(response, launchOptions, port) : await LaunchCatalyst(launchOptions, port); if (!r.success) { SendErrorResponse(response, 3002, r.message); return; } SendResponse(response); return; } SendResponse(response); }
public override async void Launch(Response response, dynamic args) { _attachMode = false; SetExceptionBreakpoints(args.__exceptionOptions); //validate argument 'program' //TODO: Remove this string programPath = getString(args, "program"); //if (programPath == null) { // SendErrorResponse(response, 3001, "Property 'program' is missing or empty.", null); // return; //} programPath = ConvertClientPathToDebugger(programPath); //if (!File.Exists(programPath) && !Directory.Exists(programPath)) { // SendErrorResponse(response, 3002, "Program '{path}' does not exist.", new { path = programPath }); // return; //} XamarinOptions xamarinOptions = CreateFromArgs(args); if (!ValidateArg(response, xamarinOptions.CSProj, VSCodeKeys.XamarinOptions.CSProj)) { return; } if (!ValidateArg(response, xamarinOptions.Configuration, VSCodeKeys.XamarinOptions.Configuration)) { return; } if (!ValidateArg(response, xamarinOptions.Platform, VSCodeKeys.XamarinOptions.Platform)) { return; } int port = Utilities.FindFreePort(10000); var host = getString(args, "address"); IPAddress address = string.IsNullOrWhiteSpace(host) ? IPAddress.Loopback : Utilities.ResolveIPAddress(host); if (address == null) { SendErrorResponse(response, 3013, "Invalid address '{address}'.", new { address = address }); return; } Connect(xamarinOptions, address, port); await LaunchiOS(xamarinOptions, port); SendResponse(response); }