Forum Xamarin.Forms

UWP DeviceInformation.FindAllAsync not finding COM Ports

wlangendorfEMwlangendorfEM Member ✭✭
edited March 2019 in Xamarin.Forms

I have a UWP app which needs to listen to a device on a COM port.

I am attempting to enumerate the available ports such that the user can select which one their device is broadcasting on. The code I am using is as follows:

        string serialDeviceType = RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort);
        DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(serialDeviceType);

On the first surface I was working with the 'devices' collection got 4 members, "Com1", "Com2", "Com3" and "Serial Port", and I was ultimately able to get everything working correctly. I have another device, however, and on this one I only get "Serial Port' in the 'devices' collection with the same code.

Does anyone know why this might be the case? On what axis would the surfaces have to differ from one another for this code to get these different return values?




  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    This might seem a simple question but...
    If you look in device manager does it even have a "com1", "com2" etc.?
    Can't report what isn't there.

  • wlangendorfEMwlangendorfEM Member ✭✭


    Thanks, that's a good question.

    On the machine where I am only seeing one result ("Serial Port"), Under Device manager there is a 'Ports (COM & LPT)' heading, which has:

    "Standard Serial over Bluetooth link (COM3)" and "Standard Serial over Bluetooth link (COM4)" in it.

    I'm looking into what the device manager on the first (working) surface had.

  • wlangendorfEMwlangendorfEM Member ✭✭

    I got the original device tested, with strange results:

    In its Device Manager it shows "Standard Serial over Bluetooth link (COM3)" all the way through "Standard Serial over Bluetooth link (COM10)". (8 total Ports under 'Ports (COM & LPT)').

    By contrast, the names of its DeviceInformation values in the 'devices' collection are COM1, COM2, COM3 and 'GNSS Server'.

    It seems like my code isn't giving me the Ports listed under device manager. I'm missing something fundamental in my understanding of what is going on here.

Sign In or Register to comment.