From 4c78751f67c9e119db4e20dcb76083bafa3b285a Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Thu, 19 Mar 2026 21:10:06 +0100 Subject: [PATCH] Fix missing FactoryBuilder.Commit() in dictionary-based complex type loading paths (#3630) * Fix missing Commit() after LoadDictionaryDataTypesAsync in ComplexTypeSystem Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: marcschier <11168470+marcschier@users.noreply.github.com> --- .../ComplexTypeSystem.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Libraries/Opc.Ua.Client.ComplexTypes/ComplexTypeSystem.cs b/Libraries/Opc.Ua.Client.ComplexTypes/ComplexTypeSystem.cs index c07078a7f4..e34c3f5fa4 100644 --- a/Libraries/Opc.Ua.Client.ComplexTypes/ComplexTypeSystem.cs +++ b/Libraries/Opc.Ua.Client.ComplexTypes/ComplexTypeSystem.cs @@ -264,6 +264,7 @@ namespace Opc.Ua.Client.ComplexTypes serverStructTypes = [.. serverStructTypes.Where( rd => rd.NodeId.NamespaceIndex == nameSpaceIndex)]; // load types + bool allTypesLoaded; if (DisableDataTypeDefinition || !await LoadBaseDataTypesAsync(serverEnumTypes, serverStructTypes, ct) .ConfigureAwait(false)) @@ -272,12 +273,16 @@ namespace Opc.Ua.Client.ComplexTypes { return false; } - return await LoadDictionaryDataTypesAsync(serverEnumTypes, false, ct) + allTypesLoaded = await LoadDictionaryDataTypesAsync(serverEnumTypes, false, ct) .ConfigureAwait(false); } + else + { + allTypesLoaded = true; + } // Commit the changes to the factory m_complexTypeResolver.FactoryBuilder.Commit(); - return true; + return allTypesLoaded; } catch (Exception ex) { @@ -338,6 +343,7 @@ namespace Opc.Ua.Client.ComplexTypes : (await m_complexTypeResolver .LoadDataTypesAsync(DataTypeIds.Structure, true, ct: ct) .ConfigureAwait(false)).ToList(); + bool allTypesLoaded; if (DisableDataTypeDefinition || !await LoadBaseDataTypesAsync(serverEnumTypes, serverStructTypes, ct) .ConfigureAwait(false)) @@ -346,12 +352,16 @@ namespace Opc.Ua.Client.ComplexTypes { return false; } - return await LoadDictionaryDataTypesAsync(serverEnumTypes, true, ct) + allTypesLoaded = await LoadDictionaryDataTypesAsync(serverEnumTypes, true, ct) .ConfigureAwait(false); } + else + { + allTypesLoaded = true; + } // Commit the changes to the factory m_complexTypeResolver.FactoryBuilder.Commit(); - return true; + return allTypesLoaded; } catch (Exception ex) {