Move files to shared CoreLib partition (dotnet/coreclr#10837)
authorJan Kotas <jkotas@microsoft.com>
Mon, 10 Apr 2017 05:53:50 +0000 (22:53 -0700)
committerGitHub <noreply@github.com>
Mon, 10 Apr 2017 05:53:50 +0000 (22:53 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/25169926291fcdcad25506c558690a0f63e61a93

31 files changed:
src/coreclr/src/mscorlib/System.Private.CoreLib.csproj
src/coreclr/src/mscorlib/shared/Interop/Unix/System.Native/Interop.GetRandomBytes.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/Interop/Windows/NtDll/Interop.ZeroMemory.cs [moved from src/coreclr/src/mscorlib/src/Interop/Windows/NtDll/Interop.ZeroMemory.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs [moved from src/coreclr/src/mscorlib/src/Interop/Windows/oleaut32/Interop.SysAllocStringLen.cs with 74% similarity]
src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysStringLen.cs [moved from src/coreclr/src/mscorlib/src/Interop/Windows/oleaut32/Interop.SysStringLen.cs with 84% similarity]
src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxationsAttribute.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/ComVisibleAttribute.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/UnmanagedFunctionPointerAttribute.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/UnmanagedType.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/VarEnum.cs [new file with mode: 0644]
src/coreclr/src/mscorlib/shared/System/Security/SecureString.Windows.cs [moved from src/coreclr/src/mscorlib/src/System/Security/SecureString.Windows.cs with 98% similarity]
src/coreclr/src/mscorlib/shared/System/Text/ASCIIEncoding.cs [moved from src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs with 100% similarity]
src/coreclr/src/mscorlib/shared/System/Text/Decoder.cs [moved from src/coreclr/src/mscorlib/src/System/Text/Decoder.cs with 98% similarity]
src/coreclr/src/mscorlib/shared/System/Text/Encoder.cs [moved from src/coreclr/src/mscorlib/src/System/Text/Encoder.cs with 98% similarity]
src/coreclr/src/mscorlib/shared/System/Text/EncodingInfo.cs [moved from src/coreclr/src/mscorlib/src/System/Text/EncodingInfo.cs with 88% similarity]
src/coreclr/src/mscorlib/shared/System/Text/EncodingNLS.cs [moved from src/coreclr/src/mscorlib/src/System/Text/EncodingNLS.cs with 98% similarity]
src/coreclr/src/mscorlib/shared/System/Text/EncodingProvider.cs [moved from src/coreclr/src/mscorlib/src/System/Text/EncodingProvider.cs with 92% similarity]
src/coreclr/src/mscorlib/shared/System/Text/UTF32Encoding.cs [moved from src/coreclr/src/mscorlib/src/System/Text/UTF32Encoding.cs with 97% similarity]
src/coreclr/src/mscorlib/shared/System/Text/UTF8Encoding.cs [moved from src/coreclr/src/mscorlib/src/System/Text/UTF8Encoding.cs with 99% similarity]
src/coreclr/src/mscorlib/shared/System/Text/UnicodeEncoding.cs [moved from src/coreclr/src/mscorlib/src/System/Text/UnicodeEncoding.cs with 99% similarity]
src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.GetRandomBytes.cs [deleted file]
src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs
src/coreclr/src/mscorlib/src/System/AppDomainSetup.cs
src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs [deleted file]
src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/FriendAccessAllowedAttribute.cs [moved from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs with 55% similarity]
src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/SuppressMergeCheckAttribute.cs [deleted file]
src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs
src/coreclr/src/mscorlib/src/System/XmlIgnoreMemberAttribute.cs [deleted file]

index 218ef08..5f55547 100644 (file)
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\CustomConstantAttribute.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\DateTimeConstantAttribute.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\DecimalConstantAttribute.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\CompilationRelaxations.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\InternalsVisibleToAttribute.cs" />
+    <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\FriendAccessAllowedAttribute.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\MethodImplAttribute.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\TypeDependencyAttribute.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\jithelpers.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\Unsafe.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\SuppressMergeCheckAttribute.cs" />
     <Compile Condition="'$(FeatureICastable)' == 'true'" Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\ICastable.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeWrappedException.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\ConditionalWeakTable.cs" />
     <Compile Include="$(BclSourcesRoot)\System\ValueType.cs" />
     <Compile Include="$(BclSourcesRoot)\System\WeakReference.cs" />
     <Compile Include="$(BclSourcesRoot)\System\WeakReferenceOfT.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\XmlIgnoreMemberAttribute.cs" />
     <Compile Include="$(BclSourcesRoot)\System\CLRConfig.cs" />
     <Compile Condition="'$(FeatureCominterop)' == 'true'" Include="$(BclSourcesRoot)\System\__ComObject.cs" />
     <Compile Condition="'$(FeatureCominterop)' == 'true'" Include="$(BclSourcesRoot)\System\Variant.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\Remoting\ObjectHandle.cs" />
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="$(BclSourcesRoot)\System\Text\ASCIIEncoding.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Text\Decoder.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\DecoderNLS.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\DecoderBestFitFallback.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\DecoderExceptionFallback.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\DecoderFallback.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\DecoderReplacementFallback.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Text\Encoder.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\EncoderNLS.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\EncoderBestFitFallback.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\EncoderExceptionFallback.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\EncoderFallback.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\EncoderReplacementFallback.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\Encoding.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Text\EncodingInfo.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Text\EncodingNLS.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Text\EncodingProvider.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\Latin1Encoding.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\Normalization.Windows.cs" Condition="'$(TargetsUnix)' != 'true'" />
-    <Compile Include="$(BclSourcesRoot)\System\Text\UnicodeEncoding.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Text\UTF7Encoding.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Text\UTF8Encoding.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Text\UTF32Encoding.cs" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="$(BclSourcesRoot)\Microsoft\Win32\UnsafeNativeMethods.cs" />
     <Compile Include="$(BclSourcesRoot)\Interop\Windows\Normaliz\Interop.Idna.cs" />
     <Compile Include="$(BclSourcesRoot)\Interop\Windows\Normaliz\Interop.Normalization.cs" />
   </ItemGroup>
-  <ItemGroup Condition="'$(TargetsUnix)' != 'true'">
-    <Compile Include="$(BclSourcesRoot)\System\Security\SecureString.Windows.cs" />
-    <!-- Interop sources -->
-    <Compile Include="$(BclSourcesRoot)\Interop\Windows\NtDll\Interop.ZeroMemory.cs" />
-    <Compile Include="$(BclSourcesRoot)\Interop\Windows\oleaut32\Interop.SysAllocStringLen.cs" />
-    <Compile Include="$(BclSourcesRoot)\Interop\Windows\oleaut32\Interop.SysStringLen.cs" />
-  </ItemGroup>
-  <ItemGroup Condition="'$(TargetsUnix)' == 'true'">
-    <Compile Include="$(BclSourcesRoot)\Interop\Unix\System.Native\Interop.GetRandomBytes.cs" />
-  </ItemGroup>
   <!-- Include additional sources shared files in the compilation -->
   <ItemGroup>
     <!-- These are files are preprocessed  -->
diff --git a/src/coreclr/src/mscorlib/shared/Interop/Unix/System.Native/Interop.GetRandomBytes.cs b/src/coreclr/src/mscorlib/shared/Interop/Unix/System.Native/Interop.GetRandomBytes.cs
new file mode 100644 (file)
index 0000000..62156e8
--- /dev/null
@@ -0,0 +1,21 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Diagnostics;
+using System.Runtime.InteropServices;
+
+internal partial class Interop
+{
+    internal unsafe partial class Sys
+    {
+        [DllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetNonCryptographicallySecureRandomBytes")]
+        internal static unsafe extern void GetNonCryptographicallySecureRandomBytes(byte* buffer, int length);
+    }
+
+    internal static unsafe void GetRandomBytes(byte* buffer, int length)
+    {
+        Sys.GetNonCryptographicallySecureRandomBytes(buffer, length);
+    }
+}
@@ -11,6 +11,9 @@ internal partial class Interop
     internal partial class OleAut32
     {
         [DllImport(Libraries.OleAut32, CharSet = CharSet.Unicode)]
-        internal static extern SafeBSTRHandle SysAllocStringLen(IntPtr src, uint len);  // BSTR
+        internal static extern SafeBSTRHandle SysAllocStringLen(IntPtr src, uint len);
+
+        [DllImport(Libraries.OleAut32, CharSet = CharSet.Unicode)]
+        internal static extern IntPtr SysAllocStringLen(String src, int len);
     }
 }
diff --git a/src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.cs b/src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.cs
new file mode 100644 (file)
index 0000000..8673cc6
--- /dev/null
@@ -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.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Runtime.InteropServices;
+
+internal partial class Interop
+{
+    internal partial class OleAut32
+    {
+        [DllImport(Libraries.OleAut32)]
+        internal static extern void SysFreeString(IntPtr bstr);
+    }
+}
@@ -15,8 +15,5 @@ internal partial class Interop
 
         [DllImport(Libraries.OleAut32)]
         internal static extern uint SysStringLen(IntPtr bstr);
-
-        [DllImport(Libraries.OleAut32)]
-        internal static extern void SysFreeString(IntPtr bstr);
     }
 }
index a5cc897..5ec833d 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.WideCharToMultiByte.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.WriteFile_SafeHandle_IntPtr.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\Kernel32\Interop.WriteFile_SafeHandle_NativeOverlapped.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\NtDll\Interop.ZeroMemory.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\OleAut32\Interop.SysAllocStringLen.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\OleAut32\Interop.SysFreeString.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Windows\OleAut32\Interop.SysStringLen.cs"/>
   </ItemGroup>
   <ItemGroup Condition="$(TargetsUnix)">
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\Interop.Errors.cs"/>
@@ -63,6 +67,7 @@
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.FSync.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.FTruncate.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetCwd.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.GetRandomBytes.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.LockFileRegion.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.LSeek.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)Interop\Unix\System.Native\Interop.MksTemps.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\CallerLineNumberAttribute.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\CallerMemberNameAttribute.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\CompilationRelaxations.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\CompilationRelaxationsAttribute.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\CompilerGeneratedAttribute.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\CompilerGlobalScopeAttribute.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\DefaultDependencyAttribute.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\FormattableStringFactory.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\IAsyncStateMachine.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\IndexerNameAttribute.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\InternalsVisibleToAttribute.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\INotifyCompletion.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\IsVolatile.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\CompilerServices\IteratorStateMachineAttribute.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\ConstrainedExecution\ReliabilityContractAttribute.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\CallingConvention.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\CharSet.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\ComVisibleAttribute.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\ExternalException.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\LayoutKind.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\StringBuffer.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\UnmanagedFunctionPointerAttribute.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\UnmanagedType.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\VarEnum.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\IFormatterConverter.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\IObjectReference.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Runtime\Serialization\ISafeSerializationData.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\StringComparison.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\StringSplitOptions.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\SystemException.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Text\ASCIIEncoding.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Text\Decoder.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Text\Encoder.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Text\EncodingInfo.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Text\EncodingNLS.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Text\EncodingProvider.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Text\Normalization.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Text\StringBuilder.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Text\UTF32Encoding.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Text\UTF8Encoding.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Text\UnicodeEncoding.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\ThreadAttributes.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Threading\DeferredDisposableLifetime.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\Threading\Tasks\TaskCanceledException.cs"/>
     <Compile Include="$(MSBuildThisFileDirectory)System\IO\PathInternal.Windows.StringBuffer.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\IO\Win32Marshal.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Security\SafeBSTRHandle.cs"/>
