Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to preview7.19362.9 packages #7037

Merged
merged 1 commit into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions eng/Packages.Data.props
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@
<ItemGroup Condition="'$(IsClientLibrary)' == 'true'">
<PackageReference Update="Azure.ClientSdk.Analyzers" Version="0.1.1-dev.20190716.1" />
<PackageReference Update="System.Memory" Version="4.5.3" />
<PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0-preview6.19303.8" />
<PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="1.0.0-preview7.19362.9" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.1.0" />
<PackageReference Update="Microsoft.Extensions.DependencyInjection" Version="2.1.0" />
<PackageReference Update="Microsoft.Extensions.Logging.Abstractions" Version="2.1.0" />
<PackageReference Update="Microsoft.Extensions.Options" Version="2.1.0" />
<PackageReference Update="System.Text.Json" Version="4.6.0-preview6.19303.8" />
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="4.6.0-preview6.19303.8" />
<PackageReference Update="System.Runtime.CompilerServices.Unsafe" Version="4.6.0-preview6.19303.8" />
<PackageReference Update="System.Text.Json" Version="4.6.0-preview7.19362.9" />
<PackageReference Update="System.Diagnostics.DiagnosticSource" Version="4.6.0-preview7.19362.9" />
<PackageReference Update="System.Runtime.CompilerServices.Unsafe" Version="4.6.0-preview7.19362.9" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private static ConfigurationSetting ReadSetting(JsonElement root)
if (root.TryGetProperty("etag", out var eTagValue)) setting.ETag = new ETag(eTagValue.GetString());
if (root.TryGetProperty("last_modified", out var lastModified))
{
if(lastModified.Type == JsonValueType.Null)
if(lastModified.ValueKind == JsonValueKind.Null)
{
setting.LastModified = null;
}
Expand All @@ -56,7 +56,7 @@ private static ConfigurationSetting ReadSetting(JsonElement root)
}
if (root.TryGetProperty("locked", out var lockedValue))
{
if(lockedValue.Type == JsonValueType.Null)
if(lockedValue.ValueKind == JsonValueKind.Null)
{
setting.Locked = null;
}
Expand Down
14 changes: 7 additions & 7 deletions sdk/core/Azure.Core/tests/TestFramework/RecordEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,22 @@ public static RecordEntry Deserialize(JsonElement element)

private static byte[] DeserializeBody(IDictionary<string, string[]> headers, in JsonElement property)
{
if (property.Type == JsonValueType.Null)
if (property.ValueKind == JsonValueKind.Null)
{
return null;
}

if (IsTextContentType(headers, out Encoding encoding))
{
if (property.Type == JsonValueType.Object)
if (property.ValueKind == JsonValueKind.Object)
{
var arrayBufferWriter = new ArrayBufferWriter<byte>();
using var writer = new Utf8JsonWriter(arrayBufferWriter);
property.WriteAsValue(writer);
property.WriteValue(writer);
writer.Flush();
return arrayBufferWriter.WrittenMemory.ToArray();
}
else if (property.Type == JsonValueType.Array)
else if (property.ValueKind == JsonValueKind.Array)
{
StringBuilder stringBuilder = new StringBuilder();

Expand All @@ -102,7 +102,7 @@ private static byte[] DeserializeBody(IDictionary<string, string[]> headers, in
}
}

if (property.Type == JsonValueType.Array)
if (property.ValueKind == JsonValueKind.Array)
{
return Array.Empty<byte>();
}
Expand All @@ -114,7 +114,7 @@ private static void DeserializeHeaders(IDictionary<string, string[]> headers, in
{
foreach (JsonProperty item in property.EnumerateObject())
{
if (item.Value.Type == JsonValueType.Array)
if (item.Value.ValueKind == JsonValueKind.Array)
{
var values = new List<string>();
foreach (JsonElement headerValue in item.Value.EnumerateArray())
Expand Down Expand Up @@ -170,7 +170,7 @@ private void SerializeBody(Utf8JsonWriter jsonWriter, string name, byte[] reques
try
{
using JsonDocument document = JsonDocument.Parse(requestBody);
document.RootElement.WriteAsProperty(name.AsSpan(), jsonWriter);
document.RootElement.WriteProperty(name.AsSpan(), jsonWriter);
return;
}
catch (Exception)
Expand Down
4 changes: 2 additions & 2 deletions sdk/identity/Azure.Identity/src/ManagedIdentityClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ private static AccessToken Deserialize(JsonElement json)
{
// the seconds from epoch may be returned as a Json number or a Json string which is a number
// depending on the environment. If neither of these are the case we throw an AuthException.
if (!(expiresOnProp.Type == JsonValueType.Number && expiresOnProp.TryGetInt64(out long expiresOnSec)) &&
!(expiresOnProp.Type == JsonValueType.String && long.TryParse(expiresOnProp.GetString(), out expiresOnSec)))
if (!(expiresOnProp.ValueKind == JsonValueKind.Number && expiresOnProp.TryGetInt64(out long expiresOnSec)) &&
!(expiresOnProp.ValueKind == JsonValueKind.String && long.TryParse(expiresOnProp.GetString(), out expiresOnSec)))
{
throw new AuthenticationFailedException(AuthenticationResponseInvalidFormatError);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ internal void ReadProperties(JsonElement json)

if (json.TryGetProperty("nbf", out JsonElement nbf))
{
if (nbf.Type == JsonValueType.Null)
if (nbf.ValueKind == JsonValueKind.Null)
{
NotBefore = null;
}
Expand All @@ -64,7 +64,7 @@ internal void ReadProperties(JsonElement json)

if (json.TryGetProperty("exp", out JsonElement exp))
{
if (exp.Type == JsonValueType.Null)
if (exp.ValueKind == JsonValueKind.Null)
{
Expires = null;
}
Expand All @@ -76,7 +76,7 @@ internal void ReadProperties(JsonElement json)

if (json.TryGetProperty("created", out JsonElement created))
{
if (created.Type == JsonValueType.Null)
if (created.ValueKind == JsonValueKind.Null)
{
Created = null;
}
Expand All @@ -88,7 +88,7 @@ internal void ReadProperties(JsonElement json)

if (json.TryGetProperty("updated", out JsonElement updated))
{
if (updated.Type == JsonValueType.Null)
if (updated.ValueKind == JsonValueKind.Null)
{
Updated = null;
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/keyvault/Azure.Security.KeyVault.Secrets/src/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal override void ReadProperties(JsonElement json)
{
if (json.TryGetProperty("value", out JsonElement value))
{
if(value.Type != JsonValueType.Null)
if(value.ValueKind != JsonValueKind.Null)
{
_items = new T[value.GetArrayLength()];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,30 +294,30 @@ private static object ParseJsonBody(byte[] body)

object Parse(JsonElement element)
{
switch (element.Type)
switch (element.ValueKind)
{
// Keep all primitives (except null) as strings
case JsonValueType.False: return "false";
case JsonValueType.True: return "true";
case JsonValueType.Undefined: return "undefined";
case JsonValueType.Number: return element.GetRawText();
case JsonValueType.String: return element.GetString();
case JsonValueType.Object:
case JsonValueKind.False: return "false";
case JsonValueKind.True: return "true";
case JsonValueKind.Undefined: return "undefined";
case JsonValueKind.Number: return element.GetRawText();
case JsonValueKind.String: return element.GetString();
case JsonValueKind.Object:
var obj = new Dictionary<string, object>();
foreach (var property in element.EnumerateObject())
{
obj.Add(property.Name, Parse(property.Value));
}
return obj;
case JsonValueType.Array:
case JsonValueKind.Array:
var values = new Dictionary<string, object>();
var index = 0;
foreach (var value in element.EnumerateArray())
{
values.Add(index++.ToString(CultureInfo.InvariantCulture), Parse(value));
}
return values;
case JsonValueType.Null:
case JsonValueKind.Null:
default:
return null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ public override string SanitizeTextBody(string contentType, string body)
writer.WriteStartObject();
foreach (var property in doc.RootElement.EnumerateObject())
{
switch (doc.RootElement.GetProperty(property.Name).Type)
switch (doc.RootElement.GetProperty(property.Name).ValueKind)
{
case JsonValueType.Null:
case JsonValueKind.Null:
writer.WriteNull(property.Name);
break;
case JsonValueType.True:
case JsonValueKind.True:
writer.WriteBoolean(property.Name, true);
break;
case JsonValueType.False:
case JsonValueKind.False:
writer.WriteBoolean(property.Name, false);
break;
case JsonValueType.Number:
case JsonValueKind.Number:
writer.WriteNumber(property.Name, property.Value.GetDouble());
break;
case JsonValueType.String:
case JsonValueKind.String:
writer.WriteString(
property.Name,
property.Name == "access_token" ?
Expand Down