OPCFoundation / UA-.NETStandard

OPC Unified Architecture .NET Standard
Other
1.9k stars 926 forks source link

No Notification on Monitored Item in ConsoleReferenceClient Sample #2517

Closed KircMax closed 4 months ago

KircMax commented 4 months ago

Type of issue

Current Behavior

When I attach to the Monitored Items Notification in the Subscription Sample of the ConsoleReferenceClient I do not hit a breakpoint that I attached to the Eventhandler for the Notification...: image I thought maybe some other MonitoredItem is used internally and if I use the one after ApplyChanges it might work but these breakpoints are also never hit image So I guess I am doing something else wrong...

If I do extend the FastDataChangeCallBack that is provided to the subscription image image

then I can see that the entries are written for the according notifications ... I guess I am missing something? Thanks in advance.

Expected Behavior

Notification (Eventhandler) is executed before/after the subscription FastDataChangeCallBack is called.

Steps To Reproduce

Attached the ClientSamples.cs and Program.cs I touched in the ConsoleReferenceClient. (the node var nId = new NodeId(6107, 4); of course needs to be changed to one (struct) that is present on your server). Sample.zip

Environment

- OS: Windows 10
- Environment: Visual Studio 2022 17.8.5
- Runtime: .NET 6.0 
- Nuget Version: 
- Component: ConsoleReferenceClient
- Server: S7-1500
- Client: ConsoleReferenceClient

Anything else?

No response

mregen commented 4 months ago

Hi @KircMax, I think this might be because of DisableMonitoredItemCache, then the callbacks in SaveValueInCache are not executed.

KircMax commented 4 months ago

Hi @mregen yes - that was it, thanks a lot