@@ -158,6 +158,10 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
158
158
159
159
try {
160
160
await deviceAppData . device . applicationManager . stopApplication ( applicationId , projectData . projectName ) ;
161
+ // Now that we've stopped the application we know it isn't started, so set debugOptions.start to false
162
+ // so that it doesn't default to true in attachDebugger method
163
+ debugOptions = debugOptions || { } ;
164
+ debugOptions . start = false ;
161
165
} catch ( err ) {
162
166
this . $logger . trace ( "Could not stop application during debug livesync. Will try to restart app instead." , err ) ;
163
167
if ( ( err . message || err ) === "Could not find developer disk image" ) {
@@ -179,8 +183,15 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
179
183
180
184
public async attachDebugger ( settings : IAttachDebuggerOptions ) : Promise < void > {
181
185
// Default values
182
- settings . debugOptions . chrome = settings . debugOptions . chrome === undefined ? true : settings . debugOptions . chrome ;
183
- settings . debugOptions . start = settings . debugOptions . start === undefined ? true : settings . debugOptions . start ;
186
+ if ( settings . debugOptions ) {
187
+ settings . debugOptions . chrome = settings . debugOptions . chrome === undefined ? true : settings . debugOptions . chrome ;
188
+ settings . debugOptions . start = settings . debugOptions . start === undefined ? true : settings . debugOptions . start ;
189
+ } else {
190
+ settings . debugOptions = {
191
+ chrome : true ,
192
+ start : true
193
+ } ;
194
+ }
184
195
185
196
const projectData = this . $projectDataService . getProjectData ( settings . projectDir ) ;
186
197
let debugData = this . $debugDataService . createDebugData ( projectData , { device : settings . deviceIdentifier } ) ;
@@ -228,25 +239,25 @@ export class LiveSyncService extends EventEmitter implements IDebugLiveSyncServi
228
239
this . $errors . failWithoutHelp ( `Couldn't enable debugging for ${ deviceOption . deviceIdentifier } ` ) ;
229
240
}
230
241
231
- currentDeviceDescriptor . debugggingEnabled = true ;
232
- const currentDeviceInstance = this . $devicesService . getDeviceByIdentifier ( deviceOption . deviceIdentifier ) ;
233
- const attachDebuggerOptions : IAttachDebuggerOptions = {
234
- deviceIdentifier : deviceOption . deviceIdentifier ,
235
- isEmulator : currentDeviceInstance . isEmulator ,
236
- outputPath : currentDeviceDescriptor . outputPath ,
237
- platform : currentDeviceInstance . deviceInfo . platform ,
238
- projectDir : debuggingAdditionalOptions . projectDir ,
239
- debugOptions : deviceOption . debugOptions
240
- } ;
242
+ currentDeviceDescriptor . debugggingEnabled = true ;
243
+ const currentDeviceInstance = this . $devicesService . getDeviceByIdentifier ( deviceOption . deviceIdentifier ) ;
244
+ const attachDebuggerOptions : IAttachDebuggerOptions = {
245
+ deviceIdentifier : deviceOption . deviceIdentifier ,
246
+ isEmulator : currentDeviceInstance . isEmulator ,
247
+ outputPath : currentDeviceDescriptor . outputPath ,
248
+ platform : currentDeviceInstance . deviceInfo . platform ,
249
+ projectDir : debuggingAdditionalOptions . projectDir ,
250
+ debugOptions : deviceOption . debugOptions
251
+ } ;
241
252
242
- try {
243
- await this . attachDebugger ( attachDebuggerOptions ) ;
244
- } catch ( err ) {
245
- this . $logger . trace ( "Couldn't attach debugger, will modify options and try again." , err ) ;
246
- attachDebuggerOptions . debugOptions . start = false ;
247
- await this . attachDebugger ( attachDebuggerOptions ) ;
248
- }
253
+ try {
254
+ await this . attachDebugger ( attachDebuggerOptions ) ;
255
+ } catch ( err ) {
256
+ this . $logger . trace ( "Couldn't attach debugger, will modify options and try again." , err ) ;
257
+ attachDebuggerOptions . debugOptions . start = false ;
258
+ await this . attachDebugger ( attachDebuggerOptions ) ;
249
259
}
260
+ }
250
261
251
262
private async enableDebuggingCore ( deviceOption : IEnableDebuggingDeviceOptions , debuggingAdditionalOptions : IDebuggingAdditionalOptions ) : Promise < void > {
252
263
const liveSyncProcessInfo : ILiveSyncProcessInfo = this . liveSyncProcessesInfo [ debuggingAdditionalOptions . projectDir ] ;
0 commit comments