summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/IO/Stream.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/IO/Stream.cs')
-rw-r--r--src/mscorlib/src/System/IO/Stream.cs28
1 files changed, 2 insertions, 26 deletions
diff --git a/src/mscorlib/src/System/IO/Stream.cs b/src/mscorlib/src/System/IO/Stream.cs
index 3cdfad613e..790f0a09ab 100644
--- a/src/mscorlib/src/System/IO/Stream.cs
+++ b/src/mscorlib/src/System/IO/Stream.cs
@@ -23,14 +23,12 @@ using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
using System.Security;
-using System.Security.Permissions;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.Reflection;
namespace System.IO {
[Serializable]
- [ComVisible(true)]
public abstract class Stream : MarshalByRefObject, IDisposable {
public static readonly Stream Null = new NullStream();
@@ -65,7 +63,6 @@ namespace System.IO {
get;
}
- [ComVisible(false)]
public virtual bool CanTimeout {
[Pure]
get {
@@ -87,7 +84,6 @@ namespace System.IO {
set;
}
- [ComVisible(false)]
public virtual int ReadTimeout {
get {
Contract.Ensures(Contract.Result<int>() >= 0);
@@ -98,7 +94,6 @@ namespace System.IO {
}
}
- [ComVisible(false)]
public virtual int WriteTimeout {
get {
Contract.Ensures(Contract.Result<int>() >= 0);
@@ -109,7 +104,6 @@ namespace System.IO {
}
}
- [ComVisible(false)]
public Task CopyToAsync(Stream destination)
{
int bufferSize = _DefaultCopyBufferSize;
@@ -146,13 +140,11 @@ namespace System.IO {
return CopyToAsync(destination, bufferSize);
}
- [ComVisible(false)]
public Task CopyToAsync(Stream destination, Int32 bufferSize)
{
return CopyToAsync(destination, bufferSize, CancellationToken.None);
}
- [ComVisible(false)]
public virtual Task CopyToAsync(Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
{
StreamHelpers.ValidateCopyToArgs(this, destination, bufferSize);
@@ -278,13 +270,11 @@ namespace System.IO {
public abstract void Flush();
- [ComVisible(false)]
public Task FlushAsync()
{
return FlushAsync(CancellationToken.None);
}
- [ComVisible(false)]
public virtual Task FlushAsync(CancellationToken cancellationToken)
{
return Task.Factory.StartNew(state => ((Stream)state).Flush(), this,
@@ -398,13 +388,11 @@ namespace System.IO {
}
}
- [ComVisible(false)]
public Task<int> ReadAsync(Byte[] buffer, int offset, int count)
{
return ReadAsync(buffer, offset, count, CancellationToken.None);
}
- [ComVisible(false)]
public virtual Task<int> ReadAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
// If cancellation was requested, bail early with an already completed task.
@@ -617,7 +605,6 @@ namespace System.IO {
_buffer = null;
}
- [MethodImpl(MethodImplOptions.NoInlining)]
public ReadWriteTask(
bool isRead,
bool apm,
@@ -630,8 +617,6 @@ namespace System.IO {
Contract.Requires(buffer != null);
Contract.EndContractBlock();
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
-
// Store the arguments
_isRead = isRead;
_apm = apm;
@@ -648,8 +633,7 @@ namespace System.IO {
if (callback != null)
{
_callback = callback;
- _context = ExecutionContext.Capture(ref stackMark,
- ExecutionContext.CaptureOptions.OptimizeDefaultCase | ExecutionContext.CaptureOptions.IgnoreSyncCtx);
+ _context = ExecutionContext.Capture();
base.AddCompletionAction(this);
}
}
@@ -683,14 +667,13 @@ namespace System.IO {
var invokeAsyncCallback = s_invokeAsyncCallback;
if (invokeAsyncCallback == null) s_invokeAsyncCallback = invokeAsyncCallback = InvokeAsyncCallback; // benign race condition
- using(context) ExecutionContext.Run(context, invokeAsyncCallback, this, true);
+ ExecutionContext.Run(context, invokeAsyncCallback, this);
}
}
bool ITaskCompletionAction.InvokeMayRunArbitraryCode { get { return true; } }
}
- [ComVisible(false)]
public Task WriteAsync(Byte[] buffer, int offset, int count)
{
return WriteAsync(buffer, offset, count, CancellationToken.None);
@@ -698,7 +681,6 @@ namespace System.IO {
- [ComVisible(false)]
public virtual Task WriteAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
// If cancellation was requested, bail early with an already completed task.
@@ -906,7 +888,6 @@ namespace System.IO {
{
}
- [ComVisible(false)]
public override Task FlushAsync(CancellationToken cancellationToken)
{
return cancellationToken.IsCancellationRequested ?
@@ -951,7 +932,6 @@ namespace System.IO {
return 0;
}
- [ComVisible(false)]
public override Task<int> ReadAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
var nullReadTask = s_nullReadTask;
@@ -970,7 +950,6 @@ namespace System.IO {
{
}
- [ComVisible(false)]
public override Task WriteAsync(Byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
return cancellationToken.IsCancellationRequested ?
@@ -1106,7 +1085,6 @@ namespace System.IO {
get { return _stream.CanSeek; }
}
- [ComVisible(false)]
public override bool CanTimeout {
[Pure]
get {
@@ -1135,7 +1113,6 @@ namespace System.IO {
}
}
- [ComVisible(false)]
public override int ReadTimeout {
get {
return _stream.ReadTimeout;
@@ -1145,7 +1122,6 @@ namespace System.IO {
}
}
- [ComVisible(false)]
public override int WriteTimeout {
get {
return _stream.WriteTimeout;