diff --git a/src/Microsoft.OData.Core/Batch/ODataBatchWriter.cs b/src/Microsoft.OData.Core/Batch/ODataBatchWriter.cs
index a0db0ff3fb..1553033d1c 100644
--- a/src/Microsoft.OData.Core/Batch/ODataBatchWriter.cs
+++ b/src/Microsoft.OData.Core/Batch/ODataBatchWriter.cs
@@ -419,6 +419,14 @@ public Task FlushAsync()
///
public abstract void OnInStreamError();
+ ///
+ public virtual Task OnInStreamErrorAsync()
+ {
+ // NOTE: ODataBatchWriter class is abstract and public. This method body is intended
+ // to prevent a breaking change in subclasses that provide the implementation.
+ throw new NotImplementedException();
+ }
+
///
/// Flush the output.
///
diff --git a/src/Microsoft.OData.Core/IODataOutputInStreamErrorListener.cs b/src/Microsoft.OData.Core/IODataOutputInStreamErrorListener.cs
index 202cf813ee..f47d4082ed 100644
--- a/src/Microsoft.OData.Core/IODataOutputInStreamErrorListener.cs
+++ b/src/Microsoft.OData.Core/IODataOutputInStreamErrorListener.cs
@@ -6,6 +6,10 @@
namespace Microsoft.OData
{
+ #region Namespaces
+ using System.Threading.Tasks;
+ #endregion Namespaces
+
///
/// An interface that allows the implementations of the writers to get notified if an in-stream error is to be written.
///
@@ -19,5 +23,15 @@ internal interface IODataOutputInStreamErrorListener
/// If the listener returns, the writer should not allow any more writing, since the in-stream error is the last thing in the payload.
///
void OnInStreamError();
+
+ ///
+ /// This method asynchronously notifies the listener, that an in-stream error is to be written.
+ ///
+ ///
+ /// This listener can choose to fail, if the currently written payload doesn't support in-stream error at this position.
+ /// If the listener returns, the writer should not allow any more writing, since the in-stream error is the last thing in the payload.
+ ///
+ /// A task that represents the asynchronous operation.
+ Task OnInStreamErrorAsync();
}
}
diff --git a/src/Microsoft.OData.Core/JsonLight/ODataJsonLightDeltaWriter.cs b/src/Microsoft.OData.Core/JsonLight/ODataJsonLightDeltaWriter.cs
index d0548cdd49..0965e41d07 100644
--- a/src/Microsoft.OData.Core/JsonLight/ODataJsonLightDeltaWriter.cs
+++ b/src/Microsoft.OData.Core/JsonLight/ODataJsonLightDeltaWriter.cs
@@ -287,6 +287,12 @@ void IODataOutputInStreamErrorListener.OnInStreamError()
this.inStreamErrorListener.OnInStreamError();
}
+ ///
+ Task IODataOutputInStreamErrorListener.OnInStreamErrorAsync()
+ {
+ throw new NotImplementedException();
+ }
+
#endregion
}
}
diff --git a/src/Microsoft.OData.Core/ODataAsynchronousWriter.cs b/src/Microsoft.OData.Core/ODataAsynchronousWriter.cs
index 224bfbc704..4889fe42d9 100644
--- a/src/Microsoft.OData.Core/ODataAsynchronousWriter.cs
+++ b/src/Microsoft.OData.Core/ODataAsynchronousWriter.cs
@@ -101,6 +101,12 @@ void IODataOutputInStreamErrorListener.OnInStreamError()
throw new ODataException(Strings.ODataAsyncWriter_CannotWriteInStreamErrorForAsync);
}
+ ///
+ Task IODataOutputInStreamErrorListener.OnInStreamErrorAsync()
+ {
+ throw new NotImplementedException();
+ }
+
///
/// Validates that the async writer is not disposed.
///
diff --git a/src/Microsoft.OData.Core/ODataCollectionWriterCore.cs b/src/Microsoft.OData.Core/ODataCollectionWriterCore.cs
index e0d1e0d536..5365553817 100644
--- a/src/Microsoft.OData.Core/ODataCollectionWriterCore.cs
+++ b/src/Microsoft.OData.Core/ODataCollectionWriterCore.cs
@@ -265,6 +265,12 @@ void IODataOutputInStreamErrorListener.OnInStreamError()
this.EnterScope(CollectionWriterState.Error, this.scopes.Peek().Item);
}
+ ///
+ Task IODataOutputInStreamErrorListener.OnInStreamErrorAsync()
+ {
+ throw new NotImplementedException();
+ }
+
///
/// Determines whether a given writer state is considered an error state.
///
diff --git a/src/Microsoft.OData.Core/ODataParameterWriterCore.cs b/src/Microsoft.OData.Core/ODataParameterWriterCore.cs
index 4fe1cc1b7f..def2994a58 100644
--- a/src/Microsoft.OData.Core/ODataParameterWriterCore.cs
+++ b/src/Microsoft.OData.Core/ODataParameterWriterCore.cs
@@ -306,6 +306,12 @@ void IODataOutputInStreamErrorListener.OnInStreamError()
throw new ODataException(Strings.ODataParameterWriter_InStreamErrorNotSupported);
}
+ ///
+ Task IODataOutputInStreamErrorListener.OnInStreamErrorAsync()
+ {
+ throw new NotImplementedException();
+ }
+
///
/// Check if the object has been disposed; called from all public API methods. Throws an ObjectDisposedException if the object
/// has already been disposed.
diff --git a/src/Microsoft.OData.Core/ODataWriterCore.cs b/src/Microsoft.OData.Core/ODataWriterCore.cs
index ebef737d3d..8bccab1d7c 100644
--- a/src/Microsoft.OData.Core/ODataWriterCore.cs
+++ b/src/Microsoft.OData.Core/ODataWriterCore.cs
@@ -760,6 +760,12 @@ void IODataOutputInStreamErrorListener.OnInStreamError()
this.EnterScope(WriterState.Error, this.CurrentScope.Item);
}
+ ///
+ Task IODataOutputInStreamErrorListener.OnInStreamErrorAsync()
+ {
+ throw new NotImplementedException();
+ }
+
///
/// This method is called when a stream is requested. It is a no-op.
///