I've been trying to fix this problem for an hour now and it's been giving me a headache. All I'm trying to do is connect a Bluetooth device to my application using the example on this page. When the .Connect function is called, a SocketException occurs saying "The requested address is not valid in its context".
I am positive the address of the device I'm pairing is correct; I even discovered devices and used an address from one of the found devices, yet I still got the same error. I've tried both BluetoothService.SerialPort and the MyConsts class example for the Guid, and both raised the same error.
The code I'm using is here:
BluetoothAddress addr = BluetoothAddress.Parse("78A2A0FC0BB1");
Guid serviceClass;
serviceClass = BluetoothService.SerialPort;
// - or - etc
// serviceClass = MyConsts.MyServiceUuid
//
var ep = new BluetoothEndPoint(addr, serviceClass);
var cli = new BluetoothClient();
cli.Connect(ep);
Stream peerStream = cli.GetStream();
I'm also using Visual Studio 2015.