mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-19 07:02:16 +08:00
fuzzing
17 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a81d981755 |
dotnet format sweep (whitespace, IDE, RCS) + code-style enforcer agent fix (#3865)
# Description
Pure code-style sweep across the repo — no behavioral changes. Drives
`dotnet format` info-level diagnostics down on a large slice of the
codebase (Stack, Libraries, Tests, Tools).
Six commits, applied bottom-up in safety order so each batch leaves the
build green:
1. **`style: fix whitespace and final-newline formatting (WHITESPACE,
FINALNEWLINE)`**
197 hits across ~30 files; pure mechanical cleanup.
2. **`style: apply dotnet format style fixes (IDE rules)`**
IDE-rule batch via `dotnet format style --severity info` —
`var`/explicit type, simplify names, collection expressions, expression
bodies, unused usings, etc.
3. **`style: apply dotnet format analyzers fixes (RCS blank-line
formatting)`**
Roslynator formatting (RCS0xxx) blank-line and punctuation rules.
4. **`style: convert comments to doc comments and inline local vars
(RCS1181, RCS1124)`**
24 files. RCS1181 promotes `// summary`-style comments above
public/internal members to `/// <summary>` doc comments; RCS1124 inlines
locals used exactly once. Generated `Tools/` files were reverted to keep
the source-generator outputs deterministic.
5. **`docs(agent): correct --diagnostics flag form and verify Roslynator
4.x code fixers`**
Updates `.github/agents/opc-ua-codestyle-enforcer.agent.md` with two
corrections discovered while running this sweep:
- `dotnet format --diagnostics "RULE1 RULE2"` (single quoted,
space-separated) silently fixes nothing on `dotnet format` 10.x — it
parses as one unknown ID and exits 0. The correct form is `--diagnostics
RULE1 --diagnostics RULE2 …`, repeated per rule.
- Roslynator 4.15.0 **does** ship code fixers for
RCS1078/1118/1124/1140/1142/1181/1221/1260 (the previous "no auto-fixer"
list was outdated). RCS1140/1142 default to `Hidden` so need `--severity
info` to surface and fire; RCS1078 requires
`roslynator_empty_string_style = field` (already set in
`.editorconfig`). Only NUnit4002/2046/2010 genuinely lack auto-fixers in
this stack.
6. **`style: format new code from master merge (dotnet format sweep)`**
After merging master into the branch (commit `e3ebc8742`), re-ran the
same three-phase format sweep on the 151 .cs files brought in by the
merge, scoped per project via repeated `--include`. 81 files changed;
same rule families as commits 1–4.
- Hand-fixed `Tests/Opc.Ua.MigrationAnalyzer.Tests/AnalyzerHarness.cs`
for `RCS1174` (redundant `async`/`await` removal) because the auto-fixer
didn't apply for that specific case.
- Reverted files that the formatter would break:
- `Libraries/Opc.Ua.Server/Server/ServerInternalData.cs` — multi-TFM
analysis disagreement injected `<<<<<<<` / `=======` / `>>>>>>>`
markers.
-
`Tools/Opc.Ua.MigrationAnalyzer.Core/{Core/Stack/Client/ChannelBase.cs,
Core/Stack/Types/IUserIdentityTokenHandler.cs,
Client/Session/Session.cs}` — IDE0005 removed `using
Opc.Ua.Security.Certificates` that IS used (the files are 1.5.378
reference fixtures for the analyzer).
- `Tests/Opc.Ua.Gds.Tests/PushTest.cs` — IDE0002 over-simplified
`OpcUa.ObjectTypeIds` to `ObjectTypeIds`, which then resolves to a
conflicting type.
### What this PR does **not** touch
- No behavioral or semantic logic changes.
- No `.editorconfig` rule promotions (rules stay at their current
severities; this is a backlog-burndown pass, not a rule tightening).
- Generated source under `Tools/` is intentionally excluded.
- Higher-risk rule families (`RCS1090`/`CA2007` `ConfigureAwait`,
`RCS1249` null-forgiving cleanup, `IDE0270`/`IDE0059`) are left for
follow-up sweeps because they need per-TFM build verification or
semantic review.
## Related Issues
_No tracking issue — this is a non-functional style sweep and the
agent-doc correction is a follow-up to the same work. Happy to open one
if the maintainers prefer._
## Checklist
- [ ] 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.
- [x] I have added tests that prove my fix is effective or that my
feature works and increased code coverage. _(N/A — style-only, no
behavioral change)_
- [x] I have added all necessary documentation. _(agent doc updated with
the two corrections)_
- [x] I have verified that my changes do not introduce (new) build or
analyzer warnings. _(verified clean on `net10.0` and `net48`; only
pre-existing `NETSDK1005`/`NETSDK1207` failures on Tools/AOT projects)_
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed. _(build
verified on net10 and net48 per batch; full test suite not yet run
locally — relying on CI)_
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.
---------
Co-authored-by: agent <agent@local>
|
||
|
|
bc4c30034d |
Fix CTT conformance issues #3719, #3720, #3723, #3841 (#3851)
# Description Fixes four CTT (OPC UA Compliance Test Tool) conformance gaps that the existing NUnit parity suite was silently passing while the CTT JS scripts kept failing: | Issue | Area | Failing CTT script | |---|---|---| | #3719 | Base Info Core Structure 2 | `001.js` | | #3720 | Base Info FiniteStateMachine + StateMachine Instance | `initialize.js` + `001.js` | | #3723 | Security None | `007.js` (DoS, partially used channels) | | #3841 | Alarms & Conditions | Acknowledge Test_003, Alarm Test_002, Confirm Test_001 / Test_003 / Err_004, Enable Test_002, Non-Exclusive Limit Test_002 | Across all four, the underlying pattern was the same — the NUnit parity tests were checking weaker invariants (DataType attribute instead of encoded Variant BuiltInType; `Assert.Ignore` instead of `Assert.Fail`; stub `GetEndpoints` instead of the real DoS scenario; method-call + Read instead of subscribe-and-validate-event-payload). So the suite gave false confidence on changes that would have failed CTT. Each commit below both **strengthens the NUnit parity test** to encode the same invariant CTT verifies, **and** fixes the server/model defect that the strengthened test surfaces. ## Commits ### `a1db2984c` Fix #3719 (BaseInfoCoreStructure) - **Test**: `BaseInfoServerTests.ReadConformanceUnitsAsync` now reads the **value** of `i=24101` and asserts `WrappedValue.TypeInfo.BuiltInType == BuiltInType.QualifiedName` AND `ValueRank == ValueRanks.OneDimension` — not just the DataType attribute. - **Test**: `BaseInformationTests.BrowseRequiresMandatoryMethodsAsync` now `Assert.Fail`s (not `Assert.Ignore`) when an expected mandatory method is missing on `i=15443` / `i=25440`. - **Server**: `Server_ServerCapabilities_ConformanceUnits` initialised with `Array.Empty<QualifiedName>().ToArrayOf()` so the encoded Variant carries QualifiedName type info even when empty. - **Server**: Added `AddSecurityGroup` / `RemoveSecurityGroup` (on `i=15443`) and `AddPushTarget` / `RemovePushTarget` (on `i=25440`) method nodes with input/output argument metadata and in-memory handlers in `Quickstarts.Servers/ReferenceServerConfigurationNodeManager`. ### `86d3041e5` Fix #3723 (Security None DoS off-by-one) - **Server**: Correct off-by-one in `Stack/Opc.Ua.Core/Stack/Tcp/TcpTransportListener.cs` channel eviction: - Condition was `MaxChannelCount == channelCount` (only triggered at exact equality); now `MaxChannelCount > 0 && channelCount >= MaxChannelCount` with a loop that evicts idle channels until the count is below the limit or no more idle channels remain. - **Server**: `UsedBySession` now properly tracks active sessions and clears on `CloseSession` (`TcpServerChannel`, `TcpListenerChannel`). - **Note**: the NUnit reproducer for this issue (`SecurityNoneDosTests`) stays on the `cttunit` branch (PR #3750) because it depends on the `TestFixture.CloseSharedFixtureSessionAsync` helper that only exists in `Tests/Opc.Ua.Conformance.Tests/`. The server fix on this branch is sufficient to make the CTT JS script pass. ### `2c98390c9` Fix #3720 (BaseInfoStateMachine GeneratesEvent) - **Model**: Add `GeneratesEvent` forward reference on `StateMachineType` (i=2299) and `FiniteStateMachineType` (i=2771) → `AuditUpdateStateEventType` (i=2315) in the design XML (`Tools/Opc.Ua.SourceGeneration.Core/Design/StandardTypes.xml`); regenerated `Stack/Opc.Ua.Core/Schema/Opc.Ua.NodeSet2.xml`. - **Server**: Remove the runtime workaround in `DiagnosticsNodeManager` that previously injected this reference at load time — now redundant because the reference ships in the NodeSet at compile time. - **Test**: New `BaseInfoStateMachineInstanceTests.StateMachineTypeHasGeneratesEventReferenceAsync` walks the type hierarchy looking for `GeneratesEvent` with `IncludeSubtypes=true` and asserts the target resolves to a `BaseEventType` subtype (matches the CTT walk). - Per OPC UA Part 16 §4.4.5 / Part 5 §6.4.2. ### `09f551449` Strengthen A&C conformance event tests (#3841) - **Test fixture**: New `AlarmEventCollector` (476 LOC) — subscribes to events on `i=Server` with a full A&C event filter (`Comment`, `Retain`, transition times, all condition-state Ids); per-condition event log; `WaitForEventAsync(conditionId, predicate, timeout)` for synchronisation. Uses async `IAsyncDisposable` cleanup. - **Tests rewritten** to subscribe to events and validate event payload (`Comment.Text`, `Retain`, `TransitionTime`): - `Acknowledge Test_003` — empty comment + locale propagates to event payload; `Retain=false` afterwards - `Alarm Test_002` — full `ActiveState` cycle Active → Normal with Acknowledge + Confirm; every transition event validated - `Confirm Test_001` — unique comment reaches event payload; `ConfirmedState/Id=true` - `Confirm Test_003` — Acknowledge → wait event → Confirm with empty comment - `Confirm Err_004` — **two concurrent sessions**; second Confirm asserts specifically `BadConditionBranchAlreadyConfirmed` (not a generic `BadInvalidState`) - `Enable Test_002` — Disable + Enable via both type method and discovered instance method; NO events during disabled period; `TransitionTime` within call window; `Retain` flips - `Non-Exclusive Limit Test_002` — mirror for `NonExclusiveLimitAlarmType` - **Server fixes** in `Stack/Opc.Ua.Core.Types/State/AcknowledgeableConditionState.cs`, `Quickstarts.Servers/Alarms/AlarmHolders/*`, and `AlarmNodeManager` for: Comment propagation, Retain clearing, TransitionTime updates, and a dedicated ack-only condition instance (`AcknowledgeableConditionHolder`). ## Verification - `dotnet build UA.slnx` — **0 errors**, 42 pre-existing warnings. - `dotnet test Tests/Opc.Ua.InformationModel.Tests` filtered for the new + master `StateMachineGeneratesEvent` / `BaseInfoServer` / `BaseInformation` tests — **6/6 pass**. - `dotnet test Tests/Opc.Ua.History.Tests --filter AlarmsAndConditions` — **141/144 pass**; the 3 occasional failures in `DisableEnableViaTypeAndInstanceMethodNoEventsDuringDisabledAsync` pass when re-run in isolation, consistent with the known A&C suite CI flakiness pattern. ## Related Issues - Fixes #3719 - Fixes #3720 - Fixes #3723 - Fixes #3841 Related: PR #3750 (`cttunit`) carries the same fixes plus the conformance-test-project versions of the strengthened NUnit tests. Either this PR or that one will land first; the other should be rebased afterwards. ## Checklist - [ ] 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. - [x] 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. - [x] I have verified that my changes do not introduce (new) build or analyzer warnings. - [x] 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. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> |
||
|
|
4756e7c245 |
DI (OPC 10000-100) with samples (Pump, SW Update), fluent API gap closures and model dependency implementation (#3808)
This PR implements the **OPC UA Device Integration (DI, OPC 10000-100)** companion-spec library trio (`Opc.Ua.Di` / `Opc.Ua.Di.Server` / `Opc.Ua.Di.Client`) plus a worked example (`Applications/MinimalPumpServer`) demonstrating the OPC 40223 Pumps companion specification end-to-end with full simulation. It also closes 11 fluent-API gaps in `Opc.Ua.Server.Fluent`, three source-generator bugs, integrates the DI layer into the unified `services.AddOpcUa()` Microsoft.Extensions DI hosting pattern, and adds 250+ new tests. **Worked example — `Applications/MinimalPumpServer/`** - AOT-compatible console host using `Host.CreateApplicationBuilder` + `AddOpcUa()`. - `PumpNodeManager` inherits from `DiNodeManager`; multi-namespace (DI + Machinery + Pumps) via runtime NodeSet2 loading and `ModelLoaderBuilder`. - Demonstrates declarative second-pump creation via `.ConfigureDevicesFor<PumpNodeManager>(...)` and software-package seeding from the same configurator. - Full simulation: pressure, temperatures, power, flow, efficiency, level, cavitation/overheat fault injection, alarm setup, NAMUR-style supervision. **Documentation** - `Docs/Opc.Ua.Di/` — README, DeviceBuilder, Hosting, LockService, SoftwareUpdate, ClientHelpers (6 new developer guides). - `Docs/Opc.Ua.Di/ComplianceMatrix.md` — every DI declaration mapped to In-v1 / Generated / Deferred / Excluded. - `Docs/CompanionSpecLibraries.md` — packaging guide for new companion-spec libraries. - `Docs/FluentApiGaps.md` — historical record of G1–G11. - `Docs/SourceGeneratedNodeManagers.md` updated for richer node managers. - `Docs/plans/StateMachineBuilder.md` — deferred state-machine builder design. |
||
|
|
dc441a8b95 |
Source generator option to override instance modelling rules with type definition modelling rules (default opt in for stack) (#3799)
## Proposed changes When the source generator creates code for "instance" definitions (e.g., the `Server` object which has `ServerType` as its type definition), it currently uses the modelling rules specified on the **instance's children**, which may differ from the **type definition's children**. For example: - `ServerType` defines `UrisVersion` as `ModellingRule="Optional"` - `Server` instance overrides it to `ModellingRule="Mandatory"` This PR introduces two layers of modelling rule enforcement: ### 1. OPC UA promotion semantics (always active) Regardless of any configuration, the generator now enforces OPC UA modelling rule promotion semantics. Instances may only **promote** the type definition's rule: | Type Definition Rule | Allowed Instance Overrides | |---|---| | `Optional` | `Mandatory` | | `OptionalPlaceholder` | `Mandatory`, `MandatoryPlaceholder` | | `MandatoryPlaceholder` | `Mandatory` | Any other instance override (demotion) is silently rejected and the type definition's rule is used instead. This applies to both structural code generation decisions and the emitted runtime `ModellingRuleId`. ### 2. `UseTypeDefinitionModellingRules` option (opt-in) When enabled, the generator uses the type definition's modelling rules **unconditionally** — instance overrides are ignored entirely (even valid promotions). This is useful for stack generation where the type definition's semantics should be preserved exactly. - **Enabled by default** for stack generation (`Opc.Ua.SourceGeneration.Stack`) - **Disabled by default** for the Roslyn source generator (`Opc.Ua.SourceGeneration`), configurable via `ModelSourceGeneratorUseTypeDefinitionModellingRules` MSBuild property ### Key design decisions - A `TypeDefinitionModellingRule` property on `HierarchyNode` captures the type definition's original rule before instance overrides, updated through base→derived type-hierarchy merges but frozen once explicit instance overrides appear - A `GetEffectiveModellingRule()` helper with `IsValidPromotion()` centralizes the rule resolution logic across all structural check sites and runtime `ModellingRuleId` emission - Factory method emission (`LoadTemplate_ReplaceChild`) uses the instance's own modelling rule for mandatory/optional list classification so children the instance marks Mandatory are always created ## Related Issues - N/A ### Types of changes - [ ] Bugfix (non-breaking change which fixes an issue) - [x] Enhancement (non-breaking change which adds functionality) - [ ] Test enhancement (non-breaking change to increase test coverage) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected, requires version increase of Nuget packages) - [ ] Documentation Update (if none of the other choices apply) ## Checklist - [x] I have read the [CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md) doc. - [x] I have signed the [CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf). - [x] I ran tests locally with my changes, all passed. - [ ] I fixed all failing tests in the CI pipelines. - [ ] I fixed all introduced issues with CodeQL and LGTM. - [ ] I have added tests that prove my fix is effective or that my feature works and increased code coverage. - [x] I have added necessary documentation (if appropriate). - [ ] Any dependent changes have been merged and published in downstream modules. ## Further comments ### Files changed: | File | Change | |------|--------| | `Schema/ModelDesign.cs` | Added `TypeDefinitionModellingRule` property to `HierarchyNode` | | `Schema/ModelDesignValidator.cs` | Populates `TypeDefinitionModellingRule` during hierarchy merge; updates through base→derived type merges, freezes on instance overrides | | `GeneratorOptions.cs` | Added `UseTypeDefinitionModellingRules` option with full XML doc | | `NodeStateGenerator.cs` | `GetEffectiveModellingRule()` + `IsValidPromotion()` helpers; updated structural check sites and runtime `ModellingRuleId` emission; `NodeToGenerate` extended with `TypeDefinitionModellingRule` | | `StackGeneration.cs` | Enabled option for stack generation | | `ModelCompilationOptions.cs` | Added option + MSBuild property read | | `ModelCompilation.cs` | Wired option through to `GeneratorOptions` | | `OPCFoundation.Opc.Ua.SourceGeneration.props` | Registered MSBuild `CompilerVisibleProperty` | | `readme.md` | Documented new MSBuild property with promotion semantics | |
||
|
|
70b4498db8 |
Certificate manager and ref counted certificate type (#3688)
* New certificate and secrete abstraction with certificate infrastructure and certificate/secret stores. * leak testing for certificate resources to validate new ref counting in every test assembly * Migration guide updated and documentation added for all * Remove IDisposable from Nodestate and UserIdentity. * UserCertificateTokenHandler now just points into certificate registry/stores, no dispose required * Fix CA2000 warnings and cleanup of other diagnostics, increase warning levels in .editorconfig |
||
|
|
13612c03b9 | Fix CreateInstanceOf<X> access restrictions emission and PrioritizedChannel polyfill TryRead bug (#3747) | ||
|
|
bd4543e961 |
ManagedSession, Pluggable Subscription engine, and fluent builder + DI (#3730)
- Add new managed session, wrapping session and providing connection management and failover handling - Add new Subscription engine that can act as alternative to current engine, but is based on channels with worker tasks - Add a fluent builder for managed session clients - Replace NodeCache with LruNodeCache, rename ILruNodeCache and LruNodeCache to INodeCache and NodeCache - Update migration guide and document new functionality. |
||
|
|
54cc3d88b1 | Prepare for C# 15 union types: UnionAttribute polyfill, TryGetValue rename, HasValue (#3727) | ||
|
|
70abb05841 |
Remove Default JSON encoding infrastructure (#3713)
* Remove Default JSON encoding infrastructure Remove IJsonEncodeable interface, JsonEncodingId properties, DefaultJson constants, and all source generator JSON encoding output. The actual JsonEncoder/JsonDecoder and PubSub JSON encoding are not affected. - Delete IJsonEncodeable interface from IEncodable.cs - Remove DataTypeAttribute.JsonEncodingId and simplify TryGetTypeIdsFromType - Remove JSON encoding from 9 source generator files - Remove IJsonEncodeable from 13 built-in types and 12 node types - Remove JSON registration from EncodeableFactory and unboundTypeIds infra - Remove jsonEncodingId from OptionSet, ComplexTypeSystem, IComplexTypeFactory - Remove BrowseNames.DefaultJson and 25 *_Encoding_DefaultJson constants - Update ~14 test files and 2 documentation files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add IJsonEncodeable removal to migration guide Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * minor --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> |
||
|
|
94bc03b9f6 |
fix address space issues (#3705)
* fix missing mandatory children * Source generator: fix encoding nodes, EventNotifier, and type RBAC - Emit DataType encoding nodes (Default Binary/XML/JSON) into the generated address space. CollectEncodingNodes() discovers DataTypeEncodingType instances and builds synthetic hierarchies with their HasEncoding/HasDescription references. - Auto-set EventNotifier=SubscribeToEvents on Object nodes that have forward HasEventSource or HasNotifier references. The fix works at two levels: ModelDesignValidator infers SupportsEvents on types with event references in design XML, and NodeStateGenerator checks the resolved reference set for merged instances that inherit references from their type definitions. - Wrap AccessRestrictions/RolePermissions in if(forInstance) guards for ObjectType, VariableType, DataType, and ReferenceType templates so type definition nodes remain accessible to all users. - Allow ModellingRule=None Object children on type definitions to be emitted (e.g. state machine states/transitions). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Update missing nodes analysis after source generator fixes Retest with admin credentials against ConsoleReferenceServer v1.05.07. Categorize 794 truly missing nodes (after filtering optional/placeholder): - 384 encoding nodes (NodeSet2.xml-only, not in design XML) - 172 role instance children - 84 other nodes - Remaining: trust list, PubSub, diagnostics, etc. RBAC and EventNotifier fixes confirmed working. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * update * plans: detailed analysis of 292 remaining missing nodes Replaced the two previous analysis files with a single consolidated validation report. Each of the 292 nodes is classified with a reason: - 212 type-level children (ObjectType definitions not instantiated) - 48 instance-level children (diagnostics, HA, FileSystem, PubSub) - 32 orphan property templates (design-time canonical definitions) Only 1 fix recommended: Server.Auditing (i=2994) should be exposed as false per Part 5 section 6.3.3. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * feat: add GDS node manager to ConsoleReferenceServer Add Global Discovery Server functionality to the reference server: - Add Opc.Ua.Gds.Server.Common project reference - Add GdsNodeManagerFactory that creates ApplicationsNodeManager with JsonApplicationsDatabase and CertificateGroup (auto-approve) - Add GlobalDiscoveryServerConfiguration extension to config XML - Add GDS to ServerCapabilities - Registration is opt-in: only when config extension is present Also fix pre-existing source generator test failures: - Add missing CreateOrReplaceTransitionNumber stub method to StateMachineTransitionState in CompilerUtils.cs (8 tests fixed) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * plans: update missing nodes report with GDS retest results Retested after adding GDS node manager to ConsoleReferenceServer. Total missing reduced from 1325 to 1243 (82 fewer). 335 remaining 'other' nodes fully classified with per-node reasons. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * plans: Server.Auditing is present (access-restricted, not missing) Live validation confirmed i=2994 exists with value=true, visible to admin users. Returns BadUserAccessDenied for anonymous. No fixes needed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix CttTestRunner build errors for v1.6 API and Jint 4.8.0 - Update System.CommandLine 2.0.7 API: SetHandler->SetAction, InvokeAsync->Parse().InvokeAsync() - Remove ObjectInstance inheritance from CttAssert, CttServiceRegister, CttIdentifierConstants, CttMonitoredItemHelper; use ToJsObject() factory methods instead - Replace Jint.Native.JsValueType with .IsObject()/.IsNumber()/.IsString() etc. - Add missing using directives (Jint.Runtime, Microsoft.Extensions.Logging, etc.) - Fix NodeId.Identifier obsolete -> TryGetIdentifier<uint> - Fix DataValue.Value obsolete -> WrappedValue.AsBoxedObject() - Fix ApplicationInstance() obsolete -> ApplicationInstance(ITelemetryContext) - Fix LoadApplicationConfiguration -> LoadApplicationConfigurationAsync - Fix CheckApplicationInstanceCertificate -> CheckApplicationInstanceCertificatesAsync - Fix CoreClientUtils.SelectEndpointAsync signature (requires telemetry param) - Fix DefaultSessionFactory() obsolete -> DefaultSessionFactory(ITelemetryContext) - Fix DiscoveryClient.Create -> DiscoveryClient.CreateAsync - Fix FindServers/GetEndpoints -> FindServersAsync/GetEndpointsAsync - Fix StatusCode to uint conversions - Fix ArrayOf<T> iteration (use foreach instead of LINQ on IConvertableToArray) - Fix XmlNodeList null coalescing in CttProjectSettings - Fix JsValue.False -> JsValue.FromObject(engine, false) - Add --json option to Program.cs for machine-readable output Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: emit type-level children with ModellingRule=None for all node classes The source generator's GetChildren method only included ModellingRule=None children when they were ObjectDesign instances (state machine states/transitions). This excluded Variables and Methods that are explicitly defined on types without a modelling rule, such as: - ConditionType.ConditionRefresh (Method) - ConditionType.ConditionRefresh2 (Method) - ConditionType.SupportsFilteredRetain (Variable) - ProgramStateMachineType.Creatable (Variable) - Various TrueState/FalseState display-hint properties Remove the ObjectDesign restriction so all explicitly defined type-level children with ModellingRule=None are included in the generated address space. This adds ~52 previously missing nodes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * plans: update report after ModellingRule=None generator fix Type-level children dropped from 261 to 203 (-58) after fixing the source generator to emit Variables and Methods with ModellingRule=None. Total 'other' reduced from 335 to 283. No fixes needed for any remaining nodes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * plans: all 203 type-level children confirmed present via Read Verified all 203 'type-level children' exist in the server (none return BadNodeIdUnknown). They return Good, BadUserAccessDenied, or BadSecurityModeInsufficient -- all confirming the node exists but is access-restricted for anonymous users. All 1,316 export-missing nodes are now accounted for. Zero nodes are actually missing from the server address space. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix CttTestRunner session service methods for CTT JS script compatibility - Implement ServiceCreateSession with real Session.CreateAsync connection - Implement ServiceActivateSession with proper response fields - Implement ServiceCloseSession with session cleanup - Fix UaSession constructor to provide service methods via CreateServiceObject - Convert all type constructors from ClrFunction to JS functions for 'new' support (Jint 4.x ClrFunction does not support [[Construct]]) - Add UaChannel.connect/disconnect stubs for OpenSecureChannel flow - Add UaDiscovery with getEndpoints/findServers from discovery session - Add missing types: UaSubscriptionDiagnosticsDataType, UaHistoryUpdateResult, etc. - Add missing enums: IdentifierType, Constants (DateTime/numeric limits) - Add UaPkiCertificate.fromDER, UaByteString.fromStringData, PkiType, UaPkiUtility - Add UaDateTime.Now constructor, equals/msecsTo methods - Add UaStatusCode with isGood/isBad/isUncertain as JS constructor - Fix response headers with Timestamp (UaDateTime), ServiceDiagnostics, StringTable - Fix endpoint descriptions with Server, UserIdentityTokens, ServerCertificate - Add CreateResponseHeader helper for consistent response header construction - Override warnOnce.js loggers to avoid Function.caller incompatibility - Add stopTest, checkResourceError (lowercase) global functions - Add UaOpcServer constructor with all method stubs - Handle JS parse errors in include() for malformed CTT files - Test.Connect() now calls InstanciateHelpers with DiscoverySession Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Add CttTestRunner: .NET replacement for CTT JavaScript host environment Implements a Jint-based JavaScript engine that can execute the OPC Foundation's Compliance Test Tool .js test scripts using the OPC UA .NET Standard stack. Features: - Parses CTT .ctt.xml project files (Qt AbstractItemModelData format) - Loads and resolves CTT include() dependency chains (~100 library files) - Registers ~250 Ua* type constructors for JavaScript - Implements session.read/write/browse/getEndpoints/findServers - Provides all OPC UA enumerations, NodeId constants, Assert methods - CLI with --list, --file, --conformance-unit, --result, --json flags - Headless operation for agent/CI integration Current status: Framework connects to OPC UA server and loads CTT test infrastructure. Session establishment flow needs additional property compatibility for CreateSession/ActivateSession request objects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: do not apply DefaultAccessRestrictions/DefaultRolePermissions to type definitions ObjectType and VariableType nodes should never have access restrictions or role permissions from DefaultAccessRestrictions/ DefaultRolePermissions. These defaults are meant to apply to instances of the type, not to the type definition node itself. Previously, CertificateGroupType, TrustListType, SecurityGroupType and other types were incorrectly emitted with AccessRestrictions inherited from their DefaultAccessRestrictions, making them unreadable without encryption even though the spec defines no restrictions on these type definitions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * CttTestRunner: fix session establishment flow - Fix constructor patterns (new/no-new dual call support) - Fix ResponseHeader with ServiceDiagnostics/StringTable - Populate ServerNonce, ServerCertificate, ServerEndpoints in CreateSession response - Add UaVariant setter methods (setNodeId/setString/setBoolean/etc.) - Add UaCreateSessionRequest/ActivateSessionRequest with proper nested structures - Fix UaPkiUtility/UaPkiCertificate with Thumbprint/toDERFile/loadCertificateFromFile - Add missing enums: PerformUpdateType, SecurityPolicy, StructureType, etc. - Add HostInfo, Bit helper, KeyPairCollection, ExpectedAndAcceptedResults - Add _error.store(), MessageSecurityMode.toString() Status: Session creates successfully, CreateSession validation runs, hits validateCertificate in PKI chain (next to implement). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * plans: update report after DefaultAccessRestrictions type definition fix ObjectTypes no longer have incorrect access restrictions. Type children reduced from 203 to 164 (39 now visible). Total export- missing reduced from 1316 to 1146. Remaining 164 type children are individual methods/variables with spec-correct access restrictions. Two source generator fixes applied: - ModellingRule=None children for Variables/Methods - DefaultAccessRestrictions not applied to ObjectType/VariableType Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * CttTestRunner: fix PKI, cert validation, warnOnce, session response - Intercept warnOnce.js with Jint-compatible replacement (no Function.caller) - Add _log.store() global helper - Add HOSTNAMES/HostnameFromUrl helpers for cert hostname validation - Add UaPkiCertificate properties: PublicKey, Issuer, Subject, KeyUsage, Hostnames - Add UaPkiUtility.validateCertificate stub - Add UaByteString static helpers: FromByteArray, ToByteArray, fromHexString - Use JS UaNodeId constructor for proper equals() support - Fill AuthenticationToken and 32-byte ServerNonce in CreateSession response - Add clone/append to ByteString objects Session flow: CreateSession validates, ActivateSession reached, hits Channel.ServerCertificate.clone() (IsSecure check — next to fix). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * CttTestRunner: complete session establishment, crypto stubs, ByteString helpers - Add _makeByteString() helper for consistent ByteString objects with clone/append/isEmpty - Add UaCryptoProvider with asymmetricSign/Verify stubs - Add UaExtensionObject setter methods (setAnonymousIdentityToken, etc.) - Fix UaChannel with full properties (RequestedSecurityPolicyUri, IsSecure, etc.) - Fix duplicate type registrations overriding custom constructors - Fix ActivateSession response header with ServiceDiagnostics - Remove UaCreateSessionResponse/ActivateSessionRequest/CloseSessionRequest duplicates Status: Full session lifecycle works (GetEndpoints → OpenSecureChannel → CreateSession → ActivateSession). Test scripts execute and hit server capabilities initialization (MonitoredItem NodeId settings configuration). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * update * plans: add spec references for access restriction reasoning Added links to Part 3 sections 5.2.9, 5.2.11, and 6.3.3 explaining why DefaultRolePermissions are applied to instance children but not to type definitions. The NodeSet2.xml has no explicit RolePermissions on these 164 nodes -- restrictions come from model design defaults. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: add GDS project references to ConsoleReferenceServer Dockerfile Add Opc.Ua.Gds.Common and Opc.Ua.Gds.Server.Common csproj COPY lines to the Docker restore layer, required since the GDS node manager was added to the ConsoleReferenceServer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * update * feat: add IsPartOfTypeHierarchy flag to bypass access restrictions on types Type hierarchy nodes (ObjectType/VariableType definitions and their children) should be universally accessible regardless of AccessRestrictions and RolePermissions. Changes: - Add IsPartOfTypeHierarchy property to NodeState - Set flag on ObjectType/VariableType in generated code (!forInstance) - Propagate flag from parent to children in AddPredefinedNode - Add flag to NodeMetadata, propagate in GetPermissionMetadata - Bypass ValidateRolePermissions and ValidateAccessRestrictions when IsPartOfTypeHierarchy is true - Revert isTypeDefinition guard: AccessRestrictions and RolePermissions are now emitted on all nodes as metadata, but enforcement is skipped for type hierarchy nodes - Fix forInstance propagation in type factories: use forInstance: forInstance for type children so deep children (TrueState/FalseState etc.) are included when !forInstance Type-level missing nodes reduced from 201 to 99. Remaining 99 are in the server but not reachable by the export tool's browse path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * plans: update report with final IsPartOfTypeHierarchy results Missing from export reduced to 998 (from 1325 original). Type children: 201 -> 99 (forInstance propagation fix). All nodes verified present via OPC UA Read. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: propagate IsPartOfTypeHierarchy in GetNodeMetadataAsync The Browse service's per-reference ValidateRolePermissionsAsync calls GetNodeMetadataAsync (not GetPermissionMetadataAsync). The IsPartOfTypeHierarchy flag was only set in GetPermissionMetadataAsync, causing type hierarchy nodes to be filtered out of Browse results. This fixes 99 ObjectType children that were previously invisible in Browse from their parent types. Type-level missing: 99 -> 0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * plans: final report -- 0 type-level children missing (694 total) Type-level missing: 99 -> 0 after fixing IsPartOfTypeHierarchy propagation in GetNodeMetadataAsync. Total export-missing: 694 (384 encoding + 236 access-restricted + 74 instance/orphan). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * update --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> |
||
|
|
38227cbeab |
Fix boolean default should be false instead of true (#3679)
* Fix boolean default should be false instead of true * Update MigrationGuide for boolean default value changes Clarified the impact of the boolean default value change and updated the migration guide to reflect the correct initialization requirements. |
||
|
|
c71f2e7733 |
Fix source generator generated structures with optional fields (#3674)
Split validator load/validate; split DesignFileCollection Targets/Dependencies ModelDesignValidator.LoadNodes now skips ValidateDictionary when a model is loaded purely as a dependency. The flag is plumbed through LoadModelDesign and LoadDesignFile; the dep loop in ValidateModel passes false, the primary target passes true. This lets callers supply unrelated or reverse dependencies (deps that import the target) without triggering premature validation failures. DesignFileCollection exposes Targets + Dependencies; generators and tests updated. MergeNamespace preserves FilePath across PublicationDate-based replacement so later loads can still find the source file. Tester simplified to treat every other xml/csv pair as a dependency of each target. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> |
||
|
|
fd41681f4b |
Add support to publish OPC UA applications as Native AOT (#3633)
* make most ptojects aot compatible * Remove newtonsoft * Migrate all projects from Mono.Options to System.CommandLine 2.0.5 * Fix array clone * Replace serializers for storage using new attribute driven type geberator * Add new AOT integration tests covering all functional areas * Documentation updates |
||
|
|
5a1e547250 | Code cleanup and modernization of test assertions to comply with project standards. (#3631) | ||
|
|
03777ecb09 |
New Json decoder/encoders, array/matrix abstractions, ByteString, and more. (#3619)
- **Collections overhaul** — new/rewritten collection types (`ArrayOf`, `Collections` commits)
- **`Variant` builder/accessor** — new APIs for constructing and accessing Variants
- **`NodeId` operators made explicit** — breaking change for implicit conversions
- **Version bumped to 1.6** with preview build support
- **NumericRange** uses Variant
- **object** type accessors and general usage removed.
### 🏗️ Infrastructure
- Build config updated; `.NET 10` targeting
- InternalsVisibleTo moved to `.csproj`
- Pipeline/CI adjustments
|
||
|
|
601cabf86f | Replace all use of object in code and API with Variant (#3550) | ||
|
|
f66ceffd75 |
Immutable built in types and code generation (#3534)
Generate stack and application code using source generators Change built in types to readonly structs Update localized text implementation to use JSON text serializer Status code with symbolic names Immutable node ids No boxing for all built in types <= 8 bytes in Variant. Split user identity token and token handling via token handler Add migration guide for breaking changes |