ReadNodeHistoryProcessed is throwing KeyNotFoundException

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
bbussewitz
Jr. Member
Jr. Member
Posts: 1
Joined: 27 Mar 2025, 07:29

ReadNodeHistoryProcessed is throwing KeyNotFoundException

Post by bbussewitz »

Hi everyone,

I am facing a problem when accessing history data for a given node. I am connected to the UaAnsiCServer and have enabled the Historizing attribute for the following node: ns=4;s=Demo.History.DoubleWithHistory. I can also see the history data in the UaExpert client.

Furthermore, I am able to access the history data for the above node via _client.ReadNodeHistory(start, end, nodeId). However, when I am trying to call _client.ReadNodeHistoryProcessed(start, end, OpcAggregateType.Average, nodeId), I keep getting the following exception:

Code: Select all

An exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in System.Private.CoreLib.dll but was not handled in user code
The given key 'ns=4;s=Demo.History.DoubleWithHistory' was not present in the dictionary.
Interestingly, it seems to be working with a different data set when I am connected to the OPC Foundation's HistoricalAccess Server from the UA Quickstart Applications solution.

On an unrelated note, calling _client.ReadNodeHistory(start, null, nodeId) with either startTime or endTime NULL returns an empty IEnumerable every time.

I am using version 2.42.5 of the Opc.UaFx.Client NuGet package.

Any help in resolving this issue would be greatly appreciated.

Cheers

User avatar
Support Team
Hero Member
Hero Member
Posts: 3265
Joined: 18 Mar 2011, 15:09

Re: ReadNodeHistoryProcessed is throwing KeyNotFoundException

Post by Support Team »

Hi,

It seems that the Träger OPC UA Library, that you are using, is buggy and throwing some internal exception. Most probably they do not support the history read.

You have two options now:
1) contact the Träger support and get the code fixed.
2) switch to working solution from Unified Automation, download .NET based OPC UA SDK here:
https://www.unified-automation.com/downloads/opc-ua-development.html
Best regards
Unified Automation Support Team

Post Reply