Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

[release/3.1] Add new System.Net.Http.Json project/namespace #42879

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
da6d3b8
Add System.Net.Http.Json related projects
jozkee Mar 11, 2020
d1e22bf
Add JsonContent, HttpContent extensions, and tests.
jozkee Mar 11, 2020
58f2ac0
Rename PErson.cs to Person.cs
jozkee Mar 11, 2020
45a84bb
Adding package for System.Net.Http.Json library
joperezr Mar 11, 2020
d3be353
Improve tests, minor fixes and code clean-up.
jozkee Mar 11, 2020
384c0bf
Remove annotations and code clean-up.
jozkee Mar 11, 2020
08f9910
Add draft description and common types to NuGet pkg.
jozkee Mar 11, 2020
d6d7587
Addres nullability issues on API surface area.
jozkee Mar 11, 2020
c19f232
Add missing configuration to test project
joperezr Mar 12, 2020
14aa391
Addressing most of the feedback.
jozkee Mar 12, 2020
a8c59d2
Fix csproj formatting and use open StrongNameKeyId
jozkee Mar 13, 2020
d2f858c
Changing prereleaselabel and ensuring the package won't go stable in …
joperezr Mar 16, 2020
686e18e
Address API review comments.
jozkee Mar 16, 2020
283818d
Add transcoding support for .NET 5
jozkee Mar 17, 2020
e97f7a2
Port TranscodingReadWriteStream to netstandard2.0
jozkee Mar 17, 2020
aab639f
Fix package testing issue by reverting the inbox version of System.Te…
joperezr Mar 17, 2020
8debf82
Adding BlockStable attribute to make sure the package won't be marked…
joperezr Mar 17, 2020
1d24f38
Remove netcoreapp dependencies on TranscodingStream classes.
jozkee Mar 19, 2020
d0d1fd5
Mark TransportContext as nullable to fix CI issues.
jozkee Mar 19, 2020
988ca9f
Addres issues raised by new nullablity awareness code in System.Net.Http
jozkee Mar 19, 2020
12dc58b
Re-enable LoopBackServer tests, address suggestions and code clean-up.
jozkee Mar 20, 2020
845ac13
Use default JsonSerializerOptions when passed-in is null
jozkee Mar 20, 2020
d6745fe
Escape a few remaining Unicode characters in test files.
jozkee Mar 20, 2020
653f26d
Address nits.
jozkee Mar 20, 2020
f9112c4
Validate inputType.IsAssignableFrom(inputValue.GetType()) on JsonContent
jozkee Mar 20, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
System.ComponentModel.Composition;
</Value>
</ValidatePackageSuppression>
<!-- Permit inbox revsion of assemblies that are part of shared framework but also ship as packages. This will
make sure other packages that have a reference to them will carry a package reference to the latest serviced
version. -->
<ValidatePackageSuppression Include="PermitInbox">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this required? Can you please share the error message you were getting?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The private transport package was failing due to a version inconsistency, System.Text.Json was expected to be inbox with version 4.0.1.0 but was found to have 4.0.1.1. Here is the error message I got:

C:\Users\joperezr\.nuget\packages\microsoft.dotnet.build.tasks.packaging\1.0.0-beta.20113.5\build\Packaging.targets(1161,5): error : File System.Text.Json, version 4.0.1.1 was included framework package Microsoft.Private.CoreFx.NETCoreApp/4.7.0-dev.20167.1 but that version is not considered inbox in package index F:\git\corefx\pkg\Microsoft.Private.PackageBaseline\packageIndex.json.  Please add it with appropriate InboxOn entry for netcoreapp3.1 or suppress this message with PermitInbox suppression. [F:\git\corefx\pkg\Microsoft.Private.CoreFx.NETCoreApp\Microsoft.Private.CoreFx.NETCoreApp.pkgproj]

<Value>
System.Text.Json;
</Value>
</ValidatePackageSuppression>
</ItemGroup>

