Skip to content

Commit

Permalink
Add PlatformNotSupportedException for SyncStream due to dotnet/corert…
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-safar committed May 30, 2018
1 parent 78fbc8e commit a813fc2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/System.Private.CoreLib/shared/System/IO/Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,9 @@ public override int ReadByte()

public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
{
#if CORERT
throw new PlatformNotSupportedException(); // TODO: https://github.com/dotnet/corert/issues/3251
#else
bool overridesBeginRead = _stream.HasOverriddenBeginEndRead();

lock (_stream)
Expand All @@ -1251,6 +1254,7 @@ public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, Asy
_stream.BeginRead(buffer, offset, count, callback, state) :
_stream.BeginReadInternal(buffer, offset, count, callback, state, serializeAsynchronously: true, apm: true);
}
#endif
}

public override int EndRead(IAsyncResult asyncResult)
Expand Down Expand Up @@ -1294,6 +1298,9 @@ public override void WriteByte(byte b)

public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, Object state)
{
#if CORERT
throw new PlatformNotSupportedException(); // TODO: https://github.com/dotnet/corert/issues/3251
#else
bool overridesBeginWrite = _stream.HasOverriddenBeginEndWrite();

lock (_stream)
Expand All @@ -1308,6 +1315,7 @@ public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, As
_stream.BeginWrite(buffer, offset, count, callback, state) :
_stream.BeginWriteInternal(buffer, offset, count, callback, state, serializeAsynchronously: true, apm: true);
}
#endif
}

public override void EndWrite(IAsyncResult asyncResult)
Expand Down

0 comments on commit a813fc2

Please sign in to comment.