title: How to use DeviceInformation.FindAllAsync to Enumerate all BLE devices visible to Windows Phone?
body: <ol>
  <li><p>I have a code to list all the BluetoothLE devices a Windows Phone 8.1 can detects (paired and unpaired):</p>
  
  <pre><code>    var devices = await DeviceInformation.FindAllAsync( BluetoothLEDevice.GetDeviceSelector() );
      foreach ( DeviceInformation di in devices )
          {
          BluetoothLEDevice bleDevice = await BluetoothLEDevice.FromIdAsync( di.Id );
  
          Debug.WriteLine( bleDevice.Name );
          }
  </code></pre></li>
  </ol>
  
  <p>However, the line:</p>
  
  <pre><code>var devices = await DeviceInformation.FindAllAsync( BluetoothLEDevice.GetDeviceSelector() );
  </code></pre>
  
  <p>Throws an exception.</p>
  
  <p><strong>Any Idea why?</strong> </p>
  
  <ol start="2">
  <li><p>I also tried this code:</p>
  
  <p>var devices = await DeviceInformation.FindAllAsync( GattDeviceService.GetDeviceSelectorFromUuid( GattServiceUuids.GenericAttribute ) );</p></li>
  </ol>
  
  <p>This code doesn't throw an exception, but returns 0 devices.</p>
  
  <p><strong>Any Idea why?</strong></p>
  
  <p>In both case, the DeviceCapability is defined as follows:</p>
  
  <pre><code>    &lt;m2:DeviceCapability Name="bluetooth.genericAttributeProfile"&gt;
          &lt;m2:Device Id="any"&gt;
              &lt;m2:Function Type="name:genericAttribute"/&gt;
          &lt;/m2:Device&gt;
      &lt;/m2:DeviceCapability&gt;
  </code></pre>