Writing Bluetooth apps to run on the Windows platform can be one of the most frustrating development experiences you will face. Who needs Bluetooth connectivity on the Windows platform? Everyone uses phones and tablets today so Windows has been forgotten by developers. That’s not true actually, Windows has been forgotten by Microsoft! That’s the frustrating part. There are many use-cases where we will need to connect to devices for testing and configuration. Our production line for one device alone has three workstations that need to connect and configure. Does Microsoft want us to use Android or iOS tablets to do that instead?
Bluetooth or BLE (Bluetooth Light) for .NET (pre Windows 10)
Microsoft has given up on the prospect of ever supporting (in any useable fashion) Bluetooth for .NET. They absolutely do not support IN ANY WAY Bluetooth Light. (4.0). What they currently do for Bluetooth Classic connections is map a paired device to a SerialPort. You have to use an old SerialPort class in .NET to communicate and it works almost half the time. That is until the new Windows 10 updates (2017) when they broke it completely without any explanation or help. This means app’s we had in production just didn’t work any longer after updating the OS overnight.
How to get Bluetooth (and BLE) to work on Windows?
1. Upgrade to Windows 10
2. Upgrade your Windows 10 version to “Fall Creators Edition”
3. Change your development platform to Universal Windows Platform (UWP).
4. Make sure you have the latest (Fall 2017) UWP Libraries.
If you are lucky enough to be able to do the above, you will have access to Microsofts full Bluetooth and BLE libraries that make connectivity easy (and fun!). Those libraries are not available for any .NET development (that I have found) unless you have the above stack. If your experience is different, let me know!