.NET Components for Mobility

BluetoothSecurity.RemoveDevice throws an ArgumentException on Windows Mobile 6.5.3

Last post 09-06-2010 11:17 AM by alanjmcf. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-03-2010 7:55 AM

    BluetoothSecurity.RemoveDevice throws an ArgumentException on Windows Mobile 6.5.3

    As part of a post-connection cleanup I remove the device using InTheHand.Net.Bluetooth.BluetoothSecurity.RemoveDevice. This works successfully on Windows Mobile 6.1, but an exception is thrown on Windows Mobile 6.5.3. I haven't had a chance to test on other versions of WM 6.5, but I believe a lot of registry security was added to versions 6.5, and this is likely the root of the problem. This is backed up by the stack trace, which shows the exception arises from RegistryKey.DeleteSubKeyTree(): System.ArgumentException at System.ThrowHelper.ThrowArgumentException() at Microsoft.Win32.RegistryKey.DeleteSubKeyTree() at InTheHand.Net.Bluetooth.WindowsBluetoothSecurity.RemoveDevice() at InTheHand.Net.Bluetooth.BluetoothSecurity.RemoveDevice() at ... etc Our workaround for now is just not to remove the device, but this is less than ideal. Anyone got any ideas how to fix this in a more sustained way? I'm not familiar with the internals of InTheHand so am unsure where to go from here. Many thanks! PS Sorry about the post formatting, I can't figure out how to make it paragraph more readably..?!
  • 09-05-2010 8:20 AM In reply to

    Re: BluetoothSecurity.RemoveDevice throws an ArgumentException on Windows Mobile 6.5.3

    So at worst, looks like we should catch that exception and return false for failure.  I'll check with Peter if that's the correct thing to do.  I don't know if there's another way to remove the device however...

    I've create a bug: http://32feet.codeplex.com/workitem/28782

  • 09-05-2010 8:43 AM In reply to

    Re: BluetoothSecurity.RemoveDevice throws an ArgumentException on Windows Mobile 6.5.3

    Hmm MSDN says the ArgumentException should occur due to the selected subkey not existing, and SecurityException in the permissions case...  Can you check whether there appears to be a list of devices at the respective place in the Registry? And the expected device(s) are there?
  • 09-06-2010 5:50 AM In reply to

    Re: BluetoothSecurity.RemoveDevice throws an ArgumentException on Windows Mobile 6.5.3

    Hi Alan, thanks for looking into this! I'm going to do some more testing this morning, am wondering if perhaps the original PairRequest (which I presume writes the registry key?) silently fails on 6.5.3 and thus the keys aren't there to remove later? Can't think of any other reason the keys wouldn't be there at the point I'm calling RemoveDevice. Can you let me know what keys I should be looking for in the registry that RemoveDevice is expecting to find? Thanks :)
  • 09-06-2010 11:17 AM In reply to

    Re: BluetoothSecurity.RemoveDevice throws an ArgumentException on Windows Mobile 6.5.3

    Hmm, could be.  The Registry location is "SOFTWARE\Microsoft\Bluetooth\Device\".  Have a look at the source file https://32feet.svn.codeplex.com/svn/InTheHand.Net.Personal/InTheHand.Net.Personal/Net.Bluetooth/WindowsBluetoothSecurity.cs you'll see the code there that does the add and removes.  (Later you might want to download the source, compile the library, and debug into it to see what is working and what is failing).

    Can you also try adding a device from the WM Control Panels and see if the Registry is similarly updated (and optionally look at remove too).

    Thanks

Page 1 of 1 (5 items)
Copyright © 2001-2012 In The Hand Ltd. All rights reserved. Terms of Use and Privacy Policy. OrcsWeb's Windows Cloud Server Hosting