Files
Marc Schier 20d9d65a64 Fix generated configuration namespace resolution (#4019)
# Description

Fix source-generated configuration types whose explicit namespace
references constants emitted by the same generator pass. Roslyn cannot
resolve those constants while `[DataType]` attributes are analyzed, so
the generated XML codec silently fell back to `urn:memorybuffer` /
`urn:testdata` while the shipped configuration uses the model namespace
URIs.

This change:

- adds `MODELGEN021` to fail when an explicitly supplied
`[DataType.Namespace]` expression cannot be resolved;
- uses compile-time-available model namespace URIs for the MemoryBuffer
and TestData configuration types;
- restores production-shaped XML fixtures and exercises the
`UpdateExtension<T>()` / `ParseExtension<T>()` path;
- documents the source-generator namespace requirement and migration
guidance.

Targeted validation passed:

- `TypeGeneratorTests`: 17 tests on `net10.0` and `net48`;
- `ConfigurationRoundTripTests`: 4 tests on `net10.0` and `net48`.

## Related Issues

- Fixes #4014

## 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.
- [x] I have added all necessary documentation.
- [x] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] 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.
- [x] I have addressed **all** PR feedback received.
2026-07-18 20:15:49 +02:00
..

Migrating from 1.5.378 to 2.0.x

Version 2.0 introduces a major architectural change from pre-generated code files to runtime source generation and more efficient memory use, with several major breaking changes requiring changes to your applications.

This folder includes all of the 1.5.378 → 2.0 migration content as a set of focused sub-documents so you can read only the parts that affect your application. Start with the Migration sub-doc index below to find the sub-doc that matches the symptom you are seeing.

Automate the migration. Add the OPCFoundation.NetStandard.Opc.Ua.MigrationAnalyzer analyzer package to your projects to receive analyzer warnings and one-click fixes for many of the patterns in these sub-docs. Rule IDs UA0001 – UA0020 map directly to the type-safety patterns described in types.md.

Pro TIP. Point your favorite coding agent at the opcua-v20-migration skill, which knows when to load each sub-doc and runs the codefixer for you.

Migration sub-doc index

Find the row that matches the error / API surface you are dealing with and read only the listed sub-doc. The agent skill uses the same table; loading a single sub-doc keeps the context window small.

When you hit… Read
CS0029 / CS1503 / CS0266 on NodeId, Variant, DataValue, ExtensionObject, QualifiedName, LocalizedText, ArrayOf<T> / MatrixOf<T>, ByteString, StatusCode, XmlElement, EnumValue; [Obsolete] warnings on built-in type APIs (analyzer UA0001–UA0020) types.md
Loggers (Utils.LogX, Utils.Trace), removed static logger helpers (Utils.SetLogger / Utils.SetLogLevel), telemetry context, constructor ITelemetryContext parameter changes, OLD-vs-NEW snippets, fluent DI registration (AddOpcUa().AddLogging().AddMetrics()), breaking-changes inventory, migration utilities telemetry.md
OPCFoundation.NetStandard.Opc.Ua.* package upgrade, TFM changes, Newtonsoft removal packages.md
Source-generated *Collection shims, NodeManager generator, default of boolean properties, project structure source-generation.md
IEncodeableFactoryBuilder, IType, JSON / XML / binary encoders, EncodeableFactory.GlobalFactory, IJsonEncodeable, ComplexTypes namespace move encoders.md
CustomNodeManager, NodeState clone / read / write helpers, OnAfterCreate(CancellationToken), INodeManager3, INodeCache.InvalidateNode, generics on BaseVariableState / BaseVariableTypeState, predefined-node processing node-states.md
IUserIdentityTokenHandler, IClientIdentityProvider, IUserTokenAuthenticator, IAccessTokenProvider, ITokenIssuer, IIdentityClaims, caller-supplied secrets, secret store identity.md
CertificateValidator, ref-counted Certificate wrapper, CertificateManager, ICertificateProvider, obsoleted X509Certificate2 direct-exposure APIs, PushManagement transactions (ApplyChanges-gated TrustList updates) certificates.md
ApplicationConfiguration changes, Data-Contract serializer removal, ParseExtension / UpdateExtension signature, session / browser state persistence configuration.md
Session → ManagedSession, V2 subscription engine, GDS-client Task → ValueTask modernisation, removed obsolete GDS APIs, durable subscriptions, PubSub, reverse-connect sessions-subscriptions.md
UaPubSubApplication.Create*, IUaPubSubConnection, UaPubSubConfigurator, IUaPublisher, AMQP transport, JsonEncodingMode.Reversible/NonReversible, PubSub JSON encoder changes, DataSetFieldContentMask RawData / timestamp behaviour pubsub.md
AlarmConditionState state-transition behaviour, auto-emitted GeneralModelChangeEvent, ModelChangeAggregator, INodeCache.InvalidateNode triggered by model change alarms-model-change.md
DateTime.UtcNow, Timer, deterministic time in tests; System.TimeProvider adoption timeprovider.md
ITransportListener.Open / Close removed, using var listener = … no longer compiles, custom ITransportListenerFactory / ITransportListenerCertificateRotation implementers need the new async method names transport-listener-async.md

All sub-documents

See also

  • Migration Guide landing page — index across all versions, including the small 1.05.377 → 1.05.378 and 1.04 → 1.05 legacy notes.
  • What's New in 2.0 — narrative tour of the 2.0 changes, grouped by theme and layer.
  • Profiles — facet / profile coverage of the 2.0 release.