Repository navigation
AutoID: the OPC UA for AutoID Devices companion SDK (OPC 30010) - #4825
Merged
Merged
Conversation
…pe refines A NodeSet may refine the DataType of an inherited property to a subtype of the structure the supertype declares. OPC 30010 (AutoID) does so for the ScanResult property of its scan event types (AutoIdScanEventType declares ScanResult[], RfidScanEventType RfidScanResult[]) and for the AccessResult property of RfidAccessEventType. Only the type argument of the generic PropertyState class changes, so the generated PropertyOverride cast PropertyState<ArrayOf<ScanResult>> to PropertyState<ArrayOf<RfidScanResult>>, which does not compile (CS0030, CS0029). The subtype now holds such a property in a field of its own, exposes it with the refined value type and enumerates and removes it itself, as it already did for a method overridden with another method state class. Overrides with the same class or from a non-generic base class are unchanged.
Opc.Ua.AutoID is the server/client-independent model package for OPC 30010 OPC UA for AutoID Devices (http://opcfoundation.org/UA/AutoID/ 1.01, 2020-06-18) over the DI model, in the layout of the GMS and AMB packages. - The NodeSet and the published NodeIds table are byte-identical to UA-Nodeset latest/AutoID (9f6c7660b94af24d32c4248d4b13bf60adab0301); provenance.json pins URLs and SHA-256, .gitattributes keeps them at LF. - The published table predates model 1.01 and lacks 67 declarations, so the generator drift guard is derived from it with derive-identifier-table.py. - AutoIdModel and the AddAutoIdTypeSystem overloads load DI before AutoID. - Opc.Ua.AutoID.Tests pins the files, checks the generated identifiers against the NodeSet and the table, loads the model, round-trips the ScanData and Location unions and the scan and access results through the binary, JSON and XML encodings, and reads the model from a server over opc.tcp. - docs/AutoID.md, the companion indexes, UA.slnx and expected-packages.
Opc.Ua.AutoID.Server hosts OPC 30010 readers on the Device Integration node manager: a fluent reader builder with rollback, an IServiceCollection registration (AddAutoId/ConfigureAutoId), a provider contract for RFID, OCR, optical, optical verifier and RTLS hardware, the Scan, ScanStart and ScanStop methods, the RFID tag access methods, the RTLS location methods, scan, access, presence and log entry events, device status handling and the conformance units and facets the hosted readers actually implement. Simulated in-memory providers (EPC Gen2 RFID, OCR/optical, verifier, RTLS) back the tests and the sample. The reader kind and its device type mapping move into the model package so the client can share them.
Opc.Ua.AutoID.Client discovers the readers below the DI DeviceSet (a rejected browse is reported, not hidden), runs Scan, ScanStart and ScanStop over the generated proxies, accesses RFID tags and queries RTLS locations, reads a device snapshot with AutoIdReadOptions, and streams scan, access, presence and log entry events as asynchronous sequences. It comes with the session extension and the AddAutoIdClient registration. The over-the-wire tests drive the hosted server with the client: method result codes, concurrent scans, scan start and stop, session close, tag commands, events and the published conformance claims.
Opc.Ua.Mcp.AutoID adds the autoid profile with nine bounded tools: reader discovery, device snapshot, synchronous scan, scan start and stop, a bounded scan event observation, tag reads and the RTLS location queries. No tool writes, locks or kills a tag or takes a password. The profile is registered in the core profile enumeration, the MCP host and the tool package list. The tests drive the tools through the real MCP transport against a hosted server with simulated readers, and the profile, catalogue and count tests of the MCP host cover the new profile.
AutoIdServer publishes a simulated RFID dock door reader with the library (AddAutoId, a reader built from an in-memory EPC Gen2 provider) and moves pallets in and out of the antenna field; AutoIdClient discovers the reader, scans, reads and writes tag memory and prints scan and presence events. Test-AutoIdSamplePair.ps1 starts the pair on a free port and checks what the client prints. The server defaults to port 62549, from the dynamic range that IANA does not assign.
Adds the server, client and MCP projects and the two samples to the solution and the three packages to the expected package inventory. The AutoID packages follow the root version, which the package policy tests now state, and a test pins the four AutoID package identities.
…apping Only map an OperationCanceledException to BadServerHalted or BadTimeout when the reader's own shutdown or scan-duration token fired.
…ples Extend docs/AutoID.md and the index, MCP, samples and what's-new pages, and drop the model-package-only statements.
Keep the reader busy until the provider has stopped an asynchronous scan, complete only the scan the in-memory loop owns, end the loop when the sink rejects a report, dispose an owned provider when reader creation fails, publish the idle status on dispose, do not fail an executed command when its audit event cannot be published, and make the client snapshot fail on a missing required variable.
Replace Enum.IsDefined<T>, Convert.FromHexString, Convert.ToHexString and PeriodicTimer where the framework target lacks them.
biancode
force-pushed
the
spec/autoid-model
branch
from
October 17, 2026 21:59
716085e to
d48e11c
Compare
Add AutoIdMcpAotTests and the project reference, and build the JSON arrays of the AutoID tools without the generic JsonArray.Add overloads that the trim and AOT analyzers reject.
marcschier
reviewed
Oct 18, 2026
OPC 30010 6.6.3.2 returns the location of an object in the requested LocationType, and 6.6.3.3 lists the types the system supports. A known object whose stored location had another supported type was reported as Bad_NotFound, as if the system did not know it. The reader now passes a result only when its location is of the requested type and answers Bad_InvalidState (6.6.3.2: the command is not available, for example due to the configuration) for a supported type the location is not available in; Bad_NotFound stays for an unknown object. InMemoryRtlsProvider takes an optional location converter that translates a stored location into another supported type, for example from the configured local coordinate system (9.3.4) into WGS84, and returns a copy so the stored result stays as registered.
OPC 30010 7.10 defines the Client of an access event as the name of the client application which was the originator of the command, and 6.1.3.3 describes LastAccess Client the same way. The runtime used the display name of the session's user (for example "Anonymous"), and the results of a scan started with ScanStart were attributed to the device. Client is now the application name of the client description the session was created with, else its application URI, else a generic name. The results of an asynchronous scan name the client that called ScanStart; results the device reports while no asynchronous scan runs keep the device as originator.
OPC 30010 leaves the length of a scan cycle to the device (ScanSettings Cycles, 9.3.7). The in-memory providers defaulted to 20 ms, so an unbounded ScanStart raised about fifty scan events per second, more than a server built on the simulated readers should publish by default. The scan cycle now defaults to one second. It stays configurable through the cycleInterval constructor argument, is exposed as CycleInterval, and a non-positive interval is rejected instead of spinning.
…napshot Most children of an AutoID device are optional (OPC 30010 6.1, 6.5.3, 6.6.3), so a client has to know which methods a device publishes and which variables it can monitor (DeviceStatus 6.1.3.15, LastScanData 6.1.3.9, LastScanTimestamp, DeviceLocation 6.1.3.12). ReadDeviceAsync already browses the device but kept only the values. AutoIdDeviceSnapshot now carries DeviceStatusId, LastScanDataId, LastScanTimestampId, DeviceLocationId and Methods (the browse names of the published methods, vendor-specific ones included) plus HasMethod. They come from the same browse, now covering methods as well, whatever the read options.
A server has one Device Integration owner. AutoID now joins it the way Pumps and Scales do instead of requiring its own node manager: - AutoIdMachineryModelProvider adds the AutoID model to the Machinery owner's model-provider pipeline and keeps the DI nodes it loaded. - AddAutoIdToMachinery registers the provider after AddMachinery. - ConfigureAutoIdFor<TNodeManager> creates readers on any DiNodeManager owner; successive delegates share one runtime. - DiNodeManager.CreateAutoIdRuntime() is the direct path without dependency injection; the owner disposes the runtime on shutdown. - AutoIdRuntime.InstanceNamespaceIndex names the owner's instance namespace for reader browse names. The stand-alone AutoIdNodeManager is built from the same provider, and AddAutoId next to another DI owner now names the composition API.
AutoIdCompositionTests use the stock Machinery owner with providers out of order: DI loaded once, readers below the shared DeviceSet with owner NodeIds, conformance of both, rollback, cancellation, runtime disposal, an application-owned DI owner, and a second DI owner rejected. AutoIdMachineryCompositionEndToEndTests host Machinery, Pumps and AutoID in one server and read it back over a session with the AutoID, Machinery and Pumps clients, including a scan and the published profiles and conformance units.
Replace the statement that AutoID cannot be combined with another DI owner by what happens in a composition: which manager owns DI and the AutoID model, where readers appear, the Machinery example, the direct path, lifetime, and what a plain AddOpcUaDi owner needs.
marcschier
approved these changes
Oct 18, 2026
biancode
marked this pull request as ready for review
October 18, 2026 17:30
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Shared source-generation changes and cross-companion ownership integration require final maintainer review.
1 open issue
What changed in this PR
Adds the OPC 30010 AutoID companion SDK, following the existing model, provider-backed server, typed client and MCP package pattern.
Changes:
- Adds AutoID reader APIs, shared Device Integration hosting and simulated readers.
- Integrates the AutoID MCP profile, samples, packaging and documentation.
- Fixes generation of refined structure properties and adds regression, conformance and Native AOT coverage.
| File | Description |
|---|---|
| UA.slnx | Registers AutoID projects. |
| tools/Opc.Ua.SourceGeneration.Core/Schema/ModelDesignExtensions.cs | Detects refined generic overrides. |
| tools/Opc.Ua.SourceGeneration.Core/Generators/NodeStateGenerator.cs | Generates independent refined properties. |
| tools/Opc.Ua.Mcp/Test-McpGrade.ps1 | Accepts the AutoID profile. |
| tools/Opc.Ua.Mcp/Opc.Ua.Mcp.csproj | References AutoID tools. |
| tools/Opc.Ua.Mcp/McpREADME.md | Documents AutoID tools. |
| tools/Opc.Ua.Mcp/McpHostBuilder.cs | Registers AutoID services and tools. |
| tools/Opc.Ua.Mcp/.mcp/server.json | Lists AutoID support. |
| tools/Opc.Ua.Mcp.Vision/OpcUaMcpVisionExtensions.cs | Accepts unselected AutoID profile. |
| tools/Opc.Ua.Mcp.Robotics/OpcUaMcpRoboticsExtensions.cs | Accepts unselected AutoID profile. |
| tools/Opc.Ua.Mcp.PubSub.Diagnostics/OpcUaMcpPubSubDiagnosticsExtensions.cs | Accepts unselected AutoID profile. |
| tools/Opc.Ua.Mcp.Diagnostics/OpcUaMcpDiagnosticsExtensions.cs | Accepts unselected AutoID profile. |
| tools/Opc.Ua.Mcp.Core/OpcUaMcpCoreExtensions.cs | Shares connection tools with AutoID. |
| tools/Opc.Ua.Mcp.Core/McpToolProfile.cs | Defines AutoID profile. |
| tools/Opc.Ua.Mcp.AutoID/Tools/AutoIdJson.cs | Projects AutoID results into JSON. |
| tools/Opc.Ua.Mcp.AutoID/OpcUaMcpAutoIdExtensions.cs | Adds embedding registration APIs. |
| tools/Opc.Ua.Mcp.AutoID/Opc.Ua.Mcp.AutoID.csproj | Defines MCP package. |
| tools/Opc.Ua.Mcp.AutoID/NugetREADME.md | Documents tool usage and limits. |
| tests/Opc.Ua.Tools.Tests/PackageVersionPolicyTests.cs | Checks AutoID release policy. |
| tests/Opc.Ua.Tools.Tests/Opc.Ua.Tools.Tests.csproj | Adds AutoID test dependencies. |
| tests/Opc.Ua.Tools.Tests/NuGetPackageSetValidationTests.cs | Checks four-package inventory. |
| tests/Opc.Ua.Tools.Tests/Mcp/Robotics/OpcUaMcpRoboticsSafetyTests.cs | Checks profile isolation. |
| tests/Opc.Ua.Tools.Tests/Mcp/Host/McpToolProfileCompositionTests.cs | Covers AutoID composition. |
| tests/Opc.Ua.Tools.Tests/Mcp/Host/McpLegacyModuleCatalogueTests.cs | Updates profile catalogue expectations. |
| tests/Opc.Ua.Tools.Tests/Mcp/Host/McpHostBuilderTests.cs | Checks AutoID tool counts. |
| tests/Opc.Ua.Tools.Tests/Mcp/CranesHoistsMcpSchemaTests.cs | Checks AutoID adds no crane tools. |
| tests/Opc.Ua.Tools.Tests/Mcp/Core/McpToolProfileSetTests.cs | Checks AutoID parsing and ordinal. |
| tests/Opc.Ua.Tools.Tests/Mcp/Core/McpExpandedToolProfileSetTests.cs | Updates profile-set coverage. |
| tests/Opc.Ua.SourceGeneration.Core.Tests/Schema/ModelDesignExtensionsTests.cs | Tests generic refinement detection. |
| tests/Opc.Ua.SourceGeneration.Core.Tests/Resources/StructurePropertyOverride.ModelDesign.xml | Supplies refinement regression model. |
| tests/Opc.Ua.SourceGeneration.Core.Tests/Generators/NodeStateGeneratorTests.cs | Validates refined generated properties. |
| tests/Opc.Ua.AutoID.Tests/Opc.Ua.AutoID.Tests.csproj | Defines AutoID test project. |
| tests/Opc.Ua.AutoID.Tests/AutoIdTestSupport.cs | Adds session and event helpers. |
| tests/Opc.Ua.AutoID.Tests/AutoIdTestContext.cs | Provides isolated model contexts. |
| tests/Opc.Ua.AutoID.Tests/AutoIdConformanceTests.cs | Checks capability-based conformance claims. |
| tests/Opc.Ua.Aot.Tests.Mcp/Opc.Ua.Aot.Tests.Mcp.csproj | References AutoID MCP package. |
| tests/Opc.Ua.Aot.Tests.Mcp/AutoIdMcpAotTests.cs | Tests reflection-free tool registration. |
| src/Opc.Ua.Di.Server/Opc.Ua.Di.Server.csproj | Grants AutoID internal access. |
| src/Opc.Ua.AutoID/Properties/AssemblyInfo.cs | Sets model assembly compliance. |
| src/Opc.Ua.AutoID/Opc.Ua.AutoID.csproj | Configures model generation and packaging. |
| src/Opc.Ua.AutoID/NugetREADME.md | Documents model APIs and provenance. |
| src/Opc.Ua.AutoID/Model/provenance.json | Pins upstream model identity and hashes. |
| src/Opc.Ua.AutoID/AutoIdReaderKind.cs | Maps reader kinds to model types. |
| src/Opc.Ua.AutoID/AutoIdModelExtensions.cs | Registers AutoID and DI models. |
| src/Opc.Ua.AutoID/AutoIdModel.cs | Exposes model identity and dependencies. |
| src/Opc.Ua.AutoID.Server/Providers/IAutoIdRtlsProvider.cs | Defines location provider contract. |
| src/Opc.Ua.AutoID.Server/Providers/IAutoIdReaderSink.cs | Defines provider event reporting. |
| src/Opc.Ua.AutoID.Server/Providers/IAutoIdReaderProvider.cs | Defines reader and scan contracts. |
| src/Opc.Ua.AutoID.Server/Providers/AutoIdScanOutcome.cs | Represents scan results and status. |
| src/Opc.Ua.AutoID.Server/Properties/AssemblyInfo.cs | Sets server assembly compliance. |
| src/Opc.Ua.AutoID.Server/OperationTracker.cs | Tracks and drains active operations. |
| src/Opc.Ua.AutoID.Server/Opc.Ua.AutoID.Server.csproj | Defines server package dependencies. |
| src/Opc.Ua.AutoID.Server/NugetREADME.md | Documents hosting and providers. |
| src/Opc.Ua.AutoID.Server/InMemory/InMemoryRfidTag.cs | Defines simulated RFID tag state. |
| src/Opc.Ua.AutoID.Server/InMemory/InMemoryOpticalVerifierProvider.cs | Adds simulated verifier provider. |
| src/Opc.Ua.AutoID.Server/Hosting/IAutoIdSetupContext.cs | Defines standalone setup context. |
| src/Opc.Ua.AutoID.Server/Hosting/IAutoIdBuildContext.cs | Defines composed-owner setup context. |
| src/Opc.Ua.AutoID.Server/EventIds.cs | Allocates logging event identifiers. |
| src/Opc.Ua.AutoID.Server/DiNodeManagerAutoIdExtensions.cs | Associates runtimes with existing owners. |
| src/Opc.Ua.AutoID.Server/AutoIdServerOptions.cs | Defines reader limits and options. |
| src/Opc.Ua.AutoID.Server/AutoIdReader.Rtls.cs | Implements location method handling. |
| src/Opc.Ua.AutoID.Server/AutoIdProfiles.cs | Defines supported conformance identifiers. |
| src/Opc.Ua.AutoID.Server/AutoIdNodeManagerFactory.cs | Creates hosted AutoID managers. |
| src/Opc.Ua.AutoID.Server/AutoIdNodeManager.cs | Hosts standalone AutoID address space. |
| src/Opc.Ua.AutoID.Server/AutoIdMachineryModelProvider.cs | Loads AutoID into Machinery owners. |
| src/Opc.Ua.AutoID.Server/AutoIdCompat.cs | Provides older-framework helpers. |
| src/Opc.Ua.AutoID.Client/SessionAutoIdExtensions.cs | Creates clients from sessions. |
| src/Opc.Ua.AutoID.Client/Properties/AssemblyInfo.cs | Sets client assembly compliance. |
| src/Opc.Ua.AutoID.Client/Opc.Ua.AutoID.Client.csproj | Defines client package dependencies. |
| src/Opc.Ua.AutoID.Client/NugetREADME.md | Documents typed client usage. |
| src/Opc.Ua.AutoID.Client/Hosting/OpcUaAutoIdClientBuilderExtensions.cs | Registers managed-session client factories. |
| src/Opc.Ua.AutoID.Client/AutoIdScanResponse.cs | Defines scan and tag-read responses. |
| src/Opc.Ua.AutoID.Client/AutoIdReadOptions.cs | Defines snapshot read selections. |
| src/Opc.Ua.AutoID.Client/AutoIdReaderEntry.cs | Represents discovered readers. |
| src/Opc.Ua.AutoID.Client/AutoIdClientFactory.cs | Creates clients over managed sessions. |
| samples/README.md | Links AutoID samples. |
| samples/AutoID/README.md | Explains sample execution. |
| samples/AutoID/AutoIdServer/Properties/AssemblyInfo.cs | Sets sample assembly compliance. |
| samples/AutoID/AutoIdServer/Program.cs | Configures sample server hosting. |
| samples/AutoID/AutoIdServer/DockDoorSimulation.cs | Simulates pallet movement and scans. |
| samples/AutoID/AutoIdServer/DockDoor.cs | Configures reader and sample tags. |
| samples/AutoID/AutoIdServer/AutoIdServer.csproj | Defines server sample project. |
| samples/AutoID/AutoIdClient/Properties/AssemblyInfo.cs | Sets sample assembly compliance. |
| samples/AutoID/AutoIdClient/AutoIdClientOptions.cs | Parses client sample options. |
| samples/AutoID/AutoIdClient/AutoIdClient.csproj | Defines client sample project. |
| README.md | Lists AutoID companion support. |
| docs/WhatsNewIn2.0.md | Announces AutoID packages and tools. |
| docs/Samples.md | Links AutoID sample pair. |
| docs/README.md | Indexes AutoID documentation. |
| docs/Profiles.md | Documents AutoID capabilities and limitations. |
| docs/McpServer.md | Documents AutoID tool catalogue. |
| docs/Machinery.md | Explains shared-owner AutoID composition. |
| docs/DeveloperGuide.md | Lists AutoID MCP release policy. |
| .gitattributes | Preserves upstream asset line endings. |
| .azurepipelines/expected-packages.txt | Adds four AutoID package identities. |
Review effort: Balanced
Clarified remarks in AutoIdReadOptions documentation. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
marcschier
enabled auto-merge (squash)
October 18, 2026 19:11
OPC 30010 6.1.3.7 lists only the Call Service status codes of OPC 10000-4 5.12.2 for GetDeviceLocation. There Bad_NotSupported means that the method is not supported for the object, which misreports a published method. 5.12.2.4 allows reusing a status code with the same canonical meaning, so GetDeviceLocation now uses the mapping of GetLocation (6.6.3.2): an undefined location type is Bad_InvalidArgument and a device location that is not available in the requested type is Bad_InvalidState.
…d_device autoid_read_device now returns the NodeIds of DeviceStatus, LastScanData, LastScanTimestamp and DeviceLocation (null when the device does not publish the variable) and "methods", the browse names of the methods the device publishes. Most children of an AutoID device are optional (OPC 30010 6.1, 6.5.3, 6.6.3), so an agent can subscribe to the variables and knows which methods it may call without browsing. The JSON is built explicitly, without reflection.
auto-merge was automatically disabled
October 18, 2026 20:10
Head branch was pushed to by a user without write access
This was referenced Oct 20, 2026
marcschier
added a commit
that referenced
this pull request
Oct 21, 2026
# Description A follow-up to #4825. It adds `AutoIdClient.RefreshDeviceAsync(AutoIdDeviceSnapshot, CancellationToken)`, which reads the variables of a reader device that change at runtime again through the NodeIds a snapshot already carries. It makes one Read and no Browse. ## Why `ReadDeviceAsync` browses the children of the device on every call. OPC 30010 makes most device variables and methods optional, so the browse is how the client finds out what this device publishes. `AutoIdReadOptions.StatusOnly` only narrows the Read. This is the point the Copilot review raised on #4825 ([discussion](#4825 (comment))). 1458af9 documented the behaviour, but a client that polls the status of N readers still pays N Browse and N Read requests per cycle. One Read per reader would do. `AutoIdDeviceSnapshot` already carries what a poll needs: `DeviceStatusId`, `LastScanDataId`, `LastScanTimestampId`, `DeviceLocationId` and `Methods`, all taken from that browse. `RefreshDeviceAsync` uses them. ## Change - **`RefreshDeviceAsync(snapshot)`** reads `DeviceStatus` and, when the device publishes them, `LastScanData`, `LastScanTimestamp` and `DeviceLocation`. That is one Read of one to four variables and no Browse. It returns a copy of the snapshot (`with`), and every other member, including `Methods` and the NodeIds, is unchanged. - **Stateless.** The client keeps no cache. The caller holds the snapshot, as with the other companion clients (`PumpsClient.ReadPumpAsync`, `ScalesClient.ReadSnapshotAsync`, and Robotics' `RefreshAsync` on its handles). A poller calls `ReadDeviceAsync` once and then passes the snapshot to `RefreshDeviceAsync` on every cycle. - **Stale snapshot.** The snapshot is not validated against the server. If it no longer matches the device (the device or a variable was deleted, or the server assigned other NodeIds after a restart), the status of the Read surfaces: - a bad status for `DeviceStatus` (for example `BadNodeIdUnknown`) is thrown as `ServiceResultException` with that status; - a bad status for `LastScanData` is returned in `LastScanStatus` with a null value; - a bad `LastScanTimestamp` or `DeviceLocation` leaves that member at its default. In each case the caller reads the device again with `ReadDeviceAsync`. That also picks up optional variables and methods the device published after the snapshot was taken. - **Arguments.** A null snapshot throws `ArgumentNullException`. A snapshot without a `DeviceStatus` NodeId (not obtained from `ReadDeviceAsync`) throws `ArgumentException`. Neither one makes a service call. - **Docs.** Covered in the XML docs of `ReadDeviceAsync`, `RefreshDeviceAsync`, `AutoIdReadOptions` and `AutoIdDeviceSnapshot`, in `docs/AutoID.md` and in the client `NugetREADME.md`. The wording maintainers gave `AutoIdReadOptions` in 1458af9 stays as it is, with one added sentence that points to `RefreshDeviceAsync`. `docs/AutoID.md` states the cost of each call: | Call | Network cost | | --- | --- | | `ReadDeviceAsync(reader)` | One Browse of the device's children (BrowseNext only if the server pages the result), one Read of every published variable | | `ReadDeviceAsync(reader, AutoIdReadOptions.StatusOnly)` | One Browse, one Read of two variables (`DeviceStatus`, `DeviceName`) | | `RefreshDeviceAsync(snapshot)` | One Read of up to four variables, no Browse | The change is additive. No existing member changes behaviour, and there are no new dependencies. The MCP `autoid_read_device` tool still uses `ReadDeviceAsync`, because a single MCP tool call has no snapshot to refresh. ## Tests `tests/Opc.Ua.AutoID.Tests`: - `AutoIdRefreshDeviceTests` (new, 7 tests) uses a `MockBehavior.Strict` `ISession` with `VerifyNoOtherCalls`, so any Browse, BrowseNext or second Read fails the test: - one Read of exactly the four snapshot NodeIds (Value attribute, `maxAge` 0), with the values mapped and the other members (`Methods`, `DeviceName`, NodeIds) unchanged; - a device without the optional variables is refreshed with a one-variable Read; - a stale `DeviceStatus` NodeId throws with the Read's status (`BadNodeIdUnknown`); - a stale `LastScanData` surfaces `BadNodeIdUnknown` in `LastScanStatus`, and a bad timestamp or location resets those members; - a result-count mismatch throws `BadUnexpectedError`; - null and invalid snapshots are rejected without a service call; - cancellation reaches the Read. - `AutoIdReaderEndToEndTests` (2 new tests against the hosted AutoID server over opc.tcp): - `ARefreshedSnapshotCarriesTheCurrentStatusAsync`: a reader is read once, then faulted on the server. The refreshed snapshot shows `Error` and the methods from the original browse. - `ARefreshOfAStaleSnapshotSurfacesTheStatusOfTheReadAsync`: snapshots whose NodeIds the server does not know (as after a deletion). `LastScanStatus` carries `BadNodeIdUnknown`, and an unknown `DeviceStatus` NodeId throws `BadNodeIdUnknown`. - **Fail-without (mutation checks):** - With a Browse of the device's children added to `RefreshDeviceAsync`, every strict-mock test that reaches the Read fails. - With a bad `LastScanData` status masked to `BadNotFound` (the `ReadDeviceAsync` convention for optional variables), `AStaleOptionalVariableSurfacesItsStatusWithoutThrowingAsync` and the end-to-end stale-snapshot test fail. - Without the method, the tests do not compile. ## Verification (local, macOS arm64, SDK 10.0.402 from `global.json`) Head 2118c24 on OPCFoundation/master ac24123 (#4852), which includes the NUnit 5 migration (#4840). The new tests follow the NUnit 5 conventions in `docs/DeveloperGuide.md`: `Assert.ThrowsAsync` and `Assert.MultipleAsync` are awaited, and the enclosing test returns `Task`. - `Opc.Ua.AutoID.Tests` on net10.0: 315 passed, 0 failed (9 of them new). - `Opc.Ua.AutoID.Tests` builds with `-p:CustomTestTarget=net48` with 0 warnings and 0 errors. Running net48 needs Windows, so the fork CI covers it. - `dotnet format` whitespace, style and analyzers at `--severity info`, verify-no-changes on the changed `.cs` files: no findings in the new code. The branch is based on OPCFoundation/master `ac24123dd` (#4852, the last master commit with a green build). Fork CI was not repeated on this head: earlier fork runs of this branch failed only in test projects outside this PR (the master build was broken by the NUnit 5 migration #4840 and fixed in #4852; master is currently broken again in `Opc.Ua.Core.Tests` by #4849). The upstream checks of this PR test it against the current master. ## Related Issues - Follow-up to #4825 (tracking issue #4824). Resolves the polling-cost point of the Copilot review on `AutoIdReadOptions` in #4825. - #4823 (open) edits prose in other sections of `docs/AutoID.md`. There is no textual overlap with the client section changed here. ## Checklist - [x] 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. - [x] I have added all necessary documentation. - [x] I have verified that my changes do not introduce (new) build or analyzer warnings. (Local build of the changed projects: 0 warnings, 0 errors.) - [ ] I ran **all** tests locally using the **UA.slnx** solution against at least .net **framework** and .net **10**, and all passed. (Locally the AutoID test project on net10.0; net48 is built but runs only on Windows CI.) - [ ] I fixed **all** failing and flaky tests in the CI pipelines and **all** CodeQL warnings. (Pending the upstream checks; see the CI note above.) - [x] I have addressed **all** PR feedback received. --------- Co-authored-by: Marc Schier <marcschier@users.noreply.github.com>
marcschier
added a commit
that referenced
this pull request
Oct 21, 2026
…be a component of a machine (#4853) # Description Follow-up to the AutoID companion (#4825). Two changes to where the AutoID server places its readers: 1. **`IAutoIdReaderBuilder.WithParent` is made conformant with OPC 10000-100 4.9.** Until now it placed a reader below another node *instead of* `DeviceSet`, and the docs suggested "a component of a machine" as the use case. A machine in the Machinery `Machines` folder is not reachable from `DeviceSet`, so such a reader could not be located from `DeviceSet`, which DI 4.9 requires for every `ComponentType` instance (every AutoID device type derives from DI `DeviceType`). Now the reader is still placed below the parent (`HasComponent`, unchanged), and: - when `DeviceSet` already reaches the parent through hierarchical references (for example another reader, or any device it organizes), nothing else is added: the reader is a component of a composed device and DI 4.9 wants "only the root instance" referenced from `DeviceSet`; - otherwise `DeviceSet` also organizes the reader (`Organizes`, both directions), so it stays locatable. 2. **New opt-in `IAutoIdReaderBuilder.AsComponentOf(BaseObjectState machine)`**, available only when AutoID is composed with Machinery (`AddAutoIdToMachinery`, or a DI owner that loads the Machinery model). It makes the reader an identifiable component of the machine per OPC 40001-1 11: - the reader is placed below the machine's `Components` add-in (`HasComponent`, as `MachineComponentsType` declares for `<Component>`); - it gets the `2:Identification` add-in (`HasAddIn`) typed `MachineryComponentIdentificationType`, which holds no copies: it references the reader's own DI nameplate properties with `HasProperty` (`Manufacturer`, `SerialNumber`, and those of `Model`, `ManufacturerUri`, `ProductCode`, `HardwareRevision`, `SoftwareRevision`, `DeviceRevision`, `DeviceClass`, `ProductInstanceUri` that are set, plus `AssetId`/`ComponentName` when published; `DeviceManual` and `RevisionCounter` are left out as 40001-1 10.2 recommends); - the reader stays a device: the same `DeviceSet` rule as for `WithParent` applies with `Components` as the parent, so in the usual case (a machine in `Machines` that `DeviceSet` does not reach) `DeviceSet` organizes it directly. It is not added to `Machines`. - Checked before anything is registered, each failing with `Bad_ConfigurationError` and a message naming the way out: the server has no Machinery model (names `AddAutoIdToMachinery`), the machine is not a node of the AutoID owner, the machine has no `Components` add-in (names `WithComponents`), or the reader nameplate lacks `Manufacturer` and/or `SerialNumber` (mandatory in `MachineryItemIdentificationType`). `WithParent` and `AsComponentOf` exclude each other (`InvalidOperationException`). Default behaviour is unchanged: a reader built without `WithParent`/`AsComponentOf` is organized by `DeviceSet` and not added to `Machines`. Rollback on failure covers the new references: a failed build removes the `DeviceSet` reference, the component and its add-in, so the name can be used again. ## Specification basis | Statement | Source | | --- | --- | | "The DeviceSet Object is the starting point to locate Devices. It shall either directly or indirectly reference all instances of a subtype of ComponentType with a Hierarchical Reference. For complex Devices that are composed of various components that are also Devices, only the root instance shall be referenced from the DeviceSet Object. The components of such complex Devices shall be locatable by following Hierarchical References from the root instance." | OPC 10000-100 (DI) 1.05.0, 4.9 | | AutoID device types are "Subtype of DeviceType defined in OPC 10000-100". OPC 30010 does not mention `DeviceSet`, Machinery or `Machines`. | OPC 30010 (AutoID) 1.01, 6.1 Table 7 | | "Each Machine providing this building block provides the Components Object, which directly references all identifiable components of a Machine." / "Note: That does not preclude that a Machine is organizing its components in various other hierarchies as well." | OPC 40001-1 (Machinery) 1.04.2, 11.1 | | "The MachineComponentsType provides HasComponent References to all identifiable components of a Machine"; Table 27: `0:HasComponent Object <Component> 0:BaseObjectType OP`; Table 28: `<Component> 0:HasAddIn Object 2:Identification MachineryItemIdentificationType M`; "As all identifiable components shall contain the Identification Object". | OPC 40001-1 1.04.2, 11.2 | | `MachineryItemIdentificationType`: `2:Manufacturer` M, `2:SerialNumber` M, all other members O. | OPC 40001-1 1.04.2, 8.3 Table 16 | | `MachineryComponentIdentificationType` is the component subtype of `MachineryItemIdentificationType` (adds `2:DeviceRevision`); "It is not recommended to use the optional Properties 2:RevisionCounter and 2:DeviceManual"; a missing component `2:ProductInstanceUri` "shall be omitted". | OPC 40001-1 1.04.2, 10.2 | | "it is recommended to keep this approach and let several References lead to the same Node, rather than duplicating the Node" / Robotics example: identification Properties "are only referenced from the Identification functional group". | OPC 40001-1 1.04.2, 7.3 and Annex B.2 (informative) | | "It is expected that domain-specific companion specifications using this specification will define what assets of the domain in what usage are considered to be Machines or components of Machines." | OPC 40001-1 1.04.2, 11.1 (Note) | | Organizes "can be used to span multiple hierarchies"; more than one hierarchical path to a Node is allowed. | OPC 10000-3 1.05, 7.11, 7.5 | **SDK decisions** (not specified by OPC 30010, which predates Machinery): - A reader is never added to `Machines`: no specification classifies an AutoID device as a machine (40001-1 11.1 leaves that to the domain specifications, AutoID is silent). - A reader becomes a component of a machine only when the application asks for it (`AsComponentOf`). - `WithParent` keeps its parent and adds the `DeviceSet` reference rather than rejecting parents outside `DeviceSet` (see below). - The component `Identification` references the reader's nameplate instead of copying it. - AutoID does not add Machinery conformance units; the Machinery owner advertises them for what its builders created. ### Why `WithParent` adds a reference instead of rejecting DI 4.9 asks for reachability, not for a particular parent, and OPC 10000-3 allows several hierarchical paths to one node. Adding `Organizes` from `DeviceSet` satisfies the "shall" while keeping the parent the application asked for, and it is the same reference type `DeviceSet` already uses for every reader (and the DI node manager for every device). Rejecting such parents with `Bad_ConfigurationError` would break existing callers that hang a reader below a machine or folder. When `DeviceSet` already reaches the parent, no reference is added, so the "only the root instance" rule of 4.9 holds for composed devices. Reachability is decided once when the reader is built, by following the forward hierarchical references of the owner's nodes. ### Why `AsComponentOf` keeps the reader referenced from `DeviceSet` Machinery does not require machines to be in `DeviceSet` (the stock builders put them in `Machines` only), so a reader that is only below `Components` would again be unreachable from `DeviceSet`. The same reachability rule as for `WithParent` applies: if the machine is itself reachable from `DeviceSet` (for example a machine that is also a DI device organized by `DeviceSet`), the reader is reached through it and gets no direct reference, otherwise `DeviceSet` organizes it. ### Shape of `AsComponentOf` It takes the machine's `BaseObjectState`, like `WithParent(NodeState)` and `IMachineryBuildContext.BindMachine(TState, ...)`; with the stock builders that is `IMachineHandle<TState>.State`. It requires the machine's `Components` add-in to exist (`IMachineBuilder.WithComponents`, or a companion-declared one bound with `WithComponents(components, ...)`) instead of creating one, so the Machinery builders stay the only place that creates Machinery building blocks (`MachineryBuildingBlocks` organization, facets). The reader's NodeState parent is the `Components` object, so the DI node manager attaches it with `HasComponent` and the existing registration and rollback code applies unchanged. ## Behaviour change for existing callers - `WithParent(parent)` with a parent that `DeviceSet` does not reach (for example a machine in `Machines`, or an application folder): the reader is now *also* browsable from `DeviceSet` (one extra `Organizes` reference, both directions), and an `AutoIdClient.EnumerateReadersAsync()` (which browses `DeviceSet`) now finds it. Its parent, NodeId and `HasComponent` reference are unchanged. - `WithParent(parent)` with a parent `DeviceSet` reaches (for example another reader): unchanged. - Default placement: unchanged. - `IAutoIdReaderBuilder` gains a member. The interface is implemented only inside the package (instances come from `AutoIdRuntime.Reader`), and the package is new in 2.0. ## Changes - `src/Opc.Ua.AutoID.Server/AutoIdReaderPlacement.cs` (new, internal): `DeviceSet` lookup, the reachability check, the `Organizes` reference and its removal, `Components` resolution and validation, the nameplate check, and the `Identification` add-in. - `src/Opc.Ua.AutoID.Server/AutoIdRuntime.cs`: the builder's nameplate delegate runs once (validated before anything is registered, then copied into the DI builder); `AsComponentOf` resolves `Components` as the parent before the device is created; after registration the add-in is added and the `DeviceSet` reference kept; rollback removes the reference. - `src/Opc.Ua.AutoID.Server/Builders/IAutoIdReaderBuilder.cs`, `AutoIdReaderBuilder.cs`: `AsComponentOf`, mutual exclusion with `WithParent`, XML docs stating the exact behaviour. - `docs/AutoID.md`: new "Placement" subsection under "Hosting readers" (what DI 4.9 and Machinery 11 require, what is an SDK decision, a table per builder call, an example), the composition table rows for readers and `Machines`, the test fixture table. `src/Opc.Ua.AutoID.Server/NugetREADME.md`: a short paragraph. - Tests (below). ## Tests - `AutoIdReaderLifecycleTests` (stand-alone owner): `ReadersCanHangBelowAnExplicitParentAsync` now also asserts that `DeviceSet` does not organize a reader below another reader; `AReaderBelowAParentOutsideTheDeviceSetIsStillOrganizedByItAsync`; `AFailedCreationBelowAnOutsideParentLeavesNoDeviceSetReferenceAsync` (rollback); `AStandaloneReaderCannotBeAComponentOfAMachineAsync` (`Bad_ConfigurationError` naming `AddAutoIdToMachinery`); argument checks for `AsComponentOf(null)` and both call orders of `WithParent`/`AsComponentOf`. - `AutoIdCompositionTests` (Machinery owner, in process): `AReaderBecomesAComponentOfAMachineAndStaysADeviceAsync` (parent is `Components`, `HasComponent`, `DeviceSet` organizes it, `Machines` does not, `Identification` with `HasAddIn` and the component type, `HasProperty` to the reader's own `Manufacturer`/`SerialNumber`/`Model` nodes, no `DeviceManual`, owned subtree); `AComponentNeedsAMachineWithComponentsAndRegistersNothingOtherwiseAsync`; `AComponentNeedsTheMandatoryIdentificationAsync`; `AComponentNeedsAMachineOfTheOwnerAsync`; `AFailedComponentCreationIsRolledBackAsync`. - `AutoIdPlacementEndToEndTests` (new, hosted Machinery + AutoID over a real session): a default reader, a reader below that reader, a reader `AsComponentOf` a machine and a reader `WithParent` the machine. Browsing `DeviceSet` finds the three roots and not the nested reader, the outer reader reaches the nested one; `MachineryClient.DiscoverMachinesAsync` returns only the machine and `Machines` contains no reader; `MachineryClient.EnumerateComponentsAsync` lists only the component reader, `ReadIdentificationAsync` reads `Manufacturer`, `SerialNumber`, `ProductCode` through the add-in, which is `HasAddIn`-referenced and typed `MachineryComponentIdentificationType` and whose `HasProperty` targets are the reader's own nameplate nodes; `AutoIdClient.EnumerateReadersAsync` finds the three roots. - The existing default assertions (`TheReadersShareTheDeviceSetWithThePumpAndStayOutOfTheMachinesFolderAsync`, `TheMachineryAndPumpsClientsStillFindTheirInstancesAsync`, `ComposedReadersLiveBelowTheSharedDeviceSetAsync`) are unchanged. - Fail-without: with the runtime wiring reverted to master (builder surface kept so the tests compile), 10 of the new tests fail: all `AsComponentOf` cases, both `WithParent` cases outside `DeviceSet` and the three session tests that look for the component or the extra `DeviceSet` reference. Removing only the rollback of the `DeviceSet` reference makes both rollback tests fail. `NoReaderBecomesAMachineAsync` and the existing default tests pass with and without the change, as intended. Local results (macOS arm64, SDK 10.0.402, head `238ed9b69` on master `9bfc780e1`; the same three commits are now based on master `ac24123dd` as `c6d70909b`, no AutoID file changed in between): `Opc.Ua.AutoID.Tests` net10.0 318/318 passed; `Opc.Ua.AutoID.Server` all TFMs and the test project with `CustomTestTarget=net48` build with 0 warnings, 0 errors (net48 tests run on Windows CI; there is no mono host here). `dotnet format whitespace/style/analyzers --verify-no-changes` on the changed files: no new findings beyond the conventions of the surrounding test files. ## Commits 1. `fix(autoid): keep every reader reachable from DeviceSet` 2. `feat(autoid): make a reader a component of a machine` 3. `docs(autoid): document where readers are placed` The branch is based on OPCFoundation/master `ac24123dd` (#4852, the last master commit with a green build). Fork CI was not repeated on this head: earlier fork runs of this branch failed only in test projects outside this PR (the master build was broken by the NUnit 5 migration #4840 and fixed in #4852; master is currently broken again in `Opc.Ua.Core.Tests` by #4849). The upstream checks of this PR test it against the current master. ## Related Issues - Follow-up to #4825 (tracking issue #4824). - #4823 (open) edits prose in other paragraphs of `docs/AutoID.md` (table of contents, the DI-owner paragraph, providers). This PR adds a subsection and changes two rows of the composition table and one row of the test table; no hunk overlaps. The table of contents is deliberately not touched here because #4823 adds the subsection entries for "Hosting readers"; the "Placement" entry can be added there or after both are merged. ## Checklist - [x] 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. - [x] I have added all necessary documentation. - [x] I have verified that my changes do not introduce (new) build or analyzer warnings. (Local build of the changed projects: 0 warnings, 0 errors.) - [ ] I ran **all** tests locally using the **UA.slnx** solution against at least .net **framework** and .net **10**, and all passed. (Locally the AutoID test project on net10.0; net48 is built but runs only on Windows CI.) - [ ] I fixed **all** failing and flaky tests in the CI pipelines and **all** CodeQL warnings. (Pending the upstream checks; see the CI note above.) - [x] I have addressed **all** PR feedback received. --------- Co-authored-by: Marc Schier <marcschier@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
This completes the AutoID contribution proposed in #4824: the model package for OPC 30010 OPC UA for AutoID Devices (1.01) plus the server, the client, an MCP profile and a sample pair, in one PR. It follows the newest companion pattern (GMS #4765, MachineTool, CranesHoists, MachineVision).
Commits
fix(sourcegen): a structure property whose DataType a subtype refines is redeclared with its own field (the NodeSet needs it; unchanged from the first slice).feat(autoid)model packageOpc.Ua.AutoID(unchanged from the first slice). Adds onlyAutoIdReaderKind.feat(autoid)server packageOpc.Ua.AutoID.Server.feat(autoid)client packageOpc.Ua.AutoID.Client.feat(autoid)MCP profileOpc.Ua.Mcp.AutoID.feat(autoid)samplessamples/AutoID.build(autoid)solution, package list and package validation tests.fix(autoid)x3,docs(autoid)andtest(autoid): review fixes, net48 compatibility, documentation, the native AOT test.fix(autoid)x3 andfeat(autoid-client):GetLocationlocation types, theClientof access events, the default scan cycle of the simulated readers, and NodeIds and methods in the device snapshot (details below).feat(autoid),test(autoid),docs(autoid)(afdd7858b,22bc3b26e,ed25fe4ae, on top of the master merge1c7948f65): AutoID composes into an existing Device Integration owner like Pumps and Scales (review feedback; see "Composition with other DI-based companions").1458af9e9(marcschier): theAutoIdReadOptionsremarks state thatStatusOnlylimits the values read and that each call still browses (Copilot review).fix(autoid)3ef2f1507:GetDeviceLocationanswers with the same status codes asGetLocation;feat(autoid-mcp)f6405152f:autoid_read_deviceshows the new snapshot NodeIds and methods (details below).Server:
Opc.Ua.AutoID.ServerAutoIdRuntime.Reader(name, provider)) and hosted withAddAutoId/ConfigureAutoIdonIServiceCollection.IAutoIdReaderProvider,IAutoIdScanProvider(Scan),IAutoIdAsyncScanProvider(ScanStart/ScanStop),IAutoIdRfidProvider(ReadTag, WriteTag, WriteTagID, KillTag, LockTag, SetTagPassword, each opt-in by flag),IAutoIdRtlsProvider. Providers push scans, presence, log entries and access events throughIAutoIdReaderSink. In-memory providers (an EPC Gen2 tag model with banks, passwords, locks and kill) are included for tests and samples.LastScanData,DeviceLocation,AntennaNames, location methods) exist only when the provider supports them. Facet profiles and conformance units are advertised only for what is implemented (IConformanceContributor); the Full facet is withheld.GetLocation(OPC 30010 6.6.3.2) returns the location in the requestedLocationType. An unsupported type isBad_InvalidArgument, an unknown objectBad_NotFound, and a supported type the object's location is not available inBad_InvalidState(6.6.3.2: "not available or not allowed e.g. due to special configuration"); a provider result of another type never reaches the client.InMemoryRtlsProvidertakes an optional location converter, for example from the configured local coordinate system (9.3.4) into WGS84.GetDeviceLocation(6.1.3.7) uses the same mapping: an undefined location type isBad_InvalidArgument, a device location that is not available in the requested typeBad_InvalidState(it answeredBad_NotSupportedbefore). 6.1.3.7 lists only "Standard OPC UA status codes defined for the Call Service in OPC 10000-4"; thereBad_NotSupportedmeans "The Method is not supported for the Object instance", which is wrong for a published method, and OPC 10000-4 5.12.2.4 allows reusing an existing status code with the same canonical meaning, so the method follows 6.6.3.2.Clientis "the name of the client application which was the originator of the command", so it is the application name of the session's client description (else its application URI), not the user identity. The results of aScanStartscan name the client that started it; scans the device reports on its own name the device.CycleInterval, configurable per provider; the length of a cycle is device specific in OPC 30010), so an unboundedScanStartraises at most one scan event per second.AutoIdServerOptions; device status changes and events are raised outside locks; registration is rolled back on failure; readers, providers and the runtime are disposed in order and in-flight operations are drained.Composition with other DI-based companions
A server has one Device Integration owner, and AutoID now uses the existing harmonized composition instead of requiring its own node manager:
AutoIdMachineryModelProvideradds the AutoID model to the Machinery owner's model-provider pipeline (dependency-ordered,Order200) and keeps the DI nodes the owner loaded, so DI andDeviceSetexist once.AddAutoIdToMachinery(afterAddMachinery) registers it;ConfigureAutoIdFor<TNodeManager>creates readers on anyDiNodeManagerowner, successive delegates share oneAutoIdRuntime;owner.CreateAutoIdRuntime()is the path without DI hosting. The owner disposes the runtime on shutdown.DeviceSet, NodeIds in the owner's instance namespace (AutoIdRuntime.InstanceNamespaceIndex), not in theMachinesfolder; the AutoID conformance units and facets are published by the owner next to the DI and Machinery ones.AddAutoIdremains for the "AutoID is the only DI-based companion" case and is built from the same provider. Next to another DI owner it is still rejected; the message names the composition API. (Bypassing that check gives twoDeviceSetcopies; the server routesDeviceSetto the first owner and readers in the second are not browsable, checked locally.)Opc.Ua.AutoID.Servernow referencesOpc.Ua.Machinery.Server(a stable package), as Vision does; a stand-alone server still loads only DI and AutoID.Client:
Opc.Ua.AutoID.ClientReader discovery (a failed browse propagates), typed calls for every published method, a device snapshot with documented
AutoIdReadOptions, and an async event stream (ObserveScan/Access/Presence/LogEntries) onIStreamingSubscription. Cancellation is honoured throughout.AddAutoIdClientregisters it for DI. Because most children of a device are optional (6.1, 6.5.3, 6.6.3), the snapshot also carries the NodeIds ofDeviceStatus,LastScanData,LastScanTimestampandDeviceLocationand the browse names of the published methods (Methods,HasMethod), taken from the same browse whatever the read options, so a client can monitor the device and knows what it may call without browsing again.MCP profile:
Opc.Ua.Mcp.AutoIDMcpToolProfile.AutoIdwith nine tools: list readers, read device, scan, scan start/stop, observe scan events, read tag, get supported location types, get location.autoid_read_devicealso returnsdeviceStatusId,lastScanDataId,lastScanTimestampIdanddeviceLocationId(NodeId strings, null when the device does not publish the variable) andmethods(the browse names of the published methods), built explicitly without reflection. Registered in the host builder, the profile switches of the other profiles,Test-McpGrade.ps1,McpREADME.mdand.mcp/server.json.Samples
samples/AutoID/AutoIdServer(a dock-door reader with a simulated pallet) andAutoIdClientwith a README andTest-AutoIdSamplePair.ps1. The default port is not a common one; tests use port 0.Other changes
Opc.Ua.Di.ServergetsInternalsVisibleToforOpc.Ua.AutoID.Server(RegisterRootNotifierAsync).UA.slnx,.azurepipelines/expected-packages.txt,PackageVersionPolicyTests,NuGetPackageSetValidationTests.docs/AutoID.md,docs/McpServer.md,docs/Profiles.md,docs/Samples.md,docs/DeveloperGuide.md,docs/README.md,docs/WhatsNewIn2.0.md,README.md, NugetREADMEs. The "model package only" statements are removed.Specification notes and questions for the maintainers
AutoIdModelVersionstring"1.00", which is what the NodeSet carries and what the server publishes.Scanmethod returnsWGS84Coordinate, which looks like a model error. It is not published, and providers that implementIAutoIdScanProviderfor a verifier are rejected. Is that the behaviour you want?BadNotImplemented.Design choices reviewers may want changed
Opc.Ua.Di.ServergetsInternalsVisibleToforOpc.Ua.AutoID.Server, so the server can callRegisterRootNotifierAsync.AutoIdReaderKind(andAutoIdReaderKinds.TypeIdOf) lives in the model packageOpc.Ua.AutoID, not in the server package, so the client and the MCP tools share it.Tests
tests/Opc.Ua.AutoID.Testshas 306 tests (116 of the model slice, 190 new): reader lifecycle, scan semantics, tag access handlers, limits, conformance, in-memory providers, hosting, and over-the-wire client/server tests with result codes, events, concurrency and dispose.tests/Opc.Ua.Tools.Testshas 13 AutoID MCP tests plus the updated profile-count tests. New behaviour tests fail without the code (for example a provider's own cancellation, a synchronous scan while a scan stop is in progress; for the last round:GetLocationof a supported type the object is not located in answeredBad_NotFound, access events named the user "Anonymous" and attributedScanStartresults to the device, and an unboundedScanStarton a default simulated reader reported 20 times in 400 ms). Composition:AutoIdCompositionTests(stock Machinery owner, providers out of order, DI loaded once, instance ownership, rollback, cancellation, runtime disposal, an application-owned DI owner, a second DI owner rejected) andAutoIdMachineryCompositionEndToEndTests(Machinery + Pumps + AutoID in one hosted server, read back by the AutoID, Machinery and Pumps clients, including a scan and the published profiles and conformance units). Mutating the change (no lifetime registration, the DI instance namespace for browse names, the old ownership message) fails three of them. The sample pair script passes.tests/Opc.Ua.Aot.Tests.Mcphas an AutoID profile test (AutoIdMcpAotTests); the project was published with Native AOT on osx-arm64 and all 64 tests passed. Publishing it also found twoJsonArray.Add<T>uses in the MCP tools (IL2026/IL3050), now fixed.Verification (local, macOS arm64, SDK pinned in
global.json)The branch contains the master merges
fc556be7e,1c7948f65andaf7feb886; the three composition commits sit between the last two (the latest merge touches no AutoID, DI or Machinery file).1458af9e9(marcschier) and the two commits of the last round followaf7feb886.Last round (
3ef2f1507,f6405152f). Builds with-m:2 -nodeReuse:false -p:UseSharedCompilation=false:Opc.Ua.AutoID.Testson all target frameworks and with-p:CustomTestTarget=net48,Opc.Ua.Mcp.AutoIDon net8.0/net9.0/net10.0,Opc.Ua.Tools.Testson net10.0: 0 warnings, 0 errors.Opc.Ua.AutoID.Tests306/306 on net10.0;Opc.Ua.Tools.TestsAutoID tests 60/60, and the profile, catalogue, composition and package tests that reference AutoID (2241) pass. The changed tests fail without the code:GetDeviceLocationansweredBad_NotSupportedfor both cases, andautoid_read_devicehad nodeviceStatusId.tests/Opc.Ua.Aot.Tests.Mcppublished with Native AOT on osx-arm64 (no IL2026/IL3050 warning): 64/64 passed.dotnet formatwhitespace, style and analyzers--verify-no-changeson the changed files: no finding on a changed line (line endings aside, which the LF checkout on macOS reports for every file).Build (composition round).
Opc.Ua.AutoID.Serveron all target frameworks,Opc.Ua.AutoID.Testson net10.0 and with-p:CustomTestTarget=net48, and the AutoID server sample: 0 warnings, 0 errors. MCP tools and JSON unchanged, so the native AOT test was not republished.Build (earlier rounds). The AutoID packages and
Opc.Ua.AutoID.Testson net10.0 and, with-p:CustomTestTarget=net48, on net48/net8.0/net9.0/net10.0;Opc.Ua.Tools.TestsandOpc.Ua.SourceGeneration.Core.Testson net10.0 (-m:2 -nodeReuse:false -p:UseSharedCompilation=false): 0 warnings, 0 errors.Tests.
Opc.Ua.AutoID.Tests306/306 on net10.0 (composition round; earlier round 288/288);Opc.Ua.Tools.Tests(AutoID, host builder, profile and package tests) 2438/2438 on net10.0;Opc.Ua.SourceGeneration.Core.Tests4358 passed, 8 skipped, after the master merge touchedNodeStateGenerator.cs. net48 was built, not run (no Mono on macOS); the fork CI runs it. The MCP tools and their JSON are unchanged in the last round, so the native AOT test was not republished.Coverage. Composition round: the local coverlet collector recorded zero hits for every module in this environment (also for unchanged code), so no new local number; the new paths are exercised by the 18 composition tests listed above and the fork CI uploads coverage. Earlier round: cobertura from the AutoID tests:
Opc.Ua.AutoID.Server92.0 % lines / 86.8 % branches,Opc.Ua.AutoID.Client89.9 % / 80 %; 110 of the 112 coverable changed lines of the last round are covered (the two missed lines skip a browse result without NodeId or name). The generated code of the model package is excluded as in the other model packages.Format.
dotnet formatwhitespace, style and analyzers (--severity info)--verify-no-changeson the changed files: clean.Fork CI (full matrix including macOS): run 39162077465 on
f6405152f: green. (Previous round: run 39130154771 oned25fe4ae, 90/90 jobs green; the upstream checks on the mergeaf7feb886green, 108 passed, 5 skipped.)CodeQL: run 39162079826 on
f6405152f: green, no alert in a file this PR touches. (Previous round: run 39130156598 oned25fe4ae, green.)Related Issues
Checklist