Skip to content

Commit c22902f

Browse files
fix: debugging in VSCode is not working on iOS Simulator
When you've stopped on breakpoint in VSCode and apply a change in the code, CLI tries to restart application. However, at this point the command for killing the application may not kill it immediately and it needs 30 seconds. The problem is that the runtime loops indefinitely while on breakpoint. After some seconds (looks like 30), the OS kills the application. In order to resolve the issue, disconnect all sockets before stopping the application, so the runtime can successfully break the indefinite loop and after that application can be safely killed.
1 parent 82741af commit c22902f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/common/mobile/ios/device/ios-application-manager.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class IOSApplicationManager extends ApplicationManagerBase {
88

99
constructor(protected $logger: ILogger,
1010
protected $hooksService: IHooksService,
11-
private device: Mobile.IDevice,
11+
private device: Mobile.IiOSDevice,
1212
private $errors: IErrors,
1313
private $iOSNotificationService: IiOSNotificationService,
1414
private $iosDeviceOperations: IIOSDeviceOperations,
@@ -88,6 +88,9 @@ export class IOSApplicationManager extends ApplicationManagerBase {
8888
public async stopApplication(appData: Mobile.IApplicationData): Promise<void> {
8989
const { appId } = appData;
9090

91+
this.device.destroyDebugSocket(appId);
92+
this.device.destroyLiveSyncSocket(appId);
93+
9194
const action = () => this.$iosDeviceOperations.stop([{ deviceId: this.device.deviceInfo.identifier, ddi: this.$options.ddi, appId }]);
9295

9396
try {

lib/common/mobile/ios/simulator/ios-simulator-application-manager.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
4747
}
4848

4949
public async stopApplication(appData: Mobile.IApplicationData): Promise<void> {
50-
return this.iosSim.stopApplication(this.device.deviceInfo.identifier, appData.appId, appData.projectName);
50+
const { appId } = appData;
51+
52+
this.device.destroyDebugSocket(appId);
53+
this.device.destroyLiveSyncSocket(appId);
54+
55+
await this.iosSim.stopApplication(this.device.deviceInfo.identifier, appData.appId, appData.projectName);
5156
}
5257

5358
public async getApplicationInfo(applicationIdentifier: string): Promise<Mobile.IApplicationInfo> {

0 commit comments

Comments
 (0)