Repository: flutter
Issue: flutter run -d macos shows a crash when there is a locked iPhone attached
Labels: c: regression,tool,platform-mac,P2,team-tool,triaged-tool

Steps:

1. Attach an iPhone to your computer and make sure it is locked.
1. flutter run -d macos

Output:

```
Launching lib/main.dart on macOS in debug mode...
2020-08-24 14:00:07.792 xcodebuild[26465:11718714]  DTDeviceKit: Failed to mount DDI from '<DVTFilePath:0x7f8a236f4660:'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/13.6/DeveloperDiskImage.dmg'>', error=-402652958: Error Domain=com.apple.dtdevicekit Code=806 "Failed to prepare device for development." UserInfo={AssociatedMobileDeviceFunction=AMDeviceMountImage, NSUnderlyingError=0x7f8a1fcc64c0 {Error Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402652958 "The device is locked." UserInfo={MobileDeviceErrorCode=(0xE80000E2), com.apple.dtdevicekit.stacktrace=(
        0   DTDeviceKitBase                     0x0000000110a9c81a DTDKCreateNSErrorFromAMDErrorCode + 233
        1   DTDeviceKitBase                     0x0000000110adb8a9 -[DTDKMobileDeviceToken _mountDeveloperDiskImage:withError:] + 1034
        2   DTDeviceKitBase                     0x0000000110adc5e7 __58-[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:]_block_invoke + 779
        3   libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8
        4   libdispatch.dylib                   0x00007fff713976ec _dispatch_lane_barrier_sync_invoke_and_complete + 60
        5   DTDeviceKitBase                     0x0000000110adc27a -[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:] + 199
        6   IDEiOSSupportCore                   0x000000010dae6741 __37-[DVTiOSDevice(Connect) hasConnected]_block_invoke_2 + 265
        7   DVTFoundation                       0x000000010071f5d4 __DVT_CALLING_CLIENT_BLOCK__ + 7
        8   DVTFoundation                       0x000000010072446b __DVTDispatchGroupAsync_block_invoke + 1194
        9   libdispatch.dylib                   0x00007fff7138a6c4 _dispatch_call_block_and_release + 12
        10  libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8
        11  libdispatch.dylib                   0x00007fff7138d890 _dispatch_continuation_pop + 534
        12  libdispatch.dylib                   0x00007fff7138cf16 _dispatch_async_redirect_invoke + 703
        13  libdispatch.dylib                   0x00007fff71399957 _dispatch_root_queue_drain + 326
        14  libdispatch.dylib                   0x00007fff7139a097 _dispatch_worker_thread2 + 92
        15  libsystem_pthread.dylib             0x00007fff715e59f7 _pthread_wqthread + 220
        16  libsystem_pthread.dylib             0x00007fff715e4b77 start_wqthread + 15
), DVTRadarComponentKey=261622, NSLocalizedDescription=The device is locked.}}, NSLocalizedRecoverySuggestion=If you are certain that Xcode supports development on this device, try disconnecting and reconnecting the device., NSLocalizedFailure=This operation can fail if the version of the OS on the device is newer than the version of Xcode that is running., DVTRadarComponentKey=487927, NSLocalizedDescription=Failed to prepare device for development.}
2020-08-24 14:00:07.793 xcodebuild[26465:11718714]  iPhoneConnect: 📱<DVTiOSDevice (0x7f8a237a71c0), Dan’s iPhone, iPhone, 13.6 (17G68), 00008030-001864980239802E> unable to mount developer disk image, (Error Domain=com.apple.dtdevicekit Code=806 "Failed to prepare device for development." UserInfo={AssociatedMobileDeviceFunction=AMDeviceMountImage, NSUnderlyingError=0x7f8a1fcc64c0 {Error Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402652958 "The device is locked." UserInfo={MobileDeviceErrorCode=(0xE80000E2), com.apple.dtdevicekit.stacktrace=(
        0   DTDeviceKitBase                     0x0000000110a9c81a DTDKCreateNSErrorFromAMDErrorCode + 233
        1   DTDeviceKitBase                     0x0000000110adb8a9 -[DTDKMobileDeviceToken _mountDeveloperDiskImage:withError:] + 1034
        2   DTDeviceKitBase                     0x0000000110adc5e7 __58-[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:]_block_invoke + 779
        3   libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8
        4   libdispatch.dylib                   0x00007fff713976ec _dispatch_lane_barrier_sync_invoke_and_complete + 60
        5   DTDeviceKitBase                     0x0000000110adc27a -[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:] + 199
        6   IDEiOSSupportCore                   0x000000010dae6741 __37-[DVTiOSDevice(Connect) hasConnected]_block_invoke_2 + 265
        7   DVTFoundation                       0x000000010071f5d4 __DVT_CALLING_CLIENT_BLOCK__ + 7
        8   DVTFoundation                       0x000000010072446b __DVTDispatchGroupAsync_block_invoke + 1194
        9   libdispatch.dylib                   0x00007fff7138a6c4 _dispatch_call_block_and_release + 12
        10  libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8
        11  libdispatch.dylib                   0x00007fff7138d890 _dispatch_continuation_pop + 534
        12  libdispatch.dylib                   0x00007fff7138cf16 _dispatch_async_redirect_invoke + 703
        13  libdispatch.dylib                   0x00007fff71399957 _dispatch_root_queue_drain + 326
        14  libdispatch.dylib                   0x00007fff7139a097 _dispatch_worker_thread2 + 92
        15  libsystem_pthread.dylib             0x00007fff715e59f7 _pthread_wqthread + 220
        16  libsystem_pthread.dylib             0x00007fff715e4b77 start_wqthread + 15
), DVTRadarComponentKey=261622, NSLocalizedDescription=The device is locked.}}, NSLocalizedRecoverySuggestion=If you are certain that Xcode supports development on this device, try disconnecting and reconnecting the device., NSLocalizedFailure=This operation can fail if the version of the OS on the device is newer than the version of Xcode that is running., DVTRadarComponentKey=487927, NSLocalizedDescription=Failed to prepare device for development.}) {
    AssociatedMobileDeviceFunction = AMDeviceMountImage;                
    DVTRadarComponentKey = 487927;                                      
    NSLocalizedDescription = "Failed to prepare device for development.";
    NSLocalizedFailure = "This operation can fail if the version of the OS on the device is newer than the version of Xcode that is running.";
    NSLocalizedRecoverySuggestion = "If you are certain that Xcode supports development on this device, try disconnecting and reconnecting the device.";
    NSUnderlyingError = "Error Domain=com.apple.dt.MobileDeviceErrorDomain Code=-402652958 \"The device is locked.\" UserInfo={MobileDeviceErrorCode=(0xE80000E2), com.apple.dtdevicekit.stacktrace=(\n\t0   DTDeviceKitBase                     0x0000000110a9c81a DTDKCreateNSErrorFromAMDErrorCode + 233\n\t1   DTDeviceKitBase                     0x0000000110adb8a9 -[DTDKMobileDeviceToken _mountDeveloperDiskImage:withError:] + 1034\n\t2   DTDeviceKitBase                     0x0000000110adc5e7 __58-[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:]_block_invoke + 779\n\t3   libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8\n\t4   libdispatch.dylib                   0x00007fff713976ec _dispatch_lane_barrier_sync_invoke_and_complete + 60\n\t5   DTDeviceKitBase                     0x0000000110adc27a -[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:] + 199\n\t6   IDEiOSSupportCore                   0x000000010dae6741 __37-[DVTiOSDevice(Connect) hasConnected]_block_invoke_2 + 265\n\t7   DVTFoundation                       0x000000010071f5d4 __DVT_CALLING_CLIENT_BLOCK__ + 7\n\t8   DVTFoundation                       0x000000010072446b __DVTDispatchGroupAsync_block_invoke + 1194\n\t9   libdispatch.dylib                   0x00007fff7138a6c4 _dispatch_call_block_and_release + 12\n\t10  libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8\n\t11  libdispatch.dylib                   0x00007fff7138d890 _dispatch_continuation_pop + 534\n\t12  libdispatch.dylib                   0x00007fff7138cf16 _dispatch_async_redirect_invoke + 703\n\t13  libdispatch.dylib                   0x00007fff71399957 _dispatch_root_queue_drain + 326\n\t14  libdispatch.dylib                   0x00007fff7139a097 _dispatch_worker_thread2 + 92\n\t15  libsystem_pthread.dylib             0x00007fff715e59f7 _pthread_wqthread + 220\n\t16  libsystem_pthread.dylib             0x00007fff715e4b77 start_wqthread + 15\n), DVTRadarComponentKey=261622, NSLocalizedDescription=The device is locked.}";
}                                                                       
2020-08-24 14:00:07.794 xcodebuild[26465:11718654] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7f8a237a71c0), Dan’s iPhone, iPhone, 13.6 (17G68), 00008030-001864980239802E> -- An error occurred whilst preparing device for development -- Failed to prepare device for development.
Domain: com.apple.dtdevicekit                                           
Code: 806                                                               
Recovery Suggestion: If you are certain that Xcode supports development on this device, try disconnecting and reconnecting the device.
User Info: {                                                            
    AssociatedMobileDeviceFunction = AMDeviceMountImage;                
    DVTRadarComponentKey = 487927;                                      
    NSLocalizedFailure = "This operation can fail if the version of the OS on the device is newer than the version of Xcode that is running.";
}                                                                       
--                                                                      
The device is locked.                                                   
Domain: com.apple.dt.MobileDeviceErrorDomain                            
Code: -402652958                                                        
User Info: {                                                            
    DVTRadarComponentKey = 261622;                                      
    MobileDeviceErrorCode = "(0xE80000E2)";                             
    "com.apple.dtdevicekit.stacktrace" = (                              
        0   DTDeviceKitBase                     0x0000000110a9c81a DTDKCreateNSErrorFromAMDErrorCode + 233
        1   DTDeviceKitBase                     0x0000000110adb8a9 -[DTDKMobileDeviceToken _mountDeveloperDiskImage:withError:] + 1034
        2   DTDeviceKitBase                     0x0000000110adc5e7 __58-[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:]_block_invoke + 779
        3   libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8
        4   libdispatch.dylib                   0x00007fff713976ec _dispatch_lane_barrier_sync_invoke_and_complete + 60
        5   DTDeviceKitBase                     0x0000000110adc27a -[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:] + 199
        6   IDEiOSSupportCore                   0x000000010dae6741 __37-[DVTiOSDevice(Connect) hasConnected]_block_invoke_2 + 265
        7   DVTFoundation                       0x000000010071f5d4 __DVT_CALLING_CLIENT_BLOCK__ + 7
        8   DVTFoundation                       0x000000010072446b __DVTDispatchGroupAsync_block_invoke + 1194
        9   libdispatch.dylib                   0x00007fff7138a6c4 _dispatch_call_block_and_release + 12
        10  libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8
        11  libdispatch.dylib                   0x00007fff7138d890 _dispatch_continuation_pop + 534
        12  libdispatch.dylib                   0x00007fff7138cf16 _dispatch_async_redirect_invoke + 703
        13  libdispatch.dylib                   0x00007fff71399957 _dispatch_root_queue_drain + 326
        14  libdispatch.dylib                   0x00007fff7139a097 _dispatch_worker_thread2 + 92
        15  libsystem_pthread.dylib             0x00007fff715e59f7 _pthread_wqthread + 220
        16  libsystem_pthread.dylib             0x00007fff715e4b77 start_wqthread + 15
);                                                                      
}                                                                       
--                                                                      
2020-08-24 14:00:07.794 xcodebuild[26465:11718654] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7f8a237a71c0), Dan’s iPhone, iPhone, 13.6 (17G68), 00008030-001864980239802E> == Underlying device preparation errors ==
2020-08-24 14:00:07.794 xcodebuild[26465:11718654] [MT] iPhoneConnect: Failed to prepare device for development.
Domain: com.apple.dtdevicekit                                           
Code: 806                                                               
Recovery Suggestion: If you are certain that Xcode supports development on this device, try disconnecting and reconnecting the device.
User Info: {                                                            
    AssociatedMobileDeviceFunction = AMDeviceMountImage;                
    DVTRadarComponentKey = 487927;                                      
    NSLocalizedFailure = "This operation can fail if the version of the OS on the device is newer than the version of Xcode that is running.";
}                                                                       
--                                                                      
The device is locked.                                                   
Domain: com.apple.dt.MobileDeviceErrorDomain                            
Code: -402652958                                                        
User Info: {                                                            
    DVTRadarComponentKey = 261622;                                      
    MobileDeviceErrorCode = "(0xE80000E2)";                             
    "com.apple.dtdevicekit.stacktrace" = (                              
        0   DTDeviceKitBase                     0x0000000110a9c81a DTDKCreateNSErrorFromAMDErrorCode + 233
        1   DTDeviceKitBase                     0x0000000110adb8a9 -[DTDKMobileDeviceToken _mountDeveloperDiskImage:withError:] + 1034
        2   DTDeviceKitBase                     0x0000000110adc5e7 __58-[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:]_block_invoke + 779
        3   libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8
        4   libdispatch.dylib                   0x00007fff713976ec _dispatch_lane_barrier_sync_invoke_and_complete + 60
        5   DTDeviceKitBase                     0x0000000110adc27a -[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:] + 199
        6   IDEiOSSupportCore                   0x000000010dae6741 __37-[DVTiOSDevice(Connect) hasConnected]_block_invoke_2 + 265
        7   DVTFoundation                       0x000000010071f5d4 __DVT_CALLING_CLIENT_BLOCK__ + 7
        8   DVTFoundation                       0x000000010072446b __DVTDispatchGroupAsync_block_invoke + 1194
        9   libdispatch.dylib                   0x00007fff7138a6c4 _dispatch_call_block_and_release + 12
        10  libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8
        11  libdispatch.dylib                   0x00007fff7138d890 _dispatch_continuation_pop + 534
        12  libdispatch.dylib                   0x00007fff7138cf16 _dispatch_async_redirect_invoke + 703
        13  libdispatch.dylib                   0x00007fff71399957 _dispatch_root_queue_drain + 326
        14  libdispatch.dylib                   0x00007fff7139a097 _dispatch_worker_thread2 + 92
        15  libsystem_pthread.dylib             0x00007fff715e59f7 _pthread_wqthread + 220
        16  libsystem_pthread.dylib             0x00007fff715e4b77 start_wqthread + 15
);                                                                      
}                                                                       
--                                                                      
2020-08-24 14:00:07.794 xcodebuild[26465:11718654] [MT] iPhoneConnect: Failed to prepare device for development.
Domain: com.apple.dtdevicekit                                           
Code: 806                                                               
Recovery Suggestion: If you are certain that Xcode supports development on this device, try disconnecting and reconnecting the device.
User Info: {                                                            
    AssociatedMobileDeviceFunction = AMDeviceMountImage;                
    DVTRadarComponentKey = 487927;                                      
    NSLocalizedFailure = "This operation can fail if the version of the OS on the device is newer than the version of Xcode that is running.";
}                                                                       
--                                                                      
The device is locked.                                                   
Domain: com.apple.dt.MobileDeviceErrorDomain                            
Code: -402652958                                                        
User Info: {                                                            
    DVTRadarComponentKey = 261622;                                      
    MobileDeviceErrorCode = "(0xE80000E2)";                             
    "com.apple.dtdevicekit.stacktrace" = (                              
        0   DTDeviceKitBase                     0x0000000110a9c81a DTDKCreateNSErrorFromAMDErrorCode + 233
        1   DTDeviceKitBase                     0x0000000110adb8a9 -[DTDKMobileDeviceToken _mountDeveloperDiskImage:withError:] + 1034
        2   DTDeviceKitBase                     0x0000000110adc5e7 __58-[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:]_block_invoke + 779
        3   libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8
        4   libdispatch.dylib                   0x00007fff713976ec _dispatch_lane_barrier_sync_invoke_and_complete + 60
        5   DTDeviceKitBase                     0x0000000110adc27a -[DTDKMobileDeviceToken mountDeveloperDiskImageWithError:] + 199
        6   IDEiOSSupportCore                   0x000000010dae6741 __37-[DVTiOSDevice(Connect) hasConnected]_block_invoke_2 + 265
        7   DVTFoundation                       0x000000010071f5d4 __DVT_CALLING_CLIENT_BLOCK__ + 7
        8   DVTFoundation                       0x000000010072446b __DVTDispatchGroupAsync_block_invoke + 1194
        9   libdispatch.dylib                   0x00007fff7138a6c4 _dispatch_call_block_and_release + 12
        10  libdispatch.dylib                   0x00007fff7138b658 _dispatch_client_callout + 8
        11  libdispatch.dylib                   0x00007fff7138d890 _dispatch_continuation_pop + 534
        12  libdispatch.dylib                   0x00007fff7138cf16 _dispatch_async_redirect_invoke + 703
        13  libdispatch.dylib                   0x00007fff71399957 _dispatch_root_queue_drain + 326
        14  libdispatch.dylib                   0x00007fff7139a097 _dispatch_worker_thread2 + 92
        15  libsystem_pthread.dylib             0x00007fff715e59f7 _pthread_wqthread + 220
        16  libsystem_pthread.dylib             0x00007fff715e4b77 start_wqthread + 15
);                                                                      
}                                                                       
--                                                                      
2020-08-24 14:00:07.795 xcodebuild[26465:11718654] [MT] iPhoneConnect: 📱<DVTiOSDevice (0x7f8a237a71c0), Dan’s iPhone, iPhone, 13.6 (17G68), 00008030-001864980239802E> == END: Underlying device preparation errors ==
Building macOS application...                                          ⡿^C
```