## Summary
### Documentation
- Stage the documentation index as a learning path: a first application,
independent client, server, and PubSub paths, then data and services,
companion models, production, advanced integration, and draft or
experimental capabilities.
- Add Getting started (repository samples or NuGet packages), OPC UA
concepts, Your first information model, and a production readiness
checklist.
- Add Native AOT application publishing, a first PubSub publisher and
subscriber exchange, and the UDP transport options.
- Add or expand contents navigation throughout `docs/`, and keep
contributor documentation separate.
- Correct outdated SDK examples and capability guidance, consolidate
repeated explanations into canonical guides, and repair local links and
heading structure.
- Rewrite What's New in 2.0 as a concise feature overview with short
linked details; keep migration instructions in the Migration Guide.
- Expand the feature catalogue with specification IDs, GDS, LDS, the OPC
10000-21 onboarding registrar, ISA-95, xRegistry, OpenUSD, and
sample-local models; distinguish draft status, explain crypto
pluggability, and bring performance guidance forward.
- Address review feedback on wording, active monitored items during
shadow reload, and the `Samples.md` filename and references.
- Regenerate the `opcua-v20-migration` plugin's bundled copy of the
migration guides so it matches the edited `docs/migrate/2.0.x` guides.
- Merge the latest `master`, preserving upstream resource-isolation
guidance within the task-based documentation index.
- Retain deferred Lingity findings where appropriate; this PR does not
claim that every document meets the Lingity score thresholds.
### Fixes found while verifying the guides
Each fix has regression tests that fail without it.
- **Client:** V2 subscriptions compared their lifetime with the
operation timeout instead of the session timeout, and logged a spurious
warning. `ISubscriptionEngineContext`, which is new in 2.0, gains a
`SessionTimeout` property; implementations must add it.
- **PubSub:** a subscriber now registers the `DataSetMetaData`
configured on its readers (OPC 10000-14 6.2.9.4), and the UADP decoder
decodes DataSetMessages that carry no ConfigurationVersion. Before, a
secured subscriber of the reference sample received no DataSets.
- **Source generator:** a ModelDesign method that declares its arguments
inline, without a method type, produced code that did not compile; it
now uses `MethodState`. The generated code of existing models is
unchanged.
- **MinimalClient sample:** waits for its first data-change notification
before it disconnects.
### Known issues, not addressed here
- UDP multicast: the publisher does not send on the interface that the
subscriber joins, and `MulticastLoopback` defaults to false. The PubSub
guide uses unicast for the exchange on one computer.
- The UDP metadata announcement is sent unsecured on secured writer
groups; a secured subscriber drops it with a warning.
- A server does not start in globalization-invariant mode, because
`ResourceManager` creates `CultureInfo("en-US")`. The Native AOT guide
cautions against the mode.
## Validation
- `git diff --check` and
`./.azurepipelines/validate-migration-plugin.ps1` (15 bundled migration
docs validated, plugin manifests synchronized).
- Local Markdown links, anchors, file-link casing, and contents lists
checked across all 87 documents under `docs/`. The index links every
top-level guide and every target of the previous index.
- Both Getting started routes, Your first information model, the PubSub
exchange, and the Native AOT publish of the Getting started client and
server were run as documented. The NuGet route and the tutorial use the
public `2.0.0-preview.5` packages.
- The changed libraries build for all target frameworks in Release
without warnings.
- Tests on .NET 10: Opc.Ua.SourceGeneration.Tests 199 passed;
Opc.Ua.SourceGeneration.Core.Tests 3,977 passed, 8 skipped;
Opc.Ua.Server.Tests `Fluent` category 621 passed; Opc.Ua.Client.Tests
subscription-engine tests 70 passed; Opc.Ua.PubSub.Tests 1,374 passed, 2
skipped; PubSub fuzz replay 145 passed. The new and affected tests also
pass on .NET Framework 4.8.
- Earlier merge validation: 174 resource-isolation tests passed on .NET
10.
- The full solution suite was not run locally.
Review and validation artifacts are maintained outside the repository.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9.3 KiB
Configuration and State Persistence
When to read this: Read this for
ApplicationConfigurationchanges, the removed Data-Contract serializer, Newtonsoft removal fromOpc.Ua.Core, the newParseExtension/UpdateExtensionsignature, and session / browser state persistence.
Contents
- Configuration
- Data Contract Serializer support removed
- TraceConfiguration apply APIs removed
- MinMetadataSamplingInterval removed, MinSupportedSamplingInterval added
- Newtonsoft.Json removed from Opc.Ua.Core
- ParseExtension/UpdateExtension signature changed
- ExtensionObject array helpers changed
- IJsonEncodeable interface removed
- Session and Browser State Persistence
Configuration
Data Contract Serializer support removed
Because Data Contract serialization is not AOT compliant and does not support trimming, all use of DataContract in the configuration has been removed. Instead, the source generator enables generating IEncodeable implementations using the DataType and DataTypeField attributes which are now consequently used for all configuration. Because the configuration is now IEncodeable the existing encoders and decoders (in particular the new XmlParser which parses Xml and allows out of order fields) compliant with Part 6 can be used to serialize and deserialize all configuration and configuration extensions.
Generated Data types still support DataContract based serialization, however, consider this a deprecated feature.
All configuration DTO classes (ApplicationConfiguration, ServerConfiguration, TraceConfiguration, TransportConfiguration, ServerSecurityPolicy, OAuth2ServerSettings, OAuth2Credential, GlobalDiscoveryServerConfiguration, CertificateGroupConfiguration, BrowserOptions, etc.) migrated from [DataContract]/[DataMember] to source-generated [DataType]/[DataTypeField] attributes and are now partial classes.
ApplicationConfiguration.LoadWithNoValidationusesXmlParser/IEncodeable.Decode(). Existing XML config files should remain loadable. Applications moving to the dependency-injection surface can pass such a file directly toservices.AddOpcUa().AddServer("MyServer.Config.xml")or.AddClient("MyClient.Config.xml")and keep every setting from it — see Migrating with an existing configuration XML file and Client: using an existing configuration XML file.- Browser and session state persistence switched from XML to OPC UA Binary encoding. Old persisted files cannot be loaded — delete and re-save.
SecuredApplicationusesSecuredApplicationEncodinghelpers instead ofDataContractSerializer.
Change code as follows:
- Replace
[DataContract(Namespace = ...)]with[DataType(Namespace = ...)]and[DataMember(...)]with[DataTypeField(...)]on custom configuration subtypes. - If the old namespace expression references a
Namespacesconstant generated from a model file in the same project, replace it with the URI literal or aconst stringfrom ordinary source. Same-run generated constants are unavailable while[DataType]attributes are analyzed and now produceMODELGEN021. - Add the
partialkeyword to any subclass of these configuration types. - Custom configuration extension types must implement
IEncodeable(the[DataType]source generator handles this automatically forpartialclasses). - Code using reflection to inspect
[DataContract]/[DataMember]attributes must switch to[DataType]/[DataTypeField].
TraceConfiguration apply APIs removed
The legacy TraceConfiguration application path (TraceConfiguration.ApplySettings() and the fluent builder methods SetOutputFilePath(...), SetDeleteOnLoad(...), SetTraceMasks(...)) has been removed. Logging/tracing setup must now be done via ITelemetryContext and ILoggerFactory.
If your startup code used these APIs, remove those calls and configure logging providers directly on your telemetry context instead.
MinMetadataSamplingInterval removed, MinSupportedSamplingInterval added
ServerConfiguration.MinMetadataSamplingInterval and the fluent
SetMinMetadataSamplingInterval(int) builder method have been removed. In
1.5.378 the setting defaulted to 1000 but was never read by the stack, so
whatever value you configured had no effect on any monitored item.
2.0 adds ServerConfiguration.MinSupportedSamplingInterval (a double, in
milliseconds) in the same position of the XML schema, exposed by the fluent
builder as SetMinSupportedSamplingInterval(double). Unlike its predecessor it
is applied: it is published in Server.ServerCapabilities.MinSupportedSampleRate
and acts as a server-wide lower bound when the sampling interval of a monitored
item is revised.
These are two different settings, not a rename. Do not carry the old value
across — in 1.5.378 it was inert, so reusing it silently introduces a sampling
floor that changes the revisedSamplingInterval your clients receive. Delete
the old element and only add the new one if you actually want that floor:
<!-- before: had no effect in 1.5.378 -->
<MinMetadataSamplingInterval>1000</MinMetadataSamplingInterval>
<!-- after: simply drop it to keep 1.5.378 behaviour -->
<!-- ...or opt in deliberately, knowing clients will now be revised up -->
<MinSupportedSamplingInterval>1000</MinSupportedSamplingInterval>
// before: had no effect in 1.5.378
builder.SetMinMetadataSamplingInterval(1000);
// after: drop the call, or opt in deliberately
builder.SetMinSupportedSamplingInterval(1000);
Doing nothing is safe. MinSupportedSamplingInterval defaults to 0, which
reproduces 1.5.378 exactly: that release hard-coded
Server.ServerCapabilities.MinSupportedSampleRate to 0 and bounded the
revised sampling interval only by the MinimumSamplingInterval declared by the
monitored node. Setting a non-zero value raises the revisedSamplingInterval
for every monitored item except those on nodes declaring
MinimumSamplingIntervals.Continuous (0), which report by exception and are
not bound by a sampling interval. See
NodeManagers.md § Sampling interval revision
for the full rule.
Newtonsoft.Json removed from Opc.Ua.Core
Newtonsoft.Json is no longer a dependency of Opc.Ua.Core. Projects relying on its transitive availability must add an explicit reference:
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
ParseExtension/UpdateExtension signature changed
ParseExtension<T>() and UpdateExtension<T>() now require T to implement IEncodeable. New delegate-based overloads were added for custom decoding:
// Generic overload (T must implement IEncodeable)
var config = configuration.ParseExtension<MyConfig>();
// Delegate overload for custom decoding
var config = configuration.ParseExtension<MyConfig>(
new XmlQualifiedName("MyConfig", myNamespace),
decoder => { var c = new MyConfig(); c.Decode(decoder); return c; });
ExtensionObject array helpers changed
ExtensionObject.ToArray(object, Type) and ToList<T>(object) removed. Use extensionObjects.GetStructuresOf<T>() or ExtensionObject.ToArray<T>(ArrayOf<ExtensionObject>).
IJsonEncodeable interface removed
The IJsonEncodeable interface and the entire "Default JSON Encoding" infrastructure have been removed. OPC UA JSON encoding is handled by the JsonEncoder/JsonDecoder classes which do not require per-type encoding node IDs — those classes are unaffected by this change.
Migration steps:
-
Remove
IJsonEncodeablefrom any custom class that implements it:- public class MyType : IEncodeable, IJsonEncodeable + public class MyType : IEncodeable -
Remove the
JsonEncodingIdproperty from those classes:- public ExpandedNodeId JsonEncodingId => ...;
Session and Browser State Persistence
Breaking Change: Persistence switched from DataContractSerializer XML to IEncoder and IDecoder. BrowserState, SessionState, SessionOptions, SubscriptionState, and MonitoredItemState are annotated with [DataType] and use the standard Encode/Decode methods generated by the source generator.
To register the state types with the encodeable factory:
context.Factory.Builder.AddOpcUaClientDataTypes();
The encoding format for session state has changed. Existing persisted session state files cannot be loaded by the new
SessionConfiguration.Create()method. Handle restore failures and re-persist the new session state.
See also
- Related: packages.md, certificates.md, identity.md.
- 2.0 migration index — analyzer quick-start + symptom → sub-doc table.
- Migration Guide — landing page across versions.