mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-16 21:02:51 +08:00
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:
@@ -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>
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user