Removing the Manual reference file from System.Text.Json (dotnet/corefx#38409)
authorJose Perez Rodriguez <joperezr@microsoft.com>
Mon, 17 Jun 2019 21:10:20 +0000 (14:10 -0700)
committerGitHub <noreply@github.com>
Mon, 17 Jun 2019 21:10:20 +0000 (14:10 -0700)
* Removing the Manual reference file from System.Text.Json

* Readd the netcoreapp and uap configurations so that we don't have to bring AsyncInterfaces package into the shared framework closure

* Revert param name change as per PR Feedback

Commit migrated from https://github.com/dotnet/corefx/commit/5b3d41c1c63c4ebd93af7e6482e954e104827884

src/libraries/System.Text.Json/ref/System.Text.Json.Manual.cs [deleted file]
src/libraries/System.Text.Json/ref/System.Text.Json.cs
src/libraries/System.Text.Json/ref/System.Text.Json.csproj
src/libraries/System.Text.Json/src/System.Text.Json.csproj
src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.cs

diff --git a/src/libraries/System.Text.Json/ref/System.Text.Json.Manual.cs b/src/libraries/System.Text.Json/ref/System.Text.Json.Manual.cs
deleted file mode 100644 (file)
index 23b8c70..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// 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 http://aka.ms/api-review process.
-// ------------------------------------------------------------------------------
-
-namespace System.Text.Json
-{
-    public sealed partial class Utf8JsonWriter : System.IAsyncDisposable
-    {
-        public System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
-    }
-}
index b335fa5..2a1b2be 100644 (file)
@@ -148,8 +148,8 @@ namespace System.Text.Json
     public partial struct JsonReaderOptions
     {
         private int _dummyPrimitive;
-        public bool AllowTrailingCommas { get { throw null; } set { } }
-        public System.Text.Json.JsonCommentHandling CommentHandling { get { throw null; } set { } }
+        public bool AllowTrailingCommas { readonly get { throw null; } set { } }
+        public System.Text.Json.JsonCommentHandling CommentHandling { readonly get { throw null; } set { } }
         public int MaxDepth { get { throw null; } set { } }
     }
     public partial struct JsonReaderState
@@ -233,13 +233,13 @@ namespace System.Text.Json
         public long BytesConsumed { get { throw null; } }
         public int CurrentDepth { get { throw null; } }
         public System.Text.Json.JsonReaderState CurrentState { get { throw null; } }
-        public bool HasValueSequence { get { throw null; } }
+        public readonly bool HasValueSequence { get { throw null; } }
         public bool IsFinalBlock { get { throw null; } }
         public System.SequencePosition Position { get { throw null; } }
-        public long TokenStartIndex { get { throw null; } }
+        public readonly long TokenStartIndex { get { throw null; } }
         public System.Text.Json.JsonTokenType TokenType { get { throw null; } }
-        public System.Buffers.ReadOnlySequence<byte> ValueSequence { get { throw null; } }
-        public System.ReadOnlySpan<byte> ValueSpan { get { throw null; } }
+        public readonly System.Buffers.ReadOnlySequence<byte> ValueSequence { get { throw null; } }
+        public readonly System.ReadOnlySpan<byte> ValueSpan { get { throw null; } }
         public bool GetBoolean() { throw null; }
         public byte[] GetBytesFromBase64() { throw null; }
         public string GetComment() { throw null; }
@@ -276,7 +276,7 @@ namespace System.Text.Json
         public bool ValueTextEquals(System.ReadOnlySpan<char> text) { throw null; }
         public bool ValueTextEquals(string text) { throw null; }
     }
-    public sealed partial class Utf8JsonWriter : System.IDisposable
+    public sealed partial class Utf8JsonWriter : System.IAsyncDisposable, System.IDisposable
     {
         public Utf8JsonWriter(System.Buffers.IBufferWriter<byte> bufferWriter, System.Text.Json.JsonWriterOptions options = default(System.Text.Json.JsonWriterOptions)) { }
         public Utf8JsonWriter(System.IO.Stream utf8Json, System.Text.Json.JsonWriterOptions options = default(System.Text.Json.JsonWriterOptions)) { }
@@ -285,6 +285,7 @@ namespace System.Text.Json
         public int CurrentDepth { get { throw null; } }
         public System.Text.Json.JsonWriterOptions Options { get { throw null; } }
         public void Dispose() { }
+        public System.Threading.Tasks.ValueTask DisposeAsync() { throw null; }
         public void Flush() { }
         public System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
         public void Reset() { }
index 85b6a4f..f0f56f7 100644 (file)
@@ -7,7 +7,6 @@
     <Compile Include="System.Text.Json.cs" />
   </ItemGroup>
   <ItemGroup Condition="'$(TargetGroup)' != 'netstandard' AND '$(TargetsNetFx)' != 'true'">
-    <Compile Include="System.Text.Json.Manual.cs" />
     <ProjectReference Include="..\..\System.Memory\ref\System.Memory.csproj" />
     <ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
   </ItemGroup>
@@ -16,5 +15,6 @@
     <Reference Include="netstandard" />
     <Reference Include="System.Memory" />
     <Reference Include="System.Threading.Tasks.Extensions" />
+    <ProjectReference Include="..\..\Microsoft.Bcl.AsyncInterfaces\ref\Microsoft.Bcl.AsyncInterfaces.csproj" />
   </ItemGroup>
 </Project>
\ No newline at end of file
index 44c9fde..bc0b068 100644 (file)
     <Reference Include="System.Core" />
     <Reference Include="System.ValueTuple" />
     <Reference Include="System.Numerics.Vectors" />
+    <Reference Include="Microsoft.Bcl.AsyncInterfaces" />
   </ItemGroup>
   <ItemGroup Condition="'$(TargetsNETStandard)' != 'true' AND '$(TargetsNetFx)' != 'true'">
     <Reference Include="System.Collections" />
index 9ac6d57..3984a70 100644 (file)
@@ -31,10 +31,7 @@ namespace System.Text.Json
     /// <see cref="JsonWriterOptions"/> and pass that in to the writer.
     /// </remarks>
     [DebuggerDisplay("{DebuggerDisplay,nq}")]
-    public sealed partial class Utf8JsonWriter : IDisposable
-#if BUILDING_INBOX_LIBRARY
-        , IAsyncDisposable
-#endif
+    public sealed partial class Utf8JsonWriter : IDisposable, IAsyncDisposable
     {
         // Depending on OS, either '\r\n' OR '\n'
         private static readonly int s_newLineLength = Environment.NewLine.Length;
@@ -340,7 +337,6 @@ namespace System.Text.Json
             _output = null;
         }
 
-#if BUILDING_INBOX_LIBRARY
         /// <summary>
         /// Asynchronously commits any left over JSON text that has not yet been flushed and releases all resources used by the current instance.
         /// </summary>
@@ -369,7 +365,6 @@ namespace System.Text.Json
             _arrayBufferWriter = null;
             _output = null;
         }
-#endif
 
         /// <summary>
         /// Asynchronously commits the JSON text written so far which makes it visible to the output destination.