Skip to content

mark Windows-specific APIs as such #39265

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

Merged
merged 37 commits into from
Jul 17, 2020

Conversation

adamsitnik
Copy link
Member

@jeffhandley this is just a draft now, I will mark it as ready and remove the "no merge" label as soon as I annotate all types and methods (a matter of hours I hope)

@adamsitnik adamsitnik added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Jul 14, 2020
@Dotnet-GitSync-Bot
Copy link
Collaborator

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@jeffhandley jeffhandley self-requested a review July 14, 2020 11:52
@adamsitnik adamsitnik removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Jul 14, 2020
@adamsitnik adamsitnik marked this pull request as ready for review July 14, 2020 16:03
@adamsitnik
Copy link
Member Author

@jeffhandley it's ready, I've applied the attributes to everything that was on the list except of System.ServiceModel* which lives in a different repo

# Conflicts:
#	src/libraries/System.IO.FileSystem.DriveInfo/ref/System.IO.FileSystem.DriveInfo.cs
#	src/libraries/System.IO.FileSystem.DriveInfo/src/System/IO/DriveInfo.Unix.cs
@jkotas
Copy link
Member

jkotas commented Jul 15, 2020

simplify the attribute name (in places with more than 2 usages)

Nit: I do not think it is worth making distinction between 1 vs 2+ usages. I believe that we typically import namespace even just for 1 usage.

Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

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

This is great, @adamsitnik! I just recommend converting all of the src attributes to drop the "Attribute" suffix and use using statements, but otherwise it looks great to me.

Copy link
Member

@jeffhandley jeffhandley left a comment

Choose a reason for hiding this comment

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

LGTM but I defer to @ViktorHofer and @safern on the infrastructure details. Thanks for trimming up the syntax on the attributes!

Copy link
Member

@ViktorHofer ViktorHofer left a comment

Choose a reason for hiding this comment

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

LGTM besides my two comments.

adamsitnik and others added 2 commits July 16, 2020 22:41
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
@adamsitnik adamsitnik merged commit 52d4d8c into dotnet:master Jul 17, 2020
@adamsitnik adamsitnik deleted the windowsSpecificAPIs branch July 17, 2020 13:11
jeffhandley added a commit that referenced this pull request Jul 21, 2020
* move all OSPlatformAttributes to a single file so they can be easily referenced in < .NET 5 libraries

* Adds System.Runtime.Versioning*Platform* annotation attributes to < .NET 5 builds

* introduce MinimiumSupportedWindowsPlatform

* introduce IsWindowsSpecific setting that adds MinimumOSPlatform attribute for Windows Specific libraries

* mark all Windows-specific libraries as such

* annotate Windows-specific System.Console methods and properites

* annotate Windows-specific DpapiProtectedConfigurationProvider type

* annotate throwing Windows-specific APIs from System.Diagnostics.Process namespace

* annotate throwing Windows-specific APIs from System.IO.MemoryMappedFiles namespace

* annotate Windows-specific APIs from System.IO.Pipes namespace

* the new attributes should support enums

* annotate Windows-specific APIs from HttpListenerTimeoutManager class

* annotate Windows-specific APIs from System.Net.Sockets namespace

* annotate Windows-specific APIs from System.Runtime.InteropServices namespace

* annotate Windows-specific APIs from System.Security.Cryptography.Csp namespace

* annotate Windows-specific APIs from System.Security.Cryptography.X509Certificates namespace

* annotate Windows-specific APIs from System.Threading namespace

* address code review feedback: dont introduce new constants, reuse existing SYSTEM_PRIVATE_CORELIB

* code review: import the namespace, simplify the attribute name

* add missing Socket.DuplicateAndClose and Socket(SocketInformation)

* fix the test name (it does not throw)

* add missing DriveInfo.set_VolumeLabel

* add System.IO.FileSystem File Encrypt and Descrypt methods

* simplify the < .NET 5 check

* enable nullable in explicit way as it's not enabled in all the projects where this file is included

* include platform attributes in projects that ask for it in explicit way

* set IncludePlatformAttributes to true for projects that include files from other projects

* use suggestions from Viktor and Santi

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants