Exemplo n.º 1
0
            protected override async Task <CollectionRuleActionResult> ExecuteCoreAsync(
                TaskCompletionSource <object> startCompletionSource,
                CancellationToken token)
            {
                try
                {
                    DiagnosticsClient client = new DiagnosticsClient(_endpointInfo.Endpoint);

                    _logger.SettingEnvironmentVariable(_options.Name, _endpointInfo.ProcessId);
                    await client.SetEnvironmentVariableAsync(_options.Name, _options.Value, token);

                    if (!startCompletionSource.TrySetResult(null))
                    {
                        throw new InvalidOperationException();
                    }

                    return(new CollectionRuleActionResult());
                }
                catch (Exception ex)
                {
                    throw new CollectionRuleActionException(ex);
                }
            }