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);