Skip to content

Prune extra decoded children that should stay on the type definition only.#3843

Merged
mrsuciu merged 3 commits into
OPCFoundation:master378from
mrsuciu:master378-PruneNonOptionalAndMandatory
Jun 17, 2026
Merged

Prune extra decoded children that should stay on the type definition only.#3843
mrsuciu merged 3 commits into
OPCFoundation:master378from
mrsuciu:master378-PruneNonOptionalAndMandatory

Conversation

@mrsuciu

@mrsuciu mrsuciu commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Keep the generated children that belong on instances, and prune the extra decoded children that should stay on the type definition only, such as Optional/Mandatory placeholders and ones that do not have Mandatory/Optional ModellingRules.

Description

Currently child nodes that are type definition detailes such as ones that do not have Mandatory/Optional ModellingRules are instantiated in the runtime instance of such type definitions. This PR proposes to correct this behaviour during NodeState creation as an alternative from it being fixed by the ModelCompiler.

Related Issues

Checklist

Put an x in the boxes that apply. You can complete these step by step after opening the PR.

  • I have signed the CLA and read the CONTRIBUTING doc.
  • I have added tests that prove my fix is effective or that my feature works and increased code coverage.
  • I have added all necessary documentation.
  • I have verified that my changes do not introduce (new) build or analyzer warnings.
  • I ran all tests locally using the UA.slnx solution against at least .net framework and .net 10, and all passed.
  • I fixed all failing and flaky tests in the CI pipelines and all CodeQL warnings.
  • I have addressed all PR feedback received.

mrsuciu and others added 2 commits June 4, 2026 17:48
…xtra decoded children that should stay on the type definition such as Optional/Mandatory placeholders and ones that do not have Mandatory/Optional ModellingRules.
@marcschier marcschier added the 1.5.378 Only affects 1.5.378 (pre 2.0) label Jun 9, 2026
@mrsuciu
mrsuciu marked this pull request as ready for review June 16, 2026 09:20
@larws

larws commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Hi @mrsuciu, this breaks any server using a nodeset which uses any instances below a folder node which is contained as Organizes. Any machinery building blocks user is affected by this. What is the migration path?

@mrsuciu

mrsuciu commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@larws Thanks for raising the issue. The PR looked ok for what it meant to fix but it looks that there are side effects. The changes have made it through in the Pre-release. They will either be reverted or a more comprehensive fix has to be done. Do not update to the Pre-release for the moment.

@opcfoundation-org

Copy link
Copy Markdown
Contributor

@larws can you explain why it would break? the pruning was to ensure compliance with the specification. we need to determine if it is failing because the bug gave you something that the spec does not allow or if the implementation of the pruning is resulting in models that are not compliant.

@larws

larws commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

@opcfoundation-org We use the Machinery Companion Spec and it's elements defined by that specification. The model compiler generates for children of the MachineryBuildingBlocks folder as defined in https://reference.opcfoundation.org/specs/OPC-40001-1/6 an element in the m_children list, which is filled by the InitializationString. The reference used is HasAddIn not Organizes as mentioned earlier. In any case, those elements are incorrectly deleted by this change. I cannot provide you the nodeset we are using, but you can create a model based on the mentioned spec this is easily reproducable.

@opcfoundation-org

opcfoundation-org commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@larws HasAddIn is just a subtype of HasComponent and is otherwise the same as HasComponent.

If you add a component to a type definition you need to set the modelling rule on the instance if you want it to be replicated in the instance.

i.e.
SpecificMachineType =HasAddIn=> MachineryBuildingBlocks => ModellingRule_Mandatory.
and
SpecificMachineType =HasAddIn=> MachineryBuildingBlocks =HasAddIn=> BuildingBlock1 => ModellingRule_Mandatory.

If ModellingRule_Mandatory or ModellingRule_Optional is omitted then the pruning is working as designed.
If it worked before it was because the SDK implemented the specification incorrectly.

Can you confirm that you do not have a ModellingRule defined on the HasAddIn Objects you have defined?

@opcfoundation-org

Copy link
Copy Markdown
Contributor

Created a sample NodeSet:
opcua_demomachines_1.0.0-alpha_2026_07_01.xml

@larws

larws commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

@opcfoundation-org In our nodeset the nodes with HasAddIn references have all a ModellingRule defined, but the code generated by the model compiler does not set the ModellingRuleId property for the BaseInstantState instances. Our nodeset uses the same modelling as your sample nodeset. I do not know when I will find the time to reproduce this issue with your nodeset.
But as in #3770 mentioned this is not a problem that should be solved by the stack, but instead the tools generating the invalid code should be fixed.

