Drop the RemoveExplicitlyDefinedChild overrides

The typed-slot consistency fix is not needed here and overlaps with #4432,
which handles an imported node replacing a generated slot inside
`CreateOrReplaceInputArguments` / `CreateOrReplaceOutputArguments` /
`CreateOrReplaceEnumStrings` (assigning the typed replacement directly)
rather than through `RemoveExplicitlyDefinedChild`. Reverting the two
overrides leaves this PR to the create-lifecycle cancellation work and
removes the overlap in the same files.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Roman Ettlinger
2026-09-07 15:56:01 +02:00
parent cdf4a32f72
commit 45c6b3eb0a
3 changed files with 0 additions and 75 deletions
@@ -184,20 +184,6 @@ namespace Opc.Ua
context, browseName, createOrReplace, replacement, assignInstanceNodeIds);
}
/// <inheritdoc/>
protected override void RemoveExplicitlyDefinedChild(BaseInstanceState child)
{
if (ReferenceEquals(EnumStrings, child))
{
EnumStrings = null;
if (ReferenceEquals(child.Parent, this))
{
child.Parent = null;
}
}
base.RemoveExplicitlyDefinedChild(child);
}
/// <summary>
/// Create or replace enum strings
/// </summary>
-21
View File
@@ -544,27 +544,6 @@ namespace Opc.Ua
}
}
/// <inheritdoc/>
protected override void RemoveExplicitlyDefinedChild(BaseInstanceState child)
{
bool removed = false;
if (ReferenceEquals(InputArguments, child))
{
InputArguments = null;
removed = true;
}
if (ReferenceEquals(OutputArguments, child))
{
OutputArguments = null;
removed = true;
}
if (removed && ReferenceEquals(child.Parent, this))
{
child.Parent = null;
}
base.RemoveExplicitlyDefinedChild(child);
}
/// <summary>
/// Create or replace output arguments
/// </summary>
@@ -2766,46 +2766,6 @@ namespace Opc.Ua.Types.Tests.State
Assert.That(parent.AfterCreateCount, Is.EqualTo(1));
}
[Test]
public void RemoveChildClearsMethodArgumentSlots()
{
var method = new MethodState(null);
PropertyState<ArrayOf<Argument>> inputArguments = method
.CreateOrReplaceInputArguments(m_context, null, false);
PropertyState<ArrayOf<Argument>> outputArguments = method
.CreateOrReplaceOutputArguments(m_context, null, false);
method.RemoveChild(inputArguments);
Assert.That(method.InputArguments, Is.Null);
Assert.That(inputArguments.Parent, Is.Null);
Assert.That(method.OutputArguments, Is.SameAs(outputArguments));
method.RemoveChild(outputArguments);
Assert.That(method.OutputArguments, Is.Null);
Assert.That(outputArguments.Parent, Is.Null);
Assert.That(
method.FindChild(m_context, inputArguments.BrowseName),
Is.Null);
}
[Test]
public void RemoveChildClearsEnumStringsSlot()
{
var variable = new BaseDataVariableState(null);
PropertyState<ArrayOf<LocalizedText>> enumStrings = variable
.CreateOrReplaceEnumStrings(m_context, null, false);
variable.RemoveChild(enumStrings);
Assert.That(variable.EnumStrings, Is.Null);
Assert.That(enumStrings.Parent, Is.Null);
Assert.That(
variable.FindChild(m_context, enumStrings.BrowseName),
Is.Null);
}
[Test]
public void DeleteResetsCreatedState()
{