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.
- Forum
- Discussions
- QuickOPC-UA in .NET
- General Issues, Building
- NullReferenceException on ReadValue after update 5.80.324
NullReferenceException on ReadValue after update 5.80.324
yes, this is precisely what I needed.
The error turns out to be a consequence of a change in the underlying UA-.NETStandard library (5.80.324 references a new version of it, for security reasons).
Thank you very much for reporting it!
It is now fixed. Please rebuild with QuickOPC 5.80.347 or later: It is now on our Web site, and www.nuget.org.
Best regards
Please Log in or Create an account to join the conversation.
Sorry for that, I had to change my catch to (Exception ex) to be able to see the stackTrace.
Please let me know if this is the one you are looking for.
ex.InnerException.StackTrace
at OpcLabs.EasyOpc.UA.Sdk.Extensions.BinaryDecoderExtension.SetStream(BinaryDecoder binaryDecoder, Stream stream)
at OpcLabs.EasyOpc.UA.Sdk.Extensions.BinaryDecoderExtension.Detach(BinaryDecoder binaryDecoder)
at OpcLabs.EasyOpc.UA.DataTypeModel.Implementation.UAOpcBinaryDataTypeDefinitionDecoder.Decode(UADataTypeInfo dataTypeInfo, String[] namespaceTable)
at OpcLabs.EasyOpc.UA.DataTypeModel.Implementation.UAOpcBinaryDts.UncheckedDecodeFromStreamInDataTypeDefinitionModel(UADataTypeInfo dataTypeInfo, Stream stream, UAEndpointDescriptor endpointDescriptor, IUAServerTables serverTables, Boolean fixedLayout)
at OpcLabs.EasyOpc.UA.DataTypeModel.Implementation.UAOpcBinaryDts.DecodeFromStreamInDataTypeDefinitionModel(UADataTypeInfo dataTypeInfo, Stream stream, UAEndpointDescriptor endpointDescriptor, IUAServerTables serverTables, Boolean fixedLayout)
at OpcLabs.EasyOpc.UA.DataTypeModel.Implementation.UAOpcBinaryDts.DecodeInDataTypeDefinitionModel(UADataTypeInfo dataTypeInfo, Object objectBody, UAEndpointDescriptor endpointDescriptor, IUAServerTables serverTables, Boolean fixedLayout)
at OpcLabs.EasyOpc.UA.ComplexData.Implementation.UAComplexDataConverter.<>c__DisplayClass5_0.<ConvertExtensionObjectsToGenericDataInDataTypeDefinitionModel>b__0(Int32 i)
at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`2.<ForWorker>b__1(RangeWorker& currentWorker, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`2.<ForWorker>b__1(RangeWorker& currentWorker, Int64 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
at System.Threading.Tasks.TaskReplicator.Replica.Execute()
Please Log in or Create an account to join the conversation.
thank you, I appreciate your effort. However, this appears to be the call stack of the outer AggregateException. Please obtain the call stack of the inner NullReferenceException.
Best regards
Please Log in or Create an account to join the conversation.
genericObject = (UAGenericObject)_easyUAClient.ReadValue(endpointDescriptor, nodeDescriptor);
The details are bellow:
System.AggregateException
HResult=0x80131500
Message=One or more errors occurred. (Object reference not set to an instance of an object.)
Source=System.Threading.Tasks.Parallel
StackTrace:
at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure)
at System.Threading.Tasks.Parallel.ForWorker[TLocal,TInt](TInt fromInclusive, TInt toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.ForWorker[TLocal,TInt](TInt fromInclusive, TInt toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
at System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, Action`1 body)
at OpcLabs.EasyOpc.UA.ComplexData.Implementation.UAComplexDataConverter.ConvertExtensionObjectsToGenericDataInDataTypeDefinitionModel(IReadOnlyList`1 argumentsList)
at OpcLabs.EasyOpc.UA.ComplexData.Implementation.UAComplexDataConverter.<>c__DisplayClass4_0.<ConvertExtensionObjectsToGenericData>b__8(IReadOnlyList`1 list2)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.IfThenElse[TInput,TOutput](IReadOnlyList`1 readOnlyList, Predicate`1 condition, Func`2 thenListSelector, Func`2 elseListSelector)
at OpcLabs.EasyOpc.UA.ComplexData.Implementation.UAComplexDataConverter.<>c__DisplayClass4_0.<ConvertExtensionObjectsToGenericData>b__4(IReadOnlyList`1 list)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.IfThenElse[TInput,TOutput](IReadOnlyList`1 readOnlyList, Predicate`1 condition, Func`2 thenListSelector, Func`2 elseListSelector)
at OpcLabs.EasyOpc.UA.ComplexData.Implementation.UAComplexDataConverter.ConvertExtensionObjectsToGenericData(IReadOnlyList`1 convertExtensionObjectArgumentsList, UAComplexDataParameters complexDataParameters)
at OpcLabs.EasyOpc.UA.ComplexData.Implementation.UAComplexDataConverter.<>c__DisplayClass2_0.<ConvertExtensionObjectsToGenericObjects>b__6(IReadOnlyList`1 list)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.IfThenElse[TInput,TOutput](IReadOnlyList`1 readOnlyList, Predicate`1 condition, Func`2 thenListSelector, Func`2 elseListSelector)
at OpcLabs.EasyOpc.UA.ComplexData.Implementation.UAComplexDataConverter.ConvertExtensionObjectsToGenericObjects(IReadOnlyList`1 convertExtensionObjectInfoList, UAComplexDataParameters complexDataParameters)
at OpcLabs.EasyOpc.UA.Plugins.ComplexData.Implementation.ComplexDataEasyUAClient.ConvertExtensionObjectsToGenericObjects(IReadOnlyList`1 convertExtensionObjectInfoList)
at OpcLabs.EasyOpc.UA.Plugins.ComplexData.Implementation.ComplexDataEasyUAClient.<ConvertValueElements>b__6_3(IReadOnlyList`1 list)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.IfThenElse[TInput,TOutput](IReadOnlyList`1 readOnlyList, Predicate`1 condition, Func`2 thenListSelector, Func`2 elseListSelector)
at OpcLabs.EasyOpc.UA.Plugins.ComplexData.Implementation.ComplexDataEasyUAClient.ConvertValueElements(IReadOnlyList`1 convertValueArgumentsList)
at OpcLabs.EasyOpc.UA.UAUtilities.ConvertValuesUsing(IReadOnlyList`1 convertValueArgumentsList, Func`2 convertElementsFunction, Func`3 arrayNeedsElementConversionFunction, Func`3 newArrayElementTypeFunction, Boolean convertingBack)
at OpcLabs.EasyOpc.UA.Implementation.DataConvertingEasyUAClient.ConvertValuesUsing(IReadOnlyList`1 convertValueArgumentsList, Func`2 convertElementsFunction, Boolean convertingBack)
at OpcLabs.EasyOpc.UA.Implementation.DataConvertingEasyUAClient.ConvertValues(IReadOnlyList`1 convertValueArgumentsList)
at OpcLabs.EasyOpc.UA.Implementation.DataConvertingEasyUAClient.<>c__DisplayClass1_0.<ConvertAttributeDataUsing>b__4(IReadOnlyList`1 list)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IReadOnlyListExtension.IfThenElse[TInput,TOutput](IReadOnlyList`1 readOnlyList, Predicate`1 condition, Func`2 thenListSelector, Func`2 elseListSelector)
at OpcLabs.EasyOpc.UA.Implementation.DataConvertingEasyUAClient.ConvertAttributeDataUsing(IReadOnlyList`1 convertInfoList, Func`2 convertValuesFunction)
at OpcLabs.EasyOpc.UA.Implementation.DataConvertingEasyUAClient.ConvertAttributeData(IReadOnlyList`1 convertInfoList)
at OpcLabs.EasyOpc.UA.Implementation.DataConvertingEasyUAClient.ReadMultiple(UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.ReadMultiple(UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.Optimization.Implementation.RequestMergingEasyUAClient.<ReadMultiple>b__2_0(UAReadArguments[] array)
at OpcLabs.BaseLib.OperationModel.Extensions.IReadOnlyListOfOperationArgumentsExtension.MergingPerform[TArguments,TResult](IReadOnlyList`1 argumentsList, Func`2 arrayOperationFunction)
at OpcLabs.EasyOpc.UA.Optimization.Implementation.RequestMergingEasyUAClient.ReadMultiple(UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.ReadMultiple(UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.ReadMultiple(UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.LicensingEasyUAClient.ReadMultiple(UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.MultiplexingEasyUAClient.<>c.<ReadMultiple>b__18_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.ReadMultiple(UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.ReadMultiple(UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.ForwardingEasyUAClient.ReadMultiple(UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.Implementation.DelegatingEasyUAClient.ReadMultiple(UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.EasyUAClientCore.ReadMultiple(UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.IEasyUAClientExtension.ReadMultipleValues(IEasyUAClient client, UAReadArguments[] readArgumentsArray)
at OpcLabs.EasyOpc.UA.IEasyUAClientExtension.ReadValue(IEasyUAClient client, UAReadArguments readArguments)
at OpcLabs.EasyOpc.UA.IEasyUAClientExtension.ReadValue(IEasyUAClient client, UAEndpointDescriptor endpointDescriptor, UANodeDescriptor nodeDescriptor)
at Test.CleanArch.Infrastructure.PLC.OpcCommunication.WriteClass(String machineIp, String machineType, MachineData opcVariable, String JSONData) in C:\Users\joao\git\VSOS\src\Test.CleanArch.Infrastructure\PLC\OpcCommunication.cs:line 208
at Test.CleanArch.UseCases.MachineDataRepo.PlcWrite(String machineIp, String machineType, MachineData updatedData, String JsonData) in C:\Users\joao\git\VSOS\src\Test.CleanArch.UseCases\MachineDataRepo.cs:line 167
at Test.CleanArch.UseCases.VLM.MachineSettings.StartupPlcSettingsUseCase.Execute(String IP) in C:\Users\joao\git\VSOS\src\Test.CleanArch.UseCases\VLM\MachineSettings\StartupPlcSettingsUseCase.cs:line 53
at Test.CleanArch.Blazor.Components.Layout.AlarmStrip.OnInitialized() in C:\Users\joao\git\VSOS\src\Test.CleanArch.Blazor\Components\Layout\AlarmStrip.razor:line 53
at Microsoft.AspNetCore.Components.ComponentBase.<RunInitAndSetParametersAsync>d__21.MoveNext()
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
NullReferenceException: Object reference not set to an instance of an object.
Please Log in or Create an account to join the conversation.
It is not clear which line of code you mean, but I suppose it is the one with the ReadValue call, is that correct?
Please provide the stack trace of the (inner) NullReferenceException.
Best regards
Please Log in or Create an account to join the conversation.
I have a C# project and my code was working with no errors or issues until I updated it to the latest version 5.80.324.
Previously I was using 5.80.277.
I'm getting this error on the line of the ReadValue call.
System.AggregateException: 'One or more errors occurred. (Object reference not set to an instance of an object.)'
Inner Exception
NullReferenceException: Object reference not set to an instance of an object.
IEasyUAClient _easyUAClient;
...
//On my constructor (I suppressed part of the code here)
_easyUAClient = new EasyUAClient();
this._easyUAClient = easyUAClient;
...
public Result Write(string Ip, string machineType, MachineData opcVariable, string JSONData)
{
UAEndpointDescriptor endpointDescriptor = $"{Suppressed_Descriptor}";
UANodeDescriptor nodeDescriptor = $"{Suppressed_Descriptor}";
UAGenericObject genericObject = new UAGenericObject();
try
{
genericObject = (UAGenericObject)_easyUAClient.ReadValue(endpointDescriptor, nodeDescriptor);
}
catch (UAException ex)
{
_logger.LogError("Read OPC Value error {ex}", ex);
return Result.Error(ex.Message);
}
}
Did something changed on the new version that I'm not considering on this code?
Thanks!
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-UA in .NET
- General Issues, Building
- NullReferenceException on ReadValue after update 5.80.324