diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs
index 0d38f64c75945..39f4eac6016ea 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs
@@ -502,7 +502,7 @@ private struct ISymUnmanagedWriter
//--------------------------------------------------------------------------------------
internal sealed class PunkSafeHandle : SafeHandle
{
- internal PunkSafeHandle()
+ public PunkSafeHandle()
: base((IntPtr)0, true)
{
}
diff --git a/src/coreclr/System.Private.CoreLib/src/System/TypeNameParser.cs b/src/coreclr/System.Private.CoreLib/src/System/TypeNameParser.cs
index 7a9dbf91e201c..9a00284c9a3c7 100644
--- a/src/coreclr/System.Private.CoreLib/src/System/TypeNameParser.cs
+++ b/src/coreclr/System.Private.CoreLib/src/System/TypeNameParser.cs
@@ -14,7 +14,7 @@
namespace System
{
- internal class SafeTypeNameParserHandle : SafeHandleZeroOrMinusOneIsInvalid
+ internal sealed class SafeTypeNameParserHandle : SafeHandleZeroOrMinusOneIsInvalid
{
#region QCalls
[DllImport(RuntimeHelpers.QCall, CharSet = CharSet.Unicode)]
diff --git a/src/installer/managed/Microsoft.NET.HostModel/ResourceUpdater.cs b/src/installer/managed/Microsoft.NET.HostModel/ResourceUpdater.cs
index af71bfeea0a51..e18eedf9804d2 100644
--- a/src/installer/managed/Microsoft.NET.HostModel/ResourceUpdater.cs
+++ b/src/installer/managed/Microsoft.NET.HostModel/ResourceUpdater.cs
@@ -150,9 +150,9 @@ public static extern uint SizeofResource(IntPtr hModule,
/// native resources for the update handle without updating
/// the target file.
///
- private class SafeUpdateHandle : SafeHandle
+ private sealed class SafeUpdateHandle : SafeHandle
{
- private SafeUpdateHandle() : base(IntPtr.Zero, true)
+ public SafeUpdateHandle() : base(IntPtr.Zero, true)
{
}
diff --git a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFArray.cs b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFArray.cs
index 9ec3cf2c96189..3c57e9f894291 100644
--- a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFArray.cs
+++ b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFArray.cs
@@ -37,7 +37,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeCFArrayHandle : SafeHandle
{
- private SafeCFArrayHandle()
+ public SafeCFArrayHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFData.cs b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFData.cs
index c703e23a9e0a1..68e8164a539f5 100644
--- a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFData.cs
+++ b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFData.cs
@@ -86,7 +86,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeCFDataHandle : SafeHandle
{
- internal SafeCFDataHandle()
+ public SafeCFDataHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFDate.cs b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFDate.cs
index fae8dfeefe309..4393796ef6add 100644
--- a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFDate.cs
+++ b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFDate.cs
@@ -49,7 +49,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeCFDateHandle : SafeHandle
{
- internal SafeCFDateHandle()
+ public SafeCFDateHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFDictionary.cs b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFDictionary.cs
index c85d65db50fdf..eeee71bd5a2a2 100644
--- a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFDictionary.cs
+++ b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFDictionary.cs
@@ -20,7 +20,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeCFDictionaryHandle : SafeHandle
{
- private SafeCFDictionaryHandle()
+ public SafeCFDictionaryHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFError.cs b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFError.cs
index db3d995f23b22..ad3b4de210938 100644
--- a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFError.cs
+++ b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFError.cs
@@ -52,7 +52,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeCFErrorHandle : SafeHandle
{
- internal SafeCFErrorHandle()
+ public SafeCFErrorHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFString.cs b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFString.cs
index 9bb891394e6a8..8c19957f55b7a 100644
--- a/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFString.cs
+++ b/src/libraries/Common/src/Interop/OSX/Interop.CoreFoundation.CFString.cs
@@ -85,7 +85,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeCFStringHandle : SafeHandle
{
- internal SafeCFStringHandle()
+ public SafeCFStringHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs
index a4f6e52ee9be5..b27ce0dd5b06a 100644
--- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs
+++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Digest.cs
@@ -42,7 +42,7 @@ namespace System.Security.Cryptography.Apple
{
internal sealed class SafeDigestCtxHandle : SafeHandle
{
- internal SafeDigestCtxHandle()
+ public SafeDigestCtxHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs
index 09bb04e86f78d..9898f5821289c 100644
--- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs
+++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Hmac.cs
@@ -42,7 +42,7 @@ namespace System.Security.Cryptography.Apple
{
internal sealed class SafeHmacHandle : SafeHandle
{
- internal SafeHmacHandle()
+ public SafeHmacHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.cs
index 36b3b7c15d2c6..fb7cb2bf7c871 100644
--- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.cs
+++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Keychain.cs
@@ -292,7 +292,7 @@ namespace System.Security.Cryptography.Apple
{
internal class SafeKeychainItemHandle : SafeHandle
{
- internal SafeKeychainItemHandle()
+ public SafeKeychainItemHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
@@ -310,7 +310,7 @@ protected override bool ReleaseHandle()
internal class SafeKeychainHandle : SafeHandle
{
- internal SafeKeychainHandle()
+ public SafeKeychainHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs
index 577ee8126829a..4ff2379911065 100644
--- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs
+++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Ssl.cs
@@ -412,7 +412,7 @@ namespace System.Net
{
internal sealed class SafeSslHandle : SafeHandle
{
- internal SafeSslHandle()
+ public SafeSslHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Symmetric.cs b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Symmetric.cs
index 2b55500b4ab36..22f6e512109ed 100644
--- a/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Symmetric.cs
+++ b/src/libraries/Common/src/Interop/OSX/System.Security.Cryptography.Native.Apple/Interop.Symmetric.cs
@@ -83,7 +83,7 @@ internal static extern unsafe int CryptorFinal(
namespace System.Security.Cryptography
{
- internal class SafeAppleCryptorHandle : SafeHandle
+ internal sealed class SafeAppleCryptorHandle : SafeHandle
{
public SafeAppleCryptorHandle()
: base(IntPtr.Zero, ownsHandle: true)
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OCSP.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OCSP.cs
index 5ca56e527be2d..ef439c56d845d 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OCSP.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.OCSP.cs
@@ -101,7 +101,7 @@ internal static SafeOcspRequestHandle X509ChainBuildOcspRequest(SafeX509StoreCtx
namespace System.Security.Cryptography.X509Certificates
{
- internal class SafeOcspRequestHandle : SafeHandleZeroOrMinusOneIsInvalid
+ internal sealed class SafeOcspRequestHandle : SafeHandleZeroOrMinusOneIsInvalid
{
public SafeOcspRequestHandle()
: base(true)
@@ -116,7 +116,7 @@ protected override bool ReleaseHandle()
}
}
- internal class SafeOcspResponseHandle : SafeHandleZeroOrMinusOneIsInvalid
+ internal sealed class SafeOcspResponseHandle : SafeHandleZeroOrMinusOneIsInvalid
{
public SafeOcspResponseHandle()
: base(true)
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
index 459b9fef61f6c..0bbb4b056c605 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
@@ -368,7 +368,7 @@ private void Disconnect()
}
}
- private SafeSslHandle() : base(IntPtr.Zero, true)
+ public SafeSslHandle() : base(IntPtr.Zero, true)
{
}
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.SslCtx.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.SslCtx.cs
index 94f68c586129f..d39b6595d39b1 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.SslCtx.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.SslCtx.cs
@@ -64,7 +64,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeSslContextHandle : SafeHandle
{
- private SafeSslContextHandle()
+ public SafeSslContextHandle()
: base(IntPtr.Zero, true)
{
}
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Name.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Name.cs
index 929440435d4b1..6a0cf0c9e3d8e 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Name.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Name.cs
@@ -49,7 +49,7 @@ namespace Microsoft.Win32.SafeHandles
///
internal sealed class SafeSharedX509NameHandle : SafeInteriorHandle
{
- private SafeSharedX509NameHandle() :
+ public SafeSharedX509NameHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
@@ -61,7 +61,7 @@ private SafeSharedX509NameHandle() :
///
internal sealed class SafeSharedX509NameStackHandle : SafeInteriorHandle
{
- private SafeSharedX509NameStackHandle() :
+ public SafeSharedX509NameStackHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Stack.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Stack.cs
index ce84ac229d5bc..c3468042c0c69 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Stack.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509Stack.cs
@@ -63,7 +63,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeX509StackHandle : SafeHandle
{
- private SafeX509StackHandle() :
+ public SafeX509StackHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
@@ -100,7 +100,7 @@ internal sealed class SafeSharedX509StackHandle : SafeInteriorHandle
{
internal static readonly SafeSharedX509StackHandle InvalidHandle = new SafeSharedX509StackHandle();
- private SafeSharedX509StackHandle() :
+ public SafeSharedX509StackHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509StoreCtx.cs b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509StoreCtx.cs
index 38d8a3ae26bdb..e98faa6fe21db 100644
--- a/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509StoreCtx.cs
+++ b/src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.X509StoreCtx.cs
@@ -75,7 +75,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeX509StoreCtxHandle : SafeHandle
{
- private SafeX509StoreCtxHandle() :
+ public SafeX509StoreCtxHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/SafeHashHandle.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/SafeHashHandle.cs
index 860e33716029e..3717976436dfb 100644
--- a/src/libraries/Common/src/Interop/Windows/Advapi32/SafeHashHandle.cs
+++ b/src/libraries/Common/src/Interop/Windows/Advapi32/SafeHashHandle.cs
@@ -14,7 +14,7 @@ internal sealed class SafeHashHandle : SafeHandleZeroOrMinusOneIsInvalid
{
private SafeProvHandle? _parent;
- private SafeHashHandle() : base(true)
+ public SafeHashHandle() : base(true)
{
SetHandle(IntPtr.Zero);
}
diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/SafeKeyHandle.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/SafeKeyHandle.cs
index c41a5432a47e8..481499fe982ac 100644
--- a/src/libraries/Common/src/Interop/Windows/Advapi32/SafeKeyHandle.cs
+++ b/src/libraries/Common/src/Interop/Windows/Advapi32/SafeKeyHandle.cs
@@ -23,7 +23,7 @@ internal sealed class SafeKeyHandle : SafeHandleZeroOrMinusOneIsInvalid
private bool _fPublicOnly;
private SafeProvHandle? _parent;
- private SafeKeyHandle() : base(true)
+ public SafeKeyHandle() : base(true)
{
SetHandle(IntPtr.Zero);
_keySpec = 0;
diff --git a/src/libraries/Common/src/Interop/Windows/Advapi32/SafeProvHandle.cs b/src/libraries/Common/src/Interop/Windows/Advapi32/SafeProvHandle.cs
index 317d3a6c38b2e..3aa1e32e05143 100644
--- a/src/libraries/Common/src/Interop/Windows/Advapi32/SafeProvHandle.cs
+++ b/src/libraries/Common/src/Interop/Windows/Advapi32/SafeProvHandle.cs
@@ -18,7 +18,7 @@ internal sealed class SafeProvHandle : SafeHandleZeroOrMinusOneIsInvalid
private uint _flags;
private bool _fPersistKeyInCsp;
- private SafeProvHandle() : base(true)
+ public SafeProvHandle() : base(true)
{
SetHandle(IntPtr.Zero);
_containerName = null;
diff --git a/src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.ICMP.cs b/src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.ICMP.cs
index 915e26af070da..1926b414e9bf1 100644
--- a/src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.ICMP.cs
+++ b/src/libraries/Common/src/Interop/Windows/IpHlpApi/Interop.ICMP.cs
@@ -80,7 +80,7 @@ internal struct Icmp6EchoReply
internal sealed class SafeCloseIcmpHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- private SafeCloseIcmpHandle() : base(true)
+ public SafeCloseIcmpHandle() : base(true)
{
}
diff --git a/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs b/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
index 5c14f4c69ffa6..ea1762564aaf3 100644
--- a/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
+++ b/src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
@@ -148,7 +148,7 @@ internal sealed class SafeFreeCertContext : SafeHandleZeroOrMinusOneIsInvalid
{
#endif
- internal SafeFreeCertContext() : base(true) { }
+ public SafeFreeCertContext() : base(true) { }
// This must be ONLY called from this file.
internal void Set(IntPtr value)
@@ -1080,7 +1080,7 @@ internal static unsafe int ApplyControlToken(
internal sealed class SafeDeleteSslContext : SafeDeleteContext
{
- internal SafeDeleteSslContext() : base() { }
+ public SafeDeleteSslContext() : base() { }
protected override bool ReleaseHandle()
{
diff --git a/src/libraries/Common/src/Interop/Windows/WinSock/SafeNativeOverlapped.cs b/src/libraries/Common/src/Interop/Windows/WinSock/SafeNativeOverlapped.cs
index 5a4a68a1d53ea..5d81d73a4fbe5 100644
--- a/src/libraries/Common/src/Interop/Windows/WinSock/SafeNativeOverlapped.cs
+++ b/src/libraries/Common/src/Interop/Windows/WinSock/SafeNativeOverlapped.cs
@@ -14,7 +14,7 @@ internal sealed class SafeNativeOverlapped : SafeHandle
{
private readonly SafeSocketHandle? _socketHandle;
- private SafeNativeOverlapped()
+ public SafeNativeOverlapped()
: this(IntPtr.Zero)
{
if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this);
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/Asn1SafeHandles.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/Asn1SafeHandles.Unix.cs
index 7a5667ec8e646..193533551bcea 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/Asn1SafeHandles.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/Asn1SafeHandles.Unix.cs
@@ -8,7 +8,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeAsn1ObjectHandle : SafeHandle
{
- private SafeAsn1ObjectHandle() :
+ public SafeAsn1ObjectHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
@@ -28,7 +28,7 @@ public override bool IsInvalid
internal sealed class SafeAsn1BitStringHandle : SafeHandle
{
- private SafeAsn1BitStringHandle() :
+ public SafeAsn1BitStringHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
@@ -48,7 +48,7 @@ public override bool IsInvalid
internal sealed class SafeAsn1OctetStringHandle : SafeHandle
{
- private SafeAsn1OctetStringHandle() :
+ public SafeAsn1OctetStringHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs
index 79283d19ecb53..b9e3b644132d4 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs
@@ -61,7 +61,7 @@ protected override bool ReleaseHandle()
return status == Interop.NetSecurityNative.Status.GSS_S_COMPLETE;
}
- private SafeGssNameHandle()
+ public SafeGssNameHandle()
: base(IntPtr.Zero, true)
{
}
@@ -70,7 +70,7 @@ private SafeGssNameHandle()
///
/// Wrapper around a gss_cred_id_t_desc_struct*
///
- internal class SafeGssCredHandle : SafeHandle
+ internal sealed class SafeGssCredHandle : SafeHandle
{
private static readonly Lazy s_IsNtlmInstalled = new Lazy(InitIsNtlmInstalled);
@@ -132,7 +132,7 @@ public static SafeGssCredHandle Create(string username, string password, bool is
return retHandle;
}
- private SafeGssCredHandle()
+ public SafeGssCredHandle()
: base(IntPtr.Zero, true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptAlgorithmHandle.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptAlgorithmHandle.cs
index d9192108d605f..ec4192dc35267 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptAlgorithmHandle.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptAlgorithmHandle.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeBCryptAlgorithmHandle : SafeBCryptHandle
{
- private SafeBCryptAlgorithmHandle()
+ public SafeBCryptAlgorithmHandle()
: base()
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptHashHandle.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptHashHandle.cs
index e3d899c8e217e..b4426f9e5feed 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptHashHandle.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptHashHandle.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeBCryptHashHandle : SafeBCryptHandle
{
- private SafeBCryptHashHandle()
+ public SafeBCryptHashHandle()
: base()
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptKeyHandle.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptKeyHandle.cs
index e7962332f219b..08fc455e140f7 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptKeyHandle.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBCryptKeyHandle.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeBCryptKeyHandle : SafeBCryptHandle
{
- private SafeBCryptKeyHandle()
+ public SafeBCryptKeyHandle()
: base()
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBignumHandle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBignumHandle.Unix.cs
index 311f24ca08630..9e702b45ff947 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBignumHandle.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBignumHandle.Unix.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeBignumHandle : SafeHandle
{
- private SafeBignumHandle() :
+ public SafeBignumHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBioHandle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBioHandle.Unix.cs
index ee59dcd0eb720..db95a83addbab 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBioHandle.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeBioHandle.Unix.cs
@@ -13,7 +13,7 @@ internal sealed class SafeBioHandle : SafeHandle
{
private SafeHandle? _parent;
- private SafeBioHandle() :
+ public SafeBioHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeCreateHandle.OSX.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeCreateHandle.OSX.cs
index 63df101a9ba00..c7a3d25fa2acd 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeCreateHandle.OSX.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeCreateHandle.OSX.cs
@@ -14,7 +14,7 @@ namespace Microsoft.Win32.SafeHandles
///
internal sealed partial class SafeCreateHandle : SafeHandle
{
- internal SafeCreateHandle() : base(IntPtr.Zero, true) { }
+ public SafeCreateHandle() : base(IntPtr.Zero, true) { }
internal SafeCreateHandle(IntPtr ptr) : base(IntPtr.Zero, true)
{
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeDsaHandle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeDsaHandle.Unix.cs
index 7d177ea60f043..0899f2f1938b9 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeDsaHandle.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeDsaHandle.Unix.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeDsaHandle : SafeHandle
{
- private SafeDsaHandle() :
+ public SafeDsaHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEcKeyHandle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEcKeyHandle.Unix.cs
index ef001881ee323..cebd28b840fd6 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEcKeyHandle.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEcKeyHandle.Unix.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeEcKeyHandle : SafeHandle
{
- private SafeEcKeyHandle() :
+ public SafeEcKeyHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEventStreamHandle.OSX.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEventStreamHandle.OSX.cs
index 622689b3e572c..a1d38ee7f99b4 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEventStreamHandle.OSX.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEventStreamHandle.OSX.cs
@@ -15,7 +15,7 @@ namespace Microsoft.Win32.SafeHandles
///
internal sealed partial class SafeEventStreamHandle : SafeHandle
{
- internal SafeEventStreamHandle() : base(IntPtr.Zero, true) { }
+ public SafeEventStreamHandle() : base(IntPtr.Zero, true) { }
internal SafeEventStreamHandle(IntPtr ptr) : base(IntPtr.Zero, true)
{
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpCipherCtxHandle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpCipherCtxHandle.Unix.cs
index bc965e7cf16e0..f5b5cd3dca266 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpCipherCtxHandle.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpCipherCtxHandle.Unix.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeEvpCipherCtxHandle : SafeHandle
{
- private SafeEvpCipherCtxHandle() :
+ public SafeEvpCipherCtxHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpMdCtxHandle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpMdCtxHandle.Unix.cs
index a15f0644d1ba5..b1e0bfe74679c 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpMdCtxHandle.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpMdCtxHandle.Unix.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeEvpMdCtxHandle : SafeHandle
{
- private SafeEvpMdCtxHandle() :
+ public SafeEvpMdCtxHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpPKeyHandle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpPKeyHandle.Unix.cs
index 99d699ea81a74..9e67a1a9df2d6 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpPKeyHandle.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpPKeyHandle.Unix.cs
@@ -15,7 +15,7 @@ sealed class SafeEvpPKeyHandle : SafeHandle
{
internal static readonly SafeEvpPKeyHandle InvalidHandle = new SafeEvpPKeyHandle();
- private SafeEvpPKeyHandle() :
+ public SafeEvpPKeyHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpPkeyCtxHandle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpPkeyCtxHandle.Unix.cs
index 2845f99073280..d64f135ca0f72 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpPkeyCtxHandle.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeEvpPkeyCtxHandle.Unix.cs
@@ -8,7 +8,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeEvpPKeyCtxHandle : SafeHandle
{
- private SafeEvpPKeyCtxHandle()
+ public SafeEvpPKeyCtxHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeFindHandle.Windows.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeFindHandle.Windows.cs
index 5d90bfff06c66..318dfd2c2d9f3 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeFindHandle.Windows.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeFindHandle.Windows.cs
@@ -8,7 +8,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeFindHandle : SafeHandle
{
- internal SafeFindHandle() : base(IntPtr.Zero, true) { }
+ public SafeFindHandle() : base(IntPtr.Zero, true) { }
protected override bool ReleaseHandle()
{
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeHmacCtxHandle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeHmacCtxHandle.Unix.cs
index f4284aa542994..5bb60d1295e17 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeHmacCtxHandle.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeHmacCtxHandle.Unix.cs
@@ -8,7 +8,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeHmacCtxHandle : SafeHandle
{
- private SafeHmacCtxHandle() :
+ public SafeHmacCtxHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs
index 4197d6834be25..f7a57d09f0db9 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs
@@ -5,7 +5,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafeLibraryHandle() : base(true) { }
+ public SafeLibraryHandle() : base(true) { }
protected override bool ReleaseHandle()
{
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs
index 96a93bfe9b8e8..bfd945f8286ad 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs
@@ -8,7 +8,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeLocalAllocHandle : SafeBuffer
{
- private SafeLocalAllocHandle() : base(true) { }
+ public SafeLocalAllocHandle() : base(true) { }
internal static readonly SafeLocalAllocHandle Zero = new SafeLocalAllocHandle();
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaHandle.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaHandle.cs
index 86a89a616ea8b..ddf32d6359172 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaHandle.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaHandle.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeLsaHandle : SafeHandle
{
- internal SafeLsaHandle()
+ public SafeLsaHandle()
: base(IntPtr.Zero, true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaMemoryHandle.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaMemoryHandle.cs
index b744a4b46b70e..a97e68019182f 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaMemoryHandle.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaMemoryHandle.cs
@@ -8,7 +8,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeLsaMemoryHandle : SafeBuffer
{
- private SafeLsaMemoryHandle() : base(true) { }
+ public SafeLsaMemoryHandle() : base(true) { }
// 0 is an Invalid Handle
internal SafeLsaMemoryHandle(IntPtr handle) : base(true)
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaPolicyHandle.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaPolicyHandle.cs
index 33263626622c7..ab1745f74da0b 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaPolicyHandle.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaPolicyHandle.cs
@@ -7,7 +7,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeLsaPolicyHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- private SafeLsaPolicyHandle() : base(true) { }
+ public SafeLsaPolicyHandle() : base(true) { }
// 0 is an Invalid Handle
internal SafeLsaPolicyHandle(IntPtr handle) : base(true)
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaReturnBufferHandle.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaReturnBufferHandle.cs
index b8ebb893c9ae1..195e37c346b47 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaReturnBufferHandle.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeLsaReturnBufferHandle.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeLsaReturnBufferHandle : SafeBuffer
{
- private SafeLsaReturnBufferHandle() : base(true) { }
+ public SafeLsaReturnBufferHandle() : base(true) { }
// 0 is an Invalid Handle
internal SafeLsaReturnBufferHandle(IntPtr handle) : base(true)
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafePerfProviderHandle.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafePerfProviderHandle.cs
index 4632fa14a93e7..afd51e1f43b16 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafePerfProviderHandle.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafePerfProviderHandle.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafePerfProviderHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- private SafePerfProviderHandle() : base(true) { }
+ public SafePerfProviderHandle() : base(true) { }
protected override bool ReleaseHandle()
{
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafePkcs7Handle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafePkcs7Handle.Unix.cs
index 328db92c4f9cc..3326c3578d37d 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafePkcs7Handle.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafePkcs7Handle.Unix.cs
@@ -8,7 +8,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafePkcs7Handle : SafeHandle
{
- private SafePkcs7Handle() :
+ public SafePkcs7Handle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeRsaHandle.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeRsaHandle.Unix.cs
index a379fed2e4079..aef516adb3a30 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeRsaHandle.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeRsaHandle.Unix.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeRsaHandle : SafeHandle
{
- private SafeRsaHandle() :
+ public SafeRsaHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeTokenHandle.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeTokenHandle.cs
index ce97df473c69f..d1e52e9a4f2c8 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeTokenHandle.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeTokenHandle.cs
@@ -11,7 +11,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeTokenHandle : SafeHandle
{
- private SafeTokenHandle() : base(IntPtr.Zero, true) { }
+ public SafeTokenHandle() : base(IntPtr.Zero, true) { }
// 0 is an Invalid Handle
internal SafeTokenHandle(IntPtr handle) : base(IntPtr.Zero, true)
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeX509Handles.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeX509Handles.Unix.cs
index 137c9d47aa38f..baced04d306d6 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeX509Handles.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/SafeX509Handles.Unix.cs
@@ -28,7 +28,7 @@ internal sealed class SafeX509Handle : SafeHandle
internal static readonly SafeX509Handle InvalidHandle = new SafeX509Handle();
- private SafeX509Handle() :
+ public SafeX509Handle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
@@ -48,7 +48,7 @@ public override bool IsInvalid
internal sealed class SafeX509CrlHandle : SafeHandle
{
- private SafeX509CrlHandle() :
+ public SafeX509CrlHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
@@ -68,7 +68,7 @@ public override bool IsInvalid
internal sealed class SafeX509StoreHandle : SafeHandle
{
- private SafeX509StoreHandle() :
+ public SafeX509StoreHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/X509ExtensionSafeHandles.Unix.cs b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/X509ExtensionSafeHandles.Unix.cs
index 0bad8f098921c..e79ff15d52111 100644
--- a/src/libraries/Common/src/Microsoft/Win32/SafeHandles/X509ExtensionSafeHandles.Unix.cs
+++ b/src/libraries/Common/src/Microsoft/Win32/SafeHandles/X509ExtensionSafeHandles.Unix.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeX509ExtensionHandle : SafeHandle
{
- private SafeX509ExtensionHandle() :
+ public SafeX509ExtensionHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
@@ -29,7 +29,7 @@ public override bool IsInvalid
internal sealed class SafeEkuExtensionHandle : SafeHandle
{
- private SafeEkuExtensionHandle() :
+ public SafeEkuExtensionHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Common/tests/TestUtilities/System/Buffers/BoundedMemory.Windows.cs b/src/libraries/Common/tests/TestUtilities/System/Buffers/BoundedMemory.Windows.cs
index ba28f79a04ec2..8c672e9d21e9e 100644
--- a/src/libraries/Common/tests/TestUtilities/System/Buffers/BoundedMemory.Windows.cs
+++ b/src/libraries/Common/tests/TestUtilities/System/Buffers/BoundedMemory.Windows.cs
@@ -276,7 +276,7 @@ private struct MEMORY_BASIC_INFORMATION
private sealed class VirtualAllocHandle : SafeHandle
{
// Called by P/Invoke when returning SafeHandles
- private VirtualAllocHandle()
+ public VirtualAllocHandle()
: base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/Microsoft.Win32.Registry/ref/Microsoft.Win32.Registry.cs b/src/libraries/Microsoft.Win32.Registry/ref/Microsoft.Win32.Registry.cs
index ea51db47d32ed..99acbd126fbcb 100644
--- a/src/libraries/Microsoft.Win32.Registry/ref/Microsoft.Win32.Registry.cs
+++ b/src/libraries/Microsoft.Win32.Registry/ref/Microsoft.Win32.Registry.cs
@@ -114,6 +114,7 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed partial class SafeRegistryHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
+ public SafeRegistryHandle() : base (default(bool)) {}
public SafeRegistryHandle(System.IntPtr preexistingHandle, bool ownsHandle) : base (default(bool)) { }
protected override bool ReleaseHandle() { throw null; }
}
diff --git a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcEnvironmentHandle.cs b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcEnvironmentHandle.cs
index 2b2177ba5e143..f816b2aa77717 100644
--- a/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcEnvironmentHandle.cs
+++ b/src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcEnvironmentHandle.cs
@@ -8,7 +8,7 @@ namespace System.Data.Odbc
{
internal sealed class OdbcEnvironmentHandle : OdbcHandle
{
- internal OdbcEnvironmentHandle() : base(ODBC32.SQL_HANDLE.ENV, null)
+ public OdbcEnvironmentHandle() : base(ODBC32.SQL_HANDLE.ENV, null)
{
ODBC32.RetCode retcode;
diff --git a/src/libraries/System.Data.OleDb/src/DbPropSet.cs b/src/libraries/System.Data.OleDb/src/DbPropSet.cs
index 30935b1c6f80d..756c4612c3f1f 100644
--- a/src/libraries/System.Data.OleDb/src/DbPropSet.cs
+++ b/src/libraries/System.Data.OleDb/src/DbPropSet.cs
@@ -16,7 +16,7 @@ internal sealed class DBPropSet : SafeHandle
// stores the exception with last error.HRESULT from IDBProperties.GetProperties
private Exception? lastErrorFromProvider;
- private DBPropSet() : base(IntPtr.Zero, true)
+ public DBPropSet() : base(IntPtr.Zero, true)
{
propertySetCount = 0;
}
diff --git a/src/libraries/System.Data.OleDb/src/SafeHandles.cs b/src/libraries/System.Data.OleDb/src/SafeHandles.cs
index 185712be565c7..879d572447719 100644
--- a/src/libraries/System.Data.OleDb/src/SafeHandles.cs
+++ b/src/libraries/System.Data.OleDb/src/SafeHandles.cs
@@ -15,7 +15,7 @@ internal sealed class DualCoTaskMem : SafeHandle
{
private IntPtr handle2; // this must be protected so derived classes can use out params.
- private DualCoTaskMem() : base(IntPtr.Zero, true)
+ public DualCoTaskMem() : base(IntPtr.Zero, true)
{
this.handle2 = IntPtr.Zero;
}
diff --git a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/WrappedIUnknown.cs b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/WrappedIUnknown.cs
index a45f38e06111a..9b3205849d249 100644
--- a/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/WrappedIUnknown.cs
+++ b/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/WrappedIUnknown.cs
@@ -14,7 +14,7 @@ namespace System.Data.ProviderBase
internal class WrappedIUnknown : SafeHandle
{
- internal WrappedIUnknown() : base(IntPtr.Zero, true)
+ public WrappedIUnknown() : base(IntPtr.Zero, true)
{
}
diff --git a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/CoTaskMemSafeHandle.cs b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/CoTaskMemSafeHandle.cs
index 6181bc8d10441..b20e9b8127e3f 100644
--- a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/CoTaskMemSafeHandle.cs
+++ b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/CoTaskMemSafeHandle.cs
@@ -10,7 +10,7 @@ namespace System.Diagnostics.Eventing.Reader
///
internal sealed class CoTaskMemSafeHandle : SafeHandle
{
- internal CoTaskMemSafeHandle()
+ public CoTaskMemSafeHandle()
: base(IntPtr.Zero, true)
{
}
diff --git a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/CoTaskMemUnicodeSafeHandle.cs b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/CoTaskMemUnicodeSafeHandle.cs
index 658a961c7b91c..ce1037f515d81 100644
--- a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/CoTaskMemUnicodeSafeHandle.cs
+++ b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/CoTaskMemUnicodeSafeHandle.cs
@@ -10,7 +10,7 @@ namespace System.Diagnostics.Eventing.Reader
///
internal sealed class CoTaskMemUnicodeSafeHandle : SafeHandle
{
- internal CoTaskMemUnicodeSafeHandle()
+ public CoTaskMemUnicodeSafeHandle()
: base(IntPtr.Zero, true)
{
}
diff --git a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogHandle.cs b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogHandle.cs
index 4424a5c9fbb20..87fe14a067c2a 100644
--- a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogHandle.cs
+++ b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/EventLogHandle.cs
@@ -11,8 +11,7 @@ namespace System.Diagnostics.Eventing.Reader
///
internal sealed class EventLogHandle : SafeHandle
{
- // Called by P/Invoke when returning SafeHandles
- private EventLogHandle()
+ public EventLogHandle()
: base(IntPtr.Zero, true)
{
}
diff --git a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogReadHandle.cs b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogReadHandle.cs
index 680444c05728f..60a3f1304f0a8 100644
--- a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogReadHandle.cs
+++ b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogReadHandle.cs
@@ -5,7 +5,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeEventLogReadHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafeEventLogReadHandle() : base(true) { }
+ public SafeEventLogReadHandle() : base(true) { }
protected override bool ReleaseHandle()
{
diff --git a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogWriteHandle.cs b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogWriteHandle.cs
index 7fb87283486ae..401ef8dec11d6 100644
--- a/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogWriteHandle.cs
+++ b/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/SafeEventLogWriteHandle.cs
@@ -6,7 +6,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeEventLogWriteHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafeEventLogWriteHandle() : base(true) { }
+ public SafeEventLogWriteHandle() : base(true) { }
protected override bool ReleaseHandle()
{
diff --git a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
index 8275a44985651..3ff66cd763934 100644
--- a/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
+++ b/src/libraries/System.Diagnostics.Process/ref/System.Diagnostics.Process.cs
@@ -8,6 +8,7 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed partial class SafeProcessHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
+ public SafeProcessHandle() : base (default(bool)) { }
public SafeProcessHandle(System.IntPtr existingHandle, bool ownsHandle) : base (default(bool)) { }
protected override bool ReleaseHandle() { throw null; }
}
diff --git a/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeProcessHandle.cs b/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeProcessHandle.cs
index 1b7511421676d..0175956501d9a 100644
--- a/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeProcessHandle.cs
+++ b/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeProcessHandle.cs
@@ -19,7 +19,7 @@ public sealed partial class SafeProcessHandle : SafeHandleZeroOrMinusOneIsInvali
{
internal static readonly SafeProcessHandle InvalidHandle = new SafeProcessHandle();
- internal SafeProcessHandle()
+ public SafeProcessHandle()
: this(IntPtr.Zero)
{
}
@@ -34,11 +34,5 @@ public SafeProcessHandle(IntPtr existingHandle, bool ownsHandle)
{
SetHandle(existingHandle);
}
-
- internal void InitialSetHandle(IntPtr h)
- {
- Debug.Assert(IsInvalid, "Safe handle should only be set once");
- base.handle = h;
- }
}
}
diff --git a/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeThreadHandle.cs b/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeThreadHandle.cs
index 055c4f6f2a465..34f3df7885f96 100644
--- a/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeThreadHandle.cs
+++ b/src/libraries/System.Diagnostics.Process/src/Microsoft/Win32/SafeHandles/SafeThreadHandle.cs
@@ -20,17 +20,11 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeThreadHandle : SafeHandle
{
- internal SafeThreadHandle()
+ public SafeThreadHandle()
: base(new IntPtr(0), true)
{
}
- internal void InitialSetHandle(IntPtr h)
- {
- Debug.Assert(IsInvalid, "Safe handle should only be set once");
- base.SetHandle(h);
- }
-
public override bool IsInvalid
{
get { return handle == IntPtr.Zero || handle == new IntPtr(-1); }
diff --git a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs
index e904dbbff06f4..f8da13f762a9d 100644
--- a/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs
+++ b/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Windows.cs
@@ -610,7 +610,7 @@ ref processInfo // pointer to PROCESS_INFORMATION
}
if (processInfo.hProcess != IntPtr.Zero && processInfo.hProcess != new IntPtr(-1))
- procSH.InitialSetHandle(processInfo.hProcess);
+ Marshal.InitHandle(procSH, processInfo.hProcess);
if (processInfo.hThread != IntPtr.Zero && processInfo.hThread != new IntPtr(-1))
Interop.Kernel32.CloseHandle(processInfo.hThread);
diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Linux.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Linux.cs
index c4f9a0bd7afcf..2383e816e1ddb 100644
--- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Linux.cs
+++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Linux.cs
@@ -9,7 +9,7 @@ internal sealed class ConnectionHandle : SafeHandleZeroOrMinusOneIsInvalid
{
internal bool _needDispose;
- internal ConnectionHandle()
+ public ConnectionHandle()
:base(true)
{
Interop.Ldap.ldap_initialize(out handle, null);
@@ -44,7 +44,7 @@ protected override bool ReleaseHandle()
internal sealed class SafeBerHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafeBerHandle() : base(true)
+ public SafeBerHandle() : base(true)
{
SetHandle(Interop.Ldap.ber_alloc(1));
if (handle == IntPtr.Zero)
diff --git a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Windows.cs b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Windows.cs
index 725ac6be053d0..15f34fff77387 100644
--- a/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Windows.cs
+++ b/src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/SafeHandles.Windows.cs
@@ -7,7 +7,7 @@ namespace System.DirectoryServices.Protocols
{
internal sealed class SafeBerHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafeBerHandle() : base(true)
+ public SafeBerHandle() : base(true)
{
SetHandle(Interop.Ldap.ber_alloc(1));
if (handle == IntPtr.Zero)
@@ -36,7 +36,7 @@ internal sealed class ConnectionHandle : SafeHandleZeroOrMinusOneIsInvalid
{
internal bool _needDispose;
- internal ConnectionHandle() : base(true)
+ public ConnectionHandle() : base(true)
{
SetHandle(Interop.Ldap.ldap_init(null, 389));
diff --git a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/SafeHandle.cs b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/SafeHandle.cs
index 1b47eaed3d483..af0b09820a11a 100644
--- a/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/SafeHandle.cs
+++ b/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/SafeHandle.cs
@@ -8,6 +8,8 @@ namespace System.DirectoryServices.ActiveDirectory
{
internal sealed class PolicySafeHandle : SafeHandleZeroOrMinusOneIsInvalid
{
+ public PolicySafeHandle() : base(true) { }
+
internal PolicySafeHandle(IntPtr value) : base(true)
{
SetHandle(value);
@@ -18,7 +20,7 @@ internal PolicySafeHandle(IntPtr value) : base(true)
internal sealed class LsaLogonProcessSafeHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- private LsaLogonProcessSafeHandle() : base(true) { }
+ public LsaLogonProcessSafeHandle() : base(true) { }
internal LsaLogonProcessSafeHandle(IntPtr value) : base(true)
{
@@ -30,7 +32,7 @@ internal LsaLogonProcessSafeHandle(IntPtr value) : base(true)
internal sealed class LoadLibrarySafeHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- private LoadLibrarySafeHandle() : base(true) { }
+ public LoadLibrarySafeHandle() : base(true) { }
internal LoadLibrarySafeHandle(IntPtr value) : base(true)
{
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Drawing2D/SafeCustomLineCapHandle.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Drawing2D/SafeCustomLineCapHandle.cs
index a139927f622c2..beb8d42bb6ff5 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Drawing2D/SafeCustomLineCapHandle.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Drawing2D/SafeCustomLineCapHandle.cs
@@ -9,7 +9,7 @@
namespace System.Drawing.Drawing2D
{
- internal class SafeCustomLineCapHandle : SafeHandle
+ internal sealed class SafeCustomLineCapHandle : SafeHandle
{
// Create a SafeHandle, informing the base class
// that this SafeHandle instance "owns" the handle,
diff --git a/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrintController.Windows.cs b/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrintController.Windows.cs
index d3c9841bd1e13..e089027bf6067 100644
--- a/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrintController.Windows.cs
+++ b/src/libraries/System.Drawing.Common/src/System/Drawing/Printing/PrintController.Windows.cs
@@ -20,12 +20,7 @@ public abstract partial class PrintController
///
internal sealed class SafeDeviceModeHandle : SafeHandle
{
- ///
- /// This constructor is used by the P/Invoke marshaling layer
- /// to allocate a SafeHandle instance. P/Invoke then does the
- /// appropriate method call, storing the handle in this class.
- ///
- private SafeDeviceModeHandle() : base(IntPtr.Zero, ownsHandle: true)
+ public SafeDeviceModeHandle() : base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs b/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs
index e112060f78498..2182c4a6d5b5a 100644
--- a/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs
+++ b/src/libraries/System.IO.MemoryMappedFiles/ref/System.IO.MemoryMappedFiles.cs
@@ -8,13 +8,13 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed partial class SafeMemoryMappedFileHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafeMemoryMappedFileHandle() : base (default(bool)) { }
+ public SafeMemoryMappedFileHandle() : base (default(bool)) { }
public override bool IsInvalid { get { throw null; } }
protected override bool ReleaseHandle() { throw null; }
}
public sealed partial class SafeMemoryMappedViewHandle : System.Runtime.InteropServices.SafeBuffer
{
- internal SafeMemoryMappedViewHandle() : base (default(bool)) { }
+ public SafeMemoryMappedViewHandle() : base (default(bool)) { }
protected override bool ReleaseHandle() { throw null; }
}
}
diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/ILLink/ILLinkTrim_LibraryBuild.xml b/src/libraries/System.IO.MemoryMappedFiles/src/ILLink/ILLinkTrim_LibraryBuild.xml
deleted file mode 100644
index 6c7d766e65f5c..0000000000000
--- a/src/libraries/System.IO.MemoryMappedFiles/src/ILLink/ILLinkTrim_LibraryBuild.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedFileHandle.Windows.cs b/src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedFileHandle.Windows.cs
index bd0f7ebb13a38..7d58a373446c9 100644
--- a/src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedFileHandle.Windows.cs
+++ b/src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedFileHandle.Windows.cs
@@ -5,11 +5,6 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed partial class SafeMemoryMappedFileHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafeMemoryMappedFileHandle()
- : base(true)
- {
- }
-
protected override bool ReleaseHandle()
{
return Interop.Kernel32.CloseHandle(handle);
diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedFileHandle.cs b/src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedFileHandle.cs
new file mode 100644
index 0000000000000..0c8da7eb7b8da
--- /dev/null
+++ b/src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedFileHandle.cs
@@ -0,0 +1,15 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Runtime.InteropServices;
+
+namespace Microsoft.Win32.SafeHandles
+{
+ public sealed partial class SafeMemoryMappedFileHandle : SafeHandleZeroOrMinusOneIsInvalid
+ {
+ public SafeMemoryMappedFileHandle()
+ : base(true)
+ {
+ }
+ }
+}
diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.cs b/src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.cs
index f3c065c07ca4b..8d8bc6f1ec4f2 100644
--- a/src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.cs
+++ b/src/libraries/System.IO.MemoryMappedFiles/src/Microsoft/Win32/SafeMemoryMappedViewHandle.cs
@@ -7,7 +7,7 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed partial class SafeMemoryMappedViewHandle : SafeBuffer
{
- internal SafeMemoryMappedViewHandle()
+ public SafeMemoryMappedViewHandle()
: base(true)
{
}
diff --git a/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj b/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
index e0a5390f9a62f..bd15c52faebb1 100644
--- a/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
+++ b/src/libraries/System.IO.MemoryMappedFiles/src/System.IO.MemoryMappedFiles.csproj
@@ -6,6 +6,7 @@
+
diff --git a/src/libraries/System.IO.Pipes/ref/System.IO.Pipes.cs b/src/libraries/System.IO.Pipes/ref/System.IO.Pipes.cs
index e7bb17903c68e..3966988ecad2d 100644
--- a/src/libraries/System.IO.Pipes/ref/System.IO.Pipes.cs
+++ b/src/libraries/System.IO.Pipes/ref/System.IO.Pipes.cs
@@ -8,6 +8,7 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed partial class SafePipeHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
+ public SafePipeHandle() : base (default(bool)) { }
public SafePipeHandle(System.IntPtr preexistingHandle, bool ownsHandle) : base (default(bool)) { }
public override bool IsInvalid { get { throw null; } }
protected override bool ReleaseHandle() { throw null; }
diff --git a/src/libraries/System.IO.Pipes/src/Microsoft/Win32/SafeHandles/SafePipeHandle.cs b/src/libraries/System.IO.Pipes/src/Microsoft/Win32/SafeHandles/SafePipeHandle.cs
index 18a06be8cbc71..df26c48b44c01 100644
--- a/src/libraries/System.IO.Pipes/src/Microsoft/Win32/SafeHandles/SafePipeHandle.cs
+++ b/src/libraries/System.IO.Pipes/src/Microsoft/Win32/SafeHandles/SafePipeHandle.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed partial class SafePipeHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafePipeHandle()
+ public SafePipeHandle()
: this(new IntPtr(DefaultInvalidHandle), true)
{
}
diff --git a/src/libraries/System.IO.Ports/src/System/IO/Ports/SafeSerialDeviceHandle.Unix.cs b/src/libraries/System.IO.Ports/src/System/IO/Ports/SafeSerialDeviceHandle.Unix.cs
index 7f3f02b47f947..4d2202b99abb8 100644
--- a/src/libraries/System.IO.Ports/src/System/IO/Ports/SafeSerialDeviceHandle.Unix.cs
+++ b/src/libraries/System.IO.Ports/src/System/IO/Ports/SafeSerialDeviceHandle.Unix.cs
@@ -12,7 +12,7 @@ namespace System.IO.Ports
{
internal sealed class SafeSerialDeviceHandle : SafeHandleMinusOneIsInvalid
{
- private SafeSerialDeviceHandle() : base(ownsHandle: true)
+ public SafeSerialDeviceHandle() : base(ownsHandle: true)
{
}
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpRequestQueueV2Handle.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpRequestQueueV2Handle.cs
index c2a480306077a..98fdf54908cc4 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpRequestQueueV2Handle.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/HttpRequestQueueV2Handle.cs
@@ -8,7 +8,7 @@ namespace System.Net
{
internal sealed class HttpRequestQueueV2Handle : SafeHandleZeroOrMinusOneIsInvalid
{
- private HttpRequestQueueV2Handle() : base(true)
+ public HttpRequestQueueV2Handle() : base(true)
{
}
diff --git a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/SafeWebSocketHandle.cs b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/SafeWebSocketHandle.cs
index 5ad684dfc8a12..90ad547f5a7b1 100644
--- a/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/SafeWebSocketHandle.cs
+++ b/src/libraries/System.Net.HttpListener/src/System/Net/Windows/WebSockets/SafeWebSocketHandle.cs
@@ -9,7 +9,7 @@ namespace System.Net.WebSockets
// but we use a SafeHandle because it provides us the guarantee that WebSocketDeleteHandle will always get called.
internal sealed class SafeWebSocketHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafeWebSocketHandle()
+ public SafeWebSocketHandle()
: base(true)
{
}
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SafeCancelMibChangeNotify.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SafeCancelMibChangeNotify.cs
index 54043bd7703ad..67f40c4c1a989 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SafeCancelMibChangeNotify.cs
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SafeCancelMibChangeNotify.cs
@@ -9,7 +9,7 @@ namespace System.Net.NetworkInformation
// CancelMibChangeNotify2 guarantees that after it returns, the callback will NEVER be called. It may block
// for a small amount of time if the callback is currently in progress, which is fine (and, intentional).
- internal class SafeCancelMibChangeNotify : SafeHandleZeroOrMinusOneIsInvalid
+ internal sealed class SafeCancelMibChangeNotify : SafeHandleZeroOrMinusOneIsInvalid
{
public SafeCancelMibChangeNotify() : base(true) { }
diff --git a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SafeFreeMibTable.cs b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SafeFreeMibTable.cs
index fb52e503153d0..8eea228d82e47 100644
--- a/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SafeFreeMibTable.cs
+++ b/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SafeFreeMibTable.cs
@@ -5,7 +5,7 @@
namespace System.Net.NetworkInformation
{
- internal class SafeFreeMibTable : SafeHandleZeroOrMinusOneIsInvalid
+ internal sealed class SafeFreeMibTable : SafeHandleZeroOrMinusOneIsInvalid
{
public SafeFreeMibTable() : base(true) { }
diff --git a/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs b/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs
index 5a5ccf63eb652..22f72fa5233e1 100644
--- a/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs
+++ b/src/libraries/System.Net.Sockets/ref/System.Net.Sockets.cs
@@ -220,6 +220,7 @@ public enum ProtocolType
}
public sealed partial class SafeSocketHandle : Microsoft.Win32.SafeHandles.SafeHandleMinusOneIsInvalid
{
+ public SafeSocketHandle() : base (default(bool)) { }
public SafeSocketHandle(System.IntPtr preexistingHandle, bool ownsHandle) : base (default(bool)) { }
protected override bool ReleaseHandle() { throw null; }
}
diff --git a/src/libraries/System.Net.Sockets/src/ILLink/ILLinkTrim_LibraryBuild.xml b/src/libraries/System.Net.Sockets/src/ILLink/ILLinkTrim_LibraryBuild.xml
deleted file mode 100644
index f135e9f7685c1..0000000000000
--- a/src/libraries/System.Net.Sockets/src/ILLink/ILLinkTrim_LibraryBuild.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SafeSocketHandle.cs b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SafeSocketHandle.cs
index 9d6311e19898a..bce056e31e2bb 100644
--- a/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SafeSocketHandle.cs
+++ b/src/libraries/System.Net.Sockets/src/System/Net/Sockets/SafeSocketHandle.cs
@@ -38,7 +38,7 @@ public SafeSocketHandle(IntPtr preexistingHandle, bool ownsHandle)
SetHandleAndValid(preexistingHandle);
}
- private SafeSocketHandle() : base(ownsHandle: true) => OwnsHandle = true;
+ public SafeSocketHandle() : base(ownsHandle: true) => OwnsHandle = true;
internal bool OwnsHandle { get; }
diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs
index d8f83af4134ad..27efa1fd31979 100644
--- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs
+++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Unix.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- private SafeFileHandle() : this(ownsHandle: true)
+ public SafeFileHandle() : this(ownsHandle: true)
{
}
diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs
index 209e6330d85a9..dfcce3cfc65ac 100644
--- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs
+++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.Windows.cs
@@ -10,7 +10,7 @@ public sealed class SafeFileHandle : SafeHandleZeroOrMinusOneIsInvalid
{
private bool? _isAsync;
- private SafeFileHandle() : base(true)
+ public SafeFileHandle() : base(true)
{
_isAsync = null;
}
diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.Windows.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.Windows.cs
index c08fe0b36f1a7..5bbd898ec31d5 100644
--- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.Windows.cs
+++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.Windows.cs
@@ -5,7 +5,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeFindHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafeFindHandle() : base(true) { }
+ public SafeFindHandle() : base(true) { }
protected override bool ReleaseHandle()
{
diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
index 0677576910a45..2b71d8c362052 100644
--- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
+++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
@@ -17,7 +17,7 @@ namespace Internal.Win32.SafeHandles
#endif
sealed partial class SafeRegistryHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafeRegistryHandle() : base(true) { }
+ public SafeRegistryHandle() : base(true) { }
public SafeRegistryHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle)
{
diff --git a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs
index 967db4e882388..a4d4735921584 100644
--- a/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs
+++ b/src/libraries/System.Private.CoreLib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs
@@ -7,8 +7,7 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed partial class SafeWaitHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- // Called by P/Invoke marshaler
- private SafeWaitHandle() : base(true)
+ public SafeWaitHandle() : base(true)
{
}
diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs
index 41a0645bd1292..9f8cc4cd04b8f 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs
@@ -996,5 +996,16 @@ internal static unsafe uint SysStringByteLen(IntPtr s)
[SupportedOSPlatform("windows")]
public static Type? GetTypeFromCLSID(Guid clsid) => GetTypeFromCLSID(clsid, null, throwOnError: false);
+
+ ///
+ /// Initializes the underlying handle of a newly created to the provided value.
+ ///
+ /// instance to update
+ /// Pre-existing handle
+ public static void InitHandle(SafeHandle safeHandle, IntPtr handle)
+ {
+ // To help maximize performance of P/Invokes, don't check if safeHandle is null.
+ safeHandle.SetHandle(handle);
+ }
}
}
diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeHandle.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeHandle.cs
index 70376d41563ff..78053e4462175 100644
--- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeHandle.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeHandle.cs
@@ -74,7 +74,7 @@ protected SafeHandle(IntPtr invalidHandleValue, bool ownsHandle)
}
#endif
- protected void SetHandle(IntPtr handle) => this.handle = handle;
+ protected internal void SetHandle(IntPtr handle) => this.handle = handle;
public IntPtr DangerousGetHandle() => handle;
diff --git a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs
index da17c552dd818..f4a56d0be99f3 100644
--- a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs
+++ b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs
@@ -601,6 +601,7 @@ public static void GetNativeVariantForObject(T? obj, System.IntPtr pDstNative
public static string GetTypeInfoName(System.Runtime.InteropServices.ComTypes.ITypeInfo typeInfo) { throw null; }
[System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")]
public static object GetUniqueObjectForIUnknown(System.IntPtr unknown) { throw null; }
+ public static void InitHandle(SafeHandle safeHandle, IntPtr handle) { }
public static bool IsComObject(object o) { throw null; }
public static bool IsTypeVisibleFromCom(System.Type t) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.Tests.csproj b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.Tests.csproj
index 29c38f3766bfc..e7d065da06cea 100644
--- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.Tests.csproj
+++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.Tests.csproj
@@ -93,6 +93,7 @@
+
@@ -176,4 +177,4 @@
-
\ No newline at end of file
+
diff --git a/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/InitHandleTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/InitHandleTests.cs
new file mode 100644
index 0000000000000..2ad614364040c
--- /dev/null
+++ b/src/libraries/System.Runtime.InteropServices/tests/System/Runtime/InteropServices/Marshal/InitHandleTests.cs
@@ -0,0 +1,30 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using Xunit;
+
+namespace System.Runtime.InteropServices.Tests
+{
+ public class InitHandleTests
+ {
+ [Fact]
+ public void InitHandle_SetsHandle()
+ {
+ var safeHandle = new TestSafeHandle();
+ nint underlyingHandle = 42;
+
+ Marshal.InitHandle(safeHandle, underlyingHandle);
+
+ Assert.Equal((IntPtr)underlyingHandle, safeHandle.DangerousGetHandle());
+ }
+
+ class TestSafeHandle : SafeHandle
+ {
+ public TestSafeHandle() : base(IntPtr.Zero, true) { }
+
+ public override bool IsInvalid => handle == IntPtr.Zero;
+
+ protected override bool ReleaseHandle() => true;
+ }
+ }
+}
diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs
index 6c2e4029a2887..9e26e36541d6e 100644
--- a/src/libraries/System.Runtime/ref/System.Runtime.cs
+++ b/src/libraries/System.Runtime/ref/System.Runtime.cs
@@ -18,6 +18,7 @@ protected CriticalHandleZeroOrMinusOneIsInvalid() : base (default(System.IntPtr)
}
public sealed partial class SafeFileHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
+ public SafeFileHandle() : base (default(bool)) { }
public SafeFileHandle(System.IntPtr preexistingHandle, bool ownsHandle) : base (default(bool)) { }
public override bool IsInvalid { get { throw null; } }
protected override bool ReleaseHandle() { throw null; }
@@ -34,6 +35,7 @@ public abstract partial class SafeHandleZeroOrMinusOneIsInvalid : System.Runtime
}
public sealed partial class SafeWaitHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
+ public SafeWaitHandle() : base (default(bool)) { }
public SafeWaitHandle(System.IntPtr existingHandle, bool ownsHandle) : base (default(bool)) { }
protected override bool ReleaseHandle() { throw null; }
}
diff --git a/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.cs b/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.cs
index bf0df9296b4f7..902fa8f3f698a 100644
--- a/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.cs
+++ b/src/libraries/System.Security.Cryptography.OpenSsl/ref/System.Security.Cryptography.OpenSsl.cs
@@ -64,6 +64,7 @@ public override void ImportParameters(System.Security.Cryptography.RSAParameters
}
public sealed partial class SafeEvpPKeyHandle : System.Runtime.InteropServices.SafeHandle
{
+ public SafeEvpPKeyHandle() : base (default(System.IntPtr), default(bool)) { }
public SafeEvpPKeyHandle(System.IntPtr handle, bool ownsHandle) : base (default(System.IntPtr), default(bool)) { }
public override bool IsInvalid { get { throw null; } }
public System.Security.Cryptography.SafeEvpPKeyHandle DuplicateHandle() { throw null; }
diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/Microsoft/Win32/SafeHandles/SafeCryptMsgHandle.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/Microsoft/Win32/SafeHandles/SafeCryptMsgHandle.cs
index c3516ad499de7..4049bdafa919f 100644
--- a/src/libraries/System.Security.Cryptography.Pkcs/src/Microsoft/Win32/SafeHandles/SafeCryptMsgHandle.cs
+++ b/src/libraries/System.Security.Cryptography.Pkcs/src/Microsoft/Win32/SafeHandles/SafeCryptMsgHandle.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeCryptMsgHandle : SafeHandle
{
- private SafeCryptMsgHandle() :
+ public SafeCryptMsgHandle() :
base(IntPtr.Zero, ownsHandle: true)
{
}
diff --git a/src/libraries/System.Security.Cryptography.Pkcs/src/Microsoft/Win32/SafeHandles/SafeHeapAllocHandle.cs b/src/libraries/System.Security.Cryptography.Pkcs/src/Microsoft/Win32/SafeHandles/SafeHeapAllocHandle.cs
index eedb572911df6..491c86bb9d30c 100644
--- a/src/libraries/System.Security.Cryptography.Pkcs/src/Microsoft/Win32/SafeHandles/SafeHeapAllocHandle.cs
+++ b/src/libraries/System.Security.Cryptography.Pkcs/src/Microsoft/Win32/SafeHandles/SafeHeapAllocHandle.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeHeapAllocHandle : SafeBuffer, IDisposable
{
- private SafeHeapAllocHandle() : base(true) { }
+ public SafeHeapAllocHandle() : base(true) { }
internal static SafeHeapAllocHandle Alloc(int size)
{
diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.cs b/src/libraries/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.cs
index f4e7a03eb8d6f..8f5f7253b6b6a 100644
--- a/src/libraries/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.cs
+++ b/src/libraries/System.Security.Cryptography.X509Certificates/ref/System.Security.Cryptography.X509Certificates.cs
@@ -8,7 +8,7 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed partial class SafeX509ChainHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
- internal SafeX509ChainHandle() : base (default(bool)) { }
+ public SafeX509ChainHandle() : base (default(bool)) { }
protected override void Dispose(bool disposing) { }
protected override bool ReleaseHandle() { throw null; }
}
diff --git a/src/libraries/System.Security.Cryptography.X509Certificates/src/Microsoft/Win32/SafeHandles/SafeX509ChainHandle.cs b/src/libraries/System.Security.Cryptography.X509Certificates/src/Microsoft/Win32/SafeHandles/SafeX509ChainHandle.cs
index a115bee34c51d..a6694d94ef986 100644
--- a/src/libraries/System.Security.Cryptography.X509Certificates/src/Microsoft/Win32/SafeHandles/SafeX509ChainHandle.cs
+++ b/src/libraries/System.Security.Cryptography.X509Certificates/src/Microsoft/Win32/SafeHandles/SafeX509ChainHandle.cs
@@ -10,7 +10,7 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed class SafeX509ChainHandle : SafeHandleZeroOrMinusOneIsInvalid
{
- private SafeX509ChainHandle()
+ public SafeX509ChainHandle()
: base(true)
{
}
diff --git a/src/libraries/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.cs b/src/libraries/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.cs
index 5107de52dbf64..5daebe3b72ab7 100644
--- a/src/libraries/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.cs
+++ b/src/libraries/System.Security.Principal.Windows/ref/System.Security.Principal.Windows.cs
@@ -8,6 +8,7 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed partial class SafeAccessTokenHandle : System.Runtime.InteropServices.SafeHandle
{
+ public SafeAccessTokenHandle() : base (default(System.IntPtr), default(bool)) { }
public SafeAccessTokenHandle(System.IntPtr handle) : base (default(System.IntPtr), default(bool)) { }
public static Microsoft.Win32.SafeHandles.SafeAccessTokenHandle InvalidHandle { get { throw null; } }
public override bool IsInvalid { get { throw null; } }
diff --git a/src/libraries/System.Security.Principal.Windows/src/Microsoft/Win32/SafeHandles/SafeAccessTokenHandle.cs b/src/libraries/System.Security.Principal.Windows/src/Microsoft/Win32/SafeHandles/SafeAccessTokenHandle.cs
index 269f6fd68dd04..ccffa35e96e12 100644
--- a/src/libraries/System.Security.Principal.Windows/src/Microsoft/Win32/SafeHandles/SafeAccessTokenHandle.cs
+++ b/src/libraries/System.Security.Principal.Windows/src/Microsoft/Win32/SafeHandles/SafeAccessTokenHandle.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
{
public sealed class SafeAccessTokenHandle : SafeHandle
{
- private SafeAccessTokenHandle() : base(IntPtr.Zero, true) { }
+ public SafeAccessTokenHandle() : base(IntPtr.Zero, true) { }
// 0 is an Invalid Handle
public SafeAccessTokenHandle(IntPtr handle) : base(handle, true) { }
diff --git a/src/libraries/System.ServiceProcess.ServiceController/src/Microsoft/Win32/SafeHandles/SafeServiceHandle.cs b/src/libraries/System.ServiceProcess.ServiceController/src/Microsoft/Win32/SafeHandles/SafeServiceHandle.cs
index a9ed61540a0cc..48f0392789609 100644
--- a/src/libraries/System.ServiceProcess.ServiceController/src/Microsoft/Win32/SafeHandles/SafeServiceHandle.cs
+++ b/src/libraries/System.ServiceProcess.ServiceController/src/Microsoft/Win32/SafeHandles/SafeServiceHandle.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
///
/// Used to wrap handles gotten from OpenSCManager or OpenService
///
- internal class SafeServiceHandle : SafeHandle
+ internal sealed class SafeServiceHandle : SafeHandle
{
internal SafeServiceHandle(IntPtr handle) : base(IntPtr.Zero, true)
{
diff --git a/src/libraries/System.Speech/src/Internal/HGlobalSafeHandle.cs b/src/libraries/System.Speech/src/Internal/HGlobalSafeHandle.cs
index d7a0ddbd3ce11..ec69855e79e5e 100644
--- a/src/libraries/System.Speech/src/Internal/HGlobalSafeHandle.cs
+++ b/src/libraries/System.Speech/src/Internal/HGlobalSafeHandle.cs
@@ -12,7 +12,7 @@ internal sealed class HGlobalSafeHandle : SafeHandle
{
#region Constructors
- internal HGlobalSafeHandle() : base(IntPtr.Zero, true)
+ public HGlobalSafeHandle() : base(IntPtr.Zero, true)
{
}
diff --git a/src/libraries/System.Text.Encoding.CodePages/src/Microsoft/Win32/SafeHandles/SafeAllocHHandle.cs b/src/libraries/System.Text.Encoding.CodePages/src/Microsoft/Win32/SafeHandles/SafeAllocHHandle.cs
index 006a3cd98362e..2c07354f17efc 100644
--- a/src/libraries/System.Text.Encoding.CodePages/src/Microsoft/Win32/SafeHandles/SafeAllocHHandle.cs
+++ b/src/libraries/System.Text.Encoding.CodePages/src/Microsoft/Win32/SafeHandles/SafeAllocHHandle.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Win32.SafeHandles
{
internal sealed class SafeAllocHHandle : SafeBuffer
{
- private SafeAllocHHandle() : base(true) { }
+ public SafeAllocHHandle() : base(true) { }
internal SafeAllocHHandle(IntPtr handle) : base(true)
{