fix: initialize SDK telemetry and preserve ByteString boundaries

This commit is contained in:
Joseph Doherty
2026-11-10 10:11:07 -05:00
parent 52a4476b21
commit f9a006dab4
3 changed files with 7 additions and 4 deletions
@@ -173,6 +173,7 @@ public sealed class OpcUaApplicationHost : IAsyncDisposable
private readonly ILogger<OpcUaApplicationHost> _logger;
private ApplicationInstance? _application;
private StandardServer? _server;
private readonly ITelemetryContext _telemetry = DefaultTelemetry.Create(_ => { });
private readonly List<IUserTokenAuthenticator> _identityAuthenticators = [];
/// <summary>Initializes a new instance of the OPC UA application host.</summary>
@@ -205,7 +206,7 @@ public sealed class OpcUaApplicationHost : IAsyncDisposable
// 1.5.378 requires an ITelemetryContext on the ApplicationInstance ctor (the parameterless ctor
// is obsolete). DefaultTelemetry.Create wires the SDK's internal logging; an empty builder keeps
// the SDK's trace off our ILogger (the host keeps its own _logger) — sufficient for the bootstrap.
_application = new ApplicationInstance(DefaultTelemetry.Create(_ => { }))
_application = new ApplicationInstance(_telemetry)
{
ApplicationName = _options.ApplicationName,
ApplicationType = ApplicationType.Server,
@@ -487,7 +488,7 @@ public sealed class OpcUaApplicationHost : IAsyncDisposable
serverConfig.SecurityPolicies = BuildSecurityPolicies(_options.EnabledSecurityProfiles).ToArray();
serverConfig.UserTokenPolicies = BuildUserTokenPolicies(_options.AllowAnonymous).ToArray();
var config = new ApplicationConfiguration
var config = new ApplicationConfiguration(_telemetry)
{
ApplicationName = _options.ApplicationName,
ApplicationUri = _options.ApplicationUri,