Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

DUE TO ADMINISTRATIVE REASONS, WE MAY NOT BE ABLE TO RESPOND (OR TO RESPOND AS QUICKLY AS USUAL) BETWEEN December 30, 2024 - January 6, 2025. WE APOLOGIZE FOR INCONVENIENCE.

Writing Boolean value results in ArgumentNullException

More
18 May 2024 09:32 #12804 by support
More detailed logging for this particular area is not available.

Can you try disabling the code optimizations for the process? I have never done that, but it seems that for .NET 6, setting the environment variable COMPlus_JITMinOpts=1 before running the process should do it:

- stackoverflow.com/questions/63959038/how-to-suppress-jit-optimization-in-net-core
- stackoverflow.com/questions/73864832/disable-jit-optimizations-for-specific-net-core-assembly

The idea is that you will end up with the same exception, but better stack trace.


Besides this, I actually know how to work around the issue (but I would prefer finding the cause). The problem is in the area where QuickOPC attempts to obtain the data type of the variable that is being written to. This is only done if the data type is *not* specified in the Write call. Specifying the data type should "resolve" it.

So just use a different overload of WriteValue, and add TypeCode.Boolean as the last parameter -
        static public (bool Clamped, bool CompletesAsynchronously) WriteValue(
            [NotNull] this IEasyUAClient client,
            [NotNull] UAEndpointDescriptor endpointDescriptor,
            [NotNull] UANodeDescriptor nodeDescriptor,
            [CanBeNull] object value,
            TypeCode typeCode)

Regards
The following user(s) said Thank You: Andriy

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

More
17 May 2024 15:25 #12801 by Andriy
Is there any way to enable detailed logging for the QuickOPC library? Could this be related to obtaining the node data type from OPC UA server? If so, could you provide the code to fetch the node attributes or any other necessary information before writing the value?

Thank you

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

More
17 May 2024 15:17 #12800 by support
I have examined the call stack.
But it does not help. The code is optimized and the really important stack frames are not listed.

Regards

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

More
17 May 2024 15:12 #12799 by Andriy
Thank you for your prompt response.
I'm unlikely to reproduce the issue without providing you access to the customer OPC UA server. Could you please examine the attached call stack and determine what might be causing this error?

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

More
17 May 2024 14:51 #12798 by support
Hello.

I do not think this is directly related to the fact that the value is Boolean. In my tests, I can write Boolean values successfully.
Can you put together a test scenario which reliable reproduces the problem?

Best regards

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

More
17 May 2024 10:24 #12797 by Andriy
Hello,

QuickOPC library 5.63.246, .Net Core 6
Writing a boolean value results in an ArgumentNullException: Value cannot be null. (Parameter 'key')
Can you assist me with this?
System.ArgumentNullException: Value cannot be null. (Parameter 'key')
   at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
   at OpcLabs.EasyOpc.UA.Toolkit.Client.UAClientSession.BrowseNodesPreprocess(UABrowseEntry[] browseEntryArray, Exception[]& exceptionArray, List`1[]& sdkNodesToBrowseArray, List`1[]& warningsArray)
   at OpcLabs.EasyOpc.UA.Toolkit.Client.UAClientSession.InternalBrowseNodes(UABrowseEntry[] browseEntryArray, Exception[]& exceptionArray, UANodeElementCollection[]& nodeElementCollectionArray, List`1[]& warningsArray)
   at OpcLabs.EasyOpc.UA.Toolkit.Client.UAClientSession.BrowseNodes(UABrowseEntry[] browseEntryArray, Exception[]& exceptionArray, UANodeElementCollection[]& nodeElementCollectionArray, List`1[]& warningsArray)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.EasyUAClientSession.DetermineDataTypeInternal(UANodeId dataTypeId, Type& dataType)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.EasyUAClientSession.DetermineDataType(UANodeId dataTypeId, Type& dataType)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.EasyUAClientSession.DetermineValueType(UAAttributeDataResult dataTypeResult, UAAttributeDataResult valueRankResult, UANodeId& dataTypeId, Int32& valueRank, Type& elementType)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.EasyUAClientSession.ReadTypeInformation(IEnumerable`1 nodeDescriptorArgumentsEnumerable)+MoveNext()
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.EasyUAClientSession.ObtainTypeInformationInternal(ValueArguments`1[] nodeDescriptorArgumentsArray, ValueResult`1[] typeInformationResultArray)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.EasyUAClientSession.ObtainTypeInformation(IEnumerable`1 nodeDescriptorArgumentsEnumerable)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.EasyUAClientSession.ResolveWriteList(List`1 resolveWriteList, ICollection`1 internalWriteList, UAWriteResult[] writeResultArray)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.EasyUAClientSession.WriteList(List`1 writeList, UAWriteResult[] writeResultArray)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.EasyUAClientEngine.Write(ICollection`1 writeListDictionary, UAWriteResult[] writeResultArray)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.EasyUAClientEngine.InnerWriteAttributes(UAWriteArguments[] writeArgumentsArray, EasyUAAdaptableParameters easyUAAdaptableParameters)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.EasyUAClientEngine.WriteAttributes(UAWriteArguments[] writeArgumentsArray, EasyUAAdaptableParameters easyUAAdaptableParameters)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.NetSdkEasyUAClient.<>c__DisplayClass56_0.<WriteMultiple>b__0()
   at OpcLabs.BaseLib.Internal.DisposableObject.DisposeGuard[TResult](Func`1 func, Boolean throwOnDisposed)
   at OpcLabs.EasyOpc.UA.Implementation.NetSdk.Client.NetSdkEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.ErrorTransformingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.DataConvertingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Optimization.Implementation.RequestMergingEasyUAClient.<WriteMultiple>b__3_0(UAWriteArguments[] array)
   at OpcLabs.BaseLib.OperationModel.Extensions.IReadOnlyListOfOperationArgumentsExtension.MergingPerform[TArguments,TResult](IReadOnlyList`1 argumentsList, Func`2 arrayOperationFunction)
   at OpcLabs.EasyOpc.UA.Optimization.Implementation.RequestMergingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.LicensingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.MultiplexingEasyUAClient.<>c.<WriteMultiple>b__22_0(IEasyUAClient client, IReadOnlyList`1 list)
   at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.SwitchCase[TInput,TOutput,TKey](IReadOnlyList`1 readOnlyList, Func`2 keySelector, IEqualityComparer`1 keyComparer, Func`3 outputSelector)
   at OpcLabs.EasyOpc.UA.Implementation.MultiplexingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.EasyUAClient.WriteMultiple(UAWriteArguments[] writeArgumentsArray)
   at OpcLabs.EasyOpc.UA.IEasyUAClientExtension.WriteMultipleValues(IEasyUAClient client, UAWriteValueArguments[] writeValueArgumentsArray)
   at OpcLabs.EasyOpc.UA.IEasyUAClientExtension.WriteValue(IEasyUAClient client, UAWriteValueArguments writeValueArguments)
   at OpcLabs.EasyOpc.UA.IEasyUAClientExtension.WriteValue(IEasyUAClient client, UAEndpointDescriptor endpointDescriptor, UANodeDescriptor nodeDescriptor, Object value, Type valueType)
   at OpcLabs.EasyOpc.UA.IEasyUAClientExtension.WriteValue(IEasyUAClient client, UAEndpointDescriptor endpointDescriptor, UANodeDescriptor nodeDescriptor, Object value)

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

Moderators: support
Time to create page: 0.087 seconds