internal ClientOptions(ClientOptions?clientOptions, DiagnosticsOptions?diagnostics) { if (clientOptions != null) { Retry = new RetryOptions(clientOptions.Retry); Diagnostics = diagnostics ?? new DiagnosticsOptions(clientOptions.Diagnostics); _transport = clientOptions.Transport; if (clientOptions.Policies != null) { Policies = new(clientOptions.Policies); } } else { // Implementation Note: this code must use the copy constructors on DiagnosticsOptions and RetryOptions specifying // null as the argument rather than calling their default constructors. Calling their default constructors would result // in a stack overflow as this constructor is called from a static initializer. _transport = GetDefaultTransport(); Diagnostics = new DiagnosticsOptions(null); Retry = new RetryOptions(null); } }
internal ClientOptions(ClientOptions?clientOptions) { if (clientOptions != null) { Retry = new RetryOptions(clientOptions.Retry); Diagnostics = new DiagnosticsOptions(clientOptions.Diagnostics); _transport = clientOptions.Transport; if (clientOptions.Policies != null) { Policies = new(clientOptions.Policies); } } else { // Intentionally leaving this null. The only consumer of this branch is // DefaultAzureCredential that would re-assign the value _transport = null !; Diagnostics = new DiagnosticsOptions(); Retry = new RetryOptions(); } }
/// <summary> /// Creates a new instance of <see cref="ClientOptions"/>. /// </summary> protected ClientOptions() { Retry = new RetryOptions(); Diagnostics = new DiagnosticsOptions(); }