<Target Name="VerifyRuntimeOnlyFilesArePresentOnAllRuntimePackages"
Expand Down
10 changes: 8 additions & 2 deletions pkg/Microsoft.Private.PackageBaseline/packageIndex.json
Original file line number Diff line number Diff line change
Expand Up @@ -2992,6 +2992,12 @@
"4.2.0.0": "4.4.0"
}
},
"System.Net.Http.Json": {
"InboxOn": {},
"AssemblyVersionInPackageVersion": {
"3.2.0.0": "3.2.0"
}
},
"System.Net.Http.Rtc": {
"StableVersions": [
"4.0.0",
Expand Down Expand Up @@ -5534,7 +5540,7 @@
"BaselineVersion": "4.7.0",
"InboxOn": {
"netcoreapp3.0": "4.0.0.0",
"netcoreapp3.1": "4.0.1.1",
"netcoreapp3.1": "4.0.1.0",
"uap10.0.16300": "4.0.1.0"
},
"AssemblyVersionInPackageVersion": {
Expand Down Expand Up @@ -6591,4 +6597,4 @@
"System.Xml.XDocument"
]
}
}
}
9 changes: 9 additions & 0 deletions pkg/descriptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,15 @@
"System.Net.HttpListener"
]
},
{
"Name": "System.Net.Http.Json",
"Description": "Provides extension methods for System.Net.Http.HttpClient and System.Net.Http.HttpContent that perform automatic serialization and deserialization using System.Text.Json.",
"CommonTypes": [
"System.Net.Http.Json.HttpClientJsonExtensions",
"System.Net.Http.Json.HttpContentJsonExtensions",
"System.Net.Http.Json.JsonContent"
]
},
{
"Name": "System.Net.Http.Rtc",
"Description": "Provides the System.Net.Http.RtcRequestFactory class, which creates HTTP requests for use with the Real-Time-Communications (RTC) background notification infrastructure.",
Expand Down
15 changes: 15 additions & 0 deletions src/System.Net.Http.Json/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<StrongNameKeyId>Open</StrongNameKeyId>
<AssemblyVersion>3.2.0.0</AssemblyVersion>
<PackageVersion>3.2.0</PackageVersion>

<!-- Setting Suppress Final Package Version and IsShippingAssembly properties in order to force the release build to
continue emitting pre-release labels as we won't want to ship stable on this release yet. -->
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
<BlockStable>true</BlockStable>
<SuppressFinalPackageVersion>true</SuppressFinalPackageVersion>
<IsShippingAssembly>false</IsShippingAssembly>
</PropertyGroup>
</Project>
53 changes: 53 additions & 0 deletions src/System.Net.Http.Json/System.Net.Http.Json.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29806.167
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Net.Http.Json", "src\System.Net.Http.Json.csproj", "{1D422B1D-D7C4-41B9-862D-EB3D98DF37DE}"
ProjectSection(ProjectDependencies) = postProject
{132BF813-FC40-4D39-8B6F-E55D7633F0ED} = {132BF813-FC40-4D39-8B6F-E55D7633F0ED}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Net.Http.Json", "ref\System.Net.Http.Json.csproj", "{132BF813-FC40-4D39-8B6F-E55D7633F0ED}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1B471D80-205C-4E9C-8D36-601275080642}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Net.Http.Json.Functional.Tests", "tests\FunctionalTests\System.Net.Http.Json.Functional.Tests.csproj", "{DC607A29-7C8D-4933-9AEB-23CF696B2BC6}"
ProjectSection(ProjectDependencies) = postProject
{1D422B1D-D7C4-41B9-862D-EB3D98DF37DE} = {1D422B1D-D7C4-41B9-862D-EB3D98DF37DE}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1D422B1D-D7C4-41B9-862D-EB3D98DF37DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D422B1D-D7C4-41B9-862D-EB3D98DF37DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D422B1D-D7C4-41B9-862D-EB3D98DF37DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D422B1D-D7C4-41B9-862D-EB3D98DF37DE}.Release|Any CPU.Build.0 = Release|Any CPU
{132BF813-FC40-4D39-8B6F-E55D7633F0ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{132BF813-FC40-4D39-8B6F-E55D7633F0ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
{132BF813-FC40-4D39-8B6F-E55D7633F0ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
{132BF813-FC40-4D39-8B6F-E55D7633F0ED}.Release|Any CPU.Build.0 = Release|Any CPU
{DC607A29-7C8D-4933-9AEB-23CF696B2BC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DC607A29-7C8D-4933-9AEB-23CF696B2BC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC607A29-7C8D-4933-9AEB-23CF696B2BC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC607A29-7C8D-4933-9AEB-23CF696B2BC6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1D422B1D-D7C4-41B9-862D-EB3D98DF37DE} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
{132BF813-FC40-4D39-8B6F-E55D7633F0ED} = {2E666815-2EDB-464B-9DF6-380BF4789AD4}
{DC607A29-7C8D-4933-9AEB-23CF696B2BC6} = {1B471D80-205C-4E9C-8D36-601275080642}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5100F629-0FAB-4C6F-9A54-95AE9565EE0D}
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions src/System.Net.Http.Json/pkg/System.Net.Http.Json.pkgproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project DefaultTargets="Build">
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Net.Http.Json.csproj">
<SupportedFramework>net461;netcoreapp2.0;uap10.0.16299;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\src\System.Net.Http.Json.csproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
7 changes: 7 additions & 0 deletions src/System.Net.Http.Json/ref/Configurations.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<BuildConfigurations>
netstandard;
</BuildConfigurations>
</PropertyGroup>
</Project>
44 changes: 44 additions & 0 deletions src/System.Net.Http.Json/ref/System.Net.Http.Json.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ------------------------------------------------------------------------------
// Changes to this file must follow the https://aka.ms/api-review process.
// ------------------------------------------------------------------------------

namespace System.Net.Http.Json
{
public static partial class HttpClientJsonExtensions
{
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, string? requestUri, System.Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, string? requestUri, System.Type type, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Type type, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<object?> GetFromJsonAsync(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Type type, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<TValue> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, string? requestUri, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<TValue> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, string? requestUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<TValue> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Text.Json.JsonSerializerOptions? options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<TValue> GetFromJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, string? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, string? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PostAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, string? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, string? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; }
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue>(this System.Net.Http.HttpClient client, System.Uri? requestUri, TValue value, System.Threading.CancellationToken cancellationToken) { throw null; }
}
public static partial class HttpContentJsonExtensions
{
public static System.Threading.Tasks.Task<object?> ReadFromJsonAsync(this System.Net.Http.HttpContent content, System.Type type, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public static System.Threading.Tasks.Task<T> ReadFromJsonAsync<T>(this System.Net.Http.HttpContent content, System.Text.Json.JsonSerializerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class JsonContent : System.Net.Http.HttpContent
{
internal JsonContent() { }
public System.Type ObjectType { get { throw null; } }
public object? Value { get { throw null; } }
public static System.Net.Http.Json.JsonContent Create(object? inputValue, System.Type inputType, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType, System.Text.Json.JsonSerializerOptions? options = null) { throw null; }
public static System.Net.Http.Json.JsonContent Create<T>(T inputValue, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType, System.Text.Json.JsonSerializerOptions? options = null) { throw null; }
protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext? context) { throw null; }
protected override bool TryComputeLength(out long length) { throw null; }
}
}
12 changes: 12 additions & 0 deletions src/System.Net.Http.Json/ref/System.Net.Http.Json.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configurations>netstandard-Debug;netstandard-Release</Configurations>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.Net.Http.Json.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Text.Json\ref\System.Text.Json.csproj" />
</ItemGroup>
</Project>
7 changes: 7 additions & 0 deletions src/System.Net.Http.Json/src/Configurations.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<BuildConfigurations>
netstandard;
</BuildConfigurations>
</PropertyGroup>
</Project>
Loading