+    <Compile Include="$(MSBuildThisFileDirectory)System\Security\SecureString.Windows.cs"/>
   </ItemGroup>
   <ItemGroup Condition="$(TargetsUnix)">
     <Compile Include="$(MSBuildThisFileDirectory)Microsoft\Win32\SafeHandles\SafeFileHandle.Unix.cs"/>
diff --git a/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxationsAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxationsAttribute.cs
new file mode 100644 (file)
index 0000000..1f100bd
--- /dev/null
@@ -0,0 +1,23 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.CompilerServices
+{
+    [Serializable]
+    [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Method)]
+    public class CompilationRelaxationsAttribute : Attribute
+    {
+        public CompilationRelaxationsAttribute(int relaxations)
+        {
+            CompilationRelaxations = relaxations;
+        }
+
+        public CompilationRelaxationsAttribute(CompilationRelaxations relaxations)
+        {
+            CompilationRelaxations = (int)relaxations;
+        }
+
+        public int CompilationRelaxations { get; }
+    }
+}
diff --git a/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs
new file mode 100644 (file)
index 0000000..f754694
--- /dev/null
@@ -0,0 +1,21 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+
+namespace System.Runtime.CompilerServices
+{
+    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
+    public sealed class InternalsVisibleToAttribute : Attribute
+    {
+        public InternalsVisibleToAttribute(string assemblyName)
+        {
+            AssemblyName = assemblyName;
+        }
+
+        public string AssemblyName { get; }
+        public bool AllInternalsVisible { get; set; } = true;
+    }
+}
+
diff --git a/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/ComVisibleAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/ComVisibleAttribute.cs
new file mode 100644 (file)
index 0000000..84b9505
--- /dev/null
@@ -0,0 +1,17 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+    [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Property, Inherited = false)]
+    public sealed class ComVisibleAttribute : Attribute
+    {
+        public ComVisibleAttribute(bool visibility)
+        {
+            Value = visibility;
+        }
+
+        public bool Value { get; }
+    }
+}
diff --git a/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/UnmanagedFunctionPointerAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/UnmanagedFunctionPointerAttribute.cs
new file mode 100644 (file)
index 0000000..2d69c95
--- /dev/null
@@ -0,0 +1,27 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+    [AttributeUsage(AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
+    public sealed class UnmanagedFunctionPointerAttribute : Attribute
+    {
+        public bool BestFitMapping;
+        public bool SetLastError;
+        public bool ThrowOnUnmappableChar;
+        public CharSet CharSet;
+
+        public UnmanagedFunctionPointerAttribute()
+        {
+            CallingConvention = CallingConvention.Winapi;
+        }
+
+        public UnmanagedFunctionPointerAttribute(CallingConvention callingConvention)
+        {
+            CallingConvention = callingConvention;
+        }
+
+        public CallingConvention CallingConvention { get; }
+    }
+}
diff --git a/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/UnmanagedType.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/UnmanagedType.cs
new file mode 100644 (file)
index 0000000..1b625b5
--- /dev/null
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+    public enum UnmanagedType
+    {
+        Bool = 0x2,         // 4 byte boolean value (true != 0, false == 0)
+        I1 = 0x3,           // 1 byte signed value
+        U1 = 0x4,           // 1 byte unsigned value
+        I2 = 0x5,           // 2 byte signed value
+        U2 = 0x6,           // 2 byte unsigned value
+        I4 = 0x7,           // 4 byte signed value
+        U4 = 0x8,           // 4 byte unsigned value
+        I8 = 0x9,           // 8 byte signed value
+        U8 = 0xa,           // 8 byte unsigned value
+        R4 = 0xb,           // 4 byte floating point
+        R8 = 0xc,           // 8 byte floating point
+        Currency = 0xf,     // A currency
+        BStr = 0x13,        // OLE Unicode BSTR
+        LPStr = 0x14,       // Ptr to SBCS string
+        LPWStr = 0x15,      // Ptr to Unicode string
+        LPTStr = 0x16,      // Ptr to OS preferred (SBCS/Unicode) string
+        ByValTStr = 0x17,   // OS preferred (SBCS/Unicode) inline string (only valid in structs)
+        IUnknown = 0x19,    // COM IUnknown pointer.
+        IDispatch = 0x1a,   // COM IDispatch pointer
+        Struct = 0x1b,      // Structure
+        Interface = 0x1c,   // COM interface
+        SafeArray = 0x1d,   // OLE SafeArray
+        ByValArray = 0x1e,  // Array of fixed size (only valid in structs)
+        SysInt = 0x1f,      // Hardware natural sized signed integer
+        SysUInt = 0x20,
+        VBByRefStr = 0x22,
+        AnsiBStr = 0x23,    // OLE BSTR containing SBCS characters
+        TBStr = 0x24,       // Ptr to OS preferred (SBCS/Unicode) BSTR
+        VariantBool = 0x25, // OLE defined BOOLEAN (2 bytes, true == -1, false == 0)
+        FunctionPtr = 0x26, // Function pointer
+        AsAny = 0x28,       // Paired with Object type and does runtime marshalling determination
+        LPArray = 0x2a,     // C style array
+        LPStruct = 0x2b,    // Pointer to a structure
+        CustomMarshaler = 0x2c,
+        Error = 0x2d,
+        IInspectable = 0x2e,
+        HString = 0x2f,     // Windows Runtime HSTRING
+    }
+}
diff --git a/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/VarEnum.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/VarEnum.cs
new file mode 100644 (file)
index 0000000..495aeca
--- /dev/null
@@ -0,0 +1,54 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Runtime.InteropServices
+{
+    public enum VarEnum
+    {
+        VT_EMPTY = 0,
+        VT_NULL = 1,
+        VT_I2 = 2,
+        VT_I4 = 3,
+        VT_R4 = 4,
+        VT_R8 = 5,
+        VT_CY = 6,
+        VT_DATE = 7,
+        VT_BSTR = 8,
+        VT_DISPATCH = 9,
+        VT_ERROR = 10,
+        VT_BOOL = 11,
+        VT_VARIANT = 12,
+        VT_UNKNOWN = 13,
+        VT_DECIMAL = 14,
+        VT_I1 = 16,
+        VT_UI1 = 17,
+        VT_UI2 = 18,
+        VT_UI4 = 19,
+        VT_I8 = 20,
+        VT_UI8 = 21,
+        VT_INT = 22,
+        VT_UINT = 23,
+        VT_VOID = 24,
+        VT_HRESULT = 25,
+        VT_PTR = 26,
+        VT_SAFEARRAY = 27,
+        VT_CARRAY = 28,
+        VT_USERDEFINED = 29,
+        VT_LPSTR = 30,
+        VT_LPWSTR = 31,
+        VT_RECORD = 36,
+        VT_FILETIME = 64,
+        VT_BLOB = 65,
+        VT_STREAM = 66,
+        VT_STORAGE = 67,
+        VT_STREAMED_OBJECT = 68,
+        VT_STORED_OBJECT = 69,
+        VT_BLOB_OBJECT = 70,
+        VT_CF = 71,
+        VT_CLSID = 72,
+        VT_VECTOR = 0x1000,
+        VT_ARRAY = 0x2000,
+        VT_BYREF = 0x4000
+    }
+}
@@ -157,7 +157,7 @@ namespace System.Security
                 _buffer.AcquirePointer(ref bufferPtr);
                 int resultByteLength = (length + 1) * sizeof(char);
 
