Professional OPC
Development Tools

logos

Exception using == equality operator against null

More
23 Oct 2019 16:11 - 23 Oct 2019 16:11 #7862 by support
Which QuickOPC version are you using? (I cannot rule out that some versions could have the operator '==' defined on easyAEClient, and the exception is coming form inside its implementation)

Anyway, first thing to do to rule this out: Replace these tests by

ReferenceEquals(aeClient, null)

or, in newer C# versions,

aeClient is null

This way no unexpected code can be called for the comparison. And let's see if that helps.

Best regards
Last edit: 23 Oct 2019 16:11 by support.

Please Log in or Create an account to join the conversation.

More
23 Oct 2019 15:21 #7860 by fancybird
Hello ...

Sometimes, we get an exception when checking for aeClient == null.

It does not always happen ... but it happened enough that we had stayed away from doing that.
We had been using a separate variable to track if aeClient had been instantiated.

Is that normal? I am just curious.

Thanks!

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.162 seconds

      

 Recommend this on Google