@opcfoundation-org

Copy link
Copy Markdown
Contributor

We will test with that sample NodeSet and see if there is a tool bug.

GoetzGoerisch pushed a commit to umati/connect that referenced this pull request Jul 2, 2026
…5.378.152 (#21)

This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [OPCFoundation.NetStandard.Opc.Ua](https://github.com/OPCFoundation/UA-.NETStandard) | `1.5.378.145` → `1.5.378.152` | ![age](https://developer.mend.io/api/mc/badges/age/nuget/OPCFoundation.NetStandard.Opc.Ua/1.5.378.152?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/OPCFoundation.NetStandard.Opc.Ua/1.5.378.145/1.5.378.152?slim=true) |

---

### Release Notes

<details>
<summary>OPCFoundation/UA-.NETStandard (OPCFoundation.NetStandard.Opc.Ua)</summary>

### [`v1.5.378.152`](https://github.com/OPCFoundation/UA-.NETStandard/releases/tag/1.5.378.152): OPC UA 1.05 Maintenance Update

[Compare Source](OPCFoundation/UA-.NETStandard@1.5.378.145...1.5.378.152)

Maintenance Release for fixing bugs found on the main378 development branch.

#### Released packages

[OPCFoundation.NetStandard.Opc.Ua](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Core](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Core/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Security.Certificates](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Security.Certificates/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Configuration](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Configuration/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Server](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Server/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Client](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Client/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Bindings.Https](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Bindings.Https/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.PubSub](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.PubSub/1.5.378.152)

#### What's Changed

- Fix memory leak: dispose linked CancellationTokenSource in ChannelAsyncOperation.EndAsync by [@&#8203;romanett](https://github.com/romanett) with [@&#8203;Copilot](https://github.com/Copilot) in [#&#8203;3812](OPCFoundation/UA-.NETStandard#3812)
- Fix Race condition in OnPublishComplete by [@&#8203;markuswallen](https://github.com/markuswallen) in [#&#8203;3837](OPCFoundation/UA-.NETStandard#3837)
- \[master378] Use request.SessionId instead of request.Session.Id in the ReportAuditCancelEvent call from CancelRequests. by [@&#8203;mrsuciu](https://github.com/mrsuciu) in [#&#8203;3853](OPCFoundation/UA-.NETStandard#3853)
- Prune extra decoded children that should stay on the type definition only. by [@&#8203;mrsuciu](https://github.com/mrsuciu) in [#&#8203;3843](OPCFoundation/UA-.NETStandard#3843)
- \[Server] Fix NRE in ActivateSession if Session times out before activation completes by [@&#8203;romanett](https://github.com/romanett) in [#&#8203;3844](OPCFoundation/UA-.NETStandard#3844)
- \[Server] Fix [#&#8203;3896](OPCFoundation/UA-.NETStandard#3896): send full certificate chain when CA is in the issuer store (1.5.x) by [@&#8203;marcschier](https://github.com/marcschier) in [#&#8203;3898](OPCFoundation/UA-.NETStandard#3898)
- Synchronize ConditionState branch collection access by [@&#8203;marcschier](https://github.com/marcschier) with [@&#8203;Copilot](https://github.com/Copilot) in [#&#8203;3895](OPCFoundation/UA-.NETStandard#3895)
- Prepare 1.5.378 maintenence release by [@&#8203;mrsuciu](https://github.com/mrsuciu) in [#&#8203;3893](OPCFoundation/UA-.NETStandard#3893)

**Full Changelog**: <OPCFoundation/UA-.NETStandard@1.5.378.145...1.5.378.152>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - Between 12:00 AM and 03:59 AM (`* 0-3 * * *`)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNDIuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI0Mi4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://codeberg.org/umati/connect/pulls/21
GoetzGoerisch pushed a commit to umati/connect that referenced this pull request Jul 2, 2026
…r to 1.5.378.152 (#22)

This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [OPCFoundation.NetStandard.Opc.Ua.Server](https://github.com/OPCFoundation/UA-.NETStandard) | `1.5.378.145` → `1.5.378.152` | ![age](https://developer.mend.io/api/mc/badges/age/nuget/OPCFoundation.NetStandard.Opc.Ua.Server/1.5.378.152?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/OPCFoundation.NetStandard.Opc.Ua.Server/1.5.378.145/1.5.378.152?slim=true) |

---

### Release Notes

<details>
<summary>OPCFoundation/UA-.NETStandard (OPCFoundation.NetStandard.Opc.Ua.Server)</summary>

### [`v1.5.378.152`](https://github.com/OPCFoundation/UA-.NETStandard/releases/tag/1.5.378.152): OPC UA 1.05 Maintenance Update

[Compare Source](OPCFoundation/UA-.NETStandard@1.5.378.145...1.5.378.152)

Maintenance Release for fixing bugs found on the main378 development branch.

#### Released packages

[OPCFoundation.NetStandard.Opc.Ua](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Core](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Core/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Security.Certificates](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Security.Certificates/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Configuration](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Configuration/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Server](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Server/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Client](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Client/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Client.ComplexTypes/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.Bindings.Https](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.Bindings.Https/1.5.378.152)
[OPCFoundation.NetStandard.Opc.Ua.PubSub](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.PubSub/1.5.378.152)

#### What's Changed

- Fix memory leak: dispose linked CancellationTokenSource in ChannelAsyncOperation.EndAsync by [@&#8203;romanett](https://github.com/romanett) with [@&#8203;Copilot](https://github.com/Copilot) in [#&#8203;3812](OPCFoundation/UA-.NETStandard#3812)
- Fix Race condition in OnPublishComplete by [@&#8203;markuswallen](https://github.com/markuswallen) in [#&#8203;3837](OPCFoundation/UA-.NETStandard#3837)
- \[master378] Use request.SessionId instead of request.Session.Id in the ReportAuditCancelEvent call from CancelRequests. by [@&#8203;mrsuciu](https://github.com/mrsuciu) in [#&#8203;3853](OPCFoundation/UA-.NETStandard#3853)
- Prune extra decoded children that should stay on the type definition only. by [@&#8203;mrsuciu](https://github.com/mrsuciu) in [#&#8203;3843](OPCFoundation/UA-.NETStandard#3843)
- \[Server] Fix NRE in ActivateSession if Session times out before activation completes by [@&#8203;romanett](https://github.com/romanett) in [#&#8203;3844](OPCFoundation/UA-.NETStandard#3844)
- \[Server] Fix [#&#8203;3896](OPCFoundation/UA-.NETStandard#3896): send full certificate chain when CA is in the issuer store (1.5.x) by [@&#8203;marcschier](https://github.com/marcschier) in [#&#8203;3898](OPCFoundation/UA-.NETStandard#3898)
- Synchronize ConditionState branch collection access by [@&#8203;marcschier](https://github.com/marcschier) with [@&#8203;Copilot](https://github.com/Copilot) in [#&#8203;3895](OPCFoundation/UA-.NETStandard#3895)
- Prepare 1.5.378 maintenence release by [@&#8203;mrsuciu](https://github.com/mrsuciu) in [#&#8203;3893](OPCFoundation/UA-.NETStandard#3893)

**Full Changelog**: <OPCFoundation/UA-.NETStandard@1.5.378.145...1.5.378.152>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - Between 12:00 AM and 03:59 AM (`* 0-3 * * *`)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNDIuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI0OS41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://codeberg.org/umati/connect/pulls/22
@larws

larws commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@opcfoundation-org With https://github.com/larws/repro-issue-3843 you can reproduce the issue I am talking about. I generated the code for your demo nodeset with the current model compiler version and added it to a server. With version 1.5.378.152 it does not work, the AddIn nodes are not visible. With version 1.5.378.145 the BuildingBlock1 and BuildingBlock2 nodes are visible in the address space.

marcschier pushed a commit that referenced this pull request Jul 9, 2026
…nition only. (#3843)" (#3976)

This reverts commit 00519fa.

# Description

Due to longer investigation time needed on ModelCompiler the pruning of
the extra decoded children that should stay on the type definition only
is reverted

## Related Issues

_Reference all GitHub issues this PR addresses. If there is no issue
yet, open one and link it here._

_If this is a relatively large or complex change, a design must have
been discussed in the related tracking issue and signed off (which
becomes the Architectural Decision Record (ADR))._

- Fixes #github-issue-number, ...

## Checklist

_Put an `x` in the boxes that apply. You can complete these step by step
after opening the PR._

- [ ] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [ ] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [ ] I have added all necessary documentation.
- [ ] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.5.378 Only affects 1.5.378 (pre 2.0)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ProgramStateMachineState has wrong InitializationString and possible many other classes also

5 participants