Wireless Communication Library Support Forum

Frameworks => Bluetooth Framework => Topic started by: rameshwar on August 18, 2012, 08:47:09 PM

Title: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: rameshwar on August 18, 2012, 08:47:09 PM
Why is sometimes, though very rare, IsInRange causing System.NullReferenceException?

Application: MyApp.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception.

Exception Info:

System.NullReferenceException Stack:

at <Module>.wcl.wcl_int.CwclSDPParser.Parse(wcl.wcl_int.CwclSDPParser*, Byte*, UInt32)
at <Module>.wcl.wcl_int.CwclSDPParser.{ctor}(wcl.wcl_int.CwclSDPParser*, Byte*, UInt32)
at <Module>.wcl.wcl_int.CwclBluetoothDevice.EnumServicesMicrosoft(wcl.wcl_int.CwclBluetoothDevice*, wcl.wcl_int.CwclBluetoothServices*, _GUID*)

at <Module>.wcl.wcl_int.CwclBluetoothDevice.EnumServices(wcl.wcl_int.CwclBluetoothDevice*,
wcl.wcl_int.CwclBluetoothRadio*, wcl.wcl_int.CwclBluetoothServices*, _GUID*)

at <Module>.wcl.wcl_int.CwclBluetoothDevice.IsInRange(wcl.wcl_int.CwclBluetoothDevice*, wcl.wcl_int.CwclBluetoothRadio*, Boolean*)

at wcl.wclBluetoothDevice.IsInRange(wcl.wclBluetoothRadio, Boolean ByRef)

at MyApp.Server.DiscoveryService.wclBluetoothDiscovery_OnDiscoveryComplete(System.Object, wcl.wclBluetoothDiscoveryCompleteEventArgs)
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on August 19, 2012, 08:32:07 AM
Hello,

Looks like a bug in SDP parser. We will check that out and fix.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on August 21, 2012, 09:07:43 AM
Hello,

Can you please try BluetoothDiscovery demo application and its Enum services button: I helps to check were bug is. It works or does not.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: rameshwar on August 22, 2012, 08:34:04 AM
I tried BluetoothDiscovery demo application and its Enum services button. It works.

I am not sure, I'll investigate more and then report to you, it seems to me that the exception occurs when two applications are using WCL at the same time. In our program one app is for configuration and the other is the main app. I guess, when both access WCL at the same time then the exception occurs. I'm not sure, I'll investigate and report to you. Thank you.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: rameshwar on August 22, 2012, 08:42:27 AM
I should have attached this image in my previous post. Thank you.

[attachment deleted by admin]
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on August 22, 2012, 08:44:41 AM
Hello,

Thank you for so detailed information. I will recheck it once again and try to reproduce the issue. WCL should work even used from few apps at the same time so, as I told before, it looks as our bug in WCL and we will do all our best to fix it as soon as possible.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on August 27, 2012, 08:17:48 AM
Hello,

I have rechecked the IsInRange code (and SDP Parser code as well). Unfortunately I couldn't reproduce the issue with debices we have but that doesn't mean that there is no bug. So I'll continue working on this matter and hopefully can find where problem is.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Flominator on February 22, 2013, 12:50:09 PM
I have had this once or twice, too.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on February 22, 2013, 01:07:19 PM
We are working on this issue but still can't reproduce it.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Flominator on February 25, 2013, 10:17:15 AM
I can, but the pc is not within our LAN. Do you maybe want to build me some version that collects the info you need?
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on February 25, 2013, 10:22:51 AM
Will do today and send to you. Thank you.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Flominator on February 25, 2013, 10:42:54 AM
Creating a Ghost image of the current state, take your time.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Flominator on March 04, 2013, 11:20:53 AM
Do you still want me to test it or can I get rid of the image?
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on March 04, 2013, 11:23:09 AM
Hi,

Have you tryed latest 6.11.4? Is problem still there?
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on March 20, 2013, 08:55:39 PM
Hi,

Finally issue has been reproduced and fixed. If you need fixed version send us a request as it is not published yet.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: rameshwar on June 21, 2013, 08:27:13 PM
Sounds great! We have been developing an app that uses WCL for almost last one year and this was the only reason that forced me to write our own small library of utility functions using Windows API, which is working fine for our requirements. However, we are yet to release our commercial product and if this issue has been fixed then we shall definitely be using WCL as we can do more with it when needed and as of now we have not found any other bug in WCL. Thank you for this great news. How can we obtain the fixed version? Thank you. Rameshwar
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on June 21, 2013, 09:44:32 PM
Hello,

