Hello,
In my software based on the InTheHand.net library, I have the following subroutine to do discovery. Note that myBlueTooth is an object of type BlueToothClient, instantiated at the class level. This subroutine is called in a thread each time I want to discover devices.
The code works fine - for 8 or 10 or even 18 hours, but eventually the system hangs (not every system, only some, and for some reason it is more likely to occur on systems with Portuguese Windows XP). I was finally able to discover that the problem is in the line of code where I call DiscoverDevices, and the NotImplemented exception is thrown.
Dim foundDevs() As BluetoothDeviceInfo = myBlueTooth.DiscoverDevices(NumToDiscover, False, True, True)
So...Is this a bug in the DiscoverDevices function? Or is it something in my code? Has anyone had a similar problem?
Thanks.
<code>
Private Sub tDoDiscovery()DeviceList = New ArrayList
NumToDiscover = SaveNumToDiscover
Dim amDone As Boolean = False
If Not HaveBluetoothDevice ThenRaiseEvent DiscoveryComplete()
Exit Sub
End If
DeviceList.Clear()
Debug.Print("About to DiscoverDevices")
Dim foundDevs() As BluetoothDeviceInfo = myBlueTooth.DiscoverDevices(NumToDiscover, False, True, True)For Each foundDev As BluetoothDeviceInfo In foundDevs
foundDev.Refresh()
DeviceList.Add(foundDev)
NextRaiseEvent DiscoveryComplete()
Debug.Print(
"BTManager: end of tDoDiscovery")
End Sub
</code>
Here is the exception information:
A first chance exception of type 'System.NotImplementedException' occurred in System.dll
System.Transactions Critical: 0 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Critical">
<TraceIdentifier>http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled</TraceIdentifier>
<Description>Unhandled exception</Description><AppDomain>Bluetooth Marketing 2Call.vshost.exe</AppDomain>
<Exception><ExceptionType>System.NotImplementedException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>This method is not implemented by this class.</Message>
<StackTrace> at System.Net.EndPoint.Create(SocketAddress socketAddress)
at InTheHand.Net.BluetoothEndPoint.Create(SocketAddress socketAddress)
at InTheHand.Net.Sockets.BluetoothClient.DiscoverDevices(Int32 maxDevices, Boolean authenticated, Boolean remembered, Boolean unknown)
at BlueGarra.BlueTooth.tDoDiscovery() in C:\Documents and Settings\Amir Bavar\My Documents\BlueGarra\BlueGarra\BlueTooth.vb:line 354
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()</StackTrace><ExceptionString>System.NotImplementedException: This method is not implemented by this class.
at System.Net.EndPoint.Create(SocketAddress socketAddress)
at InTheHand.Net.BluetoothEndPoint.Create(SocketAddress socketAddress)
at InTheHand.Net.Sockets.BluetoothClient.DiscoverDevices(Int32 maxDevices, Boolean authenticated, Boolean remembered, Boolean unknown)
at BlueGarra.BlueTooth.tDoDiscovery() in C:\Documents and Settings\Amir Bavar\My Documents\BlueGarra\BlueGarra\BlueTooth.vb:line 354
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()</ExceptionString></Exception></TraceRecord>