From ae0ab54cb2bf8aeb39a2d7c574dfd2880449e99b Mon Sep 17 00:00:00 2001 From: Vectron Date: Fri, 15 Nov 2024 14:45:53 +0100 Subject: [PATCH] [OPC] Wrap get endpoints in a task --- src/PlcInterface.OpcUa/PlcConnection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PlcInterface.OpcUa/PlcConnection.cs b/src/PlcInterface.OpcUa/PlcConnection.cs index f16a4b3..ee01b7a 100644 --- a/src/PlcInterface.OpcUa/PlcConnection.cs +++ b/src/PlcInterface.OpcUa/PlcConnection.cs @@ -95,7 +95,7 @@ public async Task ConnectAsync() await config.Validate(ApplicationType.Client).ConfigureAwait(false); var usesSecurity = await SetupSecurityAsync(config).ConfigureAwait(false); LogFindingEndpoint(settings.DiscoveryAddress); - var selectedEndpoint = CoreClientUtils.SelectEndpoint(settings.DiscoveryAddress.ToString(), usesSecurity, 15000); + var selectedEndpoint = await Task.Run(() => CoreClientUtils.SelectEndpoint(settings.DiscoveryAddress.ToString(), usesSecurity, 15000)).ConfigureAwait(false); LogSelectedSecurity(selectedEndpoint.SecurityPolicyUri[(selectedEndpoint.SecurityPolicyUri.LastIndexOf('#') + 1)..]); LogCreateSession(); var endpointConfiguration = EndpointConfiguration.Create(config);