Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mark FileStream.Lock and Unlock as unsupported on macOS #47040

Merged
merged 4 commits into from
Feb 8, 2021

Conversation

adamsitnik
Copy link
Member

the both call methods that throw on macOS:

private static void LockInternal(long position, long length)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_OSXFileLocking);
}
private static void UnlockInternal(long position, long length)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_OSXFileLocking);
}

@@ -271,6 +273,7 @@ public virtual void Lock(long position, long length)
LockInternal(position, length);
}

[UnsupportedOSPlatform("macos")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably the ref needs to be updated, too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what about overrides? e.g. IsolatedStorageFileStream.Lock/Unlock?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stephentoub excellent points (as usual). I've added missing attributes (ref & overrides) PTAL

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sorry, I've missed the VB files... let me fix the build and get back to you

@adamsitnik
Copy link
Member Author

The CI failures come from #47374, the PR should be ready for review

@@ -1000,6 +1000,7 @@ Namespace Microsoft.VisualBasic
End Try
End Sub

<UnsupportedOSPlatform("macos")>
Public Function InputString(ByVal FileNumber As Integer, ByVal CharCount As Integer) As String
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this API's area owner would prefer to reduce the aggressiveness of marking the whole platform as unsupported, and instead only calling oFile.Lock() and oFile.Unlock() when the platform is not MacOS.

Copy link
Contributor

@buyaa-n buyaa-n Feb 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, mono team has a story for adding more attributes for mac/android/ios, they might want to see this changes cc @marek-safar

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That story is for SDKs but we are going to audit libraries as well during #47910 work

Copy link
Member

@carlossanlop carlossanlop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM given that all the unit tests are failing with unrelated failures.

Copy link
Contributor

@buyaa-n buyaa-n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@adamsitnik adamsitnik merged commit a98fe6c into dotnet:master Feb 8, 2021
@adamsitnik adamsitnik deleted the fileLockingIsUnsupportedOnOSX branch February 8, 2021 12:54
@ghost ghost locked as resolved and limited conversation to collaborators Mar 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants