/// <summary> /// Constructs a new <see cref="ServiceInvocationContext"/> using the specified <see cref="HttpClient"/>, <see cref="ITraceSink"/>, base URL and <see cref="CancellationToken"/>. /// </summary> /// <param name="httpClient">The <see cref="HttpClient"/> object to use to make Http Requests.</param> /// <param name="trace">The <see cref="ITraceSink"/> object to write trace events to.</param> /// <param name="baseUrl">The base URL of the <see cref="NuGetRepository"/> associated with this invocation.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to check for cancellation.</param> public ServiceInvocationContext(HttpClient httpClient, ITraceSink trace, Uri baseUrl, CancellationToken cancellationToken) { Guard.NotNull(httpClient, "httpClient"); Guard.NotNull(trace, "trace"); Guard.NotNull(baseUrl, "baseUrl"); InvocationId = Tracing.GetNextInvocationId().ToString(CultureInfo.InvariantCulture); _client = httpClient; Trace = new TraceContext(InvocationId, trace); BaseUrl = baseUrl; CancellationToken = cancellationToken; Trace.Start(); }