Closed ErikBis closed 2 years ago
I have the same problem with ConnectAsync
What is the exception? It should contain the native SocketException which will help identify the reason
This is what I get:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=InTheHand.Net.Bluetooth
StackTrace:
at InTheHand.Net.Sockets.BluetoothClient.BeginConnect(BluetoothEndPoint endpoint, AsyncCallback requestCallback, Object state)
at WireOnAir.Infrastructure.Connections.Bluetooth.ClientWrapper.BtClientWrapper.
I can not see the native SocketException
Okay, I can see the issue, the client socket is not created in the BeginConnect method, but is in the sync Connect method. I'll get this resolved for the next release.
Thank you for your fast reply
Fixed in 4.0.26 now up on NuGet
I have now tested the BeginConnect and I don't get an exception, but I don't get connected either When I call EndConnect with the IAsyncResult I get the following exception As an remark I get an connection when I use Connect (_client.Connect(_deviceAddress, BluetoothService.SerialPort);)
System.Net.Sockets.SocketException HResult=0x80004005 Message=An invalid argument was supplied. Source=System.Private.CoreLib StackTrace: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Threading.Tasks.TaskToApm.End(IAsyncResult asyncResult) at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at InTheHand.Net.Sockets.BluetoothClient.EndConnect(IAsyncResult asyncResult) at WireOnAir.Infrastructure.Connections.Bluetooth.ClientWrapper.BtClientWrapper.EndConnect(IAsyncResult asyncResult) in C:\Users\ebs\Source\Repos\WoaEnvironmentBuilder\Infrastructure\Connections\Bluetooth\ClientWrapper\BtClientWrapper.cs:line 60 at WireOnAir.Infrastructure.Connections.Common.Clients.ClientAsync.ConnectedCallback(IAsyncResult result) in C:\Users\ebs\Source\Repos\WoaEnvironmentBuilder\Infrastructure\Connections\Common\Clients\ClientAsync.cs:line 166
I get an Exception when I try to connect to Bluttoth Following are giving me an exception () var addr = BluetoothAddress.Parse("00025BAABB99"); var service = BluetoothService.SerialPort; var port = 2;
I have upgraded to version 4.0.25 and now I get this Exception I not sure what I do wrong,