diff --git a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/OpcUaClient.java b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/OpcUaClient.java index 5bee3a46b..c2c22e6c5 100644 --- a/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/OpcUaClient.java +++ b/opc-ua-sdk/sdk-client/src/main/java/org/eclipse/milo/opcua/sdk/client/OpcUaClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 the Eclipse Milo Authors + * Copyright (c) 2026 the Eclipse Milo Authors * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -473,6 +473,18 @@ public UInteger getRequestTimeout() { }); }); + addSessionInitializer( + (client, session) -> { + // Reset before the Session is available so that the DataTypeTree and associated codecs + // are refreshed (eagerly or lazily, depending on configuration). + + resetDataTypeTree(); + resetDynamicDataTypeManager(); + resetDynamicEncodingContext(); + + return CompletableFuture.completedFuture(Unit.VALUE); + }); + faultNotificationQueue = new ExecutionQueue(transport.getConfig().getExecutor()); addressSpace = new AddressSpace(this);