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>
This commit is contained in:
Copilot
2026-03-19 21:10:06 +01:00
committed by GitHub
co-authored by marcschier
parent 5a1e547250
commit 4c78751f67
@@ -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)
{