-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Conversation
…referenced in < .NET 5 libraries
…bute for Windows Specific libraries
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. |
src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/PlatformAttributes.cs
Outdated
Show resolved
Hide resolved
…Certificates namespace
…iagnostics.Process namespace" This reverts commit 891848f.
…sting SYSTEM_PRIVATE_CORELIB
@jeffhandley it's ready, I've applied the attributes to everything that was on the list except of |
src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/NullableAttributes.cs
Show resolved
Hide resolved
# 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
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. |
There was a problem hiding this 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.
src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/PlatformAttributes.cs
Show resolved
Hide resolved
…ts where this file is included
… from other projects
There was a problem hiding this 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!
There was a problem hiding this 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.
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
* 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>
@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)