From 3bc49e84830b5f873e1bb29de5e197a5c7c1fc6b Mon Sep 17 00:00:00 2001 From: Roman Ettlinger Date: Mon, 26 Jan 2026 14:24:07 +0100 Subject: [PATCH] Modified error handling to raise publish error events for BadNoSubscription if there are active subscriptions. Fix typo in param name . --- Libraries/Opc.Ua.Client/Session/Session.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Libraries/Opc.Ua.Client/Session/Session.cs b/Libraries/Opc.Ua.Client/Session/Session.cs index 06c3c5ceb..964abe78d 100644 --- a/Libraries/Opc.Ua.Client/Session/Session.cs +++ b/Libraries/Opc.Ua.Client/Session/Session.cs @@ -2510,18 +2510,18 @@ public async Task ReconnectAsync( /// /// Recreate the subscriptions in a recreated session. /// - /// Uses Transfer service + /// Uses Transfer service /// if set to true. /// The template for the subscriptions. /// Cancellation token to cancel operation with private async Task RecreateSubscriptionsAsync( - bool transferSbscriptionTemplates, + bool transferSubscriptionTemplates, IEnumerable subscriptionsTemplate, CancellationToken ct) { using Activity? activity = m_telemetry.StartActivity(); bool transferred = false; - if (transferSbscriptionTemplates) + if (transferSubscriptionTemplates) { try { @@ -3533,7 +3533,8 @@ private void OnPublishComplete( // raise an error event. var error = new ServiceResult(e); - if (error.Code != StatusCodes.BadNoSubscription) + // raise publish error even for BadNoSubscription if there are active subscriptions. + if (error.Code != StatusCodes.BadNoSubscription || m_subscriptions.Any(s => s.Created)) { PublishErrorEventHandler? callback = m_PublishError;