From 7323c60b8cade5fce891df422982ac308657174c Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Sun, 9 Apr 2017 22:53:50 -0700 Subject: [PATCH] Move files to shared CoreLib partition (dotnet/coreclr#10837) Commit migrated from https://github.com/dotnet/coreclr/commit/25169926291fcdcad25506c558690a0f63e61a93 --- .../src/mscorlib/System.Private.CoreLib.csproj | 24 +-- .../Unix/System.Native/Interop.GetRandomBytes.cs | 21 +++ .../Interop/Windows/NtDll/Interop.ZeroMemory.cs | 0 .../Windows/OleAut32}/Interop.SysAllocStringLen.cs | 5 +- .../Windows/OleAut32/Interop.SysFreeString.cs | 15 ++ .../Windows/OleAut32}/Interop.SysStringLen.cs | 3 - .../shared/System.Private.CoreLib.Shared.projitems | 21 +++ .../CompilationRelaxationsAttribute.cs | 23 +++ .../InternalsVisibleToAttribute.cs | 21 +++ .../Runtime/InteropServices/ComVisibleAttribute.cs | 17 +++ .../UnmanagedFunctionPointerAttribute.cs | 27 ++++ .../Runtime/InteropServices/UnmanagedType.cs | 47 ++++++ .../System/Runtime/InteropServices/VarEnum.cs | 54 +++++++ .../System/Security/SecureString.Windows.cs | 4 +- .../{src => shared}/System/Text/ASCIIEncoding.cs | 2 +- .../{src => shared}/System/Text/Decoder.cs | 10 +- .../{src => shared}/System/Text/Encoder.cs | 8 +- .../{src => shared}/System/Text/EncodingInfo.cs | 8 +- .../{src => shared}/System/Text/EncodingNLS.cs | 14 +- .../System/Text/EncodingProvider.cs | 10 +- .../{src => shared}/System/Text/UTF32Encoding.cs | 46 +++--- .../{src => shared}/System/Text/UTF8Encoding.cs | 34 ++--- .../{src => shared}/System/Text/UnicodeEncoding.cs | 15 +- .../Unix/System.Native/Interop.GetRandomBytes.cs | 19 --- .../mscorlib/src/Microsoft/Win32/Win32Native.cs | 8 - .../src/mscorlib/src/System/AppDomainSetup.cs | 2 - .../CompilerServices/CompilationRelaxations.cs | 39 ----- ...ttribute.cs => FriendAccessAllowedAttribute.cs} | 32 ---- .../SuppressMergeCheckAttribute.cs | 23 --- .../System/Runtime/InteropServices/Attributes.cs | 161 --------------------- .../src/System/XmlIgnoreMemberAttribute.cs | 21 --- 31 files changed, 323 insertions(+), 411 deletions(-) create mode 100644 src/coreclr/src/mscorlib/shared/Interop/Unix/System.Native/Interop.GetRandomBytes.cs rename src/coreclr/src/mscorlib/{src => shared}/Interop/Windows/NtDll/Interop.ZeroMemory.cs (100%) rename src/coreclr/src/mscorlib/{src/Interop/Windows/oleaut32 => shared/Interop/Windows/OleAut32}/Interop.SysAllocStringLen.cs (74%) create mode 100644 src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.cs rename src/coreclr/src/mscorlib/{src/Interop/Windows/oleaut32 => shared/Interop/Windows/OleAut32}/Interop.SysStringLen.cs (84%) create mode 100644 src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxationsAttribute.cs create mode 100644 src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs create mode 100644 src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/ComVisibleAttribute.cs create mode 100644 src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/UnmanagedFunctionPointerAttribute.cs create mode 100644 src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/UnmanagedType.cs create mode 100644 src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/VarEnum.cs rename src/coreclr/src/mscorlib/{src => shared}/System/Security/SecureString.Windows.cs (98%) rename src/coreclr/src/mscorlib/{src => shared}/System/Text/ASCIIEncoding.cs (100%) rename src/coreclr/src/mscorlib/{src => shared}/System/Text/Decoder.cs (98%) rename src/coreclr/src/mscorlib/{src => shared}/System/Text/Encoder.cs (98%) rename src/coreclr/src/mscorlib/{src => shared}/System/Text/EncodingInfo.cs (88%) rename src/coreclr/src/mscorlib/{src => shared}/System/Text/EncodingNLS.cs (98%) rename src/coreclr/src/mscorlib/{src => shared}/System/Text/EncodingProvider.cs (92%) rename src/coreclr/src/mscorlib/{src => shared}/System/Text/UTF32Encoding.cs (97%) rename src/coreclr/src/mscorlib/{src => shared}/System/Text/UTF8Encoding.cs (99%) rename src/coreclr/src/mscorlib/{src => shared}/System/Text/UnicodeEncoding.cs (99%) delete mode 100644 src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.GetRandomBytes.cs delete mode 100644 src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs rename src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/{InternalsVisibleToAttribute.cs => FriendAccessAllowedAttribute.cs} (55%) delete mode 100644 src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/SuppressMergeCheckAttribute.cs delete mode 100644 src/coreclr/src/mscorlib/src/System/XmlIgnoreMemberAttribute.cs diff --git a/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj b/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj index 218ef08..5f55547 100644 --- a/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj +++ b/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj @@ -129,13 +129,11 @@ - - + - @@ -376,7 +374,6 @@ - @@ -674,29 +671,20 @@ - - - - - - - - - @@ -751,16 +739,6 @@ - - - - - - - - - - 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 index 0000000..62156e8 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/Interop/Unix/System.Native/Interop.GetRandomBytes.cs @@ -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); + } +} diff --git a/src/coreclr/src/mscorlib/src/Interop/Windows/NtDll/Interop.ZeroMemory.cs b/src/coreclr/src/mscorlib/shared/Interop/Windows/NtDll/Interop.ZeroMemory.cs similarity index 100% rename from src/coreclr/src/mscorlib/src/Interop/Windows/NtDll/Interop.ZeroMemory.cs rename to src/coreclr/src/mscorlib/shared/Interop/Windows/NtDll/Interop.ZeroMemory.cs diff --git a/src/coreclr/src/mscorlib/src/Interop/Windows/oleaut32/Interop.SysAllocStringLen.cs b/src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs similarity index 74% rename from src/coreclr/src/mscorlib/src/Interop/Windows/oleaut32/Interop.SysAllocStringLen.cs rename to src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs index 65da4ea..1af2b3f 100644 --- a/src/coreclr/src/mscorlib/src/Interop/Windows/oleaut32/Interop.SysAllocStringLen.cs +++ b/src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysAllocStringLen.cs @@ -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 index 0000000..8673cc6 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysFreeString.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. +// 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); + } +} diff --git a/src/coreclr/src/mscorlib/src/Interop/Windows/oleaut32/Interop.SysStringLen.cs b/src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysStringLen.cs similarity index 84% rename from src/coreclr/src/mscorlib/src/Interop/Windows/oleaut32/Interop.SysStringLen.cs rename to src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysStringLen.cs index 027d8ee..cf65d6b 100644 --- a/src/coreclr/src/mscorlib/src/Interop/Windows/oleaut32/Interop.SysStringLen.cs +++ b/src/coreclr/src/mscorlib/shared/Interop/Windows/OleAut32/Interop.SysStringLen.cs @@ -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); } } diff --git a/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems b/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems index a5cc897..5ec833d 100644 --- a/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems @@ -45,6 +45,10 @@ + + + + @@ -63,6 +67,7 @@ + @@ -323,6 +328,7 @@ + @@ -335,6 +341,7 @@ + @@ -357,9 +364,13 @@ + + + + @@ -386,8 +397,17 @@ + + + + + + + + + @@ -427,6 +447,7 @@ + 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 index 0000000..1f100bd --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CompilationRelaxationsAttribute.cs @@ -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 index 0000000..f754694 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs @@ -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 index 0000000..84b9505 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/ComVisibleAttribute.cs @@ -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 index 0000000..2d69c95 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/UnmanagedFunctionPointerAttribute.cs @@ -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 index 0000000..1b625b5 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/UnmanagedType.cs @@ -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 index 0000000..495aeca --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/VarEnum.cs @@ -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 + } +} diff --git a/src/coreclr/src/mscorlib/src/System/Security/SecureString.Windows.cs b/src/coreclr/src/mscorlib/shared/System/Security/SecureString.Windows.cs similarity index 98% rename from src/coreclr/src/mscorlib/src/System/Security/SecureString.Windows.cs rename to src/coreclr/src/mscorlib/shared/System/Security/SecureString.Windows.cs index 9d8d495..13f75a3 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/SecureString.Windows.cs +++ b/src/coreclr/src/mscorlib/shared/System/Security/SecureString.Windows.cs @@ -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) diff --git a/src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs b/src/coreclr/src/mscorlib/shared/System/Text/ASCIIEncoding.cs similarity index 100% rename from src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs rename to src/coreclr/src/mscorlib/shared/System/Text/ASCIIEncoding.cs index 5d4d1ba..e5c1194 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/ASCIIEncoding.cs +++ b/src/coreclr/src/mscorlib/shared/System/Text/ASCIIEncoding.cs @@ -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 { diff --git a/src/coreclr/src/mscorlib/src/System/Text/Decoder.cs b/src/coreclr/src/mscorlib/shared/System/Text/Decoder.cs similarity index 98% rename from src/coreclr/src/mscorlib/src/System/Text/Decoder.cs rename to src/coreclr/src/mscorlib/shared/System/Text/Decoder.cs index a52c9ba..b2a0030 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/Decoder.cs +++ b/src/coreclr/src/mscorlib/shared/System/Text/Decoder.cs @@ -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) diff --git a/src/coreclr/src/mscorlib/src/System/Text/Encoder.cs b/src/coreclr/src/mscorlib/shared/System/Text/Encoder.cs similarity index 98% rename from src/coreclr/src/mscorlib/src/System/Text/Encoder.cs rename to src/coreclr/src/mscorlib/shared/System/Text/Encoder.cs index 82eb2ad..e4e9176 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/Encoder.cs +++ b/src/coreclr/src/mscorlib/shared/System/Text/Encoder.cs @@ -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) diff --git a/src/coreclr/src/mscorlib/src/System/Text/EncodingInfo.cs b/src/coreclr/src/mscorlib/shared/System/Text/EncodingInfo.cs similarity index 88% rename from src/coreclr/src/mscorlib/src/System/Text/EncodingInfo.cs rename to src/coreclr/src/mscorlib/shared/System/Text/EncodingInfo.cs index 679abff..360dd7f 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/EncodingInfo.cs +++ b/src/coreclr/src/mscorlib/shared/System/Text/EncodingInfo.cs @@ -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 { diff --git a/src/coreclr/src/mscorlib/src/System/Text/EncodingNLS.cs b/src/coreclr/src/mscorlib/shared/System/Text/EncodingNLS.cs similarity index 98% rename from src/coreclr/src/mscorlib/src/System/Text/EncodingNLS.cs rename to src/coreclr/src/mscorlib/shared/System/Text/EncodingNLS.cs index dfa8766..205ae26 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/EncodingNLS.cs +++ b/src/coreclr/src/mscorlib/shared/System/Text/EncodingNLS.cs @@ -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 diff --git a/src/coreclr/src/mscorlib/src/System/Text/EncodingProvider.cs b/src/coreclr/src/mscorlib/shared/System/Text/EncodingProvider.cs similarity index 92% rename from src/coreclr/src/mscorlib/src/System/Text/EncodingProvider.cs rename to src/coreclr/src/mscorlib/shared/System/Text/EncodingProvider.cs index bf29670..ce8c3e0 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/EncodingProvider.cs +++ b/src/coreclr/src/mscorlib/shared/System/Text/EncodingProvider.cs @@ -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); diff --git a/src/coreclr/src/mscorlib/src/System/Text/UTF32Encoding.cs b/src/coreclr/src/mscorlib/shared/System/Text/UTF32Encoding.cs similarity index 97% rename from src/coreclr/src/mscorlib/src/System/Text/UTF32Encoding.cs rename to src/coreclr/src/mscorlib/shared/System/Text/UTF32Encoding.cs index a1077bb..e4cd6c9 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/UTF32Encoding.cs +++ b/src/coreclr/src/mscorlib/shared/System/Text/UTF32Encoding.cs @@ -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.Value; + return Array.Empty(); } @@ -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] diff --git a/src/coreclr/src/mscorlib/src/System/Text/UTF8Encoding.cs b/src/coreclr/src/mscorlib/shared/System/Text/UTF8Encoding.cs similarity index 99% rename from src/coreclr/src/mscorlib/src/System/Text/UTF8Encoding.cs rename to src/coreclr/src/mscorlib/shared/System/Text/UTF8Encoding.cs index 41f0b99..5cfa890 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/UTF8Encoding.cs +++ b/src/coreclr/src/mscorlib/shared/System/Text/UTF8Encoding.cs @@ -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. @@ -15,14 +14,14 @@ // 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.Value; + return Array.Empty(); } @@ -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] diff --git a/src/coreclr/src/mscorlib/src/System/Text/UnicodeEncoding.cs b/src/coreclr/src/mscorlib/shared/System/Text/UnicodeEncoding.cs similarity index 99% rename from src/coreclr/src/mscorlib/src/System/Text/UnicodeEncoding.cs rename to src/coreclr/src/mscorlib/shared/System/Text/UnicodeEncoding.cs index c168607..0e4db9a 100644 --- a/src/coreclr/src/mscorlib/src/System/Text/UnicodeEncoding.cs +++ b/src/coreclr/src/mscorlib/shared/System/Text/UnicodeEncoding.cs @@ -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.Value; + return Array.Empty(); } 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 index 4e81568..0000000 --- a/src/coreclr/src/mscorlib/src/Interop/Unix/System.Native/Interop.GetRandomBytes.cs +++ /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); - } -} diff --git a/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs b/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs index e751a63..8543bc8 100644 --- a/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs +++ b/src/coreclr/src/mscorlib/src/Microsoft/Win32/Win32Native.cs @@ -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; diff --git a/src/coreclr/src/mscorlib/src/System/AppDomainSetup.cs b/src/coreclr/src/mscorlib/src/System/AppDomainSetup.cs index 907ac69..142b8a0 100644 --- a/src/coreclr/src/mscorlib/src/System/AppDomainSetup.cs +++ b/src/coreclr/src/mscorlib/src/System/AppDomainSetup.cs @@ -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 index 9fda9c7..0000000 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs +++ /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; - } - } - } -} diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/FriendAccessAllowedAttribute.cs similarity index 55% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs rename to src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/FriendAccessAllowedAttribute.cs index b103c84..9d380e1 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/FriendAccessAllowedAttribute.cs @@ -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; } - } - } - /// /// 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 index 828ca2e..0000000 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/SuppressMergeCheckAttribute.cs +++ /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() - { } - } -} - diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs index 089e692..ccba51e 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs +++ b/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs @@ -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 index 7acd731..0000000 --- a/src/coreclr/src/mscorlib/src/System/XmlIgnoreMemberAttribute.cs +++ /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 - { - } -} -- 2.7.4