-                ptr = Win32Native.SysAllocStringLen(null, length);
+                ptr = Interop.OleAut32.SysAllocStringLen(null, length);
                 if (ptr == IntPtr.Zero)
                 {
                     throw new OutOfMemoryException();
@@ -175,7 +175,7 @@ namespace System.Security
                 if (result == IntPtr.Zero && ptr != IntPtr.Zero)
                 {
                     Interop.NtDll.ZeroMemory(ptr, (UIntPtr)(length * sizeof(char)));
-                    Win32Native.SysFreeString(ptr);
+                    Interop.OleAut32.SysFreeString(ptr);
                 }
 
                 if (bufferPtr != null)
@@ -3,9 +3,9 @@
 // See the LICENSE file in the project root for more information.
 
 using System;
-using System.Runtime.Serialization;
 using System.Diagnostics;
 using System.Diagnostics.Contracts;
+using System.Runtime.Serialization;
 
 namespace System.Text
 {
@@ -95,7 +95,7 @@ namespace System.Text
         //
         // If the caller doesn't want to try again after GetChars() throws an error, then they need to call Reset().
         //
-        // Virtual implimentation has to call GetChars with flush and a big enough buffer to clear a 0 byte string
+        // Virtual implementation has to call GetChars with flush and a big enough buffer to clear a 0 byte string
         // We avoid GetMaxCharCount() because a) we can't call the base encoder and b) it might be really big.
         public virtual void Reset()
         {
@@ -120,7 +120,7 @@ namespace System.Text
         }
 
         // We expect this to be the workhorse for NLS Encodings, but for existing
-        // ones we need a working (if slow) default implimentation)
+        // ones we need a working (if slow) default implementation)
         [CLSCompliant(false)]
         public virtual unsafe int GetCharCount(byte* bytes, int count, bool flush)
         {
@@ -169,7 +169,7 @@ namespace System.Text
         }
 
         // We expect this to be the workhorse for NLS Encodings, but for existing
-        // ones we need a working (if slow) default implimentation)
+        // ones we need a working (if slow) default implementation)
         //
         // WARNING WARNING WARNING
         //
@@ -178,7 +178,7 @@ namespace System.Text
         // and indexes are correct when you call this method.
         //
         // In addition, we have internal code, which will be marked as "safe" calling
-        // this code.  However this code is dependent upon the implimentation of an
+        // this code.  However this code is dependent upon the implementation of an
         // external GetChars() method, which could be overridden by a third party and
         // the results of which cannot be guaranteed.  We use that result to copy
         // the char[] to our char* output buffer.  If the result count was wrong, we
@@ -215,7 +215,7 @@ namespace System.Text
 
             // Copy the char array
             // WARNING: We MUST make sure that we don't copy too many chars.  We can't
-            // rely on result because it could be a 3rd party implimentation.  We need
+            // rely on result because it could be a 3rd party implementation.  We need
             // to make sure we never copy more than charCount chars no matter the value
             // of result
             if (result < charCount)
@@ -95,7 +95,7 @@ namespace System.Text
         //
         // If the caller doesn't want to try again after GetBytes() throws an error, then they need to call Reset().
         //
-        // Virtual implimentation has to call GetBytes with flush and a big enough buffer to clear a 0 char string
+        // Virtual implementation has to call GetBytes with flush and a big enough buffer to clear a 0 char string
         // We avoid GetMaxByteCount() because a) we can't call the base encoder and b) it might be really big.
         public virtual void Reset()
         {
@@ -163,7 +163,7 @@ namespace System.Text
                                         byte[] bytes, int byteIndex, bool flush);
 
         // We expect this to be the workhorse for NLS Encodings, but for existing
-        // ones we need a working (if slow) default implimentation)
+        // ones we need a working (if slow) default implementation)
         //
         // WARNING WARNING WARNING
         //
@@ -172,7 +172,7 @@ namespace System.Text
         // and indexes are correct when you call this method.
         //
         // In addition, we have internal code, which will be marked as "safe" calling
-        // this code.  However this code is dependent upon the implimentation of an
+        // this code.  However this code is dependent upon the implementation of an
         // external GetBytes() method, which could be overridden by a third party and
         // the results of which cannot be guaranteed.  We use that result to copy
         // the byte[] to our byte* output buffer.  If the result count was wrong, we
@@ -209,7 +209,7 @@ namespace System.Text
 
             // Copy the byte array
             // WARNING: We MUST make sure that we don't copy too many bytes.  We can't
-            // rely on result because it could be a 3rd party implimentation.  We need
+            // rely on result because it could be a 3rd party implementation.  We need
             // to make sure we never copy more than byteCount bytes no matter the value
             // of result
             if (result < byteCount)
@@ -11,8 +11,8 @@ namespace System.Text
     public sealed class EncodingInfo
     {
         private int iCodePage;          // Code Page #
-        private String strEncodingName;    // Short name (web name)
-        private String strDisplayName;     // Full localized name
+        private string strEncodingName;    // Short name (web name)
+        private string strDisplayName;     // Full localized name
 
         internal EncodingInfo(int codePage, string name, string displayName)
         {
@@ -31,7 +31,7 @@ namespace System.Text
         }
 
 
-        public String Name
+        public string Name
         {
             get
             {
@@ -40,7 +40,7 @@ namespace System.Text
         }
 
 
-        public String DisplayName
+        public string DisplayName
         {
             get
             {
@@ -2,16 +2,14 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
+using System;
+using System.Diagnostics.Contracts;
+using System.Collections;
+using System.Globalization;
+using System.Threading;
+
 namespace System.Text
 {
-    using System;
-    using System.Diagnostics.Contracts;
-    using System.Collections;
-    using System.Runtime.Remoting;
-    using System.Globalization;
-    using System.Threading;
-    using Win32Native = Microsoft.Win32.Win32Native;
-
     // This class overrides Encoding with the things we need for our NLS Encodings
     //
     // All of the GetBytes/Chars GetByte/CharCount methods are just wrappers for the pointer
@@ -59,7 +59,7 @@ namespace System.Text
                     return;
                 }
 
-                var providers = new EncodingProvider[s_providers.Length + 1];
+                EncodingProvider[] providers = new EncodingProvider[s_providers.Length + 1];
                 Array.Copy(s_providers, providers, s_providers.Length);
                 providers[providers.Length - 1] = provider;
                 s_providers = providers;
@@ -71,7 +71,7 @@ namespace System.Text
             if (s_providers == null)
                 return null;
 
-            var providers = s_providers;
+            EncodingProvider[] providers = s_providers;
             foreach (EncodingProvider provider in providers)
             {
                 Encoding enc = provider.GetEncoding(codepage);
@@ -87,7 +87,7 @@ namespace System.Text
             if (s_providers == null)
                 return null;
 
-            var providers = s_providers;
+            EncodingProvider[] providers = s_providers;
             foreach (EncodingProvider provider in providers)
             {
                 Encoding enc = provider.GetEncoding(encodingName);
@@ -103,7 +103,7 @@ namespace System.Text
             if (s_providers == null)
                 return null;
 
-            var providers = s_providers;
+            EncodingProvider[] providers = s_providers;
             foreach (EncodingProvider provider in providers)
             {
                 Encoding encing = provider.GetEncoding(codepage, enc, dec);
@@ -119,7 +119,7 @@ namespace System.Text
             if (s_providers == null)
                 return null;
 
-            var providers = s_providers;
+            EncodingProvider[] providers = s_providers;
             foreach (EncodingProvider provider in providers)
             {
                 Encoding encoding = provider.GetEncoding(encodingName, enc, dec);
@@ -6,7 +6,6 @@
 // Don't override IsAlwaysNormalized because it is just a Unicode Transformation and could be confused.
 //
 
-
 using System;
 using System.Diagnostics;
 using System.Diagnostics.Contracts;
@@ -41,9 +40,9 @@ namespace System.Text
         internal static readonly UTF32Encoding s_default = new UTF32Encoding(bigEndian: false, byteOrderMark: true);
         internal static readonly UTF32Encoding s_bigEndianDefault = new UTF32Encoding(bigEndian: true, byteOrderMark: true);
 
-        private bool emitUTF32ByteOrderMark = false;
-        private bool isThrowException = false;
-        private bool bigEndian = false;
+        private bool _emitUTF32ByteOrderMark = false;
+        private bool _isThrowException = false;
+        private bool _bigEndian = false;
 
 
         public UTF32Encoding() : this(false, true, false)
@@ -60,19 +59,19 @@ namespace System.Text
         public UTF32Encoding(bool bigEndian, bool byteOrderMark, bool throwOnInvalidCharacters) :
             base(bigEndian ? 12001 : 12000)
         {
-            this.bigEndian = bigEndian;
-            emitUTF32ByteOrderMark = byteOrderMark;
-            isThrowException = throwOnInvalidCharacters;
+            _bigEndian = bigEndian;
+            _emitUTF32ByteOrderMark = byteOrderMark;
+            _isThrowException = throwOnInvalidCharacters;
 
             // Encoding constructor already did this, but it'll be wrong if we're throwing exceptions
-            if (isThrowException)
+            if (_isThrowException)
                 SetDefaultFallbacks();
         }
 
         internal override void SetDefaultFallbacks()
         {
             // For UTF-X encodings, we use a replacement fallback with an empty string
-            if (isThrowException)
+            if (_isThrowException)
             {
                 this.encoderFallback = EncoderFallback.ExceptionFallback;
                 this.decoderFallback = DecoderFallback.ExceptionFallback;
@@ -604,7 +603,7 @@ namespace System.Text
                             break;
                         }
 
-                        if (bigEndian)
+                        if (_bigEndian)
                         {
                             *(bytes++) = (byte)(0x00);
                             *(bytes++) = (byte)(iTemp >> 16);       // Implies & 0xFF, which isn't needed cause high are all 0
@@ -676,7 +675,7 @@ namespace System.Text
                     break;                                              // Didn't throw, stop
                 }
 
-                if (bigEndian)
+                if (_bigEndian)
                 {
                     *(bytes++) = (byte)(0x00);
                     *(bytes++) = (byte)(0x00);
@@ -764,7 +763,7 @@ namespace System.Text
             while (bytes < end && charCount >= 0)
             {
                 // Get our next character
-                if (bigEndian)
+                if (_bigEndian)
                 {
                     // Scoot left and add it to the bottom
                     iChar <<= 8;
@@ -791,7 +790,7 @@ namespace System.Text
                 {
                     // Need to fall back these 4 bytes
                     byte[] fallbackBytes;
-                    if (bigEndian)
+                    if (_bigEndian)
                     {
                         fallbackBytes = new byte[] {
                             unchecked((byte)(iChar>>24)), unchecked((byte)(iChar>>16)),
@@ -830,7 +829,7 @@ namespace System.Text
             {
                 // Oops, there's something left over with no place to go.
                 byte[] fallbackBytes = new byte[readCount];
-                if (bigEndian)
+                if (_bigEndian)
                 {
                     while (readCount > 0)
                     {
@@ -912,7 +911,7 @@ namespace System.Text
             while (bytes < byteEnd)
             {
                 // Get our next character
-                if (bigEndian)
+                if (_bigEndian)
                 {
                     // Scoot left and add it to the bottom
                     iChar <<= 8;
@@ -939,7 +938,7 @@ namespace System.Text
                 {
                     // Need to fall back these 4 bytes
                     byte[] fallbackBytes;
-                    if (bigEndian)
+                    if (_bigEndian)
                     {
                         fallbackBytes = new byte[] {
                             unchecked((byte)(iChar>>24)), unchecked((byte)(iChar>>16)),
@@ -1025,7 +1024,7 @@ namespace System.Text
                 // Oops, there's something left over with no place to go.
                 byte[] fallbackBytes = new byte[readCount];
                 int tempCount = readCount;
-                if (bigEndian)
+                if (_bigEndian)
                 {
                     while (tempCount > 0)
                     {
@@ -1163,10 +1162,10 @@ namespace System.Text
 
         public override byte[] GetPreamble()
         {
-            if (emitUTF32ByteOrderMark)
+            if (_emitUTF32ByteOrderMark)
             {
                 // Allocate new array to prevent users from modifying it.
-                if (bigEndian)
+                if (_bigEndian)
                 {
                     return new byte[4] { 0x00, 0x00, 0xFE, 0xFF };
                 }
@@ -1176,7 +1175,7 @@ namespace System.Text
                 }
             }
             else
-                return EmptyArray<Byte>.Value;
+                return Array.Empty<byte>();
         }
 
 
@@ -1185,9 +1184,8 @@ namespace System.Text
             UTF32Encoding that = value as UTF32Encoding;
             if (that != null)
             {
-                return (emitUTF32ByteOrderMark == that.emitUTF32ByteOrderMark) &&
-                       (bigEndian == that.bigEndian) &&
-                       //                       (isThrowException == that.isThrowException) && // same as encoder/decoderfallback being exceptions
+                return (_emitUTF32ByteOrderMark == that._emitUTF32ByteOrderMark) &&
+                       (_bigEndian == that._bigEndian) &&
                        (EncoderFallback.Equals(that.EncoderFallback)) &&
                        (DecoderFallback.Equals(that.DecoderFallback));
             }
@@ -1199,7 +1197,7 @@ namespace System.Text
         {
             //Not great distribution, but this is relatively unlikely to be used as the key in a hashtable.
             return this.EncoderFallback.GetHashCode() + this.DecoderFallback.GetHashCode() +
-                   CodePage + (emitUTF32ByteOrderMark ? 4 : 0) + (bigEndian ? 8 : 0);
+                   CodePage + (_emitUTF32ByteOrderMark ? 4 : 0) + (_bigEndian ? 8 : 0);
         }
 
         [Serializable]
@@ -2,7 +2,6 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-
 // The worker functions in this file was optimized for performance. If you make changes
 // you should use care to consider all of the interesting cases.
 
 // the problem is fastloop-specific.
 #define FASTLOOP
 
+using System;
+using System.Runtime.Serialization;
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+using System.Globalization;
+
 namespace System.Text
 {
-    using System;
-    using System.Globalization;
-    using System.Runtime.Serialization;
-    using System.Diagnostics;
-    using System.Diagnostics.Contracts;
-
     // Encodes text into and out of UTF-8.  UTF-8 is a way of writing
     // Unicode characters with variable numbers of bytes per character,
     // optimized for the lower 127 ASCII characters.  It's an efficient way
@@ -66,9 +65,9 @@ namespace System.Text
 
         // Yes, the idea of emitting U+FEFF as a UTF-8 identifier has made it into
         // the standard.
-        private bool emitUTF8Identifier = false;
+        private bool _emitUTF8Identifier = false;
 
-        private bool isThrowException = false;
+        private bool _isThrowException = false;
 
 
         public UTF8Encoding() : this(false)
@@ -85,18 +84,18 @@ namespace System.Text
         public UTF8Encoding(bool encoderShouldEmitUTF8Identifier, bool throwOnInvalidBytes) :
             base(UTF8_CODEPAGE)
         {
-            emitUTF8Identifier = encoderShouldEmitUTF8Identifier;
-            isThrowException = throwOnInvalidBytes;
+            _emitUTF8Identifier = encoderShouldEmitUTF8Identifier;
+            _isThrowException = throwOnInvalidBytes;
 
             // Encoding's constructor already did this, but it'll be wrong if we're throwing exceptions
-            if (isThrowException)
+            if (_isThrowException)
                 SetDefaultFallbacks();
         }
 
         internal override void SetDefaultFallbacks()
         {
             // For UTF-X encodings, we use a replacement fallback with an empty string
-            if (isThrowException)
+            if (_isThrowException)
             {
                 this.encoderFallback = EncoderFallback.ExceptionFallback;
                 this.decoderFallback = DecoderFallback.ExceptionFallback;
@@ -2492,13 +2491,13 @@ namespace System.Text
 
         public override byte[] GetPreamble()
         {
-            if (emitUTF8Identifier)
+            if (_emitUTF8Identifier)
             {
                 // Allocate new array to prevent users from modifying it.
                 return new byte[3] { 0xEF, 0xBB, 0xBF };
             }
             else
-                return EmptyArray<Byte>.Value;
+                return Array.Empty<byte>();
         }
 
 
@@ -2507,8 +2506,7 @@ namespace System.Text
             UTF8Encoding that = value as UTF8Encoding;
             if (that != null)
             {
-                return (emitUTF8Identifier == that.emitUTF8Identifier) &&
-                       //                       (isThrowException == that.isThrowException) && // Same as encoder/decoderfallbacks being exception
+                return (_emitUTF8Identifier == that._emitUTF8Identifier) &&
                        (EncoderFallback.Equals(that.EncoderFallback)) &&
                        (DecoderFallback.Equals(that.DecoderFallback));
             }
@@ -2520,7 +2518,7 @@ namespace System.Text
         {
             //Not great distribution, but this is relatively unlikely to be used as the key in a hashtable.
             return this.EncoderFallback.GetHashCode() + this.DecoderFallback.GetHashCode() +
-                   UTF8_CODEPAGE + (emitUTF8Identifier ? 1 : 0);
+                   UTF8_CODEPAGE + (_emitUTF8Identifier ? 1 : 0);
         }
 
         [Serializable]
@@ -6,15 +6,14 @@
 // Don't override IsAlwaysNormalized because it is just a Unicode Transformation and could be confused.
 //
 
+using System;
+using System.Globalization;
+using System.Runtime.Serialization;
+using System.Diagnostics;
+using System.Diagnostics.Contracts;
+
 namespace System.Text
 {
-    using System;
-    using System.Globalization;
-    using System.Runtime.Serialization;
-    using System.Diagnostics;
-    using System.Diagnostics.Contracts;
-
-
     [Serializable]
     public class UnicodeEncoding : Encoding
     {
@@ -1908,7 +1907,7 @@ namespace System.Text
                 else
                     return new byte[2] { 0xff, 0xfe };
             }
-            return EmptyArray<Byte>.Value;
+            return Array.Empty<Byte>();
         }
 
 
diff --git a/src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.GetRandomBytes.cs b/src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.GetRandomBytes.cs
deleted file mode 100644 (file)
index 4e81568..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.Diagnostics;
-using System.Runtime.InteropServices;
-
-internal partial class Interop
-{
-    internal static unsafe void GetRandomBytes(byte* bytes, int byteCount)
-    {
-        // We want to avoid dependencies on the Crypto library when compiling in CoreCLR. This
-        // will use the existing PAL implementation.
-        byte[] buffer = new byte[byteCount];
-        Microsoft.Win32.Win32Native.Random(bStrong: true, buffer: buffer, length: byteCount);
-        System.Runtime.InteropServices.Marshal.Copy(buffer, 0, (IntPtr)bytes, byteCount);
-    }
-}
index e751a63..8543bc8 100644 (file)
@@ -964,14 +964,6 @@ namespace Microsoft.Win32
         [return: MarshalAs(UnmanagedType.Bool)]
         internal extern static bool QueryUnbiasedInterruptTime(out ulong UnbiasedTime);
 
-#if FEATURE_PAL
-        [DllImport(KERNEL32, EntryPoint = "PAL_Random")]
-        internal extern static bool Random(bool bStrong,
-                           [Out, MarshalAs(UnmanagedType.LPArray)] byte[] buffer, int length);
-#else
-        private const int BCRYPT_USE_SYSTEM_PREFERRED_RNG = 0x00000002;
-#endif
-
         internal const byte VER_GREATER_EQUAL = 0x3;
         internal const uint VER_MAJORVERSION = 0x0000002;
         internal const uint VER_MINORVERSION = 0x0000001;
index 907ac69..142b8a0 100644 (file)
@@ -272,7 +272,6 @@ namespace System
             }
         }
 
-        [XmlIgnoreMember]
         public AppDomainInitializer AppDomainInitializer
         {
             get
@@ -310,7 +309,6 @@ namespace System
             _ApplicationTrust = permissionSetName;
         }
 
-        [XmlIgnoreMember]
         internal ApplicationTrust ApplicationTrust
         {
             get
diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs
deleted file mode 100644 (file)
index 9fda9c7..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-
-
-using System;
-
-namespace System.Runtime.CompilerServices
-{
-    [Serializable]
-    [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Method)]
-    public class CompilationRelaxationsAttribute : Attribute
-    {
-        private int m_relaxations;      // The relaxations.
-
-        public CompilationRelaxationsAttribute(
-            int relaxations)
-        {
-            m_relaxations = relaxations;
-        }
-
-        public CompilationRelaxationsAttribute(
-            CompilationRelaxations relaxations)
-        {
-            m_relaxations = (int)relaxations;
-        }
-
-        public int CompilationRelaxations
-        {
-            get
-            {
-                return m_relaxations;
-            }
-        }
-    }
-}
@@ -2,39 +2,8 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.
 
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-
-using System;
-
 namespace System.Runtime.CompilerServices
 {
-    [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
-    public sealed class InternalsVisibleToAttribute : Attribute
-    {
-        private string _assemblyName;
-        private bool _allInternalsVisible = true;
-
-        public InternalsVisibleToAttribute(string assemblyName)
-        {
-            _assemblyName = assemblyName;
-        }
-
-        public string AssemblyName
-        {
-            get
-            {
-                return _assemblyName;
-            }
-        }
-
-        public bool AllInternalsVisible
-        {
-            get { return _allInternalsVisible; }
-            set { _allInternalsVisible = value; }
-        }
-    }
-
     /// <summary>
     ///     If AllInternalsVisible is not true for a friend assembly, the FriendAccessAllowed attribute
     ///     indicates which internals are shared with that friend assembly.
@@ -55,4 +24,3 @@ namespace System.Runtime.CompilerServices
     {
     }
 }
-
diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/SuppressMergeCheckAttribute.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/SuppressMergeCheckAttribute.cs
deleted file mode 100644 (file)
index 828ca2e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-
-using System.Runtime.InteropServices;
-
-namespace System.Runtime.CompilerServices
-{
-    [AttributeUsage(AttributeTargets.Class |
-                    AttributeTargets.Constructor |
-                    AttributeTargets.Method |
-                    AttributeTargets.Field |
-                    AttributeTargets.Event |
-                    AttributeTargets.Property)]
-
-    internal sealed class SuppressMergeCheckAttribute : Attribute
-    {
-        public SuppressMergeCheckAttribute()
-        { }
-    }
-}
-
index 089e692..ccba51e 100644 (file)
@@ -12,26 +12,6 @@ using System.Diagnostics.Contracts;
 
 namespace System.Runtime.InteropServices
 {
-    [AttributeUsage(AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
-    public sealed class UnmanagedFunctionPointerAttribute : Attribute
-    {
-        private CallingConvention m_callingConvention;
-
-        public UnmanagedFunctionPointerAttribute(CallingConvention callingConvention) { m_callingConvention = callingConvention; }
-
-        public CallingConvention CallingConvention { get { return m_callingConvention; } }
-
-        public CharSet CharSet;
-        public bool BestFitMapping;
-        public bool ThrowOnUnmappableChar;
-
-        // This field is ignored and marshaling behaves as if it was true (for historical reasons).
-        public bool SetLastError;
-
-        //  P/Invoke via delegate always preserves signature, HRESULT swapping is not supported.
-        //public bool PreserveSig;
-    }
-
     [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
     public sealed class TypeIdentifierAttribute : Attribute
     {
@@ -127,17 +107,6 @@ namespace System.Runtime.InteropServices
         public ClassInterfaceType Value { get { return _val; } }
     }
 
-    [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Delegate | AttributeTargets.Enum | AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Property, Inherited = false)]
-    public sealed class ComVisibleAttribute : Attribute
-    {
-        internal bool _val;
-        public ComVisibleAttribute(bool visibility)
-        {
-            _val = visibility;
-        }
-        public bool Value { get { return _val; } }
-    }
-
     [AttributeUsage(AttributeTargets.Method, Inherited = false)]
     public sealed class LCIDConversionAttribute : Attribute
     {
@@ -187,136 +156,6 @@ namespace System.Runtime.InteropServices
         public String Value { get { return _val; } }
     }
 
-    [Serializable]
-    public enum VarEnum
-    {
-        VT_EMPTY = 0,
-        VT_NULL = 1,
-        VT_I2 = 2,
-        VT_I4 = 3,
-        VT_R4 = 4,
-        VT_R8 = 5,
-        VT_CY = 6,
-        VT_DATE = 7,
-        VT_BSTR = 8,
-        VT_DISPATCH = 9,
-        VT_ERROR = 10,
-        VT_BOOL = 11,
-        VT_VARIANT = 12,
-        VT_UNKNOWN = 13,
-        VT_DECIMAL = 14,
-        VT_I1 = 16,
-        VT_UI1 = 17,
-        VT_UI2 = 18,
-        VT_UI4 = 19,
-        VT_I8 = 20,
-        VT_UI8 = 21,
-        VT_INT = 22,
-        VT_UINT = 23,
-        VT_VOID = 24,
-        VT_HRESULT = 25,
-        VT_PTR = 26,
-        VT_SAFEARRAY = 27,
-        VT_CARRAY = 28,
-        VT_USERDEFINED = 29,
-        VT_LPSTR = 30,
-        VT_LPWSTR = 31,
-        VT_RECORD = 36,
-        VT_FILETIME = 64,
-        VT_BLOB = 65,
-        VT_STREAM = 66,
-        VT_STORAGE = 67,
-        VT_STREAMED_OBJECT = 68,
-        VT_STORED_OBJECT = 69,
-        VT_BLOB_OBJECT = 70,
-        VT_CF = 71,
-        VT_CLSID = 72,
-        VT_VECTOR = 0x1000,
-        VT_ARRAY = 0x2000,
-        VT_BYREF = 0x4000
-    }
-
-    [Serializable]
-    // Note that this enum should remain in-sync with the CorNativeType enum in corhdr.h
-    public enum UnmanagedType
-    {
-        Bool = 0x2,         // 4 byte boolean value (true != 0, false == 0)
-
-        I1 = 0x3,         // 1 byte signed value
-
-        U1 = 0x4,         // 1 byte unsigned value
-
-        I2 = 0x5,         // 2 byte signed value
-
-        U2 = 0x6,         // 2 byte unsigned value
-
-        I4 = 0x7,         // 4 byte signed value
-
-        U4 = 0x8,         // 4 byte unsigned value
-
-        I8 = 0x9,         // 8 byte signed value
-
-        U8 = 0xa,         // 8 byte unsigned value
-
-        R4 = 0xb,         // 4 byte floating point
-
-        R8 = 0xc,         // 8 byte floating point
-
-        Currency = 0xf,         // A currency
-
-        BStr = 0x13,        // OLE Unicode BSTR
-
-        LPStr = 0x14,        // Ptr to SBCS string
-
-        LPWStr = 0x15,        // Ptr to Unicode string
-
-        LPTStr = 0x16,        // Ptr to OS preferred (SBCS/Unicode) string
-
-        ByValTStr = 0x17,        // OS preferred (SBCS/Unicode) inline string (only valid in structs)
-
-        IUnknown = 0x19,        // COM IUnknown pointer. 
-
-        IDispatch = 0x1a,        // COM IDispatch pointer
-
-        Struct = 0x1b,        // Structure
-
-        Interface = 0x1c,        // COM interface
-
-        SafeArray = 0x1d,        // OLE SafeArray
-
-        ByValArray = 0x1e,        // Array of fixed size (only valid in structs)
-
-        SysInt = 0x1f,        // Hardware natural sized signed integer
-
-        SysUInt = 0x20,
-
-        VBByRefStr = 0x22,
-
-        AnsiBStr = 0x23,        // OLE BSTR containing SBCS characters
-
-        TBStr = 0x24,        // Ptr to OS preferred (SBCS/Unicode) BSTR
-
-        VariantBool = 0x25,        // OLE defined BOOLEAN (2 bytes, true == -1, false == 0)
-
-        FunctionPtr = 0x26,        // Function pointer
-
-        AsAny = 0x28,        // Paired with Object type and does runtime marshalling determination
-
-        LPArray = 0x2a,        // C style array
-
-        LPStruct = 0x2b,        // Pointer to a structure
-
-        CustomMarshaler = 0x2c,
-
-        Error = 0x2d,
-
-        IInspectable = 0x2e,
-
-        HString = 0x2f,        // Windows Runtime HSTRING
-
-        LPUTF8Str = 0x30,        // UTF8 string
-    }
-
     [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.ReturnValue, Inherited = false)]
     public unsafe sealed class MarshalAsAttribute : Attribute
     {
diff --git a/src/coreclr/src/mscorlib/src/System/XmlIgnoreMemberAttribute.cs b/src/coreclr/src/mscorlib/src/System/XmlIgnoreMemberAttribute.cs
deleted file mode 100644 (file)
index 7acd731..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-/*=============================================================================
-**
-**
-**
-** Purpose: Attribute for properties/members that the Xml Serializer should
-**          ignore.
-**
-**
-=============================================================================*/
-
-namespace System
-{
-    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
-    internal sealed class XmlIgnoreMemberAttribute : Attribute
-    {
-    }
-}