Skip to content

Commit

Permalink
Annotate FileStream.Lock/Unlock as unsupported on iOS/tvOS
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximLipnin committed May 12, 2021
1 parent 2e618ff commit 897f519
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ public FileStream(string path, FileMode mode, FileAccess access, FileShare share
[Obsolete("This property has been deprecated. Please use FileStream's SafeFileHandle property instead. https://go.microsoft.com/fwlink/?linkid=14202")]
public virtual IntPtr Handle => _strategy.Handle;

[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("macos")]
[UnsupportedOSPlatform("tvos")]
public virtual void Lock(long position, long length)
{
if (position < 0 || length < 0)
Expand All @@ -212,7 +214,9 @@ public virtual void Lock(long position, long length)
_strategy.Lock(position, length);
}

[UnsupportedOSPlatform("ios")]
[UnsupportedOSPlatform("macos")]
[UnsupportedOSPlatform("tvos")]
public virtual void Unlock(long position, long length)
{
if (position < 0 || length < 0)
Expand Down
4 changes: 4 additions & 0 deletions src/libraries/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7329,7 +7329,9 @@ public override void EndWrite(System.IAsyncResult asyncResult) { }
public override void Flush() { }
public virtual void Flush(bool flushToDisk) { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("macos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public virtual void Lock(long position, long length) { }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override int Read(System.Span<byte> buffer) { throw null; }
Expand All @@ -7338,7 +7340,9 @@ public virtual void Lock(long position, long length) { }
public override int ReadByte() { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; }
public override void SetLength(long value) { }
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("macos")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public virtual void Unlock(long position, long length) { }
public override void Write(byte[] buffer, int offset, int count) { }
public override void Write(System.ReadOnlySpan<byte> buffer) { }
Expand Down

0 comments on commit 897f519

Please sign in to comment.