Utf8Json -> System.Text.Json (#9933)

This commit is contained in:
Pranav K 2019-05-03 10:33:45 -07:00 committed by GitHub
parent 69a44b5439
commit 3a4e7866d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 7 deletions

View File

@ -160,7 +160,6 @@ and are generated based on the last package release.
<LatestPackageReference Include="System.Text.Json" Version="$(SystemTextJsonPackageVersion)" />
<LatestPackageReference Include="System.Threading.Channels" Version="$(SystemThreadingChannelsPackageVersion)" />
<LatestPackageReference Include="System.Threading.Tasks.Extensions" Version="$(SystemThreadingTasksExtensionsPackageVersion)" />
<LatestPackageReference Include="Utf8Json" Version="$(Utf8JsonPackageVersion)" />
<LatestPackageReference Include="xunit.abstractions" Version="$(XunitAbstractionsPackageVersion)" />
<LatestPackageReference Include="xunit.analyzers" Version="$(XunitAnalyzersPackageVersion)" />
<LatestPackageReference Include="xunit.assert" Version="$(XunitAssertPackageVersion)" />

View File

@ -195,7 +195,6 @@
<SerilogSinksFilePackageVersion>4.0.0</SerilogSinksFilePackageVersion>
<StackExchangeRedisPackageVersion>2.0.513</StackExchangeRedisPackageVersion>
<SystemReactiveLinqPackageVersion>3.1.1</SystemReactiveLinqPackageVersion>
<Utf8JsonPackageVersion>1.3.7</Utf8JsonPackageVersion>
<XunitAbstractionsPackageVersion>2.0.3</XunitAbstractionsPackageVersion>
<XunitAnalyzersPackageVersion>0.10.0</XunitAnalyzersPackageVersion>
<XunitVersion>2.4.1</XunitVersion>

View File

@ -3,9 +3,9 @@
using System;
using System.IO.Pipelines;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
using Utf8Json;
namespace PlatformBenchmarks
{
@ -25,6 +25,8 @@ namespace PlatformBenchmarks
private readonly static AsciiString _plainTextBody = "Hello, World!";
private static readonly JsonSerializerOptions SerializerOptions = new JsonSerializerOptions();
public static class Paths
{
public readonly static AsciiString Plaintext = "/plaintext";
@ -115,8 +117,8 @@ namespace PlatformBenchmarks
// Content-Length header
writer.Write(_headerContentLength);
var jsonPayload = JsonSerializer.SerializeUnsafe(new { message = "Hello, World!" });
writer.WriteNumeric((uint)jsonPayload.Count);
var jsonPayload = JsonSerializer.ToBytes(new { message = "Hello, World!" }, SerializerOptions);
writer.WriteNumeric((uint)jsonPayload.Length);
// End of headers
writer.Write(_eoh);

View File

@ -11,7 +11,6 @@
<!-- These references are used when running locally -->
<ItemGroup Condition="'$(BenchmarksTargetFramework)' == ''">
<Reference Include="Utf8Json" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" />
@ -20,7 +19,6 @@
<!-- These references are used when running on the Benchmarks Server -->
<ItemGroup Condition="'$(BenchmarksTargetFramework)' != ''">
<PackageReference Include="Utf8Json" Version="1.3.7" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv" Version="$(MicrosoftAspNetCoreAppPackageVersion)" />
<FrameworkReference Update="Microsoft.AspNetCore.App" RuntimeFrameworkVersion="$(MicrosoftAspNetCoreAppPackageVersion)" />