locked
an issue of DeviceInformation.FindAllAsync() getting multiple repeated results

    Question

  • Hi, 

    Could anyone please help me resolve an issue of DeviceInformation.FindAllAsync() getting multiple repeated results?

    There is only one phone, but there're multiple results with the same info; and that's why there're 356 devices detected, because other devices also get repeated.

    Thanks,

    var results = await DeviceInformation.FindAllAsync();
    Debug.WriteLine("device: {0} found", results.Count());
    int i = 0;
    foreach (var result in results)
    {
             Debug.WriteLine("Loop count: {0}", i);
             try
                 {
                     if (result.Name.ToString() == "Jerry’s iPhone")
                     {
                         Debug.WriteLine("device: {0}", result.Name.ToString());
                         Debug.WriteLine("\t Id: {0}", result.Id.ToString());
                            
                         foreach (var prop in result.Properties)
                         {
                                
                              Debug.WriteLine("\t key: {0}, value: {1}", prop.Key, prop.Value);    
                          }
                        }
                    }
                    catch (Exception ex)
                    {
                    }
    
          i++;
    }

    In output window:

    device: 356 found
    Loop count: 0
    Loop count: 1
    Loop count: 2
    Loop count: 3
    Loop count: 4
    Loop count: 5
    Loop count: 6
    Loop count: 7
    Loop count: 8
    Loop count: 9
    Loop count: 10
    Loop count: 11
    Loop count: 12
    Loop count: 13
    Loop count: 14
    Loop count: 15
    Loop count: 16
    Loop count: 17
    Loop count: 18
    Loop count: 19
    Loop count: 20
    Loop count: 21
    Loop count: 22
    Loop count: 23
    Loop count: 24
    Loop count: 25
    Loop count: 26
    Loop count: 27
    Loop count: 28
    Loop count: 29
    Loop count: 30
    Loop count: 31
    Loop count: 32
    Loop count: 33
    Loop count: 34
    Loop count: 35
    Loop count: 36
    Loop count: 37
    Loop count: 38
    Loop count: 39
    Loop count: 40
    Loop count: 41
    Loop count: 42
    Loop count: 43
    Loop count: 44
    Loop count: 45
    Loop count: 46
    Loop count: 47
    Loop count: 48
    Loop count: 49
    Loop count: 50
    Loop count: 51
    Loop count: 52
    Loop count: 53
    Loop count: 54
    Loop count: 55
    Loop count: 56
    Loop count: 57
    Loop count: 58
    Loop count: 59
    Loop count: 60
    Loop count: 61
    Loop count: 62
    Loop count: 63
    Loop count: 64
    Loop count: 65
    Loop count: 66
    Loop count: 67
    Loop count: 68
    Loop count: 69
    Loop count: 70
    Loop count: 71
    Loop count: 72
    Loop count: 73
    Loop count: 74
    Loop count: 75
    Loop count: 76
    Loop count: 77
    Loop count: 78
    Loop count: 79
    Loop count: 80
    Loop count: 81
    Loop count: 82
    Loop count: 83
    Loop count: 84
    Loop count: 85
    Loop count: 86
    Loop count: 87
    Loop count: 88
    Loop count: 89
    Loop count: 90
    Loop count: 91
    Loop count: 92
    Loop count: 93
    Loop count: 94
    device: Jerry’s iPhone
    Id: \\?\BTHENUM#{0000110e-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297#8&20548d4&0&DC2B618C5F03_C00000000#{0000110e-0000-1000-8000-00805f9b34fb}
    key: System.ItemNameDisplay, value: Jerry’s iPhone
    key: System.Devices.Icon, value: C:\Windows\System32\DDORes.dll,-2035
    key: {51236583-0C4A-4FE8-B81F-166AEC13F510} 123, value: C:\Windows\SYSTEM32\DDORes.dll,-3022
    key: System.Devices.IsDefault, value: False
    key: System.Devices.DeviceInstanceId, value: BTHENUM\{0000110e-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297\8&20548d4&0&DC2B618C5F03_C00000000
    key: System.Devices.InterfaceEnabled, value: True
    Loop count: 95
    Loop count: 96
    Loop count: 97
    device: Jerry’s iPhone
    Id: \\?\BTHENUM#{00001116-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297#8&20548d4&0&DC2B618C5F03_C00000000#{00001116-0000-1000-8000-00805f9b34fb}
    key: System.ItemNameDisplay, value: Jerry’s iPhone
    key: System.Devices.Icon, value: C:\Windows\System32\DDORes.dll,-2035
    key: {51236583-0C4A-4FE8-B81F-166AEC13F510} 123, value: C:\Windows\SYSTEM32\DDORes.dll,-3022
    key: System.Devices.IsDefault, value: False
    key: System.Devices.DeviceInstanceId, value: BTHENUM\{00001116-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297\8&20548d4&0&DC2B618C5F03_C00000000
    key: System.Devices.InterfaceEnabled, value: True
    Loop count: 98
    Loop count: 99
    Loop count: 100
    Loop count: 101
    Loop count: 102
    Loop count: 103
    Loop count: 104
    Loop count: 105
    Loop count: 106
    Loop count: 107
    Loop count: 108
    Loop count: 109
    Loop count: 110
    Loop count: 111
    Loop count: 112
    Loop count: 113
    Loop count: 114
    Loop count: 115
    Loop count: 116
    Loop count: 117
    Loop count: 118
    Loop count: 119
    Loop count: 120
    Loop count: 121
    Loop count: 122
    Loop count: 123
    Loop count: 124
    Loop count: 125
    Loop count: 126
    Loop count: 127
    Loop count: 128
    Loop count: 129
    Loop count: 130
    Loop count: 131
    Loop count: 132
    Loop count: 133
    Loop count: 134
    Loop count: 135
    Loop count: 136
    device: Jerry’s iPhone
    Id: \\?\BTHENUM#{0000110a-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297#8&20548d4&0&DC2B618C5F03_C00000000#{0000110a-0000-1000-8000-00805f9b34fb}
    key: System.ItemNameDisplay, value: Jerry’s iPhone
    key: System.Devices.Icon, value: C:\Windows\System32\DDORes.dll,-2035
    key: {51236583-0C4A-4FE8-B81F-166AEC13F510} 123, value: C:\Windows\SYSTEM32\DDORes.dll,-3022
    key: System.Devices.IsDefault, value: False
    key: System.Devices.DeviceInstanceId, value: BTHENUM\{0000110a-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297\8&20548d4&0&DC2B618C5F03_C00000000
    key: System.Devices.InterfaceEnabled, value: True
    Loop count: 137
    Loop count: 138
    Loop count: 139
    Loop count: 140
    Loop count: 141
    Loop count: 142
    Loop count: 143
    Loop count: 144
    Loop count: 145
    Loop count: 146
    Loop count: 147
    Loop count: 148
    Loop count: 149
    Loop count: 150
    Loop count: 151
    Loop count: 152
    Loop count: 153
    Loop count: 154
    Loop count: 155
    Loop count: 156
    Loop count: 157
    Loop count: 158
    Loop count: 159
    Loop count: 160
    Loop count: 161
    Loop count: 162
    Loop count: 163
    Loop count: 164
    Loop count: 165
    Loop count: 166
    Loop count: 167
    Loop count: 168
    Loop count: 169
    Loop count: 170
    Loop count: 171
    Loop count: 172
    Loop count: 173
    Loop count: 174
    Loop count: 175
    Loop count: 176
    Loop count: 177
    Loop count: 178
    Loop count: 179
    Loop count: 180
    Loop count: 181
    Loop count: 182
    Loop count: 183
    Loop count: 184
    Loop count: 185
    Loop count: 186
    Loop count: 187
    Loop count: 188
    Loop count: 189
    Loop count: 190
    Loop count: 191
    Loop count: 192
    Loop count: 193
    Loop count: 194
    Loop count: 195
    Loop count: 196
    Loop count: 197
    Loop count: 198
    Loop count: 199
    Loop count: 200
    Loop count: 201
    Loop count: 202
    Loop count: 203
    Loop count: 204
    Loop count: 205
    Loop count: 206
    Loop count: 207
    Loop count: 208
    Loop count: 209
    Loop count: 210
    Loop count: 211
    Loop count: 212
    Loop count: 213
    Loop count: 214
    Loop count: 215
    Loop count: 216
    Loop count: 217
    Loop count: 218
    Loop count: 219
    Loop count: 220
    Loop count: 221
    Loop count: 222
    Loop count: 223
    Loop count: 224
    device: Jerry’s iPhone
    Id: \\?\BTHENUM#{0000112f-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297#8&20548d4&0&DC2B618C5F03_C00000000#{0000112f-0000-1000-8000-00805f9b34fb}
    key: System.ItemNameDisplay, value: Jerry’s iPhone
    key: System.Devices.Icon, value: C:\Windows\System32\DDORes.dll,-2035
    key: {51236583-0C4A-4FE8-B81F-166AEC13F510} 123, value: C:\Windows\SYSTEM32\DDORes.dll,-3022
    key: System.Devices.IsDefault, value: False
    key: System.Devices.DeviceInstanceId, value: BTHENUM\{0000112f-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297\8&20548d4&0&DC2B618C5F03_C00000000
    key: System.Devices.InterfaceEnabled, value: True
    Loop count: 225
    Loop count: 226
    Loop count: 227
    Loop count: 228
    Loop count: 229
    Loop count: 230
    Loop count: 231
    Loop count: 232
    Loop count: 233
    Loop count: 234
    Loop count: 235
    Loop count: 236
    Loop count: 237
    Loop count: 238
    Loop count: 239
    Loop count: 240
    Loop count: 241
    Loop count: 242
    Loop count: 243
    Loop count: 244
    Loop count: 245
    Loop count: 246
    Loop count: 247
    Loop count: 248
    Loop count: 249
    Loop count: 250
    Loop count: 251
    Loop count: 252
    Loop count: 253
    Loop count: 254
    Loop count: 255
    Loop count: 256
    Loop count: 257
    device: Jerry’s iPhone
    Id: \\?\BTHENUM#{00000000-deca-fade-deca-deafdecacafe}_VID&000205ac_PID&1297#8&20548d4&0&DC2B618C5F03_C00000000#{00000000-deca-fade-deca-deafdecacafe}
    key: System.ItemNameDisplay, value: Jerry’s iPhone
    key: System.Devices.Icon, value: C:\Windows\System32\DDORes.dll,-2035
    key: {51236583-0C4A-4FE8-B81F-166AEC13F510} 123, value: C:\Windows\SYSTEM32\DDORes.dll,-3022
    key: System.Devices.IsDefault, value: False
    key: System.Devices.DeviceInstanceId, value: BTHENUM\{00000000-deca-fade-deca-deafdecacafe}_VID&000205ac_PID&1297\8&20548d4&0&DC2B618C5F03_C00000000
    key: System.Devices.InterfaceEnabled, value: True
    Loop count: 258
    Loop count: 259
    Loop count: 260
    Loop count: 261
    Loop count: 262
    Loop count: 263
    Loop count: 264
    Loop count: 265
    Loop count: 266
    Loop count: 267
    Loop count: 268
    Loop count: 269
    Loop count: 270
    Loop count: 271
    Loop count: 272
    Loop count: 273
    Loop count: 274
    Loop count: 275
    Loop count: 276
    Loop count: 277
    Loop count: 278
    Loop count: 279
    Loop count: 280
    Loop count: 281
    Loop count: 282
    Loop count: 283
    Loop count: 284
    Loop count: 285
    Loop count: 286
    device: Jerry’s iPhone
    Id: \\?\BTHENUM#{0000111f-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297#8&20548d4&0&DC2B618C5F03_C00000000#{0000111f-0000-1000-8000-00805f9b34fb}
    key: System.ItemNameDisplay, value: Jerry’s iPhone
    key: System.Devices.Icon, value: C:\Windows\System32\DDORes.dll,-2035
    key: {51236583-0C4A-4FE8-B81F-166AEC13F510} 123, value: C:\Windows\SYSTEM32\DDORes.dll,-3022
    key: System.Devices.IsDefault, value: False
    key: System.Devices.DeviceInstanceId, value: BTHENUM\{0000111f-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297\8&20548d4&0&DC2B618C5F03_C00000000
    key: System.Devices.InterfaceEnabled, value: True
    Loop count: 287
    device: Jerry’s iPhone
    Id: \\?\BTHENUM#Dev_DC2B618C5F03#8&20548d4&0&BluetoothDevice_DC2B618C5F03#{00f40965-e89d-4487-9890-87c3abb211f4}
    key: System.ItemNameDisplay, value: Jerry’s iPhone
    key: System.Devices.Icon, value: C:\Windows\System32\DDORes.dll,-2035
    key: {51236583-0C4A-4FE8-B81F-166AEC13F510} 123, value: C:\Windows\SYSTEM32\DDORes.dll,-3022
    key: System.Devices.IsDefault, value: False
    key: System.Devices.DeviceInstanceId, value: BTHENUM\Dev_DC2B618C5F03\8&20548d4&0&BluetoothDevice_DC2B618C5F03
    key: System.Devices.InterfaceEnabled, value: True
    Loop count: 288
    Loop count: 289
    Loop count: 290
    device: Jerry’s iPhone
    Id: \\?\BTHENUM#{0000110c-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297#8&20548d4&0&DC2B618C5F03_C00000000#{0000110c-0000-1000-8000-00805f9b34fb}
    key: System.ItemNameDisplay, value: Jerry’s iPhone
    key: System.Devices.Icon, value: C:\Windows\System32\DDORes.dll,-2035
    key: {51236583-0C4A-4FE8-B81F-166AEC13F510} 123, value: C:\Windows\SYSTEM32\DDORes.dll,-3022
    key: System.Devices.IsDefault, value: False
    key: System.Devices.DeviceInstanceId, value: BTHENUM\{0000110c-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297\8&20548d4&0&DC2B618C5F03_C00000000
    key: System.Devices.InterfaceEnabled, value: True
    Loop count: 291
    Loop count: 292
    Loop count: 293
    Loop count: 294
    Loop count: 295
    Loop count: 296
    Loop count: 297
    Loop count: 298
    Loop count: 299
    Loop count: 300
    Loop count: 301
    Loop count: 302
    Loop count: 303
    Loop count: 304
    Loop count: 305
    Loop count: 306
    Loop count: 307
    Loop count: 308
    Loop count: 309
    Loop count: 310
    Loop count: 311
    Loop count: 312
    Loop count: 313
    Loop count: 314
    Loop count: 315
    Loop count: 316
    Loop count: 317
    Loop count: 318
    Loop count: 319
    Loop count: 320
    Loop count: 321
    Loop count: 322
    Loop count: 323
    Loop count: 324
    Loop count: 325
    device: Jerry’s iPhone
    Id: \\?\HID#{0000110e-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297&Col01#9&1f2f457b&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}
    key: System.ItemNameDisplay, value: Jerry’s iPhone
    key: System.Devices.Icon, value: C:\Windows\System32\DDORes.dll,-2035
    key: {51236583-0C4A-4FE8-B81F-166AEC13F510} 123, value: C:\Windows\SYSTEM32\DDORes.dll,-3022
    key: System.Devices.IsDefault, value: False
    key: System.Devices.DeviceInstanceId, value: HID\{0000110e-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297&Col01\9&1f2f457b&0&0000
    key: System.Devices.InterfaceEnabled, value: True
    Loop count: 326
    Loop count: 327
    Loop count: 328
    Loop count: 329
    Loop count: 330
    Loop count: 331
    Loop count: 332
    Loop count: 333
    Loop count: 334
    Loop count: 335
    Loop count: 336
    Loop count: 337
    Loop count: 338
    Loop count: 339
    Loop count: 340
    device: Jerry’s iPhone
    Id: \\?\HID#{0000110e-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297&Col02#9&1f2f457b&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}
    key: System.ItemNameDisplay, value: Jerry’s iPhone
    key: System.Devices.Icon, value: C:\Windows\System32\DDORes.dll,-2035
    key: {51236583-0C4A-4FE8-B81F-166AEC13F510} 123, value: C:\Windows\SYSTEM32\DDORes.dll,-3022
    key: System.Devices.IsDefault, value: False
    key: System.Devices.DeviceInstanceId, value: HID\{0000110e-0000-1000-8000-00805f9b34fb}_VID&000205ac_PID&1297&Col02\9&1f2f457b&0&0001
    key: System.Devices.InterfaceEnabled, value: True
    Loop count: 341
    Loop count: 342
    Loop count: 343
    Loop count: 344
    Loop count: 345
    Loop count: 346
    Loop count: 347
    Loop count: 348
    Loop count: 349
    Loop count: 350
    Loop count: 351
    Loop count: 352
    Loop count: 353
    Loop count: 354
    Loop count: 355


    Jerry

    Monday, May 21, 2012 10:18 AM

Answers