Skip to content

Issues with pruning - AddIns missing. #3972

Closed
1 of 1 issue completed
Closed

Description

@marcschier

@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.

Originally posted by @larws in #3843 (comment)

Activity

  1. changed the title [-]@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.[/-] [+]Issues with pruning - AddIns missing.[/+] on Jul 9, 2026
  2. added theissue type on Jul 9, 2026
  3. added
    bugA bug was identified and should be fixed.
    codegenModelCompiler and source generation related
    and removed on Jul 23, 2026
  4. modified the milestones: 2.0, 2.1 on Sep 8, 2026
  5. biancode commented on Sep 30, 2026

    @biancode
    Contributor

    Status summary from the Machinery side, in case it helps to decide what is left here:

    What seems to remain is the ModelCompiler side for 1.5.378 (children emitted without a ModellingRuleId), which would have to be fixed before the pruning comes back to master378. If a regression test on master with the demo NodeSet from #3843 would help to close the 2.0 part, I can add one.

  6. romanett commented on Sep 30, 2026

    @romanett
    Contributor

    The ModelCompiler side is addressed in OPCFoundation/UA-ModelCompiler#260.

    Root cause: ClearModellingRules removed the ModellingRuleId from a type's instance state and from all of its children. That instance state is emitted as the InitializationString of the generated class. Children without a strongly typed property, such as the BuildingBlock1/BuildingBlock2 AddIns below Identification, were therefore decoded as dynamic children without a modelling rule. The pruning from #3843 removes exactly those.

    Fix: only the instance's own modelling rule is cleared. The instance declarations below it keep their rules (Mandatory, Optional, placeholders). This matches what the 2.0 source generator already emits. With the repro NodeSet from https://github.com/larws/repro-issue-3843, the generated DemoMachineTypeState initializer now carries ModellingRuleId = i=78 for Identification, BuildingBlock1 and BuildingBlock2. A regression test covers this.

    Side effect: children of instances created from generated classes now expose HasModellingRule when browsed, as on 2.0.

    The PR also bumps the ModelCompiler's Opc.Ua.Core/Opc.Ua.Types references from 1.5.378.152 (no longer on nuget.org) to 1.5.378.176. Code generated with this change should be compatible with bringing the pruning back to master378.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

1.5.378Only affects 1.5.378 (pre 2.0)bugA bug was identified and should be fixed.codegenModelCompiler and source generation related

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions