From fa23d38db8bd54a132d1ed3a61340eefeb495f4b Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Wed, 15 Jul 2020 20:20:22 -0700 Subject: [PATCH] Improve SuppressGCTransitionAttribute docs --- .../SuppressGCTransitionAttribute.internal.cs | 12 ------------ .../src/Microsoft.Extensions.Logging.Console.csproj | 4 ++-- .../src/Microsoft.IO.Redist.csproj | 3 ++- .../src/Microsoft.Win32.SystemEvents.csproj | 4 ++-- .../src/System.IO.FileSystem.AccessControl.csproj | 3 ++- .../InteropServices/SuppressGCTransitionAttribute.cs | 10 +++++++++- 6 files changed, 17 insertions(+), 19 deletions(-) delete mode 100644 src/libraries/Common/src/System/Runtime/InteropServices/SuppressGCTransitionAttribute.internal.cs diff --git a/src/libraries/Common/src/System/Runtime/InteropServices/SuppressGCTransitionAttribute.internal.cs b/src/libraries/Common/src/System/Runtime/InteropServices/SuppressGCTransitionAttribute.internal.cs deleted file mode 100644 index e9fbb73111d2f0..00000000000000 --- a/src/libraries/Common/src/System/Runtime/InteropServices/SuppressGCTransitionAttribute.internal.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -// Internal copy of SuppressGCTransitionAttribute used only to enable files -// that use this to compile. On any platforms that support this attribute, -// the real one exposed from CoreLib should be used. - -namespace System.Runtime.InteropServices -{ - [AttributeUsage(AttributeTargets.Method)] - internal sealed class SuppressGCTransitionAttribute : Attribute { } -} diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/src/Microsoft.Extensions.Logging.Console.csproj b/src/libraries/Microsoft.Extensions.Logging.Console/src/Microsoft.Extensions.Logging.Console.csproj index 9e07f911a6639a..5ffe073177612b 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/src/Microsoft.Extensions.Logging.Console.csproj +++ b/src/libraries/Microsoft.Extensions.Logging.Console/src/Microsoft.Extensions.Logging.Console.csproj @@ -38,8 +38,8 @@ - + diff --git a/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj b/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj index 5e8d6bcfed8545..2614f3c3181ba0 100644 --- a/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj +++ b/src/libraries/Microsoft.IO.Redist/src/Microsoft.IO.Redist.csproj @@ -190,7 +190,8 @@ Link="Common\System\IO\PathInternal.CaseSensitivity.cs" /> - + diff --git a/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft.Win32.SystemEvents.csproj b/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft.Win32.SystemEvents.csproj index 407a37698931ec..0470f8b07a7963 100644 --- a/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft.Win32.SystemEvents.csproj +++ b/src/libraries/Microsoft.Win32.SystemEvents/src/Microsoft.Win32.SystemEvents.csproj @@ -113,8 +113,8 @@ - + diff --git a/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj b/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj index ac6c8e8a6690c4..3d496a69c3f217 100644 --- a/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj +++ b/src/libraries/System.IO.FileSystem.AccessControl/src/System.IO.FileSystem.AccessControl.csproj @@ -12,7 +12,8 @@ SR.PlatformNotSupported_AccessControl - + diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SuppressGCTransitionAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SuppressGCTransitionAttribute.cs index 1909af3f6d6ddc..21b8a615f1a7fd 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SuppressGCTransitionAttribute.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SuppressGCTransitionAttribute.cs @@ -42,6 +42,9 @@ namespace System.Runtime.InteropServices /// In general, usage of this attribute is not recommended if debugging the P/Invoke is important, for example /// stepping through the native code or diagnosing an exception thrown from the native code. /// + /// The runtime may load the native library for method marked with this attribute in advance before the method is called for the first time. + /// Usage of this attribute is not recommended for platform neutral libraries with conditional platform specific code. + /// /// The P/Invoke method that this attribute is applied to must have all of the following properties: /// * Native function always executes for a trivial amount of time (less than 1 microsecond). /// * Native function does not perform a blocking syscall (e.g. any type of I/O). @@ -55,7 +58,12 @@ namespace System.Runtime.InteropServices /// * Data corruption. /// [AttributeUsage(AttributeTargets.Method, Inherited = false)] - public sealed class SuppressGCTransitionAttribute : Attribute +#if SYSTEM_PRIVATE_CORELIB + public +#else + internal +#endif + sealed class SuppressGCTransitionAttribute : Attribute { public SuppressGCTransitionAttribute() {