If you are registered user you can download latest version from registered users area. If you use WCL demo download the latest demo from our site.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: rameshwar on June 22, 2013, 07:41:29 PM
Hello

Have you removed the Demo warning dialog from Demo version?

My previous experience was that Demo Version does not work with Windows Service applications due to Demo Warning Dialog, this is because Windows Service is not meant for interactive desktop.

I was fortunate enough to have received the full version from you for evaluation and then this Exception started occurring. I am not a registered user as yet.

Thank you
Rameshwar
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on June 22, 2013, 08:32:23 PM
Hello,

No, we did not and I do not think we ever do. However, you can check that the bug is fixed (or not) if simple run BluetoothDiscovery demo application from WCL package.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: rameshwar on June 25, 2013, 08:01:17 AM
Thank you for your reply.

I have created many testing scenarios and come to the conclusion that I cannot test for exception caused in our product by WCL simply by running BluetoothDiscovery demo.

Accordingly, since no demo is available, I have decided to move on.

Also, if we decide to buy and the exception still exists then shall we get the refund?

Thank you
Rameshwar
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on June 25, 2013, 08:15:58 AM
Hello,

In fact we can not guaratee that Bluetooth part of WCL will work in service application  as there are some things out of our control. For example, WidComm and Toshiba have limitations for using it from Windows Service. Also as WCL has unlimited trial period usualy we do not do refunds.
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: rameshwar on July 07, 2013, 11:30:34 AM
Based on your assurance that the exception has been fixed we purchased Lite license in the name Saucepan Productions as "License Comparison Tool" list for Lite includes the features we wanted to use including pairing. The accompanying documents too contained these classes. However, when I use it build the solution I get following errors -

(1) For the following classes the error is -
The type or namespace name ... does not exist in the namespace 'wcl'

'wclAuthenticator'
'wclPairedEventHandler'
'wclAuthenticationRequestEventHandler'
'wclPINRequestEventHandler'
'wclPINRequestEventArgs'
'wclAuthenticationRequestEventArgs'
'wclPairedEventArgs'
'wclClientTransport'

(2) The other error is -
'wcl.wclBluetoothRadio' does not contain a constructor that takes 1 arguments

I have downloaded version 6 12 0 0

Thank you
Rameshwar
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on July 07, 2013, 11:37:37 AM
Hello,

Thank you for your purchase. Unfortunately wclAuthenticator (as described in License Comparison Table, SilentAuth) is available in Personal License. However, manual pairing (wclBluetoothDevice.Pair) is available in Lite License.

wclClientTransport is depricated since 6.11.4.0 (www.btframework.com/news.htm#a28022013) and in latest WCL you have to use wclTransport.

Events in WCL authenticator have been changed since 6.11.3.0 (www.btframework.com/news.htm#a22022013).

Copy constructors have been removed. You should use Assign method instead (as it was in always in WCL).
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: rameshwar on July 07, 2013, 01:39:48 PM
From the downloaded licensed version when I run the BluetoothDiscoveryDemo I get the following errors -

The type or namespace name ... does not exist in the namespace 'wcl' - for the following
'wclPINRequestEventArgs'
'wclNumericComparisonEventArgs'

Thank you
Rameshwar
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on July 07, 2013, 02:03:50 PM
Looks like something went wrong when building setup it demo from old version appears in this installation. Please find attached correct demo. Also we will upload fixed installtion in few minutes.

[attachment deleted by admin]
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: rameshwar on July 09, 2013, 08:32:50 AM
In the new library I am not getting NullReferenceException but it now has another problem. At the point where I was getting exception the call now returns "not in range" even though the discovered device is only some inches away. I am surmising that the Null Reference Exception was happening probably because Radio was going away and now "not in range" is occurring because of the the same i.e. because of Radio going away. Is my assumption correct? If my assumption is correct then in this case have you released handle to the hardware in your code in such a situation?

Thank you
Rameshwar
Title: Re: Why is sometimes, though rare, IsInRange causing System.NullReferenceException?
Post by: Mike Petrichenko on July 09, 2013, 08:51:56 AM
IsInRange uses service enumeration to detect that device is in range. If your device reuiqres pairing to enumerate service and not paired, if your device is not in connectable mode, if your device busy and can't reurn its services IsInRange returns False (device is not in range).