From 3f58d7591610ec8cee9a7aff63a5176e5fba5cf8 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 24 Jul 2020 14:06:04 -0700 Subject: [PATCH 01/17] Add sync HttpClient support --- sdk/core/Azure.Core/src/AccessToken.cs | 2 +- sdk/core/Azure.Core/src/AsyncPageable.cs | 2 +- sdk/core/Azure.Core/src/Azure.Core.csproj | 4 +- sdk/core/Azure.Core/src/ClientOptions.cs | 2 +- sdk/core/Azure.Core/src/DiagnosticsOptions.cs | 2 +- .../Internal/AzureBaseBuffersExtensions.cs | 3 + sdk/core/Azure.Core/src/Operation{T}.cs | 4 +- sdk/core/Azure.Core/src/Page.cs | 2 +- sdk/core/Azure.Core/src/Pageable.cs | 2 +- .../src/Pipeline/HttpClientTransport.cs | 65 ++++++++++++++----- .../src/Pipeline/HttpPipelineBuilder.cs | 8 +-- .../Internal/RequestActivityPolicy.cs | 8 ++- .../Pipeline/Internal/ResponseBodyPolicy.cs | 2 +- .../src/Pipeline/Internal/RetryPolicy.cs | 2 +- .../Azure.Core/src/Shared/DiagnosticScope.cs | 4 +- .../src/Shared/EventSourceEventFormatting.cs | 18 +++-- .../Azure.Core/src/Shared/HashCodeBuilder.cs | 2 +- .../src/Shared/NullableAttributes.cs | 2 + .../Azure.Core/tests/Azure.Core.Tests.csproj | 2 +- 19 files changed, 92 insertions(+), 44 deletions(-) diff --git a/sdk/core/Azure.Core/src/AccessToken.cs b/sdk/core/Azure.Core/src/AccessToken.cs index 0f245a3a4cf0c..c33beee6aba7a 100644 --- a/sdk/core/Azure.Core/src/AccessToken.cs +++ b/sdk/core/Azure.Core/src/AccessToken.cs @@ -45,7 +45,7 @@ public override bool Equals(object? obj) /// public override int GetHashCode() { - return Token.GetHashCode() ^ ExpiresOn.GetHashCode(); + return HashCodeBuilder.Combine(Token, ExpiresOn); } } } diff --git a/sdk/core/Azure.Core/src/AsyncPageable.cs b/sdk/core/Azure.Core/src/AsyncPageable.cs index 9fc03ea084dfd..a4e0da46af4b9 100644 --- a/sdk/core/Azure.Core/src/AsyncPageable.cs +++ b/sdk/core/Azure.Core/src/AsyncPageable.cs @@ -116,7 +116,7 @@ public virtual async IAsyncEnumerator GetAsyncEnumerator(CancellationToken ca /// A string representation of an . /// [EditorBrowsable(EditorBrowsableState.Never)] - public override string ToString() => base.ToString(); + public override string? ToString() => base.ToString(); /// /// Check if two instances are equal. diff --git a/sdk/core/Azure.Core/src/Azure.Core.csproj b/sdk/core/Azure.Core/src/Azure.Core.csproj index ca0b641499d07..7450f47e136d3 100644 --- a/sdk/core/Azure.Core/src/Azure.Core.csproj +++ b/sdk/core/Azure.Core/src/Azure.Core.csproj @@ -7,9 +7,11 @@ Microsoft Azure Client Pipeline enable $(DefineConstants);AZURE_NULLABLE - $(RequiredTargetFrameworks) + $(RequiredTargetFrameworks);netcoreapp5.0 true false + + $(NoWarn);CA1307 diff --git a/sdk/core/Azure.Core/src/ClientOptions.cs b/sdk/core/Azure.Core/src/ClientOptions.cs index f2994fee930c3..fda3e2b18ffbc 100644 --- a/sdk/core/Azure.Core/src/ClientOptions.cs +++ b/sdk/core/Azure.Core/src/ClientOptions.cs @@ -79,6 +79,6 @@ public void AddPolicy(HttpPipelinePolicy policy, HttpPipelinePosition position) /// [EditorBrowsable(EditorBrowsableState.Never)] - public override string ToString() => base.ToString(); + public override string? ToString() => base.ToString(); } } diff --git a/sdk/core/Azure.Core/src/DiagnosticsOptions.cs b/sdk/core/Azure.Core/src/DiagnosticsOptions.cs index 7da5e321f2d8b..72dd193111c9b 100644 --- a/sdk/core/Azure.Core/src/DiagnosticsOptions.cs +++ b/sdk/core/Azure.Core/src/DiagnosticsOptions.cs @@ -108,7 +108,7 @@ public string? ApplicationId /// public static string? DefaultApplicationId { get; set; } - private static bool? EnvironmentVariableToBool(string value) + private static bool? EnvironmentVariableToBool(string? value) { if (string.Equals("true", value, StringComparison.OrdinalIgnoreCase) || string.Equals("1", value, StringComparison.OrdinalIgnoreCase)) diff --git a/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs b/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs index 298dad464d29a..e4bf7643dde5f 100644 --- a/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs +++ b/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs @@ -3,6 +3,7 @@ using System; using System.Buffers; +using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; using System.Threading; @@ -23,6 +24,7 @@ public static async Task WriteAsync(this Stream stream, ReadOnlyMemory buf { if (MemoryMarshal.TryGetArray(buffer, out ArraySegment arraySegment)) { + Debug.Assert(arraySegment.Array != null); await stream.WriteAsync(arraySegment.Array, arraySegment.Offset, arraySegment.Count, cancellation).ConfigureAwait(false); } else @@ -55,6 +57,7 @@ public static async Task WriteAsync(this Stream stream, ReadOnlySequence b { if (MemoryMarshal.TryGetArray(segment, out ArraySegment arraySegment)) { + Debug.Assert(arraySegment.Array != null); await stream.WriteAsync(arraySegment.Array, arraySegment.Offset, arraySegment.Count, cancellation).ConfigureAwait(false); } else diff --git a/sdk/core/Azure.Core/src/Operation{T}.cs b/sdk/core/Azure.Core/src/Operation{T}.cs index a3af9ca68f1b9..ad4827028506c 100644 --- a/sdk/core/Azure.Core/src/Operation{T}.cs +++ b/sdk/core/Azure.Core/src/Operation{T}.cs @@ -97,7 +97,7 @@ public abstract class Operation where T : notnull /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => base.Equals(obj); + public override bool Equals(object? obj) => base.Equals(obj); /// [EditorBrowsable(EditorBrowsableState.Never)] @@ -105,6 +105,6 @@ public abstract class Operation where T : notnull /// [EditorBrowsable(EditorBrowsableState.Never)] - public override string ToString() => base.ToString(); + public override string? ToString() => base.ToString(); } } diff --git a/sdk/core/Azure.Core/src/Page.cs b/sdk/core/Azure.Core/src/Page.cs index b1d54413d9909..41ca557bb28f8 100644 --- a/sdk/core/Azure.Core/src/Page.cs +++ b/sdk/core/Azure.Core/src/Page.cs @@ -57,7 +57,7 @@ public static Page FromValues(IReadOnlyList values, string? continuationTo /// A string representation of an . /// [EditorBrowsable(EditorBrowsableState.Never)] - public override string ToString() => base.ToString(); + public override string? ToString() => base.ToString(); /// /// Check if two instances are equal. diff --git a/sdk/core/Azure.Core/src/Pageable.cs b/sdk/core/Azure.Core/src/Pageable.cs index 5b410de07e3cd..86d7d99048641 100644 --- a/sdk/core/Azure.Core/src/Pageable.cs +++ b/sdk/core/Azure.Core/src/Pageable.cs @@ -65,7 +65,7 @@ public abstract IEnumerable> AsPages( /// A string representation of an . /// [EditorBrowsable(EditorBrowsableState.Never)] - public override string ToString() => base.ToString(); + public override string? ToString() => base.ToString(); IEnumerator IEnumerable.GetEnumerator() { diff --git a/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs b/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs index de841a5fdf9ae..568ba3ebcaf81 100644 --- a/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs +++ b/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs @@ -19,7 +19,7 @@ namespace Azure.Core.Pipeline /// public class HttpClientTransport : HttpPipelineTransport { - private readonly HttpClient _client; + private readonly HttpMessageInvoker _client; /// /// Creates a new instance using default configuration. @@ -49,33 +49,62 @@ public sealed override Request CreateRequest() /// public override void Process(HttpMessage message) { +#if NETCOREAPP + ProcessAsync(message, false).EnsureCompleted(); +#else // Intentionally blocking here - ProcessAsync(message).GetAwaiter().GetResult(); + ProcessAsync(message, true).GetAwaiter().GetResult(); +#endif } /// public sealed override async ValueTask ProcessAsync(HttpMessage message) { - using (HttpRequestMessage httpRequest = BuildRequestMessage(message)) + await ProcessAsync(message, true).ConfigureAwait(false); + } + +#pragma warning disable CA1801 // async parameter unused on netstandard + private async Task ProcessAsync(HttpMessage message, bool async) +#pragma warning restore CA1801 + { + using HttpRequestMessage httpRequest = BuildRequestMessage(message); + HttpResponseMessage responseMessage; + Stream? contentStream = null; + try { - HttpResponseMessage responseMessage; - Stream? contentStream = null; - try +#if NETCOREAPP + if (!async) + { + responseMessage = _client.Send(httpRequest, message.CancellationToken); + } + else +#endif { - responseMessage = await _client.SendAsync(httpRequest, HttpCompletionOption.ResponseHeadersRead, message.CancellationToken) + responseMessage = await _client.SendAsync(httpRequest, message.CancellationToken) .ConfigureAwait(false); - if (responseMessage.Content != null) + } + + if (responseMessage.Content != null) + { +#if NETCOREAPP + if (!async) + { + contentStream = responseMessage.Content.ReadAsStream(); + } + else +#endif { contentStream = await responseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false); } - } - catch (HttpRequestException e) - { - throw new RequestFailedException(e.Message, e); - } - message.Response = new PipelineResponse(message.Request.ClientRequestId, responseMessage, contentStream); + } + } + catch (HttpRequestException e) + { + throw new RequestFailedException(e.Message, e); } + + message.Response = new PipelineResponse(message.Request.ClientRequestId, responseMessage, contentStream); } private static HttpClient CreateDefaultClient() @@ -112,7 +141,9 @@ internal static bool TryGetHeader(HttpHeaders headers, HttpContent? content, str internal static bool TryGetHeader(HttpHeaders headers, HttpContent? content, string name, [NotNullWhen(true)] out IEnumerable? values) { - return headers.TryGetValues(name, out values) || content?.Headers.TryGetValues(name, out values) == true; + return headers.TryGetValues(name, out values) || + content != null && + content.Headers.TryGetValues(name, out values); } internal static IEnumerable GetHeaders(HttpHeaders headers, HttpContent? content) @@ -332,7 +363,7 @@ private sealed class PipelineContentAdapter : HttpContent public CancellationToken CancellationToken { get; set; } - protected override async Task SerializeToStreamAsync(Stream stream, TransportContext context) + protected override async Task SerializeToStreamAsync(Stream stream, TransportContext? context) { Debug.Assert(PipelineContent != null); await PipelineContent!.WriteToAsync(stream, CancellationToken).ConfigureAwait(false); @@ -365,7 +396,7 @@ public PipelineResponse(string requestId, HttpResponseMessage responseMessage, S public override int Status => (int)_responseMessage.StatusCode; - public override string ReasonPhrase => _responseMessage.ReasonPhrase; + public override string ReasonPhrase => _responseMessage.ReasonPhrase ?? string.Empty; public override Stream? ContentStream { diff --git a/sdk/core/Azure.Core/src/Pipeline/HttpPipelineBuilder.cs b/sdk/core/Azure.Core/src/Pipeline/HttpPipelineBuilder.cs index dc9112fdbe9c0..eab957e53d52d 100644 --- a/sdk/core/Azure.Core/src/Pipeline/HttpPipelineBuilder.cs +++ b/sdk/core/Azure.Core/src/Pipeline/HttpPipelineBuilder.cs @@ -71,7 +71,7 @@ public static HttpPipeline Build(ClientOptions options, HttpPipelinePolicy[] per if (diagnostics.IsLoggingEnabled) { - string assemblyName = options.GetType().Assembly.GetName().Name; + string assemblyName = options.GetType().Assembly!.GetName().Name!; policies.Add(new LoggingPolicy(diagnostics.IsLoggingContentEnabled, diagnostics.LoggedContentSizeLimit, diagnostics.LoggedHeaderNames.ToArray(), diagnostics.LoggedQueryParameters.ToArray(), assemblyName)); @@ -93,9 +93,9 @@ internal static TelemetryPolicy CreateTelemetryPolicy(ClientOptions options) { const string PackagePrefix = "Azure."; - Assembly clientAssembly = options.GetType().Assembly; + Assembly clientAssembly = options.GetType().Assembly!; - AssemblyInformationalVersionAttribute versionAttribute = clientAssembly.GetCustomAttribute(); + AssemblyInformationalVersionAttribute? versionAttribute = clientAssembly.GetCustomAttribute(); if (versionAttribute == null) { throw new InvalidOperationException($"{nameof(AssemblyInformationalVersionAttribute)} is required on client SDK assembly '{clientAssembly.FullName}' (inferred from the use of options type '{options.GetType().FullName}')."); @@ -103,7 +103,7 @@ internal static TelemetryPolicy CreateTelemetryPolicy(ClientOptions options) string version = versionAttribute.InformationalVersion; - string assemblyName = clientAssembly.GetName().Name; + string assemblyName = clientAssembly.GetName().Name!; if (assemblyName.StartsWith(PackagePrefix, StringComparison.Ordinal)) { assemblyName = assemblyName.Substring(PackagePrefix.Length); diff --git a/sdk/core/Azure.Core/src/Pipeline/Internal/RequestActivityPolicy.cs b/sdk/core/Azure.Core/src/Pipeline/Internal/RequestActivityPolicy.cs index 309bbd055d1b6..9dcca3c05ad2d 100644 --- a/sdk/core/Azure.Core/src/Pipeline/Internal/RequestActivityPolicy.cs +++ b/sdk/core/Azure.Core/src/Pipeline/Internal/RequestActivityPolicy.cs @@ -114,15 +114,17 @@ private async ValueTask ProcessAsync(HttpMessage message, ReadOnlyMemory pipeline, bool isAsync) { - Activity currentActivity = Activity.Current; + Activity? currentActivity = Activity.Current; if (currentActivity != null) { + var currentActivityId = currentActivity.Id ?? string.Empty; + if (currentActivity.IsW3CFormat()) { if (!message.Request.Headers.Contains(TraceParentHeaderName)) { - message.Request.Headers.Add(TraceParentHeaderName, currentActivity.Id); + message.Request.Headers.Add(TraceParentHeaderName, currentActivityId); if (currentActivity.TryGetTraceState(out string? traceStateString) && traceStateString != null) { message.Request.Headers.Add(TraceStateHeaderName, traceStateString); @@ -133,7 +135,7 @@ private static async ValueTask ProcessNextAsync(HttpMessage message, ReadOnlyMem { if (!message.Request.Headers.Contains(RequestIdHeaderName)) { - message.Request.Headers.Add(RequestIdHeaderName, currentActivity.Id); + message.Request.Headers.Add(RequestIdHeaderName, currentActivityId); } } } diff --git a/sdk/core/Azure.Core/src/Pipeline/Internal/ResponseBodyPolicy.cs b/sdk/core/Azure.Core/src/Pipeline/Internal/ResponseBodyPolicy.cs index 2f493caf8b0b0..6a7fa2a88cc1f 100644 --- a/sdk/core/Azure.Core/src/Pipeline/Internal/ResponseBodyPolicy.cs +++ b/sdk/core/Azure.Core/src/Pipeline/Internal/ResponseBodyPolicy.cs @@ -69,7 +69,7 @@ private async ValueTask ProcessAsync(HttpMessage message, ReadOnlyMemory ((Stream)state)?.Dispose(), responseContentStream); + cts.Token.Register(state => ((Stream?)state)?.Dispose(), responseContentStream); } try diff --git a/sdk/core/Azure.Core/src/Pipeline/Internal/RetryPolicy.cs b/sdk/core/Azure.Core/src/Pipeline/Internal/RetryPolicy.cs index c7f486d597396..cfc58e37837f8 100644 --- a/sdk/core/Azure.Core/src/Pipeline/Internal/RetryPolicy.cs +++ b/sdk/core/Azure.Core/src/Pipeline/Internal/RetryPolicy.cs @@ -91,7 +91,7 @@ private async ValueTask ProcessAsync(HttpMessage message, ReadOnlyMemory? _links; - public IEnumerable Links => (IEnumerable?)_links ?? Array.Empty(); +#pragma warning disable 109 // extra new modifier + public new IEnumerable Links => (IEnumerable?)_links ?? Array.Empty(); +#pragma warning restore 109 public DiagnosticActivity(string operationName) : base(operationName) { diff --git a/sdk/core/Azure.Core/src/Shared/EventSourceEventFormatting.cs b/sdk/core/Azure.Core/src/Shared/EventSourceEventFormatting.cs index e5d7f71d7853d..155c05b83e996 100644 --- a/sdk/core/Azure.Core/src/Shared/EventSourceEventFormatting.cs +++ b/sdk/core/Azure.Core/src/Shared/EventSourceEventFormatting.cs @@ -1,18 +1,21 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Diagnostics.Tracing; using System.Globalization; using System.Linq; using System.Text; +#nullable enable + namespace Azure.Core.Shared { internal static class EventSourceEventFormatting { public static string Format(EventWrittenEventArgs eventData) { - var payloadArray = eventData.Payload.ToArray(); + var payloadArray = eventData.Payload?.ToArray() ?? Array.Empty(); ProcessPayloadArray(payloadArray); @@ -24,16 +27,19 @@ public static string Format(EventWrittenEventArgs eventData) var stringBuilder = new StringBuilder(); stringBuilder.Append(eventData.EventName); - for (int i = 0; i < eventData.PayloadNames.Count; i++) + if (eventData.PayloadNames != null) { - stringBuilder.AppendLine(); - stringBuilder.Append(eventData.PayloadNames[i]).Append(" = ").Append(payloadArray[i]); + for (int i = 0; i < eventData.PayloadNames.Count; i++) + { + stringBuilder.AppendLine(); + stringBuilder.Append(eventData.PayloadNames[i]).Append(" = ").Append(payloadArray[i]); + } } return stringBuilder.ToString(); } - private static void ProcessPayloadArray(object[] payloadArray) + private static void ProcessPayloadArray(object?[] payloadArray) { for (int i = 0; i < payloadArray.Length; i++) { @@ -41,7 +47,7 @@ private static void ProcessPayloadArray(object[] payloadArray) } } - private static object FormatValue(object o) + private static object? FormatValue(object? o) { if (o is byte[] bytes) { diff --git a/sdk/core/Azure.Core/src/Shared/HashCodeBuilder.cs b/sdk/core/Azure.Core/src/Shared/HashCodeBuilder.cs index 301db77ec72d0..94acf1a220c80 100644 --- a/sdk/core/Azure.Core/src/Shared/HashCodeBuilder.cs +++ b/sdk/core/Azure.Core/src/Shared/HashCodeBuilder.cs @@ -264,7 +264,7 @@ public void Add(T value) public void Add(T value, IEqualityComparer comparer) { - Add(comparer != null ? comparer.GetHashCode(value) : (value?.GetHashCode() ?? 0)); + Add((comparer != null && value != null) ? comparer.GetHashCode(value) : (value?.GetHashCode() ?? 0)); } private void Add(int value) diff --git a/sdk/core/Azure.Core/src/Shared/NullableAttributes.cs b/sdk/core/Azure.Core/src/Shared/NullableAttributes.cs index b5ea989c3b57d..1abf754b7b8f0 100644 --- a/sdk/core/Azure.Core/src/Shared/NullableAttributes.cs +++ b/sdk/core/Azure.Core/src/Shared/NullableAttributes.cs @@ -6,6 +6,7 @@ #pragma warning disable SA1402 // File may only contain a single type #pragma warning disable SA1649 // File name should match first type name +#if !NETCOREAPP namespace System.Diagnostics.CodeAnalysis { /// Specifies that null is allowed as an input even if the corresponding type disallows it. @@ -130,3 +131,4 @@ sealed class DoesNotReturnIfAttribute : Attribute public bool ParameterValue { get; } } } +#endif \ No newline at end of file diff --git a/sdk/core/Azure.Core/tests/Azure.Core.Tests.csproj b/sdk/core/Azure.Core/tests/Azure.Core.Tests.csproj index 962293005e77f..9ed397d113a08 100644 --- a/sdk/core/Azure.Core/tests/Azure.Core.Tests.csproj +++ b/sdk/core/Azure.Core/tests/Azure.Core.Tests.csproj @@ -1,7 +1,7 @@  {84491222-6C36-4FA7-BBAE-1FA804129151} - $(RequiredTargetFrameworks) + $(RequiredTargetFrameworks);netcoreapp5.0 $(DefineConstants);HAS_INTERNALS_VISIBLE_CORE true From 24a7b327aa8cf40821326694e39adb6ed154e90c Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Fri, 24 Jul 2020 16:23:56 -0700 Subject: [PATCH 02/17] Fix most of the tests --- sdk/core/Azure.Core/src/JsonObjectSerializer.cs | 4 ++-- sdk/core/Azure.Core/src/ObjectSerializer.cs | 4 ++-- .../Azure.Core/src/Pipeline/HttpClientTransport.cs | 14 +++++++++++--- .../Azure.Core/tests/ClientDiagnosticsTests.cs | 5 +++-- .../Azure.Core/tests/HttpClientTransportTests.cs | 6 ++++++ .../tests/HttpPipelineFunctionalTests.cs | 3 ++- sdk/core/Azure.Core/tests/MockHttpClientHandler.cs | 9 +++++++++ .../Azure.Core/tests/RequestActivityPolicyTests.cs | 4 ++++ 8 files changed, 39 insertions(+), 10 deletions(-) diff --git a/sdk/core/Azure.Core/src/JsonObjectSerializer.cs b/sdk/core/Azure.Core/src/JsonObjectSerializer.cs index bda8dddb780f9..5118479cbdf85 100644 --- a/sdk/core/Azure.Core/src/JsonObjectSerializer.cs +++ b/sdk/core/Azure.Core/src/JsonObjectSerializer.cs @@ -47,7 +47,7 @@ public override async ValueTask SerializeAsync(Stream stream, object? value, Typ } /// - public override object Deserialize(Stream stream, Type returnType, CancellationToken cancellationToken) + public override object? Deserialize(Stream stream, Type returnType, CancellationToken cancellationToken) { using var memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); @@ -55,7 +55,7 @@ public override object Deserialize(Stream stream, Type returnType, CancellationT } /// - public override async ValueTask DeserializeAsync(Stream stream, Type returnType, CancellationToken cancellationToken) + public override async ValueTask DeserializeAsync(Stream stream, Type returnType, CancellationToken cancellationToken) { return await JsonSerializer.DeserializeAsync(stream, returnType, _options, cancellationToken).ConfigureAwait(false); } diff --git a/sdk/core/Azure.Core/src/ObjectSerializer.cs b/sdk/core/Azure.Core/src/ObjectSerializer.cs index 35045d7ceb240..f38408193e25e 100644 --- a/sdk/core/Azure.Core/src/ObjectSerializer.cs +++ b/sdk/core/Azure.Core/src/ObjectSerializer.cs @@ -38,7 +38,7 @@ public abstract class ObjectSerializer /// The to read from. /// The type of the object to convert to and return. /// The to use during deserialization. - public abstract object Deserialize(Stream stream, Type returnType, CancellationToken cancellationToken); + public abstract object? Deserialize(Stream stream, Type returnType, CancellationToken cancellationToken); /// /// Read the binary representation into a . @@ -47,6 +47,6 @@ public abstract class ObjectSerializer /// The to read from. /// The type of the object to convert to and return. /// The to use during deserialization. - public abstract ValueTask DeserializeAsync(Stream stream, Type returnType, CancellationToken cancellationToken); + public abstract ValueTask DeserializeAsync(Stream stream, Type returnType, CancellationToken cancellationToken); } } diff --git a/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs b/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs index 568ba3ebcaf81..db32ec276ffbe 100644 --- a/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs +++ b/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs @@ -19,7 +19,7 @@ namespace Azure.Core.Pipeline /// public class HttpClientTransport : HttpPipelineTransport { - private readonly HttpMessageInvoker _client; + private readonly HttpClient _client; /// /// Creates a new instance using default configuration. @@ -75,12 +75,12 @@ private async Task ProcessAsync(HttpMessage message, bool async) #if NETCOREAPP if (!async) { - responseMessage = _client.Send(httpRequest, message.CancellationToken); + responseMessage = _client.Send(httpRequest, HttpCompletionOption.ResponseHeadersRead, message.CancellationToken); } else #endif { - responseMessage = await _client.SendAsync(httpRequest, message.CancellationToken) + responseMessage = await _client.SendAsync(httpRequest, HttpCompletionOption.ResponseHeadersRead, message.CancellationToken) .ConfigureAwait(false); } @@ -375,6 +375,14 @@ protected override bool TryComputeLength(out long length) return PipelineContent!.TryComputeLength(out length); } + +#if NETCOREAPP + protected override void SerializeToStream(Stream stream, TransportContext? context, CancellationToken cancellationToken) + { + Debug.Assert(PipelineContent != null); + PipelineContent.WriteTo(stream, CancellationToken); + } +#endif } } diff --git a/sdk/core/Azure.Core/tests/ClientDiagnosticsTests.cs b/sdk/core/Azure.Core/tests/ClientDiagnosticsTests.cs index 52d74d5ab9eb7..6b367d40f8290 100644 --- a/sdk/core/Azure.Core/tests/ClientDiagnosticsTests.cs +++ b/sdk/core/Azure.Core/tests/ClientDiagnosticsTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; using Azure.Core; using Azure.Core.Pipeline; using NUnit.Framework; @@ -99,7 +100,7 @@ public void AddLinkCallsPassesLinksAsPartOfStartPayload() Assert.AreEqual("ActivityName.Start", startEvent.Key); Assert.AreEqual("ActivityName.Stop", stopEvent.Key); - var activities = (IEnumerable)startEvent.Value.GetType().GetProperty("Links").GetValue(startEvent.Value); + var activities = (IEnumerable)startEvent.Value.GetType().GetProperty("Links", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).GetValue(startEvent.Value); Activity[] activitiesArray = activities.ToArray(); Assert.AreEqual(activitiesArray.Length, 2); @@ -143,7 +144,7 @@ public void AddLinkCreatesLinkedActivityWithTags() Assert.AreEqual("ActivityName.Start", startEvent.Key); Assert.AreEqual("ActivityName.Stop", stopEvent.Key); - var activities = (IEnumerable)startEvent.Value.GetType().GetProperty("Links").GetValue(startEvent.Value); + var activities = (IEnumerable)startEvent.Value.GetType().GetProperty("Links", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly).GetValue(startEvent.Value); Activity linkedActivity = activities.Single(); Assert.AreEqual(ActivityIdFormat.W3C, linkedActivity.IdFormat); diff --git a/sdk/core/Azure.Core/tests/HttpClientTransportTests.cs b/sdk/core/Azure.Core/tests/HttpClientTransportTests.cs index 8ca4dd3f2cebf..cd3e1a680e236 100644 --- a/sdk/core/Azure.Core/tests/HttpClientTransportTests.cs +++ b/sdk/core/Azure.Core/tests/HttpClientTransportTests.cs @@ -6,6 +6,7 @@ using System.IO; using System.Net; using System.Net.Http; +using System.Threading; using System.Threading.Tasks; using Azure.Core.Pipeline; using NUnit.Framework; @@ -168,6 +169,11 @@ protected override Task SerializeToStreamAsync(Stream stream, TransportContext c return Task.CompletedTask; } +#if NET5_0 + protected override void SerializeToStream(Stream stream, TransportContext context, CancellationToken cancellationToken) + { + } +#endif protected override bool TryComputeLength(out long length) { length = 0; diff --git a/sdk/core/Azure.Core/tests/HttpPipelineFunctionalTests.cs b/sdk/core/Azure.Core/tests/HttpPipelineFunctionalTests.cs index b185e54ae7f60..2ea3a2bee565a 100644 --- a/sdk/core/Azure.Core/tests/HttpPipelineFunctionalTests.cs +++ b/sdk/core/Azure.Core/tests/HttpPipelineFunctionalTests.cs @@ -69,6 +69,7 @@ public async Task NonBufferedExtractedStreamReadableAfterMessageDisposed() byte[] buffer = { 0 }; HttpPipeline httpPipeline = HttpPipelineBuilder.Build(GetOptions()); + TaskCompletionSource blockRequestTsc = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); using TestServer testServer = new TestServer( async context => @@ -90,7 +91,7 @@ public async Task NonBufferedExtractedStreamReadableAfterMessageDisposed() await ExecuteRequest(message, httpPipeline); - Assert.AreEqual(message.Response.ContentStream.CanSeek, false); + Assert.AreEqual(false, message.Response.ContentStream.CanSeek); extractedStream = message.ExtractResponseContent(); } diff --git a/sdk/core/Azure.Core/tests/MockHttpClientHandler.cs b/sdk/core/Azure.Core/tests/MockHttpClientHandler.cs index 176e91e0353dd..12ffb7b227f64 100644 --- a/sdk/core/Azure.Core/tests/MockHttpClientHandler.cs +++ b/sdk/core/Azure.Core/tests/MockHttpClientHandler.cs @@ -32,5 +32,14 @@ protected override async Task SendAsync(HttpRequestMessage return response ?? new HttpResponseMessage((HttpStatusCode)200); } + +#if NET5_0 + protected override HttpResponseMessage Send(HttpRequestMessage request, CancellationToken cancellationToken) + { + HttpResponseMessage response = _onSend(request).GetAwaiter().GetResult(); + + return response ?? new HttpResponseMessage((HttpStatusCode)200); + } +#endif } } diff --git a/sdk/core/Azure.Core/tests/RequestActivityPolicyTests.cs b/sdk/core/Azure.Core/tests/RequestActivityPolicyTests.cs index 47456aed9d434..b2bed85e8684c 100644 --- a/sdk/core/Azure.Core/tests/RequestActivityPolicyTests.cs +++ b/sdk/core/Azure.Core/tests/RequestActivityPolicyTests.cs @@ -146,7 +146,11 @@ public async Task CurrentActivityIsInjectedIntoRequest() activity.Stop(); +#if NET5_0 + Assert.True(transport.SingleRequest.TryGetHeader("traceparent", out string requestId)); +#else Assert.True(transport.SingleRequest.TryGetHeader("Request-Id", out string requestId)); +#endif Assert.AreEqual(activity.Id, requestId); } From 812b18312378537ff25327ba5b303bb89cf66e65 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 10 Aug 2020 13:46:27 -0700 Subject: [PATCH 03/17] Fixes --- .../Azure.Core/src/Serialization/JsonObjectSerializer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/core/Azure.Core/src/Serialization/JsonObjectSerializer.cs b/sdk/core/Azure.Core/src/Serialization/JsonObjectSerializer.cs index 5559deadeab67..c556347a8711e 100644 --- a/sdk/core/Azure.Core/src/Serialization/JsonObjectSerializer.cs +++ b/sdk/core/Azure.Core/src/Serialization/JsonObjectSerializer.cs @@ -54,7 +54,7 @@ public override async ValueTask SerializeAsync(Stream stream, object? value, Typ } /// - public override object Deserialize(Stream stream, Type returnType, CancellationToken cancellationToken) + public override object? Deserialize(Stream stream, Type returnType, CancellationToken cancellationToken) { using var memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); @@ -62,7 +62,7 @@ public override object Deserialize(Stream stream, Type returnType, CancellationT } /// - public override async ValueTask DeserializeAsync(Stream stream, Type returnType, CancellationToken cancellationToken) + public override async ValueTask DeserializeAsync(Stream stream, Type returnType, CancellationToken cancellationToken) { return await JsonSerializer.DeserializeAsync(stream, returnType, _options, cancellationToken).ConfigureAwait(false); } @@ -117,7 +117,7 @@ private string GetPropertyName(MemberInfo memberInfo) // Mimics property name determination based on // https://github.com/dotnet/runtime/blob/dc8b6f90/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonPropertyInfo.cs#L53-L90 - JsonPropertyNameAttribute nameAttribute = memberInfo.GetCustomAttribute(false); + JsonPropertyNameAttribute? nameAttribute = memberInfo.GetCustomAttribute(false); if (nameAttribute != null) { return nameAttribute.Name From 2b57aa34fdaf8c5c7298c28f8d88d19cd0f60de4 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 10 Aug 2020 16:35:29 -0700 Subject: [PATCH 04/17] API --- .../src/Azure.Core.Experimental.csproj | 1 + .../src/DynamicJson.cs | 4 +- .../src/Primitives/BinaryData.cs | 13 +- sdk/core/Azure.Core/Azure.Core.All.sln | 14 + sdk/core/Azure.Core/api/Azure.Core.net461.cs | 522 ++++++++++++++++++ .../api/Azure.Core.netcoreapp5.0.cs | 522 ++++++++++++++++++ .../api/Azure.Core.netstandard2.0.cs | 20 +- ...zure.Core.NewtonsoftJson.netstandard2.0.cs | 2 +- .../NewtonsoftJsonObjectSerializer.cs | 4 +- 9 files changed, 1081 insertions(+), 21 deletions(-) create mode 100644 sdk/core/Azure.Core/api/Azure.Core.net461.cs create mode 100644 sdk/core/Azure.Core/api/Azure.Core.netcoreapp5.0.cs diff --git a/sdk/core/Azure.Core.Experimental/src/Azure.Core.Experimental.csproj b/sdk/core/Azure.Core.Experimental/src/Azure.Core.Experimental.csproj index 361a5bb79ed69..31453f2a0ed2f 100644 --- a/sdk/core/Azure.Core.Experimental/src/Azure.Core.Experimental.csproj +++ b/sdk/core/Azure.Core.Experimental/src/Azure.Core.Experimental.csproj @@ -17,5 +17,6 @@ + diff --git a/sdk/core/Azure.Core.Experimental/src/DynamicJson.cs b/sdk/core/Azure.Core.Experimental/src/DynamicJson.cs index abc76e8a8b520..bee2498d610d4 100644 --- a/sdk/core/Azure.Core.Experimental/src/DynamicJson.cs +++ b/sdk/core/Azure.Core.Experimental/src/DynamicJson.cs @@ -521,13 +521,13 @@ public T Deserialize(JsonSerializerOptions? options = null) public T Deserialize(ObjectSerializer serializer, CancellationToken cancellationToken = default) { var stream = new MemoryStream(Encoding.UTF8.GetBytes(ToString())); - return (T) serializer.Deserialize(stream, typeof(T), cancellationToken); + return (T)serializer.Deserialize(stream, typeof(T), cancellationToken)!; } public async Task DeserializeAsync(ObjectSerializer serializer, CancellationToken cancellationToken = default) { var stream = new MemoryStream(Encoding.UTF8.GetBytes(ToString())); - return (T) await serializer.DeserializeAsync(stream, typeof(T), cancellationToken).ConfigureAwait(false); + return (T)(await serializer.DeserializeAsync(stream, typeof(T), cancellationToken).ConfigureAwait(false))!; } private struct Number diff --git a/sdk/core/Azure.Core.Experimental/src/Primitives/BinaryData.cs b/sdk/core/Azure.Core.Experimental/src/Primitives/BinaryData.cs index 4777c83e87ca7..741592b3f63bf 100644 --- a/sdk/core/Azure.Core.Experimental/src/Primitives/BinaryData.cs +++ b/sdk/core/Azure.Core.Experimental/src/Primitives/BinaryData.cs @@ -3,6 +3,7 @@ using System; using System.ComponentModel; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Runtime.InteropServices; using System.Text; @@ -287,15 +288,15 @@ private async ValueTask DeserializeInternalAsync( Argument.AssertNotNull(serializer, nameof(serializer)); if (async) { - return (T)await serializer.DeserializeAsync( - ToStream(), - typeof(T), - cancellationToken) - .ConfigureAwait(false); + return (T)(await serializer.DeserializeAsync( + ToStream(), + typeof(T), + cancellationToken) + .ConfigureAwait(false))!; } else { - return (T)serializer.Deserialize(ToStream(), typeof(T), cancellationToken); + return (T)(serializer.Deserialize(ToStream(), typeof(T), cancellationToken))!; } } diff --git a/sdk/core/Azure.Core/Azure.Core.All.sln b/sdk/core/Azure.Core/Azure.Core.All.sln index 0b224f40af2c3..b7db8133e9c99 100644 --- a/sdk/core/Azure.Core/Azure.Core.All.sln +++ b/sdk/core/Azure.Core/Azure.Core.All.sln @@ -221,6 +221,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Storage.Internal.Avro EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IotHubClientSamples", "..\..\iot\Azure.Iot.Hub.Service\samples\IotHubClientSamples\IotHubClientSamples.csproj", "{E4EA7D47-B37F-45EE-8366-944A395859F2}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Azure.Core.NewtonsoftJson", "..\Microsoft.Azure.Core.NewtonsoftJson\src\Microsoft.Azure.Core.NewtonsoftJson.csproj", "{512581E8-E5EE-428C-8682-BF35079F6A73}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution ..\..\keyvault\Azure.Security.KeyVault.Shared\src\Azure.Security.KeyVault.Shared.projitems*{359ffa3a-4f5d-411c-8978-28e58f50eea3}*SharedItemsImports = 5 @@ -1547,6 +1549,18 @@ Global {E4EA7D47-B37F-45EE-8366-944A395859F2}.Release|x64.Build.0 = Release|Any CPU {E4EA7D47-B37F-45EE-8366-944A395859F2}.Release|x86.ActiveCfg = Release|Any CPU {E4EA7D47-B37F-45EE-8366-944A395859F2}.Release|x86.Build.0 = Release|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Debug|Any CPU.Build.0 = Debug|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Debug|x64.ActiveCfg = Debug|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Debug|x64.Build.0 = Debug|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Debug|x86.ActiveCfg = Debug|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Debug|x86.Build.0 = Debug|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Release|Any CPU.ActiveCfg = Release|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Release|Any CPU.Build.0 = Release|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Release|x64.ActiveCfg = Release|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Release|x64.Build.0 = Release|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Release|x86.ActiveCfg = Release|Any CPU + {512581E8-E5EE-428C-8682-BF35079F6A73}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/sdk/core/Azure.Core/api/Azure.Core.net461.cs b/sdk/core/Azure.Core/api/Azure.Core.net461.cs new file mode 100644 index 0000000000000..605ec113f5fe1 --- /dev/null +++ b/sdk/core/Azure.Core/api/Azure.Core.net461.cs @@ -0,0 +1,522 @@ +namespace Azure +{ + public abstract partial class AsyncPageable : System.Collections.Generic.IAsyncEnumerable where T : notnull + { + protected AsyncPageable() { } + protected AsyncPageable(System.Threading.CancellationToken cancellationToken) { } + protected virtual System.Threading.CancellationToken CancellationToken { get { throw null; } } + public abstract System.Collections.Generic.IAsyncEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?)); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + public virtual System.Collections.Generic.IAsyncEnumerator GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public partial class AzureKeyCredential + { + public AzureKeyCredential(string key) { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public string Key { get { throw null; } } + public void Update(string key) { } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ETag : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public static readonly Azure.ETag All; + public ETag(string etag) { throw null; } + public bool Equals(Azure.ETag other) { throw null; } + public override bool Equals(object? obj) { throw null; } + public bool Equals(string? other) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ETag left, Azure.ETag right) { throw null; } + public static bool operator !=(Azure.ETag left, Azure.ETag right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HttpRange : System.IEquatable + { + private readonly int _dummyPrimitive; + public HttpRange(long offset = (long)0, long? length = default(long?)) { throw null; } + public long? Length { get { throw null; } } + public long Offset { get { throw null; } } + public bool Equals(Azure.HttpRange other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.HttpRange left, Azure.HttpRange right) { throw null; } + public static bool operator !=(Azure.HttpRange left, Azure.HttpRange right) { throw null; } + public override string ToString() { throw null; } + } + public partial class MatchConditions + { + public MatchConditions() { } + public Azure.ETag? IfMatch { get { throw null; } set { } } + public Azure.ETag? IfNoneMatch { get { throw null; } set { } } + } + public abstract partial class Operation where T : notnull + { + protected Operation() { } + public abstract bool HasCompleted { get; } + public abstract bool HasValue { get; } + public abstract string Id { get; } + public abstract T Value { get; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public abstract Azure.Response GetRawResponse(); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + public abstract Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + public abstract System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + public abstract System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + public abstract System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken); + } + public abstract partial class Pageable : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where T : notnull + { + protected Pageable() { } + protected Pageable(System.Threading.CancellationToken cancellationToken) { } + protected virtual System.Threading.CancellationToken CancellationToken { get { throw null; } } + public abstract System.Collections.Generic.IEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?)); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public abstract partial class Page + { + protected Page() { } + public abstract string? ContinuationToken { get; } + public abstract System.Collections.Generic.IReadOnlyList Values { get; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + public static Azure.Page FromValues(System.Collections.Generic.IReadOnlyList values, string? continuationToken, Azure.Response response) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public abstract Azure.Response GetRawResponse(); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public partial class RequestConditions : Azure.MatchConditions + { + public RequestConditions() { } + public System.DateTimeOffset? IfModifiedSince { get { throw null; } set { } } + public System.DateTimeOffset? IfUnmodifiedSince { get { throw null; } set { } } + } + public partial class RequestFailedException : System.Exception, System.Runtime.Serialization.ISerializable + { + public RequestFailedException(int status, string message) { } + public RequestFailedException(int status, string message, System.Exception? innerException) { } + public RequestFailedException(int status, string message, string? errorCode, System.Exception? innerException) { } + protected RequestFailedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public RequestFailedException(string message) { } + public RequestFailedException(string message, System.Exception? innerException) { } + public string? ErrorCode { get { throw null; } } + public int Status { get { throw null; } } + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public abstract partial class Response : System.IDisposable + { + protected Response() { } + public abstract string ClientRequestId { get; set; } + public abstract System.IO.Stream? ContentStream { get; set; } + public virtual Azure.Core.ResponseHeaders Headers { get { throw null; } } + public abstract string ReasonPhrase { get; } + public abstract int Status { get; } + protected internal abstract bool ContainsHeader(string name); + public abstract void Dispose(); + protected internal abstract System.Collections.Generic.IEnumerable EnumerateHeaders(); + public static Azure.Response FromValue(T value, Azure.Response response) { throw null; } + public override string ToString() { throw null; } + protected internal abstract bool TryGetHeader(string name, out string? value); + protected internal abstract bool TryGetHeaderValues(string name, out System.Collections.Generic.IEnumerable? values); + } + public abstract partial class Response + { + protected Response() { } + public abstract T Value { get; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public abstract Azure.Response GetRawResponse(); + public static implicit operator T (Azure.Response response) { throw null; } + public override string ToString() { throw null; } + } +} +namespace Azure.Core +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct AccessToken + { + private object _dummy; + private int _dummyPrimitive; + public AccessToken(string accessToken, System.DateTimeOffset expiresOn) { throw null; } + public System.DateTimeOffset ExpiresOn { get { throw null; } } + public string Token { get { throw null; } } + public override bool Equals(object? obj) { throw null; } + public override int GetHashCode() { throw null; } + } + public abstract partial class ClientOptions + { + protected ClientOptions() { } + public Azure.Core.DiagnosticsOptions Diagnostics { get { throw null; } } + public Azure.Core.RetryOptions Retry { get { throw null; } } + public Azure.Core.Pipeline.HttpPipelineTransport Transport { get { throw null; } set { } } + public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public partial class DiagnosticsOptions + { + internal DiagnosticsOptions() { } + public string? ApplicationId { get { throw null; } set { } } + public static string? DefaultApplicationId { get { throw null; } set { } } + public bool IsDistributedTracingEnabled { get { throw null; } set { } } + public bool IsLoggingContentEnabled { get { throw null; } set { } } + public bool IsLoggingEnabled { get { throw null; } set { } } + public bool IsTelemetryEnabled { get { throw null; } set { } } + public int LoggedContentSizeLimit { get { throw null; } set { } } + public System.Collections.Generic.IList LoggedHeaderNames { get { throw null; } } + public System.Collections.Generic.IList LoggedQueryParameters { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HttpHeader : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HttpHeader(string name, string value) { throw null; } + public string Name { get { throw null; } } + public string Value { get { throw null; } } + public bool Equals(Azure.Core.HttpHeader other) { throw null; } + public override bool Equals(object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public override string ToString() { throw null; } + public static partial class Common + { + public static readonly Azure.Core.HttpHeader FormUrlEncodedContentType; + public static readonly Azure.Core.HttpHeader JsonAccept; + public static readonly Azure.Core.HttpHeader JsonContentType; + public static readonly Azure.Core.HttpHeader OctetStreamContentType; + } + public static partial class Names + { + public static string Accept { get { throw null; } } + public static string Authorization { get { throw null; } } + public static string ContentLength { get { throw null; } } + public static string ContentType { get { throw null; } } + public static string Date { get { throw null; } } + public static string ETag { get { throw null; } } + public static string IfMatch { get { throw null; } } + public static string IfModifiedSince { get { throw null; } } + public static string IfNoneMatch { get { throw null; } } + public static string IfUnmodifiedSince { get { throw null; } } + public static string Range { get { throw null; } } + public static string UserAgent { get { throw null; } } + public static string XMsDate { get { throw null; } } + public static string XMsRange { get { throw null; } } + public static string XMsRequestId { get { throw null; } } + } + } + public sealed partial class HttpMessage : System.IDisposable + { + public HttpMessage(Azure.Core.Request request, Azure.Core.ResponseClassifier responseClassifier) { } + public bool BufferResponse { get { throw null; } set { } } + public System.Threading.CancellationToken CancellationToken { get { throw null; } } + public bool HasResponse { get { throw null; } } + public Azure.Core.Request Request { get { throw null; } } + public Azure.Response Response { get { throw null; } set { } } + public Azure.Core.ResponseClassifier ResponseClassifier { get { throw null; } } + public void Dispose() { } + public System.IO.Stream? ExtractResponseContent() { throw null; } + public void SetProperty(string name, object value) { } + public bool TryGetProperty(string name, out object? value) { throw null; } + } + public enum HttpPipelinePosition + { + PerCall = 0, + PerRetry = 1, + } + public abstract partial class Request : System.IDisposable + { + protected Request() { } + public abstract string ClientRequestId { get; set; } + public virtual Azure.Core.RequestContent? Content { get { throw null; } set { } } + public Azure.Core.RequestHeaders Headers { get { throw null; } } + public virtual Azure.Core.RequestMethod Method { get { throw null; } set { } } + public virtual Azure.Core.RequestUriBuilder Uri { get { throw null; } set { } } + protected internal abstract void AddHeader(string name, string value); + protected internal abstract bool ContainsHeader(string name); + public abstract void Dispose(); + protected internal abstract System.Collections.Generic.IEnumerable EnumerateHeaders(); + protected internal abstract bool RemoveHeader(string name); + protected internal virtual void SetHeader(string name, string value) { } + protected internal abstract bool TryGetHeader(string name, out string? value); + protected internal abstract bool TryGetHeaderValues(string name, out System.Collections.Generic.IEnumerable? values); + } + public abstract partial class RequestContent : System.IDisposable + { + protected RequestContent() { } + public static Azure.Core.RequestContent Create(System.Buffers.ReadOnlySequence bytes) { throw null; } + public static Azure.Core.RequestContent Create(byte[] bytes) { throw null; } + public static Azure.Core.RequestContent Create(byte[] bytes, int index, int length) { throw null; } + public static Azure.Core.RequestContent Create(System.IO.Stream stream) { throw null; } + public static Azure.Core.RequestContent Create(System.ReadOnlyMemory bytes) { throw null; } + public abstract void Dispose(); + public abstract bool TryComputeLength(out long length); + public abstract void WriteTo(System.IO.Stream stream, System.Threading.CancellationToken cancellation); + public abstract System.Threading.Tasks.Task WriteToAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellation); + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RequestHeaders : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public void Add(Azure.Core.HttpHeader header) { } + public void Add(string name, string value) { } + public bool Contains(string name) { throw null; } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public bool Remove(string name) { throw null; } + public void SetValue(string name, string value) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public bool TryGetValue(string name, out string? value) { throw null; } + public bool TryGetValues(string name, out System.Collections.Generic.IEnumerable? values) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RequestMethod : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RequestMethod(string method) { throw null; } + public static Azure.Core.RequestMethod Delete { get { throw null; } } + public static Azure.Core.RequestMethod Get { get { throw null; } } + public static Azure.Core.RequestMethod Head { get { throw null; } } + public string Method { get { throw null; } } + public static Azure.Core.RequestMethod Options { get { throw null; } } + public static Azure.Core.RequestMethod Patch { get { throw null; } } + public static Azure.Core.RequestMethod Post { get { throw null; } } + public static Azure.Core.RequestMethod Put { get { throw null; } } + public static Azure.Core.RequestMethod Trace { get { throw null; } } + public bool Equals(Azure.Core.RequestMethod other) { throw null; } + public override bool Equals(object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Core.RequestMethod left, Azure.Core.RequestMethod right) { throw null; } + public static bool operator !=(Azure.Core.RequestMethod left, Azure.Core.RequestMethod right) { throw null; } + public static Azure.Core.RequestMethod Parse(string method) { throw null; } + public override string ToString() { throw null; } + } + public partial class RequestUriBuilder + { + public RequestUriBuilder() { } + public string? Host { get { throw null; } set { } } + public string Path { get { throw null; } set { } } + public string PathAndQuery { get { throw null; } } + public int Port { get { throw null; } set { } } + public string Query { get { throw null; } set { } } + public string? Scheme { get { throw null; } set { } } + public void AppendPath(string value) { } + public void AppendPath(string value, bool escape) { } + public void AppendQuery(string name, string value) { } + public void AppendQuery(string name, string value, bool escapeValue) { } + public void Reset(System.Uri value) { } + public override string ToString() { throw null; } + public System.Uri ToUri() { throw null; } + } + public partial class ResponseClassifier + { + public ResponseClassifier() { } + public virtual bool IsErrorResponse(Azure.Core.HttpMessage message) { throw null; } + public virtual bool IsRetriable(Azure.Core.HttpMessage message, System.Exception exception) { throw null; } + public virtual bool IsRetriableException(System.Exception exception) { throw null; } + public virtual bool IsRetriableResponse(Azure.Core.HttpMessage message) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResponseHeaders : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public int? ContentLength { get { throw null; } } + public string? ContentType { get { throw null; } } + public System.DateTimeOffset? Date { get { throw null; } } + public Azure.ETag? ETag { get { throw null; } } + public string? RequestId { get { throw null; } } + public bool Contains(string name) { throw null; } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public bool TryGetValue(string name, out string? value) { throw null; } + public bool TryGetValues(string name, out System.Collections.Generic.IEnumerable? values) { throw null; } + } + public enum RetryMode + { + Fixed = 0, + Exponential = 1, + } + public partial class RetryOptions + { + internal RetryOptions() { } + public System.TimeSpan Delay { get { throw null; } set { } } + public System.TimeSpan MaxDelay { get { throw null; } set { } } + public int MaxRetries { get { throw null; } set { } } + public Azure.Core.RetryMode Mode { get { throw null; } set { } } + public System.TimeSpan NetworkTimeout { get { throw null; } set { } } + } + public abstract partial class TokenCredential + { + protected TokenCredential() { } + public abstract Azure.Core.AccessToken GetToken(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.ValueTask GetTokenAsync(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken); + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TokenRequestContext + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TokenRequestContext(string[] scopes, string? parentRequestId = null) { throw null; } + public string? ParentRequestId { get { throw null; } } + public string[] Scopes { get { throw null; } } + } +} +namespace Azure.Core.Cryptography +{ + public partial interface IKeyEncryptionKey + { + string KeyId { get; } + byte[] UnwrapKey(string algorithm, System.ReadOnlyMemory encryptedKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task UnwrapKeyAsync(string algorithm, System.ReadOnlyMemory encryptedKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + byte[] WrapKey(string algorithm, System.ReadOnlyMemory key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task WrapKeyAsync(string algorithm, System.ReadOnlyMemory key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + public partial interface IKeyEncryptionKeyResolver + { + Azure.Core.Cryptography.IKeyEncryptionKey Resolve(string keyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ResolveAsync(string keyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} +namespace Azure.Core.Diagnostics +{ + public partial class AzureEventSourceListener : System.Diagnostics.Tracing.EventListener + { + public const string TraitName = "AzureEventSource"; + public const string TraitValue = "true"; + public AzureEventSourceListener(System.Action log, System.Diagnostics.Tracing.EventLevel level) { } + public static Azure.Core.Diagnostics.AzureEventSourceListener CreateConsoleLogger(System.Diagnostics.Tracing.EventLevel level = System.Diagnostics.Tracing.EventLevel.Informational) { throw null; } + public static Azure.Core.Diagnostics.AzureEventSourceListener CreateTraceLogger(System.Diagnostics.Tracing.EventLevel level = System.Diagnostics.Tracing.EventLevel.Informational) { throw null; } + protected sealed override void OnEventSourceCreated(System.Diagnostics.Tracing.EventSource eventSource) { } + protected sealed override void OnEventWritten(System.Diagnostics.Tracing.EventWrittenEventArgs eventData) { } + } +} +namespace Azure.Core.Extensions +{ + public partial interface IAzureClientBuilder where TOptions : class + { + } + public partial interface IAzureClientFactoryBuilder + { + Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(System.Func clientFactory) where TOptions : class; + } + public partial interface IAzureClientFactoryBuilderWithConfiguration : Azure.Core.Extensions.IAzureClientFactoryBuilder + { + Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(TConfiguration configuration) where TOptions : class; + } + public partial interface IAzureClientFactoryBuilderWithCredential + { + Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(System.Func clientFactory, bool requiresCredential = true) where TOptions : class; + } +} +namespace Azure.Core.Pipeline +{ + public partial class BearerTokenAuthenticationPolicy : Azure.Core.Pipeline.HttpPipelinePolicy + { + public BearerTokenAuthenticationPolicy(Azure.Core.TokenCredential credential, System.Collections.Generic.IEnumerable scopes) { } + public BearerTokenAuthenticationPolicy(Azure.Core.TokenCredential credential, string scope) { } + public override void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } + public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } + } + public partial class HttpClientTransport : Azure.Core.Pipeline.HttpPipelineTransport + { + public static readonly Azure.Core.Pipeline.HttpClientTransport Shared; + public HttpClientTransport() { } + public HttpClientTransport(System.Net.Http.HttpClient client) { } + public sealed override Azure.Core.Request CreateRequest() { throw null; } + public override void Process(Azure.Core.HttpMessage message) { } + public sealed override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message) { throw null; } + } + public partial class HttpPipeline + { + public HttpPipeline(Azure.Core.Pipeline.HttpPipelineTransport transport, Azure.Core.Pipeline.HttpPipelinePolicy[]? policies = null, Azure.Core.ResponseClassifier? responseClassifier = null) { } + public Azure.Core.ResponseClassifier ResponseClassifier { get { throw null; } } + public static System.IDisposable CreateClientRequestIdScope(string? clientRequestId) { throw null; } + public Azure.Core.HttpMessage CreateMessage() { throw null; } + public Azure.Core.Request CreateRequest() { throw null; } + public void Send(Azure.Core.HttpMessage message, System.Threading.CancellationToken cancellationToken) { } + public System.Threading.Tasks.ValueTask SendAsync(Azure.Core.HttpMessage message, System.Threading.CancellationToken cancellationToken) { throw null; } + public Azure.Response SendRequest(Azure.Core.Request request, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.ValueTask SendRequestAsync(Azure.Core.Request request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public static partial class HttpPipelineBuilder + { + public static Azure.Core.Pipeline.HttpPipeline Build(Azure.Core.ClientOptions options, params Azure.Core.Pipeline.HttpPipelinePolicy[] perRetryPolicies) { throw null; } + public static Azure.Core.Pipeline.HttpPipeline Build(Azure.Core.ClientOptions options, Azure.Core.Pipeline.HttpPipelinePolicy[] perCallPolicies, Azure.Core.Pipeline.HttpPipelinePolicy[] perRetryPolicies, Azure.Core.ResponseClassifier responseClassifier) { throw null; } + } + public abstract partial class HttpPipelinePolicy + { + protected HttpPipelinePolicy() { } + public abstract void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline); + public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline); + protected static void ProcessNext(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } + protected static System.Threading.Tasks.ValueTask ProcessNextAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } + } + public abstract partial class HttpPipelineSynchronousPolicy : Azure.Core.Pipeline.HttpPipelinePolicy + { + protected HttpPipelineSynchronousPolicy() { } + public virtual void OnReceivedResponse(Azure.Core.HttpMessage message) { } + public virtual void OnSendingRequest(Azure.Core.HttpMessage message) { } + public override void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } + public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } + } + public abstract partial class HttpPipelineTransport + { + protected HttpPipelineTransport() { } + public abstract Azure.Core.Request CreateRequest(); + public abstract void Process(Azure.Core.HttpMessage message); + public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message); + } +} +namespace Azure.Core.Serialization +{ + public partial interface IMemberNameConverter + { + string? ConvertMemberName(System.Reflection.MemberInfo member); + } + public partial class JsonObjectSerializer : Azure.Core.Serialization.ObjectSerializer, Azure.Core.Serialization.IMemberNameConverter + { + public JsonObjectSerializer() { } + public JsonObjectSerializer(System.Text.Json.JsonSerializerOptions options) { } + string? Azure.Core.Serialization.IMemberNameConverter.ConvertMemberName(System.Reflection.MemberInfo member) { throw null; } + public override object? Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } + public override System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } + public override void Serialize(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { } + public override System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public abstract partial class ObjectSerializer + { + protected ObjectSerializer() { } + public abstract object? Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); + public abstract void Serialize(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken); + } +} diff --git a/sdk/core/Azure.Core/api/Azure.Core.netcoreapp5.0.cs b/sdk/core/Azure.Core/api/Azure.Core.netcoreapp5.0.cs new file mode 100644 index 0000000000000..2d37502726a37 --- /dev/null +++ b/sdk/core/Azure.Core/api/Azure.Core.netcoreapp5.0.cs @@ -0,0 +1,522 @@ +namespace Azure +{ + public abstract partial class AsyncPageable : System.Collections.Generic.IAsyncEnumerable where T : notnull + { + protected AsyncPageable() { } + protected AsyncPageable(System.Threading.CancellationToken cancellationToken) { } + protected virtual System.Threading.CancellationToken CancellationToken { get { throw null; } } + public abstract System.Collections.Generic.IAsyncEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?)); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + public virtual System.Collections.Generic.IAsyncEnumerator GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public partial class AzureKeyCredential + { + public AzureKeyCredential(string key) { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public string Key { get { throw null; } } + public void Update(string key) { } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ETag : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public static readonly Azure.ETag All; + public ETag(string etag) { throw null; } + public bool Equals(Azure.ETag other) { throw null; } + public override bool Equals(object? obj) { throw null; } + public bool Equals(string? other) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ETag left, Azure.ETag right) { throw null; } + public static bool operator !=(Azure.ETag left, Azure.ETag right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HttpRange : System.IEquatable + { + private readonly int _dummyPrimitive; + public HttpRange(long offset = (long)0, long? length = default(long?)) { throw null; } + public long? Length { get { throw null; } } + public long Offset { get { throw null; } } + public bool Equals(Azure.HttpRange other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.HttpRange left, Azure.HttpRange right) { throw null; } + public static bool operator !=(Azure.HttpRange left, Azure.HttpRange right) { throw null; } + public override string ToString() { throw null; } + } + public partial class MatchConditions + { + public MatchConditions() { } + public Azure.ETag? IfMatch { get { throw null; } set { } } + public Azure.ETag? IfNoneMatch { get { throw null; } set { } } + } + public abstract partial class Operation where T : notnull + { + protected Operation() { } + public abstract bool HasCompleted { get; } + public abstract bool HasValue { get; } + public abstract string Id { get; } + public abstract T Value { get; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public abstract Azure.Response GetRawResponse(); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + public abstract Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + public abstract System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + public abstract System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + public abstract System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken); + } + public abstract partial class Pageable : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where T : notnull + { + protected Pageable() { } + protected Pageable(System.Threading.CancellationToken cancellationToken) { } + protected virtual System.Threading.CancellationToken CancellationToken { get { throw null; } } + public abstract System.Collections.Generic.IEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?)); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public abstract partial class Page + { + protected Page() { } + public abstract string? ContinuationToken { get; } + public abstract System.Collections.Generic.IReadOnlyList Values { get; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + public static Azure.Page FromValues(System.Collections.Generic.IReadOnlyList values, string? continuationToken, Azure.Response response) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public abstract Azure.Response GetRawResponse(); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public partial class RequestConditions : Azure.MatchConditions + { + public RequestConditions() { } + public System.DateTimeOffset? IfModifiedSince { get { throw null; } set { } } + public System.DateTimeOffset? IfUnmodifiedSince { get { throw null; } set { } } + } + public partial class RequestFailedException : System.Exception, System.Runtime.Serialization.ISerializable + { + public RequestFailedException(int status, string message) { } + public RequestFailedException(int status, string message, System.Exception? innerException) { } + public RequestFailedException(int status, string message, string? errorCode, System.Exception? innerException) { } + protected RequestFailedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public RequestFailedException(string message) { } + public RequestFailedException(string message, System.Exception? innerException) { } + public string? ErrorCode { get { throw null; } } + public int Status { get { throw null; } } + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public abstract partial class Response : System.IDisposable + { + protected Response() { } + public abstract string ClientRequestId { get; set; } + public abstract System.IO.Stream? ContentStream { get; set; } + public virtual Azure.Core.ResponseHeaders Headers { get { throw null; } } + public abstract string ReasonPhrase { get; } + public abstract int Status { get; } + protected internal abstract bool ContainsHeader(string name); + public abstract void Dispose(); + protected internal abstract System.Collections.Generic.IEnumerable EnumerateHeaders(); + public static Azure.Response FromValue(T value, Azure.Response response) { throw null; } + public override string ToString() { throw null; } + protected internal abstract bool TryGetHeader(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value); + protected internal abstract bool TryGetHeaderValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values); + } + public abstract partial class Response + { + protected Response() { } + public abstract T Value { get; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public abstract Azure.Response GetRawResponse(); + public static implicit operator T (Azure.Response response) { throw null; } + public override string ToString() { throw null; } + } +} +namespace Azure.Core +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct AccessToken + { + private object _dummy; + private int _dummyPrimitive; + public AccessToken(string accessToken, System.DateTimeOffset expiresOn) { throw null; } + public System.DateTimeOffset ExpiresOn { get { throw null; } } + public string Token { get { throw null; } } + public override bool Equals(object? obj) { throw null; } + public override int GetHashCode() { throw null; } + } + public abstract partial class ClientOptions + { + protected ClientOptions() { } + public Azure.Core.DiagnosticsOptions Diagnostics { get { throw null; } } + public Azure.Core.RetryOptions Retry { get { throw null; } } + public Azure.Core.Pipeline.HttpPipelineTransport Transport { get { throw null; } set { } } + public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public partial class DiagnosticsOptions + { + internal DiagnosticsOptions() { } + public string? ApplicationId { get { throw null; } set { } } + public static string? DefaultApplicationId { get { throw null; } set { } } + public bool IsDistributedTracingEnabled { get { throw null; } set { } } + public bool IsLoggingContentEnabled { get { throw null; } set { } } + public bool IsLoggingEnabled { get { throw null; } set { } } + public bool IsTelemetryEnabled { get { throw null; } set { } } + public int LoggedContentSizeLimit { get { throw null; } set { } } + public System.Collections.Generic.IList LoggedHeaderNames { get { throw null; } } + public System.Collections.Generic.IList LoggedQueryParameters { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HttpHeader : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HttpHeader(string name, string value) { throw null; } + public string Name { get { throw null; } } + public string Value { get { throw null; } } + public bool Equals(Azure.Core.HttpHeader other) { throw null; } + public override bool Equals(object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public override string ToString() { throw null; } + public static partial class Common + { + public static readonly Azure.Core.HttpHeader FormUrlEncodedContentType; + public static readonly Azure.Core.HttpHeader JsonAccept; + public static readonly Azure.Core.HttpHeader JsonContentType; + public static readonly Azure.Core.HttpHeader OctetStreamContentType; + } + public static partial class Names + { + public static string Accept { get { throw null; } } + public static string Authorization { get { throw null; } } + public static string ContentLength { get { throw null; } } + public static string ContentType { get { throw null; } } + public static string Date { get { throw null; } } + public static string ETag { get { throw null; } } + public static string IfMatch { get { throw null; } } + public static string IfModifiedSince { get { throw null; } } + public static string IfNoneMatch { get { throw null; } } + public static string IfUnmodifiedSince { get { throw null; } } + public static string Range { get { throw null; } } + public static string UserAgent { get { throw null; } } + public static string XMsDate { get { throw null; } } + public static string XMsRange { get { throw null; } } + public static string XMsRequestId { get { throw null; } } + } + } + public sealed partial class HttpMessage : System.IDisposable + { + public HttpMessage(Azure.Core.Request request, Azure.Core.ResponseClassifier responseClassifier) { } + public bool BufferResponse { get { throw null; } set { } } + public System.Threading.CancellationToken CancellationToken { get { throw null; } } + public bool HasResponse { get { throw null; } } + public Azure.Core.Request Request { get { throw null; } } + public Azure.Response Response { get { throw null; } set { } } + public Azure.Core.ResponseClassifier ResponseClassifier { get { throw null; } } + public void Dispose() { } + public System.IO.Stream? ExtractResponseContent() { throw null; } + public void SetProperty(string name, object value) { } + public bool TryGetProperty(string name, out object? value) { throw null; } + } + public enum HttpPipelinePosition + { + PerCall = 0, + PerRetry = 1, + } + public abstract partial class Request : System.IDisposable + { + protected Request() { } + public abstract string ClientRequestId { get; set; } + public virtual Azure.Core.RequestContent? Content { get { throw null; } set { } } + public Azure.Core.RequestHeaders Headers { get { throw null; } } + public virtual Azure.Core.RequestMethod Method { get { throw null; } set { } } + public virtual Azure.Core.RequestUriBuilder Uri { get { throw null; } set { } } + protected internal abstract void AddHeader(string name, string value); + protected internal abstract bool ContainsHeader(string name); + public abstract void Dispose(); + protected internal abstract System.Collections.Generic.IEnumerable EnumerateHeaders(); + protected internal abstract bool RemoveHeader(string name); + protected internal virtual void SetHeader(string name, string value) { } + protected internal abstract bool TryGetHeader(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value); + protected internal abstract bool TryGetHeaderValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values); + } + public abstract partial class RequestContent : System.IDisposable + { + protected RequestContent() { } + public static Azure.Core.RequestContent Create(System.Buffers.ReadOnlySequence bytes) { throw null; } + public static Azure.Core.RequestContent Create(byte[] bytes) { throw null; } + public static Azure.Core.RequestContent Create(byte[] bytes, int index, int length) { throw null; } + public static Azure.Core.RequestContent Create(System.IO.Stream stream) { throw null; } + public static Azure.Core.RequestContent Create(System.ReadOnlyMemory bytes) { throw null; } + public abstract void Dispose(); + public abstract bool TryComputeLength(out long length); + public abstract void WriteTo(System.IO.Stream stream, System.Threading.CancellationToken cancellation); + public abstract System.Threading.Tasks.Task WriteToAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellation); + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RequestHeaders : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public void Add(Azure.Core.HttpHeader header) { } + public void Add(string name, string value) { } + public bool Contains(string name) { throw null; } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public bool Remove(string name) { throw null; } + public void SetValue(string name, string value) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public bool TryGetValue(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value) { throw null; } + public bool TryGetValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RequestMethod : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RequestMethod(string method) { throw null; } + public static Azure.Core.RequestMethod Delete { get { throw null; } } + public static Azure.Core.RequestMethod Get { get { throw null; } } + public static Azure.Core.RequestMethod Head { get { throw null; } } + public string Method { get { throw null; } } + public static Azure.Core.RequestMethod Options { get { throw null; } } + public static Azure.Core.RequestMethod Patch { get { throw null; } } + public static Azure.Core.RequestMethod Post { get { throw null; } } + public static Azure.Core.RequestMethod Put { get { throw null; } } + public static Azure.Core.RequestMethod Trace { get { throw null; } } + public bool Equals(Azure.Core.RequestMethod other) { throw null; } + public override bool Equals(object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Core.RequestMethod left, Azure.Core.RequestMethod right) { throw null; } + public static bool operator !=(Azure.Core.RequestMethod left, Azure.Core.RequestMethod right) { throw null; } + public static Azure.Core.RequestMethod Parse(string method) { throw null; } + public override string ToString() { throw null; } + } + public partial class RequestUriBuilder + { + public RequestUriBuilder() { } + public string? Host { get { throw null; } set { } } + public string Path { get { throw null; } set { } } + public string PathAndQuery { get { throw null; } } + public int Port { get { throw null; } set { } } + public string Query { get { throw null; } set { } } + public string? Scheme { get { throw null; } set { } } + public void AppendPath(string value) { } + public void AppendPath(string value, bool escape) { } + public void AppendQuery(string name, string value) { } + public void AppendQuery(string name, string value, bool escapeValue) { } + public void Reset(System.Uri value) { } + public override string ToString() { throw null; } + public System.Uri ToUri() { throw null; } + } + public partial class ResponseClassifier + { + public ResponseClassifier() { } + public virtual bool IsErrorResponse(Azure.Core.HttpMessage message) { throw null; } + public virtual bool IsRetriable(Azure.Core.HttpMessage message, System.Exception exception) { throw null; } + public virtual bool IsRetriableException(System.Exception exception) { throw null; } + public virtual bool IsRetriableResponse(Azure.Core.HttpMessage message) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResponseHeaders : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public int? ContentLength { get { throw null; } } + public string? ContentType { get { throw null; } } + public System.DateTimeOffset? Date { get { throw null; } } + public Azure.ETag? ETag { get { throw null; } } + public string? RequestId { get { throw null; } } + public bool Contains(string name) { throw null; } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public bool TryGetValue(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value) { throw null; } + public bool TryGetValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values) { throw null; } + } + public enum RetryMode + { + Fixed = 0, + Exponential = 1, + } + public partial class RetryOptions + { + internal RetryOptions() { } + public System.TimeSpan Delay { get { throw null; } set { } } + public System.TimeSpan MaxDelay { get { throw null; } set { } } + public int MaxRetries { get { throw null; } set { } } + public Azure.Core.RetryMode Mode { get { throw null; } set { } } + public System.TimeSpan NetworkTimeout { get { throw null; } set { } } + } + public abstract partial class TokenCredential + { + protected TokenCredential() { } + public abstract Azure.Core.AccessToken GetToken(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.ValueTask GetTokenAsync(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken); + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TokenRequestContext + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TokenRequestContext(string[] scopes, string? parentRequestId = null) { throw null; } + public string? ParentRequestId { get { throw null; } } + public string[] Scopes { get { throw null; } } + } +} +namespace Azure.Core.Cryptography +{ + public partial interface IKeyEncryptionKey + { + string KeyId { get; } + byte[] UnwrapKey(string algorithm, System.ReadOnlyMemory encryptedKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task UnwrapKeyAsync(string algorithm, System.ReadOnlyMemory encryptedKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + byte[] WrapKey(string algorithm, System.ReadOnlyMemory key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task WrapKeyAsync(string algorithm, System.ReadOnlyMemory key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + public partial interface IKeyEncryptionKeyResolver + { + Azure.Core.Cryptography.IKeyEncryptionKey Resolve(string keyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ResolveAsync(string keyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} +namespace Azure.Core.Diagnostics +{ + public partial class AzureEventSourceListener : System.Diagnostics.Tracing.EventListener + { + public const string TraitName = "AzureEventSource"; + public const string TraitValue = "true"; + public AzureEventSourceListener(System.Action log, System.Diagnostics.Tracing.EventLevel level) { } + public static Azure.Core.Diagnostics.AzureEventSourceListener CreateConsoleLogger(System.Diagnostics.Tracing.EventLevel level = System.Diagnostics.Tracing.EventLevel.Informational) { throw null; } + public static Azure.Core.Diagnostics.AzureEventSourceListener CreateTraceLogger(System.Diagnostics.Tracing.EventLevel level = System.Diagnostics.Tracing.EventLevel.Informational) { throw null; } + protected sealed override void OnEventSourceCreated(System.Diagnostics.Tracing.EventSource eventSource) { } + protected sealed override void OnEventWritten(System.Diagnostics.Tracing.EventWrittenEventArgs eventData) { } + } +} +namespace Azure.Core.Extensions +{ + public partial interface IAzureClientBuilder where TOptions : class + { + } + public partial interface IAzureClientFactoryBuilder + { + Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(System.Func clientFactory) where TOptions : class; + } + public partial interface IAzureClientFactoryBuilderWithConfiguration : Azure.Core.Extensions.IAzureClientFactoryBuilder + { + Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(TConfiguration configuration) where TOptions : class; + } + public partial interface IAzureClientFactoryBuilderWithCredential + { + Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(System.Func clientFactory, bool requiresCredential = true) where TOptions : class; + } +} +namespace Azure.Core.Pipeline +{ + public partial class BearerTokenAuthenticationPolicy : Azure.Core.Pipeline.HttpPipelinePolicy + { + public BearerTokenAuthenticationPolicy(Azure.Core.TokenCredential credential, System.Collections.Generic.IEnumerable scopes) { } + public BearerTokenAuthenticationPolicy(Azure.Core.TokenCredential credential, string scope) { } + public override void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } + public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } + } + public partial class HttpClientTransport : Azure.Core.Pipeline.HttpPipelineTransport + { + public static readonly Azure.Core.Pipeline.HttpClientTransport Shared; + public HttpClientTransport() { } + public HttpClientTransport(System.Net.Http.HttpClient client) { } + public sealed override Azure.Core.Request CreateRequest() { throw null; } + public override void Process(Azure.Core.HttpMessage message) { } + public sealed override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message) { throw null; } + } + public partial class HttpPipeline + { + public HttpPipeline(Azure.Core.Pipeline.HttpPipelineTransport transport, Azure.Core.Pipeline.HttpPipelinePolicy[]? policies = null, Azure.Core.ResponseClassifier? responseClassifier = null) { } + public Azure.Core.ResponseClassifier ResponseClassifier { get { throw null; } } + public static System.IDisposable CreateClientRequestIdScope(string? clientRequestId) { throw null; } + public Azure.Core.HttpMessage CreateMessage() { throw null; } + public Azure.Core.Request CreateRequest() { throw null; } + public void Send(Azure.Core.HttpMessage message, System.Threading.CancellationToken cancellationToken) { } + public System.Threading.Tasks.ValueTask SendAsync(Azure.Core.HttpMessage message, System.Threading.CancellationToken cancellationToken) { throw null; } + public Azure.Response SendRequest(Azure.Core.Request request, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.ValueTask SendRequestAsync(Azure.Core.Request request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public static partial class HttpPipelineBuilder + { + public static Azure.Core.Pipeline.HttpPipeline Build(Azure.Core.ClientOptions options, params Azure.Core.Pipeline.HttpPipelinePolicy[] perRetryPolicies) { throw null; } + public static Azure.Core.Pipeline.HttpPipeline Build(Azure.Core.ClientOptions options, Azure.Core.Pipeline.HttpPipelinePolicy[] perCallPolicies, Azure.Core.Pipeline.HttpPipelinePolicy[] perRetryPolicies, Azure.Core.ResponseClassifier responseClassifier) { throw null; } + } + public abstract partial class HttpPipelinePolicy + { + protected HttpPipelinePolicy() { } + public abstract void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline); + public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline); + protected static void ProcessNext(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } + protected static System.Threading.Tasks.ValueTask ProcessNextAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } + } + public abstract partial class HttpPipelineSynchronousPolicy : Azure.Core.Pipeline.HttpPipelinePolicy + { + protected HttpPipelineSynchronousPolicy() { } + public virtual void OnReceivedResponse(Azure.Core.HttpMessage message) { } + public virtual void OnSendingRequest(Azure.Core.HttpMessage message) { } + public override void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } + public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } + } + public abstract partial class HttpPipelineTransport + { + protected HttpPipelineTransport() { } + public abstract Azure.Core.Request CreateRequest(); + public abstract void Process(Azure.Core.HttpMessage message); + public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message); + } +} +namespace Azure.Core.Serialization +{ + public partial interface IMemberNameConverter + { + string? ConvertMemberName(System.Reflection.MemberInfo member); + } + public partial class JsonObjectSerializer : Azure.Core.Serialization.ObjectSerializer, Azure.Core.Serialization.IMemberNameConverter + { + public JsonObjectSerializer() { } + public JsonObjectSerializer(System.Text.Json.JsonSerializerOptions options) { } + string? Azure.Core.Serialization.IMemberNameConverter.ConvertMemberName(System.Reflection.MemberInfo member) { throw null; } + public override object? Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } + public override System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } + public override void Serialize(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { } + public override System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public abstract partial class ObjectSerializer + { + protected ObjectSerializer() { } + public abstract object? Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); + public abstract void Serialize(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken); + } +} diff --git a/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs b/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs index c0b60287caf04..605ec113f5fe1 100644 --- a/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs +++ b/sdk/core/Azure.Core/api/Azure.Core.netstandard2.0.cs @@ -12,7 +12,7 @@ protected AsyncPageable(System.Threading.CancellationToken cancellationToken) { [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override string ToString() { throw null; } + public override string? ToString() { throw null; } } public partial class AzureKeyCredential { @@ -66,12 +66,12 @@ protected Operation() { } public abstract string Id { get; } public abstract T Value { get; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } + public override bool Equals(object? obj) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } public abstract Azure.Response GetRawResponse(); [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override string ToString() { throw null; } + public override string? ToString() { throw null; } public abstract Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); public abstract System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); public abstract System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); @@ -90,7 +90,7 @@ protected Pageable(System.Threading.CancellationToken cancellationToken) { } public override int GetHashCode() { throw null; } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override string ToString() { throw null; } + public override string? ToString() { throw null; } } public abstract partial class Page { @@ -104,7 +104,7 @@ protected Page() { } public override int GetHashCode() { throw null; } public abstract Azure.Response GetRawResponse(); [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override string ToString() { throw null; } + public override string? ToString() { throw null; } } public partial class RequestConditions : Azure.MatchConditions { @@ -178,7 +178,7 @@ public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core. [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override string ToString() { throw null; } + public override string? ToString() { throw null; } } public partial class DiagnosticsOptions { @@ -506,16 +506,16 @@ public partial class JsonObjectSerializer : Azure.Core.Serialization.ObjectSeria public JsonObjectSerializer() { } public JsonObjectSerializer(System.Text.Json.JsonSerializerOptions options) { } string? Azure.Core.Serialization.IMemberNameConverter.ConvertMemberName(System.Reflection.MemberInfo member) { throw null; } - public override object Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } - public override System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } + public override object? Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } + public override System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } public override void Serialize(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { } public override System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { throw null; } } public abstract partial class ObjectSerializer { protected ObjectSerializer() { } - public abstract object Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); - public abstract System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); + public abstract object? Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); public abstract void Serialize(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken); public abstract System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken); } diff --git a/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/api/Microsoft.Azure.Core.NewtonsoftJson.netstandard2.0.cs b/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/api/Microsoft.Azure.Core.NewtonsoftJson.netstandard2.0.cs index 4e0715785f50e..67871681f5c0c 100644 --- a/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/api/Microsoft.Azure.Core.NewtonsoftJson.netstandard2.0.cs +++ b/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/api/Microsoft.Azure.Core.NewtonsoftJson.netstandard2.0.cs @@ -6,7 +6,7 @@ public NewtonsoftJsonObjectSerializer() { } public NewtonsoftJsonObjectSerializer(Newtonsoft.Json.JsonSerializerSettings settings) { } string? Azure.Core.Serialization.IMemberNameConverter.ConvertMemberName(System.Reflection.MemberInfo member) { throw null; } public override object Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } - public override System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } + public override System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } public override void Serialize(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { } public override System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { throw null; } } diff --git a/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Serialization/NewtonsoftJsonObjectSerializer.cs b/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Serialization/NewtonsoftJsonObjectSerializer.cs index 11656de58d14f..ed4636fff9ff5 100644 --- a/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Serialization/NewtonsoftJsonObjectSerializer.cs +++ b/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Serialization/NewtonsoftJsonObjectSerializer.cs @@ -59,8 +59,8 @@ public override object Deserialize(Stream stream, Type returnType, CancellationT /// /// or is null. - public override ValueTask DeserializeAsync(Stream stream, Type returnType, CancellationToken cancellationToken) => - new ValueTask(Deserialize(stream, returnType, cancellationToken)); + public override ValueTask DeserializeAsync(Stream stream, Type returnType, CancellationToken cancellationToken) => + new ValueTask(Deserialize(stream, returnType, cancellationToken)); /// /// or is null. From 4d786031b0863a68bea110359810de8abf3977fb Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 23 Nov 2020 16:49:12 -0800 Subject: [PATCH 05/17] builds and fixes --- .../Serialization/SerializationExtensions.cs | 5 ++-- sdk/core/Azure.Core/src/Azure.Core.csproj | 2 +- sdk/core/Azure.Core/src/ETag.cs | 5 ++-- sdk/core/Azure.Core/src/ETagConverter.cs | 2 +- .../src/Internal/StringExtensions.cs | 30 +++++++++++++++++++ .../src/Pipeline/HttpPipelineBuilder.cs | 2 +- .../Pipeline/Internal/HttpEnvironmentProxy.cs | 4 +-- .../HttpEnvironmentProxyCredentials.cs | 4 +-- sdk/core/Azure.Core/src/RequestMethod.cs | 2 +- .../src/Shared/EventSourceEventFormatting.cs | 9 ++++-- .../src/Shared/HttpMessageSanitizer.cs | 2 +- ...Microsoft.Azure.Core.NewtonsoftJson.csproj | 2 +- 12 files changed, 52 insertions(+), 17 deletions(-) create mode 100644 sdk/core/Azure.Core/src/Internal/StringExtensions.cs diff --git a/sdk/core/Azure.Core.Experimental/src/Serialization/SerializationExtensions.cs b/sdk/core/Azure.Core.Experimental/src/Serialization/SerializationExtensions.cs index 8dfe7b9edda2e..c77acccf50031 100644 --- a/sdk/core/Azure.Core.Experimental/src/Serialization/SerializationExtensions.cs +++ b/sdk/core/Azure.Core.Experimental/src/Serialization/SerializationExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Threading; using System.Threading.Tasks; @@ -28,7 +29,7 @@ public static class SerializationExtensions /// The to use during deserialization. ///The data converted to the specified type. public static T ToObject(this BinaryData data, ObjectSerializer serializer, CancellationToken cancellationToken = default) => - (T)serializer.Deserialize(data.ToStream(), typeof(T), cancellationToken); + (T)serializer.Deserialize(data.ToStream(), typeof(T), cancellationToken)!; /// /// Converts the to the specified type using @@ -42,7 +43,7 @@ public static T ToObject(this BinaryData data, ObjectSerializer serializer, C /// The to use during deserialization. ///The data converted to the specified type. public static async ValueTask ToObjectAsync(this BinaryData data, ObjectSerializer serializer, CancellationToken cancellationToken = default) => - (T)await serializer.DeserializeAsync(data.ToStream(), typeof(T), cancellationToken).ConfigureAwait(false); + (T)(await serializer.DeserializeAsync(data.ToStream(), typeof(T), cancellationToken).ConfigureAwait(false))!; /// /// Convert the provided value to it's binary representation and return it as a instance. diff --git a/sdk/core/Azure.Core/src/Azure.Core.csproj b/sdk/core/Azure.Core/src/Azure.Core.csproj index b8a5e76eb6075..f2366f92968d7 100644 --- a/sdk/core/Azure.Core/src/Azure.Core.csproj +++ b/sdk/core/Azure.Core/src/Azure.Core.csproj @@ -7,7 +7,7 @@ Microsoft Azure Client Pipeline enable $(DefineConstants);AZURE_NULLABLE - $(RequiredTargetFrameworks);net461 + $(RequiredTargetFrameworks);net461;net5.0 true false diff --git a/sdk/core/Azure.Core/src/ETag.cs b/sdk/core/Azure.Core/src/ETag.cs index 437a9644848a7..c2af4eb088d2d 100644 --- a/sdk/core/Azure.Core/src/ETag.cs +++ b/sdk/core/Azure.Core/src/ETag.cs @@ -4,6 +4,7 @@ using System; using System.ComponentModel; using System.Text.Json.Serialization; +using Azure.Core; namespace Azure { @@ -18,7 +19,7 @@ namespace Azure private const string WeakETagPrefix = "W/\""; private const string DefaultFormat = "G"; private const string HeaderFormat = "H"; - private readonly string _value; + private readonly string? _value; /// /// Creates a new instance of . @@ -73,7 +74,7 @@ public override bool Equals(object? obj) /// public override int GetHashCode() { - return _value?.GetHashCode() ?? 0; + return _value.GetHashCodeOrdinal(); } /// diff --git a/sdk/core/Azure.Core/src/ETagConverter.cs b/sdk/core/Azure.Core/src/ETagConverter.cs index 11df83c3c14b0..3458caa0cf346 100644 --- a/sdk/core/Azure.Core/src/ETagConverter.cs +++ b/sdk/core/Azure.Core/src/ETagConverter.cs @@ -11,7 +11,7 @@ internal class ETagConverter: JsonConverter { public override ETag Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - string value = reader.GetString(); + string? value = reader.GetString(); if (value == null) { return default; diff --git a/sdk/core/Azure.Core/src/Internal/StringExtensions.cs b/sdk/core/Azure.Core/src/Internal/StringExtensions.cs new file mode 100644 index 0000000000000..8be52a7589148 --- /dev/null +++ b/sdk/core/Azure.Core/src/Internal/StringExtensions.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; + +namespace Azure.Core +{ + internal static class StringExtensions + { + public static int IndexOfOrdinal(this string s, char c) + { +#if NET5_0 + return s.IndexOf(c, StringComparison.Ordinal); +#else + return s.IndexOf(c); +#endif + } + + public static int GetHashCodeOrdinal(this string? s) + { + if (s == null) return 0; + +#if NET5_0 + return s.GetHashCode(StringComparison.Ordinal); +#else + return StringComparer.OrdinalIgnoreCase.GetHashCode(s); +#endif + } + } +} \ No newline at end of file diff --git a/sdk/core/Azure.Core/src/Pipeline/HttpPipelineBuilder.cs b/sdk/core/Azure.Core/src/Pipeline/HttpPipelineBuilder.cs index eab957e53d52d..a1232da4275aa 100644 --- a/sdk/core/Azure.Core/src/Pipeline/HttpPipelineBuilder.cs +++ b/sdk/core/Azure.Core/src/Pipeline/HttpPipelineBuilder.cs @@ -109,7 +109,7 @@ internal static TelemetryPolicy CreateTelemetryPolicy(ClientOptions options) assemblyName = assemblyName.Substring(PackagePrefix.Length); } - int hashSeparator = version.IndexOf('+'); + int hashSeparator = version.IndexOfOrdinal('+'); if (hashSeparator != -1) { version = version.Substring(0, hashSeparator); diff --git a/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxy.cs b/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxy.cs index b6c91fd894193..f2d8e5a0b866f 100644 --- a/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxy.cs +++ b/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxy.cs @@ -139,7 +139,7 @@ private static Uri GetUriFromString(string value) catch { }; value = value.Substring(separatorIndex + 1); - separatorIndex = auth.IndexOf(':'); + separatorIndex = auth.IndexOfOrdinal(':'); if (separatorIndex == -1) { user = auth; @@ -151,7 +151,7 @@ private static Uri GetUriFromString(string value) } } - int ipV6AddressEnd = value.IndexOf(']'); + int ipV6AddressEnd = value.IndexOfOrdinal(']'); separatorIndex = value.LastIndexOf(':'); string host; // No ':' or it is part of IPv6 address. diff --git a/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxyCredentials.cs b/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxyCredentials.cs index 664b2e7553e94..f51829d646aa4 100644 --- a/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxyCredentials.cs +++ b/sdk/core/Azure.Core/src/Pipeline/Internal/HttpEnvironmentProxyCredentials.cs @@ -71,14 +71,14 @@ private static NetworkCredential GetCredentialsFromString(string value) string password = ""; string domain = null; - int idx = value.IndexOf(':'); + int idx = value.IndexOfOrdinal(':'); if (idx != -1) { password = value.Substring(idx + 1); value = value.Substring(0, idx); } - idx = value.IndexOf('\\'); + idx = value.IndexOfOrdinal('\\'); if (idx != -1) { domain = value.Substring(0, idx); diff --git a/sdk/core/Azure.Core/src/RequestMethod.cs b/sdk/core/Azure.Core/src/RequestMethod.cs index b5c1aba93214b..cdd297c14b182 100644 --- a/sdk/core/Azure.Core/src/RequestMethod.cs +++ b/sdk/core/Azure.Core/src/RequestMethod.cs @@ -130,7 +130,7 @@ public override bool Equals(object? obj) /// public override int GetHashCode() { - return Method?.GetHashCode() ?? 0; + return Method.GetHashCodeOrdinal(); } /// diff --git a/sdk/core/Azure.Core/src/Shared/EventSourceEventFormatting.cs b/sdk/core/Azure.Core/src/Shared/EventSourceEventFormatting.cs index e348bc33b3bf8..01f675ca7b7ca 100644 --- a/sdk/core/Azure.Core/src/Shared/EventSourceEventFormatting.cs +++ b/sdk/core/Azure.Core/src/Shared/EventSourceEventFormatting.cs @@ -40,10 +40,13 @@ public static string Format(EventWrittenEventArgs eventData) stringBuilder.Append(nameof(eventData.Message)).Append(" = ").Append(eventData.Message); } - for (int i = 0; i < eventData.PayloadNames.Count; i++) + if (eventData.PayloadNames != null) { - stringBuilder.AppendLine(); - stringBuilder.Append(eventData.PayloadNames[i]).Append(" = ").Append(payloadArray[i]); + for (int i = 0; i < eventData.PayloadNames.Count; i++) + { + stringBuilder.AppendLine(); + stringBuilder.Append(eventData.PayloadNames[i]).Append(" = ").Append(payloadArray[i]); + } } return stringBuilder.ToString(); diff --git a/sdk/core/Azure.Core/src/Shared/HttpMessageSanitizer.cs b/sdk/core/Azure.Core/src/Shared/HttpMessageSanitizer.cs index a8b705f3f6b53..d04028c7a33b7 100644 --- a/sdk/core/Azure.Core/src/Shared/HttpMessageSanitizer.cs +++ b/sdk/core/Azure.Core/src/Shared/HttpMessageSanitizer.cs @@ -44,7 +44,7 @@ public string SanitizeUrl(string url) return url; } - int indexOfQuerySeparator = url.IndexOf('?'); + int indexOfQuerySeparator = url.IndexOfOrdinal('?'); if (indexOfQuerySeparator == -1) { return url; diff --git a/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Microsoft.Azure.Core.NewtonsoftJson.csproj b/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Microsoft.Azure.Core.NewtonsoftJson.csproj index 069647f17efb8..9e80a313305db 100644 --- a/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Microsoft.Azure.Core.NewtonsoftJson.csproj +++ b/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Microsoft.Azure.Core.NewtonsoftJson.csproj @@ -11,7 +11,7 @@ - + From 1fb414fced1d3aee9914dd284c29bc9162da579e Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 23 Nov 2020 16:53:31 -0800 Subject: [PATCH 06/17] Comparer fix --- sdk/core/Azure.Core/src/Internal/StringExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/Azure.Core/src/Internal/StringExtensions.cs b/sdk/core/Azure.Core/src/Internal/StringExtensions.cs index 8be52a7589148..0e9e9f4b8ef23 100644 --- a/sdk/core/Azure.Core/src/Internal/StringExtensions.cs +++ b/sdk/core/Azure.Core/src/Internal/StringExtensions.cs @@ -23,7 +23,7 @@ public static int GetHashCodeOrdinal(this string? s) #if NET5_0 return s.GetHashCode(StringComparison.Ordinal); #else - return StringComparer.OrdinalIgnoreCase.GetHashCode(s); + return StringComparer.Ordinal.GetHashCode(s); #endif } } From c5247ad4e02b8765f84e85a5e819b87534c455e6 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 23 Nov 2020 16:54:58 -0800 Subject: [PATCH 07/17] export api --- sdk/core/Azure.Core/api/Azure.Core.net461.cs | 26 + sdk/core/Azure.Core/api/Azure.Core.net5.0.cs | 548 +++++++++++++++++++ 2 files changed, 574 insertions(+) create mode 100644 sdk/core/Azure.Core/api/Azure.Core.net5.0.cs diff --git a/sdk/core/Azure.Core/api/Azure.Core.net461.cs b/sdk/core/Azure.Core/api/Azure.Core.net461.cs index 605ec113f5fe1..f22d63a15b29a 100644 --- a/sdk/core/Azure.Core/api/Azure.Core.net461.cs +++ b/sdk/core/Azure.Core/api/Azure.Core.net461.cs @@ -8,6 +8,7 @@ protected AsyncPageable(System.Threading.CancellationToken cancellationToken) { public abstract System.Collections.Generic.IAsyncEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?)); [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object? obj) { throw null; } + public static Azure.AsyncPageable FromPages(System.Collections.Generic.IEnumerable> pages) { throw null; } public virtual System.Collections.Generic.IAsyncEnumerator GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } @@ -34,7 +35,9 @@ public void Update(string key) { } public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ETag left, Azure.ETag right) { throw null; } public static bool operator !=(Azure.ETag left, Azure.ETag right) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override string ToString() { throw null; } + public string ToString(string format) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct HttpRange : System.IEquatable @@ -52,6 +55,24 @@ public void Update(string key) { } public static bool operator !=(Azure.HttpRange left, Azure.HttpRange right) { throw null; } public override string ToString() { throw null; } } + public partial class JsonPatchDocument + { + public JsonPatchDocument() { } + public JsonPatchDocument(Azure.Core.Serialization.ObjectSerializer serializer) { } + public JsonPatchDocument(System.ReadOnlyMemory rawDocument) { } + public JsonPatchDocument(System.ReadOnlyMemory rawDocument, Azure.Core.Serialization.ObjectSerializer serializer) { } + public void AppendAddRaw(string path, string rawJsonValue) { } + public void AppendAdd(string path, T value) { } + public void AppendCopy(string from, string path) { } + public void AppendMove(string from, string path) { } + public void AppendRemove(string path) { } + public void AppendReplaceRaw(string path, string rawJsonValue) { } + public void AppendReplace(string path, T value) { } + public void AppendTestRaw(string path, string rawJsonValue) { } + public void AppendTest(string path, T value) { } + public System.ReadOnlyMemory ToBytes() { throw null; } + public override string ToString() { throw null; } + } public partial class MatchConditions { public MatchConditions() { } @@ -85,6 +106,7 @@ protected Pageable(System.Threading.CancellationToken cancellationToken) { } public abstract System.Collections.Generic.IEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?)); [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object? obj) { throw null; } + public static Azure.Pageable FromPages(System.Collections.Generic.IEnumerable> pages) { throw null; } public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } @@ -216,15 +238,18 @@ public static partial class Names { public static string Accept { get { throw null; } } public static string Authorization { get { throw null; } } + public static string ContentDisposition { get { throw null; } } public static string ContentLength { get { throw null; } } public static string ContentType { get { throw null; } } public static string Date { get { throw null; } } public static string ETag { get { throw null; } } + public static string Host { get { throw null; } } public static string IfMatch { get { throw null; } } public static string IfModifiedSince { get { throw null; } } public static string IfNoneMatch { get { throw null; } } public static string IfUnmodifiedSince { get { throw null; } } public static string Range { get { throw null; } } + public static string Referer { get { throw null; } } public static string UserAgent { get { throw null; } } public static string XMsDate { get { throw null; } } public static string XMsRange { get { throw null; } } @@ -450,6 +475,7 @@ public partial class HttpClientTransport : Azure.Core.Pipeline.HttpPipelineTrans public static readonly Azure.Core.Pipeline.HttpClientTransport Shared; public HttpClientTransport() { } public HttpClientTransport(System.Net.Http.HttpClient client) { } + public HttpClientTransport(System.Net.Http.HttpMessageHandler messageHandler) { } public sealed override Azure.Core.Request CreateRequest() { throw null; } public override void Process(Azure.Core.HttpMessage message) { } public sealed override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message) { throw null; } diff --git a/sdk/core/Azure.Core/api/Azure.Core.net5.0.cs b/sdk/core/Azure.Core/api/Azure.Core.net5.0.cs new file mode 100644 index 0000000000000..bcabbc77fb10b --- /dev/null +++ b/sdk/core/Azure.Core/api/Azure.Core.net5.0.cs @@ -0,0 +1,548 @@ +namespace Azure +{ + public abstract partial class AsyncPageable : System.Collections.Generic.IAsyncEnumerable where T : notnull + { + protected AsyncPageable() { } + protected AsyncPageable(System.Threading.CancellationToken cancellationToken) { } + protected virtual System.Threading.CancellationToken CancellationToken { get { throw null; } } + public abstract System.Collections.Generic.IAsyncEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?)); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + public static Azure.AsyncPageable FromPages(System.Collections.Generic.IEnumerable> pages) { throw null; } + public virtual System.Collections.Generic.IAsyncEnumerator GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public partial class AzureKeyCredential + { + public AzureKeyCredential(string key) { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public string Key { get { throw null; } } + public void Update(string key) { } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ETag : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public static readonly Azure.ETag All; + public ETag(string etag) { throw null; } + public bool Equals(Azure.ETag other) { throw null; } + public override bool Equals(object? obj) { throw null; } + public bool Equals(string? other) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ETag left, Azure.ETag right) { throw null; } + public static bool operator !=(Azure.ETag left, Azure.ETag right) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string ToString() { throw null; } + public string ToString(string format) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HttpRange : System.IEquatable + { + private readonly int _dummyPrimitive; + public HttpRange(long offset = (long)0, long? length = default(long?)) { throw null; } + public long? Length { get { throw null; } } + public long Offset { get { throw null; } } + public bool Equals(Azure.HttpRange other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.HttpRange left, Azure.HttpRange right) { throw null; } + public static bool operator !=(Azure.HttpRange left, Azure.HttpRange right) { throw null; } + public override string ToString() { throw null; } + } + public partial class JsonPatchDocument + { + public JsonPatchDocument() { } + public JsonPatchDocument(Azure.Core.Serialization.ObjectSerializer serializer) { } + public JsonPatchDocument(System.ReadOnlyMemory rawDocument) { } + public JsonPatchDocument(System.ReadOnlyMemory rawDocument, Azure.Core.Serialization.ObjectSerializer serializer) { } + public void AppendAddRaw(string path, string rawJsonValue) { } + public void AppendAdd(string path, T value) { } + public void AppendCopy(string from, string path) { } + public void AppendMove(string from, string path) { } + public void AppendRemove(string path) { } + public void AppendReplaceRaw(string path, string rawJsonValue) { } + public void AppendReplace(string path, T value) { } + public void AppendTestRaw(string path, string rawJsonValue) { } + public void AppendTest(string path, T value) { } + public System.ReadOnlyMemory ToBytes() { throw null; } + public override string ToString() { throw null; } + } + public partial class MatchConditions + { + public MatchConditions() { } + public Azure.ETag? IfMatch { get { throw null; } set { } } + public Azure.ETag? IfNoneMatch { get { throw null; } set { } } + } + public abstract partial class Operation where T : notnull + { + protected Operation() { } + public abstract bool HasCompleted { get; } + public abstract bool HasValue { get; } + public abstract string Id { get; } + public abstract T Value { get; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public abstract Azure.Response GetRawResponse(); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + public abstract Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + public abstract System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + public abstract System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + public abstract System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken); + } + public abstract partial class Pageable : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where T : notnull + { + protected Pageable() { } + protected Pageable(System.Threading.CancellationToken cancellationToken) { } + protected virtual System.Threading.CancellationToken CancellationToken { get { throw null; } } + public abstract System.Collections.Generic.IEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?)); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + public static Azure.Pageable FromPages(System.Collections.Generic.IEnumerable> pages) { throw null; } + public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public abstract partial class Page + { + protected Page() { } + public abstract string? ContinuationToken { get; } + public abstract System.Collections.Generic.IReadOnlyList Values { get; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + public static Azure.Page FromValues(System.Collections.Generic.IReadOnlyList values, string? continuationToken, Azure.Response response) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public abstract Azure.Response GetRawResponse(); + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public partial class RequestConditions : Azure.MatchConditions + { + public RequestConditions() { } + public System.DateTimeOffset? IfModifiedSince { get { throw null; } set { } } + public System.DateTimeOffset? IfUnmodifiedSince { get { throw null; } set { } } + } + public partial class RequestFailedException : System.Exception, System.Runtime.Serialization.ISerializable + { + public RequestFailedException(int status, string message) { } + public RequestFailedException(int status, string message, System.Exception? innerException) { } + public RequestFailedException(int status, string message, string? errorCode, System.Exception? innerException) { } + protected RequestFailedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public RequestFailedException(string message) { } + public RequestFailedException(string message, System.Exception? innerException) { } + public string? ErrorCode { get { throw null; } } + public int Status { get { throw null; } } + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public abstract partial class Response : System.IDisposable + { + protected Response() { } + public abstract string ClientRequestId { get; set; } + public abstract System.IO.Stream? ContentStream { get; set; } + public virtual Azure.Core.ResponseHeaders Headers { get { throw null; } } + public abstract string ReasonPhrase { get; } + public abstract int Status { get; } + protected internal abstract bool ContainsHeader(string name); + public abstract void Dispose(); + protected internal abstract System.Collections.Generic.IEnumerable EnumerateHeaders(); + public static Azure.Response FromValue(T value, Azure.Response response) { throw null; } + public override string ToString() { throw null; } + protected internal abstract bool TryGetHeader(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value); + protected internal abstract bool TryGetHeaderValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values); + } + public abstract partial class Response + { + protected Response() { } + public abstract T Value { get; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public abstract Azure.Response GetRawResponse(); + public static implicit operator T (Azure.Response response) { throw null; } + public override string ToString() { throw null; } + } +} +namespace Azure.Core +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public partial struct AccessToken + { + private object _dummy; + private int _dummyPrimitive; + public AccessToken(string accessToken, System.DateTimeOffset expiresOn) { throw null; } + public System.DateTimeOffset ExpiresOn { get { throw null; } } + public string Token { get { throw null; } } + public override bool Equals(object? obj) { throw null; } + public override int GetHashCode() { throw null; } + } + public abstract partial class ClientOptions + { + protected ClientOptions() { } + public Azure.Core.DiagnosticsOptions Diagnostics { get { throw null; } } + public Azure.Core.RetryOptions Retry { get { throw null; } } + public Azure.Core.Pipeline.HttpPipelineTransport Transport { get { throw null; } set { } } + public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object? obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override string? ToString() { throw null; } + } + public partial class DiagnosticsOptions + { + internal DiagnosticsOptions() { } + public string? ApplicationId { get { throw null; } set { } } + public static string? DefaultApplicationId { get { throw null; } set { } } + public bool IsDistributedTracingEnabled { get { throw null; } set { } } + public bool IsLoggingContentEnabled { get { throw null; } set { } } + public bool IsLoggingEnabled { get { throw null; } set { } } + public bool IsTelemetryEnabled { get { throw null; } set { } } + public int LoggedContentSizeLimit { get { throw null; } set { } } + public System.Collections.Generic.IList LoggedHeaderNames { get { throw null; } } + public System.Collections.Generic.IList LoggedQueryParameters { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HttpHeader : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HttpHeader(string name, string value) { throw null; } + public string Name { get { throw null; } } + public string Value { get { throw null; } } + public bool Equals(Azure.Core.HttpHeader other) { throw null; } + public override bool Equals(object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public override string ToString() { throw null; } + public static partial class Common + { + public static readonly Azure.Core.HttpHeader FormUrlEncodedContentType; + public static readonly Azure.Core.HttpHeader JsonAccept; + public static readonly Azure.Core.HttpHeader JsonContentType; + public static readonly Azure.Core.HttpHeader OctetStreamContentType; + } + public static partial class Names + { + public static string Accept { get { throw null; } } + public static string Authorization { get { throw null; } } + public static string ContentDisposition { get { throw null; } } + public static string ContentLength { get { throw null; } } + public static string ContentType { get { throw null; } } + public static string Date { get { throw null; } } + public static string ETag { get { throw null; } } + public static string Host { get { throw null; } } + public static string IfMatch { get { throw null; } } + public static string IfModifiedSince { get { throw null; } } + public static string IfNoneMatch { get { throw null; } } + public static string IfUnmodifiedSince { get { throw null; } } + public static string Range { get { throw null; } } + public static string Referer { get { throw null; } } + public static string UserAgent { get { throw null; } } + public static string XMsDate { get { throw null; } } + public static string XMsRange { get { throw null; } } + public static string XMsRequestId { get { throw null; } } + } + } + public sealed partial class HttpMessage : System.IDisposable + { + public HttpMessage(Azure.Core.Request request, Azure.Core.ResponseClassifier responseClassifier) { } + public bool BufferResponse { get { throw null; } set { } } + public System.Threading.CancellationToken CancellationToken { get { throw null; } } + public bool HasResponse { get { throw null; } } + public Azure.Core.Request Request { get { throw null; } } + public Azure.Response Response { get { throw null; } set { } } + public Azure.Core.ResponseClassifier ResponseClassifier { get { throw null; } } + public void Dispose() { } + public System.IO.Stream? ExtractResponseContent() { throw null; } + public void SetProperty(string name, object value) { } + public bool TryGetProperty(string name, out object? value) { throw null; } + } + public enum HttpPipelinePosition + { + PerCall = 0, + PerRetry = 1, + } + public abstract partial class Request : System.IDisposable + { + protected Request() { } + public abstract string ClientRequestId { get; set; } + public virtual Azure.Core.RequestContent? Content { get { throw null; } set { } } + public Azure.Core.RequestHeaders Headers { get { throw null; } } + public virtual Azure.Core.RequestMethod Method { get { throw null; } set { } } + public virtual Azure.Core.RequestUriBuilder Uri { get { throw null; } set { } } + protected internal abstract void AddHeader(string name, string value); + protected internal abstract bool ContainsHeader(string name); + public abstract void Dispose(); + protected internal abstract System.Collections.Generic.IEnumerable EnumerateHeaders(); + protected internal abstract bool RemoveHeader(string name); + protected internal virtual void SetHeader(string name, string value) { } + protected internal abstract bool TryGetHeader(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value); + protected internal abstract bool TryGetHeaderValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values); + } + public abstract partial class RequestContent : System.IDisposable + { + protected RequestContent() { } + public static Azure.Core.RequestContent Create(System.Buffers.ReadOnlySequence bytes) { throw null; } + public static Azure.Core.RequestContent Create(byte[] bytes) { throw null; } + public static Azure.Core.RequestContent Create(byte[] bytes, int index, int length) { throw null; } + public static Azure.Core.RequestContent Create(System.IO.Stream stream) { throw null; } + public static Azure.Core.RequestContent Create(System.ReadOnlyMemory bytes) { throw null; } + public abstract void Dispose(); + public abstract bool TryComputeLength(out long length); + public abstract void WriteTo(System.IO.Stream stream, System.Threading.CancellationToken cancellation); + public abstract System.Threading.Tasks.Task WriteToAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellation); + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RequestHeaders : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public void Add(Azure.Core.HttpHeader header) { } + public void Add(string name, string value) { } + public bool Contains(string name) { throw null; } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + public bool Remove(string name) { throw null; } + public void SetValue(string name, string value) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public bool TryGetValue(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value) { throw null; } + public bool TryGetValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RequestMethod : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RequestMethod(string method) { throw null; } + public static Azure.Core.RequestMethod Delete { get { throw null; } } + public static Azure.Core.RequestMethod Get { get { throw null; } } + public static Azure.Core.RequestMethod Head { get { throw null; } } + public string Method { get { throw null; } } + public static Azure.Core.RequestMethod Options { get { throw null; } } + public static Azure.Core.RequestMethod Patch { get { throw null; } } + public static Azure.Core.RequestMethod Post { get { throw null; } } + public static Azure.Core.RequestMethod Put { get { throw null; } } + public static Azure.Core.RequestMethod Trace { get { throw null; } } + public bool Equals(Azure.Core.RequestMethod other) { throw null; } + public override bool Equals(object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Core.RequestMethod left, Azure.Core.RequestMethod right) { throw null; } + public static bool operator !=(Azure.Core.RequestMethod left, Azure.Core.RequestMethod right) { throw null; } + public static Azure.Core.RequestMethod Parse(string method) { throw null; } + public override string ToString() { throw null; } + } + public partial class RequestUriBuilder + { + public RequestUriBuilder() { } + public string? Host { get { throw null; } set { } } + public string Path { get { throw null; } set { } } + public string PathAndQuery { get { throw null; } } + public int Port { get { throw null; } set { } } + public string Query { get { throw null; } set { } } + public string? Scheme { get { throw null; } set { } } + public void AppendPath(string value) { } + public void AppendPath(string value, bool escape) { } + public void AppendQuery(string name, string value) { } + public void AppendQuery(string name, string value, bool escapeValue) { } + public void Reset(System.Uri value) { } + public override string ToString() { throw null; } + public System.Uri ToUri() { throw null; } + } + public partial class ResponseClassifier + { + public ResponseClassifier() { } + public virtual bool IsErrorResponse(Azure.Core.HttpMessage message) { throw null; } + public virtual bool IsRetriable(Azure.Core.HttpMessage message, System.Exception exception) { throw null; } + public virtual bool IsRetriableException(System.Exception exception) { throw null; } + public virtual bool IsRetriableResponse(Azure.Core.HttpMessage message) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResponseHeaders : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public int? ContentLength { get { throw null; } } + public string? ContentType { get { throw null; } } + public System.DateTimeOffset? Date { get { throw null; } } + public Azure.ETag? ETag { get { throw null; } } + public string? RequestId { get { throw null; } } + public bool Contains(string name) { throw null; } + public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + public bool TryGetValue(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value) { throw null; } + public bool TryGetValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values) { throw null; } + } + public enum RetryMode + { + Fixed = 0, + Exponential = 1, + } + public partial class RetryOptions + { + internal RetryOptions() { } + public System.TimeSpan Delay { get { throw null; } set { } } + public System.TimeSpan MaxDelay { get { throw null; } set { } } + public int MaxRetries { get { throw null; } set { } } + public Azure.Core.RetryMode Mode { get { throw null; } set { } } + public System.TimeSpan NetworkTimeout { get { throw null; } set { } } + } + public abstract partial class TokenCredential + { + protected TokenCredential() { } + public abstract Azure.Core.AccessToken GetToken(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.ValueTask GetTokenAsync(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken); + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TokenRequestContext + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TokenRequestContext(string[] scopes, string? parentRequestId = null) { throw null; } + public string? ParentRequestId { get { throw null; } } + public string[] Scopes { get { throw null; } } + } +} +namespace Azure.Core.Cryptography +{ + public partial interface IKeyEncryptionKey + { + string KeyId { get; } + byte[] UnwrapKey(string algorithm, System.ReadOnlyMemory encryptedKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task UnwrapKeyAsync(string algorithm, System.ReadOnlyMemory encryptedKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + byte[] WrapKey(string algorithm, System.ReadOnlyMemory key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task WrapKeyAsync(string algorithm, System.ReadOnlyMemory key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } + public partial interface IKeyEncryptionKeyResolver + { + Azure.Core.Cryptography.IKeyEncryptionKey Resolve(string keyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + System.Threading.Tasks.Task ResolveAsync(string keyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } +} +namespace Azure.Core.Diagnostics +{ + public partial class AzureEventSourceListener : System.Diagnostics.Tracing.EventListener + { + public const string TraitName = "AzureEventSource"; + public const string TraitValue = "true"; + public AzureEventSourceListener(System.Action log, System.Diagnostics.Tracing.EventLevel level) { } + public static Azure.Core.Diagnostics.AzureEventSourceListener CreateConsoleLogger(System.Diagnostics.Tracing.EventLevel level = System.Diagnostics.Tracing.EventLevel.Informational) { throw null; } + public static Azure.Core.Diagnostics.AzureEventSourceListener CreateTraceLogger(System.Diagnostics.Tracing.EventLevel level = System.Diagnostics.Tracing.EventLevel.Informational) { throw null; } + protected sealed override void OnEventSourceCreated(System.Diagnostics.Tracing.EventSource eventSource) { } + protected sealed override void OnEventWritten(System.Diagnostics.Tracing.EventWrittenEventArgs eventData) { } + } +} +namespace Azure.Core.Extensions +{ + public partial interface IAzureClientBuilder where TOptions : class + { + } + public partial interface IAzureClientFactoryBuilder + { + Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(System.Func clientFactory) where TOptions : class; + } + public partial interface IAzureClientFactoryBuilderWithConfiguration : Azure.Core.Extensions.IAzureClientFactoryBuilder + { + Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(TConfiguration configuration) where TOptions : class; + } + public partial interface IAzureClientFactoryBuilderWithCredential + { + Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(System.Func clientFactory, bool requiresCredential = true) where TOptions : class; + } +} +namespace Azure.Core.Pipeline +{ + public partial class BearerTokenAuthenticationPolicy : Azure.Core.Pipeline.HttpPipelinePolicy + { + public BearerTokenAuthenticationPolicy(Azure.Core.TokenCredential credential, System.Collections.Generic.IEnumerable scopes) { } + public BearerTokenAuthenticationPolicy(Azure.Core.TokenCredential credential, string scope) { } + public override void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } + public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } + } + public partial class HttpClientTransport : Azure.Core.Pipeline.HttpPipelineTransport + { + public static readonly Azure.Core.Pipeline.HttpClientTransport Shared; + public HttpClientTransport() { } + public HttpClientTransport(System.Net.Http.HttpClient client) { } + public HttpClientTransport(System.Net.Http.HttpMessageHandler messageHandler) { } + public sealed override Azure.Core.Request CreateRequest() { throw null; } + public override void Process(Azure.Core.HttpMessage message) { } + public sealed override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message) { throw null; } + } + public partial class HttpPipeline + { + public HttpPipeline(Azure.Core.Pipeline.HttpPipelineTransport transport, Azure.Core.Pipeline.HttpPipelinePolicy[]? policies = null, Azure.Core.ResponseClassifier? responseClassifier = null) { } + public Azure.Core.ResponseClassifier ResponseClassifier { get { throw null; } } + public static System.IDisposable CreateClientRequestIdScope(string? clientRequestId) { throw null; } + public Azure.Core.HttpMessage CreateMessage() { throw null; } + public Azure.Core.Request CreateRequest() { throw null; } + public void Send(Azure.Core.HttpMessage message, System.Threading.CancellationToken cancellationToken) { } + public System.Threading.Tasks.ValueTask SendAsync(Azure.Core.HttpMessage message, System.Threading.CancellationToken cancellationToken) { throw null; } + public Azure.Response SendRequest(Azure.Core.Request request, System.Threading.CancellationToken cancellationToken) { throw null; } + public System.Threading.Tasks.ValueTask SendRequestAsync(Azure.Core.Request request, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public static partial class HttpPipelineBuilder + { + public static Azure.Core.Pipeline.HttpPipeline Build(Azure.Core.ClientOptions options, params Azure.Core.Pipeline.HttpPipelinePolicy[] perRetryPolicies) { throw null; } + public static Azure.Core.Pipeline.HttpPipeline Build(Azure.Core.ClientOptions options, Azure.Core.Pipeline.HttpPipelinePolicy[] perCallPolicies, Azure.Core.Pipeline.HttpPipelinePolicy[] perRetryPolicies, Azure.Core.ResponseClassifier responseClassifier) { throw null; } + } + public abstract partial class HttpPipelinePolicy + { + protected HttpPipelinePolicy() { } + public abstract void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline); + public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline); + protected static void ProcessNext(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } + protected static System.Threading.Tasks.ValueTask ProcessNextAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } + } + public abstract partial class HttpPipelineSynchronousPolicy : Azure.Core.Pipeline.HttpPipelinePolicy + { + protected HttpPipelineSynchronousPolicy() { } + public virtual void OnReceivedResponse(Azure.Core.HttpMessage message) { } + public virtual void OnSendingRequest(Azure.Core.HttpMessage message) { } + public override void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } + public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } + } + public abstract partial class HttpPipelineTransport + { + protected HttpPipelineTransport() { } + public abstract Azure.Core.Request CreateRequest(); + public abstract void Process(Azure.Core.HttpMessage message); + public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message); + } +} +namespace Azure.Core.Serialization +{ + public partial interface IMemberNameConverter + { + string? ConvertMemberName(System.Reflection.MemberInfo member); + } + public partial class JsonObjectSerializer : Azure.Core.Serialization.ObjectSerializer, Azure.Core.Serialization.IMemberNameConverter + { + public JsonObjectSerializer() { } + public JsonObjectSerializer(System.Text.Json.JsonSerializerOptions options) { } + string? Azure.Core.Serialization.IMemberNameConverter.ConvertMemberName(System.Reflection.MemberInfo member) { throw null; } + public override object? Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } + public override System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } + public override void Serialize(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { } + public override System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { throw null; } + } + public abstract partial class ObjectSerializer + { + protected ObjectSerializer() { } + public abstract object? Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); + public abstract void Serialize(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken); + public abstract System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken); + } +} From dd594a01db4f5f8436639f9876c7ad48420a7115 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 23 Nov 2020 17:00:39 -0800 Subject: [PATCH 08/17] adjust ifdefs --- .../src/Pipeline/HttpClientTransport.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs b/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs index e0382ee1ce100..822c390fc9222 100644 --- a/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs +++ b/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs @@ -58,7 +58,7 @@ public sealed override Request CreateRequest() /// public override void Process(HttpMessage message) { -#if NETCOREAPP +#if NET5_0 ProcessAsync(message, false).EnsureCompleted(); #else // Intentionally blocking here @@ -81,7 +81,7 @@ private async Task ProcessAsync(HttpMessage message, bool async) Stream? contentStream = null; try { -#if NETCOREAPP +#if NET5_0 if (!async) { responseMessage = _client.Send(httpRequest, HttpCompletionOption.ResponseHeadersRead, message.CancellationToken); @@ -95,16 +95,19 @@ private async Task ProcessAsync(HttpMessage message, bool async) if (responseMessage.Content != null) { -#if NETCOREAPP +#if NET5_0 if (!async) { - contentStream = responseMessage.Content.ReadAsStream(); + contentStream = responseMessage.Content.ReadAsStream(message.CancellationToken); } else -#endif { - contentStream = await responseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false); + contentStream = await responseMessage.Content.ReadAsStreamAsync(message.CancellationToken).ConfigureAwait(false); } +#else + contentStream = await responseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false); +#endif + } } From 8282891297be34029fd3ca25fca8953441a7e20e Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 23 Nov 2020 17:06:35 -0800 Subject: [PATCH 09/17] cleanup implementation --- .../src/Pipeline/HttpClientTransport.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs b/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs index 31dcf31dd74fb..b64040657720c 100644 --- a/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs +++ b/sdk/core/Azure.Core/src/Pipeline/HttpClientTransport.cs @@ -96,13 +96,13 @@ private async Task ProcessAsync(HttpMessage message, bool async) if (responseMessage.Content != null) { #if NET5_0 - if (!async) + if (async) { - contentStream = responseMessage.Content.ReadAsStream(message.CancellationToken); + contentStream = await responseMessage.Content.ReadAsStreamAsync(message.CancellationToken).ConfigureAwait(false); } else { - contentStream = await responseMessage.Content.ReadAsStreamAsync(message.CancellationToken).ConfigureAwait(false); + contentStream = responseMessage.Content.ReadAsStream(message.CancellationToken); } #else contentStream = await responseMessage.Content.ReadAsStreamAsync().ConfigureAwait(false); @@ -393,11 +393,17 @@ protected override bool TryComputeLength(out long length) return PipelineContent!.TryComputeLength(out length); } -#if NETCOREAPP +#if NET5_0 + protected override async Task SerializeToStreamAsync(Stream stream, TransportContext? context, CancellationToken cancellationToken) + { + Debug.Assert(PipelineContent != null); + await PipelineContent!.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + protected override void SerializeToStream(Stream stream, TransportContext? context, CancellationToken cancellationToken) { Debug.Assert(PipelineContent != null); - PipelineContent.WriteTo(stream, CancellationToken); + PipelineContent.WriteTo(stream, cancellationToken); } #endif } From 1c897ece5c4a1ea975a6b8f42ceb9d9620a0d18d Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 23 Nov 2020 17:12:38 -0800 Subject: [PATCH 10/17] rem extra file --- .../api/Azure.Core.netcoreapp5.0.cs | 522 ------------------ 1 file changed, 522 deletions(-) delete mode 100644 sdk/core/Azure.Core/api/Azure.Core.netcoreapp5.0.cs diff --git a/sdk/core/Azure.Core/api/Azure.Core.netcoreapp5.0.cs b/sdk/core/Azure.Core/api/Azure.Core.netcoreapp5.0.cs deleted file mode 100644 index 2d37502726a37..0000000000000 --- a/sdk/core/Azure.Core/api/Azure.Core.netcoreapp5.0.cs +++ /dev/null @@ -1,522 +0,0 @@ -namespace Azure -{ - public abstract partial class AsyncPageable : System.Collections.Generic.IAsyncEnumerable where T : notnull - { - protected AsyncPageable() { } - protected AsyncPageable(System.Threading.CancellationToken cancellationToken) { } - protected virtual System.Threading.CancellationToken CancellationToken { get { throw null; } } - public abstract System.Collections.Generic.IAsyncEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?)); - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object? obj) { throw null; } - public virtual System.Collections.Generic.IAsyncEnumerator GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override string? ToString() { throw null; } - } - public partial class AzureKeyCredential - { - public AzureKeyCredential(string key) { } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public string Key { get { throw null; } } - public void Update(string key) { } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct ETag : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public static readonly Azure.ETag All; - public ETag(string etag) { throw null; } - public bool Equals(Azure.ETag other) { throw null; } - public override bool Equals(object? obj) { throw null; } - public bool Equals(string? other) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ETag left, Azure.ETag right) { throw null; } - public static bool operator !=(Azure.ETag left, Azure.ETag right) { throw null; } - public override string ToString() { throw null; } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct HttpRange : System.IEquatable - { - private readonly int _dummyPrimitive; - public HttpRange(long offset = (long)0, long? length = default(long?)) { throw null; } - public long? Length { get { throw null; } } - public long Offset { get { throw null; } } - public bool Equals(Azure.HttpRange other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object? obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.HttpRange left, Azure.HttpRange right) { throw null; } - public static bool operator !=(Azure.HttpRange left, Azure.HttpRange right) { throw null; } - public override string ToString() { throw null; } - } - public partial class MatchConditions - { - public MatchConditions() { } - public Azure.ETag? IfMatch { get { throw null; } set { } } - public Azure.ETag? IfNoneMatch { get { throw null; } set { } } - } - public abstract partial class Operation where T : notnull - { - protected Operation() { } - public abstract bool HasCompleted { get; } - public abstract bool HasValue { get; } - public abstract string Id { get; } - public abstract T Value { get; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object? obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public abstract Azure.Response GetRawResponse(); - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override string? ToString() { throw null; } - public abstract Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - public abstract System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken); - } - public abstract partial class Pageable : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable where T : notnull - { - protected Pageable() { } - protected Pageable(System.Threading.CancellationToken cancellationToken) { } - protected virtual System.Threading.CancellationToken CancellationToken { get { throw null; } } - public abstract System.Collections.Generic.IEnumerable> AsPages(string? continuationToken = null, int? pageSizeHint = default(int?)); - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object? obj) { throw null; } - public virtual System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override string? ToString() { throw null; } - } - public abstract partial class Page - { - protected Page() { } - public abstract string? ContinuationToken { get; } - public abstract System.Collections.Generic.IReadOnlyList Values { get; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object? obj) { throw null; } - public static Azure.Page FromValues(System.Collections.Generic.IReadOnlyList values, string? continuationToken, Azure.Response response) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public abstract Azure.Response GetRawResponse(); - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override string? ToString() { throw null; } - } - public partial class RequestConditions : Azure.MatchConditions - { - public RequestConditions() { } - public System.DateTimeOffset? IfModifiedSince { get { throw null; } set { } } - public System.DateTimeOffset? IfUnmodifiedSince { get { throw null; } set { } } - } - public partial class RequestFailedException : System.Exception, System.Runtime.Serialization.ISerializable - { - public RequestFailedException(int status, string message) { } - public RequestFailedException(int status, string message, System.Exception? innerException) { } - public RequestFailedException(int status, string message, string? errorCode, System.Exception? innerException) { } - protected RequestFailedException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } - public RequestFailedException(string message) { } - public RequestFailedException(string message, System.Exception? innerException) { } - public string? ErrorCode { get { throw null; } } - public int Status { get { throw null; } } - public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } - } - public abstract partial class Response : System.IDisposable - { - protected Response() { } - public abstract string ClientRequestId { get; set; } - public abstract System.IO.Stream? ContentStream { get; set; } - public virtual Azure.Core.ResponseHeaders Headers { get { throw null; } } - public abstract string ReasonPhrase { get; } - public abstract int Status { get; } - protected internal abstract bool ContainsHeader(string name); - public abstract void Dispose(); - protected internal abstract System.Collections.Generic.IEnumerable EnumerateHeaders(); - public static Azure.Response FromValue(T value, Azure.Response response) { throw null; } - public override string ToString() { throw null; } - protected internal abstract bool TryGetHeader(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value); - protected internal abstract bool TryGetHeaderValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values); - } - public abstract partial class Response - { - protected Response() { } - public abstract T Value { get; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object? obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public abstract Azure.Response GetRawResponse(); - public static implicit operator T (Azure.Response response) { throw null; } - public override string ToString() { throw null; } - } -} -namespace Azure.Core -{ - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct AccessToken - { - private object _dummy; - private int _dummyPrimitive; - public AccessToken(string accessToken, System.DateTimeOffset expiresOn) { throw null; } - public System.DateTimeOffset ExpiresOn { get { throw null; } } - public string Token { get { throw null; } } - public override bool Equals(object? obj) { throw null; } - public override int GetHashCode() { throw null; } - } - public abstract partial class ClientOptions - { - protected ClientOptions() { } - public Azure.Core.DiagnosticsOptions Diagnostics { get { throw null; } } - public Azure.Core.RetryOptions Retry { get { throw null; } } - public Azure.Core.Pipeline.HttpPipelineTransport Transport { get { throw null; } set { } } - public void AddPolicy(Azure.Core.Pipeline.HttpPipelinePolicy policy, Azure.Core.HttpPipelinePosition position) { } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object? obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override string? ToString() { throw null; } - } - public partial class DiagnosticsOptions - { - internal DiagnosticsOptions() { } - public string? ApplicationId { get { throw null; } set { } } - public static string? DefaultApplicationId { get { throw null; } set { } } - public bool IsDistributedTracingEnabled { get { throw null; } set { } } - public bool IsLoggingContentEnabled { get { throw null; } set { } } - public bool IsLoggingEnabled { get { throw null; } set { } } - public bool IsTelemetryEnabled { get { throw null; } set { } } - public int LoggedContentSizeLimit { get { throw null; } set { } } - public System.Collections.Generic.IList LoggedHeaderNames { get { throw null; } } - public System.Collections.Generic.IList LoggedQueryParameters { get { throw null; } } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct HttpHeader : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public HttpHeader(string name, string value) { throw null; } - public string Name { get { throw null; } } - public string Value { get { throw null; } } - public bool Equals(Azure.Core.HttpHeader other) { throw null; } - public override bool Equals(object? obj) { throw null; } - public override int GetHashCode() { throw null; } - public override string ToString() { throw null; } - public static partial class Common - { - public static readonly Azure.Core.HttpHeader FormUrlEncodedContentType; - public static readonly Azure.Core.HttpHeader JsonAccept; - public static readonly Azure.Core.HttpHeader JsonContentType; - public static readonly Azure.Core.HttpHeader OctetStreamContentType; - } - public static partial class Names - { - public static string Accept { get { throw null; } } - public static string Authorization { get { throw null; } } - public static string ContentLength { get { throw null; } } - public static string ContentType { get { throw null; } } - public static string Date { get { throw null; } } - public static string ETag { get { throw null; } } - public static string IfMatch { get { throw null; } } - public static string IfModifiedSince { get { throw null; } } - public static string IfNoneMatch { get { throw null; } } - public static string IfUnmodifiedSince { get { throw null; } } - public static string Range { get { throw null; } } - public static string UserAgent { get { throw null; } } - public static string XMsDate { get { throw null; } } - public static string XMsRange { get { throw null; } } - public static string XMsRequestId { get { throw null; } } - } - } - public sealed partial class HttpMessage : System.IDisposable - { - public HttpMessage(Azure.Core.Request request, Azure.Core.ResponseClassifier responseClassifier) { } - public bool BufferResponse { get { throw null; } set { } } - public System.Threading.CancellationToken CancellationToken { get { throw null; } } - public bool HasResponse { get { throw null; } } - public Azure.Core.Request Request { get { throw null; } } - public Azure.Response Response { get { throw null; } set { } } - public Azure.Core.ResponseClassifier ResponseClassifier { get { throw null; } } - public void Dispose() { } - public System.IO.Stream? ExtractResponseContent() { throw null; } - public void SetProperty(string name, object value) { } - public bool TryGetProperty(string name, out object? value) { throw null; } - } - public enum HttpPipelinePosition - { - PerCall = 0, - PerRetry = 1, - } - public abstract partial class Request : System.IDisposable - { - protected Request() { } - public abstract string ClientRequestId { get; set; } - public virtual Azure.Core.RequestContent? Content { get { throw null; } set { } } - public Azure.Core.RequestHeaders Headers { get { throw null; } } - public virtual Azure.Core.RequestMethod Method { get { throw null; } set { } } - public virtual Azure.Core.RequestUriBuilder Uri { get { throw null; } set { } } - protected internal abstract void AddHeader(string name, string value); - protected internal abstract bool ContainsHeader(string name); - public abstract void Dispose(); - protected internal abstract System.Collections.Generic.IEnumerable EnumerateHeaders(); - protected internal abstract bool RemoveHeader(string name); - protected internal virtual void SetHeader(string name, string value) { } - protected internal abstract bool TryGetHeader(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value); - protected internal abstract bool TryGetHeaderValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values); - } - public abstract partial class RequestContent : System.IDisposable - { - protected RequestContent() { } - public static Azure.Core.RequestContent Create(System.Buffers.ReadOnlySequence bytes) { throw null; } - public static Azure.Core.RequestContent Create(byte[] bytes) { throw null; } - public static Azure.Core.RequestContent Create(byte[] bytes, int index, int length) { throw null; } - public static Azure.Core.RequestContent Create(System.IO.Stream stream) { throw null; } - public static Azure.Core.RequestContent Create(System.ReadOnlyMemory bytes) { throw null; } - public abstract void Dispose(); - public abstract bool TryComputeLength(out long length); - public abstract void WriteTo(System.IO.Stream stream, System.Threading.CancellationToken cancellation); - public abstract System.Threading.Tasks.Task WriteToAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellation); - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct RequestHeaders : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public void Add(Azure.Core.HttpHeader header) { } - public void Add(string name, string value) { } - public bool Contains(string name) { throw null; } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - public bool Remove(string name) { throw null; } - public void SetValue(string name, string value) { } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value) { throw null; } - public bool TryGetValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values) { throw null; } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct RequestMethod : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public RequestMethod(string method) { throw null; } - public static Azure.Core.RequestMethod Delete { get { throw null; } } - public static Azure.Core.RequestMethod Get { get { throw null; } } - public static Azure.Core.RequestMethod Head { get { throw null; } } - public string Method { get { throw null; } } - public static Azure.Core.RequestMethod Options { get { throw null; } } - public static Azure.Core.RequestMethod Patch { get { throw null; } } - public static Azure.Core.RequestMethod Post { get { throw null; } } - public static Azure.Core.RequestMethod Put { get { throw null; } } - public static Azure.Core.RequestMethod Trace { get { throw null; } } - public bool Equals(Azure.Core.RequestMethod other) { throw null; } - public override bool Equals(object? obj) { throw null; } - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.Core.RequestMethod left, Azure.Core.RequestMethod right) { throw null; } - public static bool operator !=(Azure.Core.RequestMethod left, Azure.Core.RequestMethod right) { throw null; } - public static Azure.Core.RequestMethod Parse(string method) { throw null; } - public override string ToString() { throw null; } - } - public partial class RequestUriBuilder - { - public RequestUriBuilder() { } - public string? Host { get { throw null; } set { } } - public string Path { get { throw null; } set { } } - public string PathAndQuery { get { throw null; } } - public int Port { get { throw null; } set { } } - public string Query { get { throw null; } set { } } - public string? Scheme { get { throw null; } set { } } - public void AppendPath(string value) { } - public void AppendPath(string value, bool escape) { } - public void AppendQuery(string name, string value) { } - public void AppendQuery(string name, string value, bool escapeValue) { } - public void Reset(System.Uri value) { } - public override string ToString() { throw null; } - public System.Uri ToUri() { throw null; } - } - public partial class ResponseClassifier - { - public ResponseClassifier() { } - public virtual bool IsErrorResponse(Azure.Core.HttpMessage message) { throw null; } - public virtual bool IsRetriable(Azure.Core.HttpMessage message, System.Exception exception) { throw null; } - public virtual bool IsRetriableException(System.Exception exception) { throw null; } - public virtual bool IsRetriableResponse(Azure.Core.HttpMessage message) { throw null; } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct ResponseHeaders : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public int? ContentLength { get { throw null; } } - public string? ContentType { get { throw null; } } - public System.DateTimeOffset? Date { get { throw null; } } - public Azure.ETag? ETag { get { throw null; } } - public string? RequestId { get { throw null; } } - public bool Contains(string name) { throw null; } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public bool TryGetValue(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out string? value) { throw null; } - public bool TryGetValues(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Collections.Generic.IEnumerable? values) { throw null; } - } - public enum RetryMode - { - Fixed = 0, - Exponential = 1, - } - public partial class RetryOptions - { - internal RetryOptions() { } - public System.TimeSpan Delay { get { throw null; } set { } } - public System.TimeSpan MaxDelay { get { throw null; } set { } } - public int MaxRetries { get { throw null; } set { } } - public Azure.Core.RetryMode Mode { get { throw null; } set { } } - public System.TimeSpan NetworkTimeout { get { throw null; } set { } } - } - public abstract partial class TokenCredential - { - protected TokenCredential() { } - public abstract Azure.Core.AccessToken GetToken(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken); - public abstract System.Threading.Tasks.ValueTask GetTokenAsync(Azure.Core.TokenRequestContext requestContext, System.Threading.CancellationToken cancellationToken); - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct TokenRequestContext - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public TokenRequestContext(string[] scopes, string? parentRequestId = null) { throw null; } - public string? ParentRequestId { get { throw null; } } - public string[] Scopes { get { throw null; } } - } -} -namespace Azure.Core.Cryptography -{ - public partial interface IKeyEncryptionKey - { - string KeyId { get; } - byte[] UnwrapKey(string algorithm, System.ReadOnlyMemory encryptedKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - System.Threading.Tasks.Task UnwrapKeyAsync(string algorithm, System.ReadOnlyMemory encryptedKey, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - byte[] WrapKey(string algorithm, System.ReadOnlyMemory key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - System.Threading.Tasks.Task WrapKeyAsync(string algorithm, System.ReadOnlyMemory key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - } - public partial interface IKeyEncryptionKeyResolver - { - Azure.Core.Cryptography.IKeyEncryptionKey Resolve(string keyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - System.Threading.Tasks.Task ResolveAsync(string keyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - } -} -namespace Azure.Core.Diagnostics -{ - public partial class AzureEventSourceListener : System.Diagnostics.Tracing.EventListener - { - public const string TraitName = "AzureEventSource"; - public const string TraitValue = "true"; - public AzureEventSourceListener(System.Action log, System.Diagnostics.Tracing.EventLevel level) { } - public static Azure.Core.Diagnostics.AzureEventSourceListener CreateConsoleLogger(System.Diagnostics.Tracing.EventLevel level = System.Diagnostics.Tracing.EventLevel.Informational) { throw null; } - public static Azure.Core.Diagnostics.AzureEventSourceListener CreateTraceLogger(System.Diagnostics.Tracing.EventLevel level = System.Diagnostics.Tracing.EventLevel.Informational) { throw null; } - protected sealed override void OnEventSourceCreated(System.Diagnostics.Tracing.EventSource eventSource) { } - protected sealed override void OnEventWritten(System.Diagnostics.Tracing.EventWrittenEventArgs eventData) { } - } -} -namespace Azure.Core.Extensions -{ - public partial interface IAzureClientBuilder where TOptions : class - { - } - public partial interface IAzureClientFactoryBuilder - { - Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(System.Func clientFactory) where TOptions : class; - } - public partial interface IAzureClientFactoryBuilderWithConfiguration : Azure.Core.Extensions.IAzureClientFactoryBuilder - { - Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(TConfiguration configuration) where TOptions : class; - } - public partial interface IAzureClientFactoryBuilderWithCredential - { - Azure.Core.Extensions.IAzureClientBuilder RegisterClientFactory(System.Func clientFactory, bool requiresCredential = true) where TOptions : class; - } -} -namespace Azure.Core.Pipeline -{ - public partial class BearerTokenAuthenticationPolicy : Azure.Core.Pipeline.HttpPipelinePolicy - { - public BearerTokenAuthenticationPolicy(Azure.Core.TokenCredential credential, System.Collections.Generic.IEnumerable scopes) { } - public BearerTokenAuthenticationPolicy(Azure.Core.TokenCredential credential, string scope) { } - public override void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } - public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } - } - public partial class HttpClientTransport : Azure.Core.Pipeline.HttpPipelineTransport - { - public static readonly Azure.Core.Pipeline.HttpClientTransport Shared; - public HttpClientTransport() { } - public HttpClientTransport(System.Net.Http.HttpClient client) { } - public sealed override Azure.Core.Request CreateRequest() { throw null; } - public override void Process(Azure.Core.HttpMessage message) { } - public sealed override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message) { throw null; } - } - public partial class HttpPipeline - { - public HttpPipeline(Azure.Core.Pipeline.HttpPipelineTransport transport, Azure.Core.Pipeline.HttpPipelinePolicy[]? policies = null, Azure.Core.ResponseClassifier? responseClassifier = null) { } - public Azure.Core.ResponseClassifier ResponseClassifier { get { throw null; } } - public static System.IDisposable CreateClientRequestIdScope(string? clientRequestId) { throw null; } - public Azure.Core.HttpMessage CreateMessage() { throw null; } - public Azure.Core.Request CreateRequest() { throw null; } - public void Send(Azure.Core.HttpMessage message, System.Threading.CancellationToken cancellationToken) { } - public System.Threading.Tasks.ValueTask SendAsync(Azure.Core.HttpMessage message, System.Threading.CancellationToken cancellationToken) { throw null; } - public Azure.Response SendRequest(Azure.Core.Request request, System.Threading.CancellationToken cancellationToken) { throw null; } - public System.Threading.Tasks.ValueTask SendRequestAsync(Azure.Core.Request request, System.Threading.CancellationToken cancellationToken) { throw null; } - } - public static partial class HttpPipelineBuilder - { - public static Azure.Core.Pipeline.HttpPipeline Build(Azure.Core.ClientOptions options, params Azure.Core.Pipeline.HttpPipelinePolicy[] perRetryPolicies) { throw null; } - public static Azure.Core.Pipeline.HttpPipeline Build(Azure.Core.ClientOptions options, Azure.Core.Pipeline.HttpPipelinePolicy[] perCallPolicies, Azure.Core.Pipeline.HttpPipelinePolicy[] perRetryPolicies, Azure.Core.ResponseClassifier responseClassifier) { throw null; } - } - public abstract partial class HttpPipelinePolicy - { - protected HttpPipelinePolicy() { } - public abstract void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline); - public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline); - protected static void ProcessNext(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } - protected static System.Threading.Tasks.ValueTask ProcessNextAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } - } - public abstract partial class HttpPipelineSynchronousPolicy : Azure.Core.Pipeline.HttpPipelinePolicy - { - protected HttpPipelineSynchronousPolicy() { } - public virtual void OnReceivedResponse(Azure.Core.HttpMessage message) { } - public virtual void OnSendingRequest(Azure.Core.HttpMessage message) { } - public override void Process(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { } - public override System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message, System.ReadOnlyMemory pipeline) { throw null; } - } - public abstract partial class HttpPipelineTransport - { - protected HttpPipelineTransport() { } - public abstract Azure.Core.Request CreateRequest(); - public abstract void Process(Azure.Core.HttpMessage message); - public abstract System.Threading.Tasks.ValueTask ProcessAsync(Azure.Core.HttpMessage message); - } -} -namespace Azure.Core.Serialization -{ - public partial interface IMemberNameConverter - { - string? ConvertMemberName(System.Reflection.MemberInfo member); - } - public partial class JsonObjectSerializer : Azure.Core.Serialization.ObjectSerializer, Azure.Core.Serialization.IMemberNameConverter - { - public JsonObjectSerializer() { } - public JsonObjectSerializer(System.Text.Json.JsonSerializerOptions options) { } - string? Azure.Core.Serialization.IMemberNameConverter.ConvertMemberName(System.Reflection.MemberInfo member) { throw null; } - public override object? Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } - public override System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken) { throw null; } - public override void Serialize(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { } - public override System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken) { throw null; } - } - public abstract partial class ObjectSerializer - { - protected ObjectSerializer() { } - public abstract object? Deserialize(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); - public abstract System.Threading.Tasks.ValueTask DeserializeAsync(System.IO.Stream stream, System.Type returnType, System.Threading.CancellationToken cancellationToken); - public abstract void Serialize(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken); - public abstract System.Threading.Tasks.ValueTask SerializeAsync(System.IO.Stream stream, object? value, System.Type inputType, System.Threading.CancellationToken cancellationToken); - } -} From 551c2ae10c1c2ed9789ab2c00ccea8379b4d3ed0 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 24 Nov 2020 08:35:35 -0800 Subject: [PATCH 11/17] fix build --- .../Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs | 8 ++++++++ .../Azure.Core/src/Pipeline/Internal/LoggingPolicy.cs | 2 ++ .../Azure.Core/src/Pipeline/Internal/ReadTimeoutStream.cs | 3 +++ .../src/Pipeline/Internal/ResponseBodyPolicy.cs | 2 ++ sdk/core/Azure.Core/src/RequestContent.cs | 2 ++ sdk/core/Azure.Core/src/Shared/HttpMessageSanitizer.cs | 7 ++++++- 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs b/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs index e4bf7643dde5f..03efb8a69f362 100644 --- a/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs +++ b/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs @@ -16,6 +16,9 @@ internal static class AzureBaseBuffersExtensions public static async Task WriteAsync(this Stream stream, ReadOnlyMemory buffer, CancellationToken cancellation = default) { Argument.AssertNotNull(stream, nameof(stream)); +#if NET5_0 + await stream.WriteAsync(buffer, cancellation).ConfigureAwait(false); +#else if (buffer.Length == 0) return; @@ -42,6 +45,7 @@ public static async Task WriteAsync(this Stream stream, ReadOnlyMemory buf if (array != null) ArrayPool.Shared.Return(array); } +#endif } public static async Task WriteAsync(this Stream stream, ReadOnlySequence buffer, CancellationToken cancellation = default) @@ -55,6 +59,9 @@ public static async Task WriteAsync(this Stream stream, ReadOnlySequence b { foreach (ReadOnlyMemory segment in buffer) { +#if NET5_0 + await stream.WriteAsync(buffer, cancellation).ConfigureAwait(false); +#else if (MemoryMarshal.TryGetArray(segment, out ArraySegment arraySegment)) { Debug.Assert(arraySegment.Array != null); @@ -72,6 +79,7 @@ public static async Task WriteAsync(this Stream stream, ReadOnlySequence b throw new Exception("could not rent large enough buffer."); await stream.WriteAsync(array, 0, segment.Length, cancellation).ConfigureAwait(false); } +#endif } } finally diff --git a/sdk/core/Azure.Core/src/Pipeline/Internal/LoggingPolicy.cs b/sdk/core/Azure.Core/src/Pipeline/Internal/LoggingPolicy.cs index d665cfe1950c9..f1d9346c12a3b 100644 --- a/sdk/core/Azure.Core/src/Pipeline/Internal/LoggingPolicy.cs +++ b/sdk/core/Azure.Core/src/Pipeline/Internal/LoggingPolicy.cs @@ -204,7 +204,9 @@ private void LogBuffer(byte[] buffer, int offset, int count) public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { +#pragma warning disable CA1835 // ReadAsync(Memory<>) overload is not available in all targets var result = await _originalStream.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false); +#pragma warning restore // ReadAsync(Memory<>) overload is not available in all targets var countToLog = result; DecrementLength(ref countToLog); diff --git a/sdk/core/Azure.Core/src/Pipeline/Internal/ReadTimeoutStream.cs b/sdk/core/Azure.Core/src/Pipeline/Internal/ReadTimeoutStream.cs index 0e855baa45c87..4c383efe930b6 100644 --- a/sdk/core/Azure.Core/src/Pipeline/Internal/ReadTimeoutStream.cs +++ b/sdk/core/Azure.Core/src/Pipeline/Internal/ReadTimeoutStream.cs @@ -49,7 +49,10 @@ public override async Task ReadAsync(byte[] buffer, int offset, int count, var source = StartTimeout(cancellationToken, out bool dispose); try { + +#pragma warning disable CA1835 // ReadAsync(Memory<>) overload is not available in all targets return await _stream.ReadAsync(buffer, offset, count, source.Token).ConfigureAwait(false); +#pragma warning restore // ReadAsync(Memory<>) overload is not available in all targets } // We dispose stream on timeout so catch and check if cancellation token was cancelled catch (ObjectDisposedException) diff --git a/sdk/core/Azure.Core/src/Pipeline/Internal/ResponseBodyPolicy.cs b/sdk/core/Azure.Core/src/Pipeline/Internal/ResponseBodyPolicy.cs index eb7ad01d459e1..92511ad32357b 100644 --- a/sdk/core/Azure.Core/src/Pipeline/Internal/ResponseBodyPolicy.cs +++ b/sdk/core/Azure.Core/src/Pipeline/Internal/ResponseBodyPolicy.cs @@ -109,7 +109,9 @@ private async Task CopyToAsync(Stream source, Stream destination, CancellationTo while (true) { cancellationTokenSource.CancelAfter(_networkTimeout); +#pragma warning disable CA1835 // ReadAsync(Memory<>) overload is not available in all targets int bytesRead = await source.ReadAsync(buffer, 0, buffer.Length, cancellationTokenSource.Token).ConfigureAwait(false); +#pragma warning restore // ReadAsync(Memory<>) overload is not available in all targets if (bytesRead == 0) break; await destination.WriteAsync(new ReadOnlyMemory(buffer, 0, bytesRead), cancellationTokenSource.Token).ConfigureAwait(false); } diff --git a/sdk/core/Azure.Core/src/RequestContent.cs b/sdk/core/Azure.Core/src/RequestContent.cs index d30d4091defaf..6c1c49d3b4217 100644 --- a/sdk/core/Azure.Core/src/RequestContent.cs +++ b/sdk/core/Azure.Core/src/RequestContent.cs @@ -170,7 +170,9 @@ public override bool TryComputeLength(out long length) public override async Task WriteToAsync(Stream stream, CancellationToken cancellation) { +#pragma warning disable CA1835 // WriteAsync(Memory<>) overload is not available in all targets await stream.WriteAsync(_bytes, _contentStart, _contentLength, cancellation).ConfigureAwait(false); +#pragma warning restore // WriteAsync(Memory<>) overload is not available in all targets } } diff --git a/sdk/core/Azure.Core/src/Shared/HttpMessageSanitizer.cs b/sdk/core/Azure.Core/src/Shared/HttpMessageSanitizer.cs index 00ebd66595b65..5b426d865ec16 100644 --- a/sdk/core/Azure.Core/src/Shared/HttpMessageSanitizer.cs +++ b/sdk/core/Azure.Core/src/Shared/HttpMessageSanitizer.cs @@ -44,7 +44,12 @@ public string SanitizeUrl(string url) return url; } - int indexOfQuerySeparator = url.IndexOfOrdinal('?'); +#if NET5_0 + int indexOfQuerySeparator = url.IndexOf('?', StringComparison.Ordinal); +#else + int indexOfQuerySeparator = url.IndexOf('?'); +#endif + if (indexOfQuerySeparator == -1) { return url; From 516b69c830e2631f4b84e6ee86e7c5f502382e01 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 24 Nov 2020 09:20:45 -0800 Subject: [PATCH 12/17] suppress api compat --- sdk/core/Azure.Core/src/Azure.Core.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/core/Azure.Core/src/Azure.Core.csproj b/sdk/core/Azure.Core/src/Azure.Core.csproj index f2366f92968d7..71b7466007002 100644 --- a/sdk/core/Azure.Core/src/Azure.Core.csproj +++ b/sdk/core/Azure.Core/src/Azure.Core.csproj @@ -4,6 +4,8 @@ Microsoft Azure Client Pipeline 1.7.0-beta.1 1.6.0 + + Microsoft Azure Client Pipeline enable $(DefineConstants);AZURE_NULLABLE From fefef2a5cc8f17ea3e2472cd2492378ea6f57d1c Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 24 Nov 2020 09:36:27 -0800 Subject: [PATCH 13/17] Update sdk/core/Azure.Core/src/Azure.Core.csproj Co-authored-by: Mariana Rios Flores --- sdk/core/Azure.Core/src/Azure.Core.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/core/Azure.Core/src/Azure.Core.csproj b/sdk/core/Azure.Core/src/Azure.Core.csproj index 71b7466007002..6aaffd793d7bd 100644 --- a/sdk/core/Azure.Core/src/Azure.Core.csproj +++ b/sdk/core/Azure.Core/src/Azure.Core.csproj @@ -4,7 +4,7 @@ Microsoft Azure Client Pipeline 1.7.0-beta.1 1.6.0 - + Microsoft Azure Client Pipeline enable From 78c4638f5056bff6b3b28dfc8e7983c2496645d2 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 24 Nov 2020 12:08:01 -0800 Subject: [PATCH 14/17] FB --- .../api/Azure.Core.Experimental.netstandard2.0.cs | 4 ++-- .../src/Serialization/SerializationExtensions.cs | 8 ++++---- sdk/core/Azure.Core/tests/HttpPipelineFunctionalTests.cs | 4 ++-- .../src/Microsoft.Azure.Core.NewtonsoftJson.csproj | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/sdk/core/Azure.Core.Experimental/api/Azure.Core.Experimental.netstandard2.0.cs b/sdk/core/Azure.Core.Experimental/api/Azure.Core.Experimental.netstandard2.0.cs index b7bd1c59187e2..f26fa023f7314 100644 --- a/sdk/core/Azure.Core.Experimental/api/Azure.Core.Experimental.netstandard2.0.cs +++ b/sdk/core/Azure.Core.Experimental/api/Azure.Core.Experimental.netstandard2.0.cs @@ -4,8 +4,8 @@ public static partial class SerializationExtensions { public static System.BinaryData SerializeToBinaryData(this Azure.Core.Serialization.ObjectSerializer serializer, object? value, System.Type? inputType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.ValueTask SerializeToBinaryDataAsync(this Azure.Core.Serialization.ObjectSerializer serializer, object? value, System.Type? inputType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.ValueTask ToObjectAsync(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static T ToObject(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.ValueTask ToObjectAsync(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static T? ToObject(this System.BinaryData data, Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.Core diff --git a/sdk/core/Azure.Core.Experimental/src/Serialization/SerializationExtensions.cs b/sdk/core/Azure.Core.Experimental/src/Serialization/SerializationExtensions.cs index c77acccf50031..fee64e9d23477 100644 --- a/sdk/core/Azure.Core.Experimental/src/Serialization/SerializationExtensions.cs +++ b/sdk/core/Azure.Core.Experimental/src/Serialization/SerializationExtensions.cs @@ -28,8 +28,8 @@ public static class SerializationExtensions /// when deserializing the data. /// The to use during deserialization. ///The data converted to the specified type. - public static T ToObject(this BinaryData data, ObjectSerializer serializer, CancellationToken cancellationToken = default) => - (T)serializer.Deserialize(data.ToStream(), typeof(T), cancellationToken)!; + public static T? ToObject(this BinaryData data, ObjectSerializer serializer, CancellationToken cancellationToken = default) => + (T?)serializer.Deserialize(data.ToStream(), typeof(T), cancellationToken); /// /// Converts the to the specified type using @@ -42,8 +42,8 @@ public static T ToObject(this BinaryData data, ObjectSerializer serializer, C /// when deserializing the data. /// The to use during deserialization. ///The data converted to the specified type. - public static async ValueTask ToObjectAsync(this BinaryData data, ObjectSerializer serializer, CancellationToken cancellationToken = default) => - (T)(await serializer.DeserializeAsync(data.ToStream(), typeof(T), cancellationToken).ConfigureAwait(false))!; + public static async ValueTask ToObjectAsync(this BinaryData data, ObjectSerializer serializer, CancellationToken cancellationToken = default) => + (T?)await serializer.DeserializeAsync(data.ToStream(), typeof(T), cancellationToken).ConfigureAwait(false); /// /// Convert the provided value to it's binary representation and return it as a instance. diff --git a/sdk/core/Azure.Core/tests/HttpPipelineFunctionalTests.cs b/sdk/core/Azure.Core/tests/HttpPipelineFunctionalTests.cs index 41bc26db0282d..214d891927b8a 100644 --- a/sdk/core/Azure.Core/tests/HttpPipelineFunctionalTests.cs +++ b/sdk/core/Azure.Core/tests/HttpPipelineFunctionalTests.cs @@ -91,14 +91,14 @@ public async Task NonBufferedExtractedStreamReadableAfterMessageDisposed() await ExecuteRequest(message, httpPipeline); - Assert.AreEqual(false, message.Response.ContentStream.CanSeek); + Assert.False(message.Response.ContentStream.CanSeek); extractedStream = message.ExtractResponseContent(); } var memoryStream = new MemoryStream(); await extractedStream.CopyToAsync(memoryStream); - Assert.AreEqual(memoryStream.Length, 1000); + Assert.AreEqual(1000, memoryStream.Length); extractedStream.Dispose(); } } diff --git a/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Microsoft.Azure.Core.NewtonsoftJson.csproj b/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Microsoft.Azure.Core.NewtonsoftJson.csproj index 9e80a313305db..5c54061af95f7 100644 --- a/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Microsoft.Azure.Core.NewtonsoftJson.csproj +++ b/sdk/core/Microsoft.Azure.Core.NewtonsoftJson/src/Microsoft.Azure.Core.NewtonsoftJson.csproj @@ -11,6 +11,7 @@ + From 091c8c4f5e1cf75b4055ca72ef8547f88f8b17bb Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 24 Nov 2020 12:28:06 -0800 Subject: [PATCH 15/17] more fb --- .../api/Azure.Core.Experimental.netstandard2.0.cs | 4 ++-- sdk/core/Azure.Core.Experimental/src/DynamicJson.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/core/Azure.Core.Experimental/api/Azure.Core.Experimental.netstandard2.0.cs b/sdk/core/Azure.Core.Experimental/api/Azure.Core.Experimental.netstandard2.0.cs index f26fa023f7314..325db8d7c5b83 100644 --- a/sdk/core/Azure.Core.Experimental/api/Azure.Core.Experimental.netstandard2.0.cs +++ b/sdk/core/Azure.Core.Experimental/api/Azure.Core.Experimental.netstandard2.0.cs @@ -20,8 +20,8 @@ public DynamicJson(System.Text.Json.JsonElement element) { } public static Azure.Core.DynamicJson Array(params Azure.Core.DynamicJson[] values) { throw null; } public static Azure.Core.DynamicJson Array(System.Collections.Generic.IEnumerable values) { throw null; } public static Azure.Core.DynamicJson Create(System.Text.Json.JsonElement element) { throw null; } - public System.Threading.Tasks.Task DeserializeAsync(Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public T Deserialize(Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public System.Threading.Tasks.Task DeserializeAsync(Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public T? Deserialize(Azure.Core.Serialization.ObjectSerializer serializer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public T Deserialize(System.Text.Json.JsonSerializerOptions? options = null) { throw null; } public System.Collections.Generic.IEnumerable EnumerateArray() { throw null; } public System.Collections.Generic.IEnumerable> EnumerateObject() { throw null; } diff --git a/sdk/core/Azure.Core.Experimental/src/DynamicJson.cs b/sdk/core/Azure.Core.Experimental/src/DynamicJson.cs index bee2498d610d4..71a0ad4288d54 100644 --- a/sdk/core/Azure.Core.Experimental/src/DynamicJson.cs +++ b/sdk/core/Azure.Core.Experimental/src/DynamicJson.cs @@ -518,16 +518,16 @@ public T Deserialize(JsonSerializerOptions? options = null) return JsonSerializer.Deserialize(ToString(), options); } - public T Deserialize(ObjectSerializer serializer, CancellationToken cancellationToken = default) + public T? Deserialize(ObjectSerializer serializer, CancellationToken cancellationToken = default) { var stream = new MemoryStream(Encoding.UTF8.GetBytes(ToString())); - return (T)serializer.Deserialize(stream, typeof(T), cancellationToken)!; + return (T?)serializer.Deserialize(stream, typeof(T), cancellationToken); } - public async Task DeserializeAsync(ObjectSerializer serializer, CancellationToken cancellationToken = default) + public async Task DeserializeAsync(ObjectSerializer serializer, CancellationToken cancellationToken = default) { var stream = new MemoryStream(Encoding.UTF8.GetBytes(ToString())); - return (T)(await serializer.DeserializeAsync(stream, typeof(T), cancellationToken).ConfigureAwait(false))!; + return (T?)(await serializer.DeserializeAsync(stream, typeof(T), cancellationToken).ConfigureAwait(false))!; } private struct Number From 50cc8fdc931c8a4fa5e7767b3a4dd2496b5965ba Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 24 Nov 2020 13:51:02 -0800 Subject: [PATCH 16/17] is it only core? --- sdk/core/Azure.Core/src/Internal/StringExtensions.cs | 2 +- sdk/core/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/core/Azure.Core/src/Internal/StringExtensions.cs b/sdk/core/Azure.Core/src/Internal/StringExtensions.cs index 0e9e9f4b8ef23..06b10d3402a03 100644 --- a/sdk/core/Azure.Core/src/Internal/StringExtensions.cs +++ b/sdk/core/Azure.Core/src/Internal/StringExtensions.cs @@ -27,4 +27,4 @@ public static int GetHashCodeOrdinal(this string? s) #endif } } -} \ No newline at end of file +} diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index 441cd183648b6..db72f2350c961 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -33,7 +33,7 @@ extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: core - ServiceToTest: '*' + ServiceToTest: core ArtifactName: packages Artifacts: - name: Azure.Core From f4b84edfcd09a23b4b823a42f094ab7583ae2cdc Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 24 Nov 2020 14:16:49 -0800 Subject: [PATCH 17/17] phew --- sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs | 2 +- sdk/core/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs b/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs index 03efb8a69f362..8696d830e50d7 100644 --- a/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs +++ b/sdk/core/Azure.Core/src/Internal/AzureBaseBuffersExtensions.cs @@ -60,7 +60,7 @@ public static async Task WriteAsync(this Stream stream, ReadOnlySequence b foreach (ReadOnlyMemory segment in buffer) { #if NET5_0 - await stream.WriteAsync(buffer, cancellation).ConfigureAwait(false); + await stream.WriteAsync(segment, cancellation).ConfigureAwait(false); #else if (MemoryMarshal.TryGetArray(segment, out ArraySegment arraySegment)) { diff --git a/sdk/core/ci.yml b/sdk/core/ci.yml index db72f2350c961..441cd183648b6 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/ci.yml @@ -33,7 +33,7 @@ extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: core - ServiceToTest: core + ServiceToTest: '*' ArtifactName: packages Artifacts: - name: Azure.Core