From 215f454c3959c9013c63c7586ee11677b59939ff Mon Sep 17 00:00:00 2001 From: DimitarTachev Date: Fri, 22 Mar 2019 14:58:07 +0200 Subject: [PATCH 1/2] fix: allow hmr + debugBrk in order to support useLegacyWorkflow:false and --debug-brk --- lib/commands/debug.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/commands/debug.ts b/lib/commands/debug.ts index 728d38b559..95457625e0 100644 --- a/lib/commands/debug.ts +++ b/lib/commands/debug.ts @@ -66,10 +66,6 @@ export class DebugPlatformCommand extends ValidatePlatformCommandBase implements this.$errors.fail("--release flag is not applicable to this command"); } - if (this.$options.hmr && this.$options.debugBrk) { - this.$errors.fail("--debug-brk and --hmr flags cannot be combined"); - } - const minSupportedWebpackVersion = this.$options.hmr ? LiveSyncCommandHelper.MIN_SUPPORTED_WEBPACK_VERSION_WITH_HMR : null; this.$bundleValidatorHelper.validate(minSupportedWebpackVersion); From 6c36359c660792d863f56480e2dd21a8b571fe40 Mon Sep 17 00:00:00 2001 From: DimitarTachev Date: Fri, 22 Mar 2019 15:01:10 +0200 Subject: [PATCH 2/2] fix: ensure running app only on LiveSync as its causing issues in debug When we try to get debug socket in (tns debug ios --debug-brk), the additional app start is resuming the app and we are not able to debug the app start. --- lib/common/definitions/mobile.d.ts | 2 +- lib/common/mobile/ios/ios-device-base.ts | 7 +++++-- lib/services/livesync/ios-device-livesync-service.ts | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/common/definitions/mobile.d.ts b/lib/common/definitions/mobile.d.ts index e66e93aed9..e3beddaac0 100644 --- a/lib/common/definitions/mobile.d.ts +++ b/lib/common/definitions/mobile.d.ts @@ -106,7 +106,7 @@ declare module Mobile { } interface IiOSDevice extends IDevice { - getDebugSocket(appId: string, projectName: string): Promise; + getDebugSocket(appId: string, projectName: string, ensureAppStarted?: boolean): Promise; destroyDebugSocket(appId: string): Promise; openDeviceLogStream(options?: IiOSLogStreamOptions): Promise; destroyAllSockets(): Promise; diff --git a/lib/common/mobile/ios/ios-device-base.ts b/lib/common/mobile/ios/ios-device-base.ts index ee585c2b25..d9e6d11ae6 100644 --- a/lib/common/mobile/ios/ios-device-base.ts +++ b/lib/common/mobile/ios/ios-device-base.ts @@ -15,7 +15,7 @@ export abstract class IOSDeviceBase implements Mobile.IiOSDevice { abstract openDeviceLogStream(options?: Mobile.IiOSLogStreamOptions): Promise; @performanceLog() - public async getDebugSocket(appId: string, projectName: string): Promise { + public async getDebugSocket(appId: string, projectName: string, ensureAppStarted: boolean = false): Promise { return this.$lockService.executeActionWithLock( async () => { if (this.cachedSockets[appId]) { @@ -23,7 +23,10 @@ export abstract class IOSDeviceBase implements Mobile.IiOSDevice { } await this.attachToDebuggerFoundEvent(appId, projectName); - await this.applicationManager.startApplication({ appId, projectName }); + if (ensureAppStarted) { + await this.applicationManager.startApplication({ appId, projectName }); + } + this.cachedSockets[appId] = await this.getDebugSocketCore(appId); if (this.cachedSockets[appId]) { diff --git a/lib/services/livesync/ios-device-livesync-service.ts b/lib/services/livesync/ios-device-livesync-service.ts index c7595e4874..249ec41a1e 100644 --- a/lib/services/livesync/ios-device-livesync-service.ts +++ b/lib/services/livesync/ios-device-livesync-service.ts @@ -25,7 +25,9 @@ export class IOSDeviceLiveSyncService extends DeviceLiveSyncServiceBase implemen const appId = projectData.projectIdentifiers.ios; try { - this.socket = await this.device.getDebugSocket(appId, projectData.projectName); + // TODO: temp workaround till we setup the sockets along with the app start + const ensureAppStarted = true; + this.socket = await this.device.getDebugSocket(appId, projectData.projectName, ensureAppStarted); } catch (err) { this.$logger.trace(`Error while connecting to the debug socket. Error is:`, err); }