You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@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.
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
master (2.0): the pruning was never ported, and the in-repo source generator emits ModellingRuleId on every generated child (Mandatory, Optional and the placeholder rules; an instance declaration can only promote the type's rule). So Mandatory AddIns would survive even if the pruning came to master later.
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.
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.
Activity
[-]@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.[/+]biancode commentedon Sep 30, 2026
Status summary from the Machinery side, in case it helps to decide what is left here:
BuildingBlock1/BuildingBlock2AddIns of the repro are instantiated again.ModellingRuleIdon every generated child (Mandatory, Optional and the placeholder rules; an instance declaration can only promote the type's rule). So Mandatory AddIns would survive even if the pruning came to master later.MachineryBuildingBlockswith itsHasAddInreferences on 2.0, and its tests browse them over a real session.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.romanett commentedon Sep 30, 2026
The ModelCompiler side is addressed in OPCFoundation/UA-ModelCompiler#260.
Root cause:
ClearModellingRulesremoved theModellingRuleIdfrom a type's instance state and from all of its children. That instance state is emitted as theInitializationStringof the generated class. Children without a strongly typed property, such as theBuildingBlock1/BuildingBlock2AddIns belowIdentification, 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
DemoMachineTypeStateinitializer now carriesModellingRuleId = i=78forIdentification,BuildingBlock1andBuildingBlock2. A regression test covers this.Side effect: children of instances created from generated classes now expose
HasModellingRulewhen browsed, as on 2.0.The PR also bumps the ModelCompiler's
Opc.Ua.Core/Opc.Ua.Typesreferences 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.