Skip to content

Commit fd9f3bc

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 fd9f3bc

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

+3-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,
@@ -86,6 +86,8 @@ export class IOSApplicationManager extends ApplicationManagerBase {
8686
}
8787

8888
public async stopApplication(appData: Mobile.IApplicationData): Promise<void> {
89+
this.device.destroyAllSockets();
90+
8991
const { appId } = appData;
9092

9193
const action = () => this.$iosDeviceOperations.stop([{ deviceId: this.device.deviceInfo.identifier, ddi: this.$options.ddi, appId }]);

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ 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+
this.device.destroyAllSockets();
51+
52+
await this.iosSim.stopApplication(this.device.deviceInfo.identifier, appData.appId, appData.projectName);
5153
}
5254

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

0 commit comments

Comments
 (0)