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