Marc Schier
eb40a59566
More format and diagnostic fixes ( #3780 )
...
Drive the solution to zero warnings / zero errors with analyzers on,
promote the consistently-fixed rules to error, and lock in coverage
on the only line of new logic.
2026-05-26 06:06:09 +02:00
Marc Schier
889572472f
Convert DataValue from class to readonly struct for further GC relief ( #3796 )
...
Convert `DataValue` from a mutable reference type (`class`) to a `readonly struct` to eliminate per-allocation GC pressure on every attribute read, subscription publish, and history sample.
### Key API changes (user-visible)
| Before | After | Pattern |
|---|---|---|
| `class DataValue` | `readonly struct DataValue : INullable` | Foundation |
| `Equals(DataValue?)` / `operator ==(DataValue?, DataValue?)` | `Equals(DataValue)` / `operator ==(DataValue, DataValue)` | Value semantics |
| `IEncoder.WriteDataValue(string?, DataValue?)` | `IEncoder.WriteDataValue(string?, DataValue)` | Non-nullable wire API |
| `IDecoder.ReadDataValue(...) -> DataValue?` | `IDecoder.ReadDataValue(...) -> DataValue` | Same |
| `IDataChangeMonitoredItemQueue.PeekLast/Oldest()` | `TryPeekLastValue/Oldest(out DataValue)` | TryGet pattern |
| `IAggregateCalculator.GetProcessedValue(bool)` | `TryGetProcessedValue(bool, out DataValue)` | Same |
| `IUaPubSubDataStore.ReadPublishedDataItem(...)` | `TryReadPublishedDataItem(NodeId, uint, out DataValue)` | Same |
| `Dictionary<uint, DataValue?>` (NodeCacheContext) | `Dictionary<uint, DataValue>` | Default + IsNull |
| `IHistoryDataSource.FirstRaw/NextRaw` | `TryFirstRaw/TryNextRaw(out DataValue)` | TryGet pattern |
| `NodeState.ReadAttribute(... DataValue)` | `NodeState.ReadAttribute(... ref DataValue)` | Sync mutation via ref |
| `NodeState.ReadAttributeAsync(... DataValue)` | `NodeState.ReadAttributeAsync(...) -> ValueTask<(ServiceResult, DataValue)>` | Async return tuple |
| `obj as DataValue` (heterogeneous Dictionary<string, object>) | `obj is DataValue dv ? dv : default(DataValue)` | Safe struct cast |
| `Assert.That(dv, Is.Not.Null)` (tests) | `Assert.That(dv.IsNull, Is.False)` | Struct test pattern |
| `[Obsolete] Value` setter, all property setters | Removed; use ctor or `With*()` | Immutability |
| `[DataContract]` + `[DataMember]` | Removed; surrogate via `SerializableDataValue` + `DataValueSurrogateProvider` | Serialization |
### Wire format
Wire format is **byte-identical** to the previous class-based implementation across binary / JSON / XML encoders. Default DataValue (`.IsNull == true`) is treated as the equivalent of the old null reference (writes JSON `null`, binary `byte 0`, XML omitted element).
### Why TryGet pattern (instead of leaving `DataValue?`)
For methods that previously returned `DataValue?` to signal "no value available" (queue peek, aggregate result, data store lookup, history navigation), the conversion to `bool TryGet(out DataValue)` matches BCL conventions (`Dictionary.TryGetValue`, `Queue.TryPeek`, `Int32.TryParse`) and gives the caller an explicit "may be absent" affordance without `Nullable<DataValue>` overhead.
### Breaking changes summary
- `DataValue` is now a `readonly struct` - boxing/unboxing semantics change for callers using `object`-typed APIs.
- `IEncoder.WriteDataValue` / `IDecoder.ReadDataValue` / `ReadDataValueArray` interface signatures lose the `Nullable` wrapper.
- `IDataChangeMonitoredItemQueue.PeekLastValue` / `PeekOldestValue` -> `TryPeekLastValue` / `TryPeekOldestValue` (out parameter).
- `IAggregateCalculator.GetProcessedValue` -> `TryGetProcessedValue` (out parameter).
- `IUaPubSubDataStore.ReadPublishedDataItem` -> `TryReadPublishedDataItem` (out parameter).
- `NodeState.ReadAttribute` takes `ref DataValue`; `ReadAttributeAsync` returns `ValueTask<(ServiceResult, DataValue)>`.
- `DataValue` property setters removed (use constructor + `With*` mutators).
2026-05-23 11:38:49 +02:00
Marc Schier
3e5f129c6f
Enable nullable in Stack, Libraries (9), and Applications projects ( #3732 )
2026-05-17 12:55:24 +02:00
Copilot
54cc3d88b1
Prepare for C# 15 union types: UnionAttribute polyfill, TryGetValue rename, HasValue ( #3727 )
2026-05-02 18:33:46 +02:00
Marc Schier and Copilot
b2cbf6b03b
Fix DataValue(int) overload resolution bug ( #3721 )
...
new DataValue(42) silently resolved to DataValue(StatusCode) instead of
DataValue(Variant) due to C# 'better conversion target' rule — StatusCode
wins because it implicitly converts to Variant, making it 'more specific'.
This caused m_value = Variant.Null and downstream BadTypeMismatch failures.
Changes:
- Add [OverloadResolutionPriority(1)] on DataValue(Variant) constructor
- Obsolete DataValue(StatusCode) and DataValue(StatusCode, DateTimeUtc)
- Add DataValue.FromStatusCode() static factory methods (2 overloads)
- Delete DataValue(DataValue) copy constructor
- Add DataValue.Copy() instance method using base.MemberwiseClone()
- Rewrite Clone()/MemberwiseClone() to delegate to Copy()
- Migrate all call sites across 14 files
- Add tests verifying new DataValue(42) wraps value correctly
- Update MigrationGuide.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com >
2026-04-30 14:24:45 +02:00
Marc Schier
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
2026-03-18 12:23:30 +01:00
Marc Schier
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
2026-02-12 16:27:07 +01:00
Marc Schier
2960388560
Update headers and license files ( #3388 )
...
Update license headers to copy right year 2025, replace RCL/GPL headers with MIT, replace the nuget license with MIT (via license expression).
2025-12-04 19:44:40 +01:00
Marc Schier
f8042e445c
Check bounds for switched on values and roslyn cleanup ( #3264 )
2025-10-21 09:28:19 +02:00
Marc Schier
8e7a73c7df
Introduce telemetry context and proper use of ILogger ( #3213 )
2025-09-25 20:25:31 +02:00
Marc Schier
9830e5d53e
Enable roslynizer and fix all analyzer issues ( #3157 )
...
* Fix warnings and suggestions
* Enable roslynator
2025-08-16 04:10:24 -07:00
Martin Regen
4c0880c800
Fix codesmells. No functional changes and bug fixes. ( #2368 )
...
Fix many warnings to improve code quality or simplify the code.
2023-11-07 10:34:42 +01:00
Suciu Mircea Adrian
75744e27dd
Support Metadata frames in PubSub ( #1518 )
...
Refactored WriterGroupPublishState out of IPubSubConnection file
JSON Discovery messages for DataSetMetaData
UADP Discovery messages for DataSetMetaData (Request + response)
Refactored the UaPublisher, extracted IntervalRunner and reused it in UdpDiscoveryPublisher & UdpDiscoverySubscriber
Proposal: automatic setting of ConfigurationVersion based on the rules in 6.2.2.1.5 (part 14)in new class Opc.Ua.PubSub.Configuration.ConfigurationVersionUtils
New events added to UaPubSubApplication
Implemented support for UADP Data Key Frame DataSetMessages
Unit tests were updated to cover the new functionality
2021-09-28 11:54:37 +03:00
Alin Moldovean
08164fe04a
MetaData support for PubSub library ( #1452 )
...
* Metadata support
* Fixes for UaPubSub.
* Add support for delta frames.
2021-07-08 19:29:24 +03:00
Alin Moldovean
a5e1f4c8cd
PubSub fixes ( #1394 )
2021-05-12 13:33:29 +03:00
Alin Moldovean
7a4a22201b
MQTT support in PubSub library ( #1376 )
...
Implementation of MQTT support in PubSub library
2021-04-28 15:31:06 +03:00
Alin Moldovean
16ff6511f2
PubSub Support for UADP ( #1195 )
...
* Add PubSub library and console samples. #1169
2021-01-08 17:48:09 +02:00