From eed97b9ef68a0340366a94d693e3af9056f17fee Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Sun, 9 Apr 2017 06:55:23 -0700 Subject: [PATCH] Move files to shared CoreLib partition (dotnet/coreclr#10830) Commit migrated from https://github.com/dotnet/coreclr/commit/1a9781b68b8ec66c223bb96f44ae1d2704ce6fdf --- .../src/mscorlib/System.Private.CoreLib.csproj | 60 +---------------- .../shared/System.Private.CoreLib.Shared.projitems | 57 +++++++++++++++- .../{src => shared}/System/ArgumentException.cs | 2 +- .../Assemblies/AssemblyHashAlgorithm.cs | 15 ----- .../Assemblies/AssemblyVersionCompatibility.cs | 12 ---- .../CodeAnalysis/SuppressMessageAttribute.cs | 39 +++++++++++ .../System/Diagnostics/ConditionalAttribute.cs | 16 +---- .../src/mscorlib/shared/System/ICloneable.cs | 11 ++++ .../System/IO/DirectoryNotFoundException.cs | 19 ++---- .../System/IO/EndOfStreamException.cs | 23 +++---- .../{src => shared}/System/IO/FileAccess.cs | 16 +---- .../mscorlib/{src => shared}/System/IO/FileMode.cs | 19 +----- .../{src => shared}/System/IO/FileOptions.cs | 17 +---- .../{src => shared}/System/IO/FileShare.cs | 18 +----- .../System/IO/PathTooLongException.cs | 18 ++---- .../{src => shared}/System/IO/SeekOrigin.cs | 16 ----- .../System/MissingMethodException.cs | 44 +++++-------- .../mscorlib/{src => shared}/System/ParamsArray.cs | 56 ++++++++-------- .../mscorlib/{src => shared}/System/Progress.cs | 3 + .../src/mscorlib/{src => shared}/System/Random.cs | 42 ++++++------ .../System/Resources/IResourceReader.cs | 2 - .../Resources/MissingManifestResourceException.cs | 21 ++---- .../Resources/MissingSatelliteAssemblyException.cs | 9 +-- .../Resources/NeutralResourcesLanguageAttribute.cs | 36 +++++++++++ .../System/Resources/ResourceTypeCode.cs | 1 - .../Resources/SatelliteContractVersionAttribute.cs | 16 ++--- .../Resources/UltimateResourceFallbackLocation.cs | 5 +- .../AccessedThroughPropertyAttribute.cs | 18 +----- .../CompilerServices/AsyncStateMachineAttribute.cs | 6 +- .../CompilerServices/CallerFilePathAttribute.cs | 3 - .../CompilerServices/CallerLineNumberAttribute.cs | 3 - .../CompilerServices/CallerMemberNameAttribute.cs | 3 - .../CompilerServices/CompilerGeneratedAttribute.cs | 4 -- .../DisablePrivateReflectionAttribute.cs | 5 -- .../CompilerServices/FixedBufferAttribute.cs | 24 ++----- .../Runtime/CompilerServices/IAsyncStateMachine.cs | 0 .../Runtime/CompilerServices/INotifyCompletion.cs | 0 .../CompilerServices/IndexerNameAttribute.cs | 5 +- .../IteratorStateMachineAttribute.cs | 6 +- .../CompilerServices/ReferenceAssemblyAttribute.cs | 11 +--- .../RuntimeCompatibilityAttribute.cs | 25 +------- .../CompilerServices/StateMachineAttribute.cs | 10 +-- .../CompilerServices/TypeForwardedFromAttribute.cs | 23 +------ .../CompilerServices/TypeForwardedToAttribute.cs | 20 +----- .../CompilerServices/UnsafeValueTypeAttribute.cs | 2 - .../Runtime/InteropServices/CallingConvention.cs | 8 +-- .../System/Runtime/InteropServices/CharSet.cs | 11 +--- .../Runtime/InteropServices/ExternalException.cs | 27 ++++---- .../System/Runtime/InteropServices/LayoutKind.cs | 12 +--- .../Runtime/Serialization/IFormatterConverter.cs | 28 ++++++++ .../Runtime/Serialization/IObjectReference.cs | 11 ++++ .../System/Runtime/Serialization/ISerializable.cs | 11 ++++ .../Runtime/Versioning/TargetFrameworkAttribute.cs | 1 - .../System/Security/SafeBSTRHandle.cs | 0 .../System/Security/VerificationException.cs | 11 ++-- .../mscorlib/{src => shared}/System/ValueTuple.cs | 14 ++-- .../src/mscorlib/{src => shared}/System/Version.cs | 28 +++----- .../CodeAnalysis/SuppressMessageAttribute.cs | 75 ---------------------- src/coreclr/src/mscorlib/src/System/ICloneable.cs | 30 --------- .../Resources/NeutralResourcesLanguageAttribute.cs | 67 ------------------- .../Runtime/Serialization/IFormatterConverter.cs | 42 ------------ .../Runtime/Serialization/IObjectReference.cs | 30 --------- .../System/Runtime/Serialization/ISerializable.cs | 31 --------- 63 files changed, 375 insertions(+), 823 deletions(-) rename src/coreclr/src/mscorlib/{src => shared}/System/ArgumentException.cs (97%) rename src/coreclr/src/mscorlib/{src => shared}/System/Configuration/Assemblies/AssemblyHashAlgorithm.cs (65%) rename src/coreclr/src/mscorlib/{src => shared}/System/Configuration/Assemblies/AssemblyVersionCompatibility.cs (60%) create mode 100644 src/coreclr/src/mscorlib/shared/System/Diagnostics/CodeAnalysis/SuppressMessageAttribute.cs rename src/coreclr/src/mscorlib/{src => shared}/System/Diagnostics/ConditionalAttribute.cs (58%) create mode 100644 src/coreclr/src/mscorlib/shared/System/ICloneable.cs rename src/coreclr/src/mscorlib/{src => shared}/System/IO/DirectoryNotFoundException.cs (73%) rename src/coreclr/src/mscorlib/{src => shared}/System/IO/EndOfStreamException.cs (67%) rename src/coreclr/src/mscorlib/{src => shared}/System/IO/FileAccess.cs (79%) rename src/coreclr/src/mscorlib/{src => shared}/System/IO/FileMode.cs (83%) rename src/coreclr/src/mscorlib/{src => shared}/System/IO/FileOptions.cs (81%) rename src/coreclr/src/mscorlib/{src => shared}/System/IO/FileShare.cs (84%) rename src/coreclr/src/mscorlib/{src => shared}/System/IO/PathTooLongException.cs (68%) rename src/coreclr/src/mscorlib/{src => shared}/System/IO/SeekOrigin.cs (64%) rename src/coreclr/src/mscorlib/{src => shared}/System/MissingMethodException.cs (55%) rename src/coreclr/src/mscorlib/{src => shared}/System/ParamsArray.cs (57%) rename src/coreclr/src/mscorlib/{src => shared}/System/Progress.cs (98%) rename src/coreclr/src/mscorlib/{src => shared}/System/Random.cs (91%) rename src/coreclr/src/mscorlib/{src => shared}/System/Resources/IResourceReader.cs (97%) rename src/coreclr/src/mscorlib/{src => shared}/System/Resources/MissingManifestResourceException.cs (70%) rename src/coreclr/src/mscorlib/{src => shared}/System/Resources/MissingSatelliteAssemblyException.cs (85%) create mode 100644 src/coreclr/src/mscorlib/shared/System/Resources/NeutralResourcesLanguageAttribute.cs rename src/coreclr/src/mscorlib/{src => shared}/System/Resources/ResourceTypeCode.cs (98%) rename src/coreclr/src/mscorlib/{src => shared}/System/Resources/SatelliteContractVersionAttribute.cs (77%) rename src/coreclr/src/mscorlib/{src => shared}/System/Resources/UltimateResourceFallbackLocation.cs (95%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs (53%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs (79%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/CallerFilePathAttribute.cs (96%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs (96%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs (96%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs (73%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs (72%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/FixedBufferAttribute.cs (69%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/IAsyncStateMachine.cs (100%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/INotifyCompletion.cs (100%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/IndexerNameAttribute.cs (94%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs (79%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs (80%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs (63%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/StateMachineAttribute.cs (65%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs (54%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs (65%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs (96%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/InteropServices/CallingConvention.cs (68%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/InteropServices/CharSet.cs (70%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/InteropServices/ExternalException.cs (73%) rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/InteropServices/LayoutKind.cs (52%) create mode 100644 src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/IFormatterConverter.cs create mode 100644 src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/IObjectReference.cs create mode 100644 src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/ISerializable.cs rename src/coreclr/src/mscorlib/{src => shared}/System/Runtime/Versioning/TargetFrameworkAttribute.cs (99%) rename src/coreclr/src/mscorlib/{src => shared}/System/Security/SafeBSTRHandle.cs (100%) rename src/coreclr/src/mscorlib/{src => shared}/System/Security/VerificationException.cs (80%) rename src/coreclr/src/mscorlib/{src => shared}/System/ValueTuple.cs (99%) rename src/coreclr/src/mscorlib/{src => shared}/System/Version.cs (97%) delete mode 100644 src/coreclr/src/mscorlib/src/System/Diagnostics/CodeAnalysis/SuppressMessageAttribute.cs delete mode 100644 src/coreclr/src/mscorlib/src/System/ICloneable.cs delete mode 100644 src/coreclr/src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs delete mode 100644 src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IFormatterConverter.cs delete mode 100644 src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IObjectReference.cs delete mode 100644 src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializable.cs diff --git a/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj b/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj index ff62e7d..218ef08 100644 --- a/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj +++ b/src/coreclr/src/mscorlib/System.Private.CoreLib.csproj @@ -125,39 +125,21 @@ - - - - - - - - - - - - - - - - - - @@ -181,17 +163,13 @@ - - - - @@ -310,7 +288,6 @@ - @@ -327,6 +304,7 @@ + @@ -336,7 +314,6 @@ - @@ -368,16 +345,12 @@ - - - - @@ -401,7 +374,6 @@ - @@ -628,23 +600,15 @@ - - - - - - - - @@ -654,13 +618,11 @@ - - @@ -677,7 +639,6 @@ - @@ -699,9 +660,6 @@ - - - @@ -709,15 +667,10 @@ - - - - - @@ -758,20 +711,13 @@ - - - - - - - @@ -801,13 +747,11 @@ - - @@ -815,7 +759,6 @@ - @@ -833,7 +776,6 @@ - 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 a773629..a5cc897 100644 --- a/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/coreclr/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems @@ -82,6 +82,7 @@ + @@ -121,6 +122,8 @@ + + @@ -130,6 +133,8 @@ + + @@ -175,6 +180,7 @@ + @@ -188,12 +194,20 @@ + + + + + + + + @@ -203,6 +217,7 @@ + @@ -212,7 +227,10 @@ + + + @@ -292,29 +310,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -329,12 +380,12 @@ + - @@ -346,6 +397,7 @@ + @@ -359,6 +411,8 @@ + + @@ -372,6 +426,7 @@ + diff --git a/src/coreclr/src/mscorlib/src/System/ArgumentException.cs b/src/coreclr/src/mscorlib/shared/System/ArgumentException.cs similarity index 97% rename from src/coreclr/src/mscorlib/src/System/ArgumentException.cs rename to src/coreclr/src/mscorlib/shared/System/ArgumentException.cs index fe054a9..96afbe1 100644 --- a/src/coreclr/src/mscorlib/src/System/ArgumentException.cs +++ b/src/coreclr/src/mscorlib/shared/System/ArgumentException.cs @@ -21,7 +21,7 @@ namespace System // message describing what was wrong and which parameter is incorrect. // [Serializable] - public class ArgumentException : SystemException, ISerializable + public class ArgumentException : SystemException { private String _paramName; diff --git a/src/coreclr/src/mscorlib/src/System/Configuration/Assemblies/AssemblyHashAlgorithm.cs b/src/coreclr/src/mscorlib/shared/System/Configuration/Assemblies/AssemblyHashAlgorithm.cs similarity index 65% rename from src/coreclr/src/mscorlib/src/System/Configuration/Assemblies/AssemblyHashAlgorithm.cs rename to src/coreclr/src/mscorlib/shared/System/Configuration/Assemblies/AssemblyHashAlgorithm.cs index b3e6b214..aca8da5 100644 --- a/src/coreclr/src/mscorlib/src/System/Configuration/Assemblies/AssemblyHashAlgorithm.cs +++ b/src/coreclr/src/mscorlib/shared/System/Configuration/Assemblies/AssemblyHashAlgorithm.cs @@ -2,23 +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. -/*============================================================ -** -** -** -** Purpose: -** -** -===========================================================*/ - -using System.Runtime.InteropServices; - - -using System; - namespace System.Configuration.Assemblies { - [Serializable] public enum AssemblyHashAlgorithm { None = 0, diff --git a/src/coreclr/src/mscorlib/src/System/Configuration/Assemblies/AssemblyVersionCompatibility.cs b/src/coreclr/src/mscorlib/shared/System/Configuration/Assemblies/AssemblyVersionCompatibility.cs similarity index 60% rename from src/coreclr/src/mscorlib/src/System/Configuration/Assemblies/AssemblyVersionCompatibility.cs rename to src/coreclr/src/mscorlib/shared/System/Configuration/Assemblies/AssemblyVersionCompatibility.cs index f1d5ff0..ef7b3eb 100644 --- a/src/coreclr/src/mscorlib/src/System/Configuration/Assemblies/AssemblyVersionCompatibility.cs +++ b/src/coreclr/src/mscorlib/shared/System/Configuration/Assemblies/AssemblyVersionCompatibility.cs @@ -2,20 +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. -/*============================================================ -** -** -** -** Purpose: defining the different flavor's assembly version compatibility -** -** -===========================================================*/ - -using System; - namespace System.Configuration.Assemblies { - [Serializable] public enum AssemblyVersionCompatibility { SameMachine = 1, diff --git a/src/coreclr/src/mscorlib/shared/System/Diagnostics/CodeAnalysis/SuppressMessageAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Diagnostics/CodeAnalysis/SuppressMessageAttribute.cs new file mode 100644 index 0000000..893d7b8 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/Diagnostics/CodeAnalysis/SuppressMessageAttribute.cs @@ -0,0 +1,39 @@ +// 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. + +/*============================================================ +** +** +** +** An attribute to suppress violation messages/warnings +** by static code analysis tools. +** +** +===========================================================*/ + +namespace System.Diagnostics.CodeAnalysis +{ + [AttributeUsage( + AttributeTargets.All, + Inherited = false, + AllowMultiple = true + ) + ] + [Conditional("CODE_ANALYSIS")] + public sealed class SuppressMessageAttribute : Attribute + { + public SuppressMessageAttribute(string category, string checkId) + { + Category = category; + CheckId = checkId; + } + + public string Category { get; } + public string CheckId { get; } + public string Scope { get; set; } + public string Target { get; set; } + public string MessageId { get; set; } + public string Justification { get; set; } + } +} diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/ConditionalAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Diagnostics/ConditionalAttribute.cs similarity index 58% rename from src/coreclr/src/mscorlib/src/System/Diagnostics/ConditionalAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Diagnostics/ConditionalAttribute.cs index 5212db8..d5bca6e 100644 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/ConditionalAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Diagnostics/ConditionalAttribute.cs @@ -2,27 +2,17 @@ // 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.Diagnostics { [Serializable] [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = true)] public sealed class ConditionalAttribute : Attribute { - public ConditionalAttribute(String conditionString) - { - m_conditionString = conditionString; - } - - public String ConditionString + public ConditionalAttribute(string conditionString) { - get - { - return m_conditionString; - } + ConditionString = conditionString; } - private String m_conditionString; + public string ConditionString { get; } } } diff --git a/src/coreclr/src/mscorlib/shared/System/ICloneable.cs b/src/coreclr/src/mscorlib/shared/System/ICloneable.cs new file mode 100644 index 0000000..9f123e4 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/ICloneable.cs @@ -0,0 +1,11 @@ +// 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 +{ + public interface ICloneable + { + object Clone(); + } +} diff --git a/src/coreclr/src/mscorlib/src/System/IO/DirectoryNotFoundException.cs b/src/coreclr/src/mscorlib/shared/System/IO/DirectoryNotFoundException.cs similarity index 73% rename from src/coreclr/src/mscorlib/src/System/IO/DirectoryNotFoundException.cs rename to src/coreclr/src/mscorlib/shared/System/IO/DirectoryNotFoundException.cs index 83ddf60..786c210 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/DirectoryNotFoundException.cs +++ b/src/coreclr/src/mscorlib/shared/System/IO/DirectoryNotFoundException.cs @@ -2,18 +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. -/*============================================================ -** -** -** -** -** -** Purpose: Exception for accessing a path that doesn't exist. -** -** -===========================================================*/ - -using System; using System.Runtime.Serialization; namespace System.IO @@ -33,19 +21,20 @@ namespace System.IO HResult = __HResults.COR_E_DIRECTORYNOTFOUND; } - public DirectoryNotFoundException(String message) + public DirectoryNotFoundException(string message) : base(message) { HResult = __HResults.COR_E_DIRECTORYNOTFOUND; } - public DirectoryNotFoundException(String message, Exception innerException) + public DirectoryNotFoundException(string message, Exception innerException) : base(message, innerException) { HResult = __HResults.COR_E_DIRECTORYNOTFOUND; } - protected DirectoryNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) + protected DirectoryNotFoundException(SerializationInfo info, StreamingContext context) + : base(info, context) { } } diff --git a/src/coreclr/src/mscorlib/src/System/IO/EndOfStreamException.cs b/src/coreclr/src/mscorlib/shared/System/IO/EndOfStreamException.cs similarity index 67% rename from src/coreclr/src/mscorlib/src/System/IO/EndOfStreamException.cs rename to src/coreclr/src/mscorlib/shared/System/IO/EndOfStreamException.cs index a0e197a..52ab22c 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/EndOfStreamException.cs +++ b/src/coreclr/src/mscorlib/shared/System/IO/EndOfStreamException.cs @@ -2,22 +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. -/*============================================================ -** -** -** -** -** -** Purpose: Exception to be thrown when reading past end-of-file. -** -** -===========================================================*/ - -using System; using System.Runtime.Serialization; namespace System.IO { +#if PROJECTN + [Internal.Runtime.CompilerServices.RelocatedType("System.IO")] + [Internal.Runtime.CompilerServices.RelocatedType("System.Runtime.Extensions")] +#endif [Serializable] public class EndOfStreamException : IOException { @@ -27,19 +19,20 @@ namespace System.IO HResult = __HResults.COR_E_ENDOFSTREAM; } - public EndOfStreamException(String message) + public EndOfStreamException(string message) : base(message) { HResult = __HResults.COR_E_ENDOFSTREAM; } - public EndOfStreamException(String message, Exception innerException) + public EndOfStreamException(string message, Exception innerException) : base(message, innerException) { HResult = __HResults.COR_E_ENDOFSTREAM; } - protected EndOfStreamException(SerializationInfo info, StreamingContext context) : base(info, context) + protected EndOfStreamException(SerializationInfo info, StreamingContext context) + : base(info, context) { } } diff --git a/src/coreclr/src/mscorlib/src/System/IO/FileAccess.cs b/src/coreclr/src/mscorlib/shared/System/IO/FileAccess.cs similarity index 79% rename from src/coreclr/src/mscorlib/src/System/IO/FileAccess.cs rename to src/coreclr/src/mscorlib/shared/System/IO/FileAccess.cs index ad6117e..eaa94f3 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/FileAccess.cs +++ b/src/coreclr/src/mscorlib/shared/System/IO/FileAccess.cs @@ -2,19 +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. -/*============================================================ -** -** Enum: FileAccess -** -** -** -** -** Purpose: Enum describing whether you want read and/or write -** permission to a file. -** -** -===========================================================*/ - using System; namespace System.IO @@ -24,6 +11,9 @@ namespace System.IO // [Serializable] [Flags] +#if PROJECTN + [Internal.Runtime.CompilerServices.RelocatedTypeAttribute("System.IO.FileSystem.Primitives")] +#endif public enum FileAccess { // Specifies read access to the file. Data can be read from the file and diff --git a/src/coreclr/src/mscorlib/src/System/IO/FileMode.cs b/src/coreclr/src/mscorlib/shared/System/IO/FileMode.cs similarity index 83% rename from src/coreclr/src/mscorlib/src/System/IO/FileMode.cs rename to src/coreclr/src/mscorlib/shared/System/IO/FileMode.cs index 6f222e7..73ef68b 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/FileMode.cs +++ b/src/coreclr/src/mscorlib/shared/System/IO/FileMode.cs @@ -2,21 +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. -/*============================================================ -** -** Enum: FileMode -** -** -** -** -** Purpose: Enum describing whether to create a new file or -** open an existing one. -** -** -===========================================================*/ - -using System; - namespace System.IO { // Contains constants for specifying how the OS should open a file. @@ -27,7 +12,9 @@ namespace System.IO // to the end of the file). To truncate a file or create it if it doesn't // exist, use Create. // - [Serializable] +#if PROJECTN + [Internal.Runtime.CompilerServices.RelocatedTypeAttribute("System.IO.FileSystem.Primitives")] +#endif public enum FileMode { // Creates a new file. An exception is raised if the file already exists. diff --git a/src/coreclr/src/mscorlib/src/System/IO/FileOptions.cs b/src/coreclr/src/mscorlib/shared/System/IO/FileOptions.cs similarity index 81% rename from src/coreclr/src/mscorlib/src/System/IO/FileOptions.cs rename to src/coreclr/src/mscorlib/shared/System/IO/FileOptions.cs index c01d705..d9188dd 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/FileOptions.cs +++ b/src/coreclr/src/mscorlib/shared/System/IO/FileOptions.cs @@ -2,19 +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. -/*============================================================ -** -** Enum: FileOptions -** -** -** -** -** Purpose: Additional options to how to create a FileStream. -** Exposes the more obscure CreateFile functionality. -** -** -===========================================================*/ - using System; using System.Runtime.InteropServices; @@ -23,8 +10,10 @@ namespace System.IO // Maps to FILE_FLAG_DELETE_ON_CLOSE and similar values from winbase.h. // We didn't expose a number of these values because we didn't believe // a number of them made sense in managed code, at least not yet. - [Serializable] [Flags] +#if PROJECTN + [Internal.Runtime.CompilerServices.RelocatedTypeAttribute("System.IO.FileSystem")] +#endif public enum FileOptions { // NOTE: any change to FileOptions enum needs to be diff --git a/src/coreclr/src/mscorlib/src/System/IO/FileShare.cs b/src/coreclr/src/mscorlib/shared/System/IO/FileShare.cs similarity index 84% rename from src/coreclr/src/mscorlib/src/System/IO/FileShare.cs rename to src/coreclr/src/mscorlib/shared/System/IO/FileShare.cs index 812a001..a96ae5c 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/FileShare.cs +++ b/src/coreclr/src/mscorlib/shared/System/IO/FileShare.cs @@ -2,20 +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. -/*============================================================ -** -** Enum: FileShare -** -** -** -** -** Purpose: Enum describing how to share files with other -** processes - ie, whether two processes can simultaneously -** read from the same file. -** -** -===========================================================*/ - using System; namespace System.IO @@ -27,8 +13,10 @@ namespace System.IO // Note these values currently match the values for FILE_SHARE_READ, // FILE_SHARE_WRITE, and FILE_SHARE_DELETE in winnt.h // - [Serializable] [Flags] +#if PROJECTN + [Internal.Runtime.CompilerServices.RelocatedTypeAttribute("System.IO.FileSystem.Primitives")] +#endif public enum FileShare { // No sharing. Any request to open the file (by this process or another diff --git a/src/coreclr/src/mscorlib/src/System/IO/PathTooLongException.cs b/src/coreclr/src/mscorlib/shared/System/IO/PathTooLongException.cs similarity index 68% rename from src/coreclr/src/mscorlib/src/System/IO/PathTooLongException.cs rename to src/coreclr/src/mscorlib/shared/System/IO/PathTooLongException.cs index 156c836..613af05 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/PathTooLongException.cs +++ b/src/coreclr/src/mscorlib/shared/System/IO/PathTooLongException.cs @@ -2,17 +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. -/*============================================================ -** -** -** -** -** -** Purpose: Exception for paths and/or filenames that are -** too long. -** -** -===========================================================*/ using System; using System.Runtime.Serialization; @@ -28,19 +17,20 @@ namespace System.IO HResult = __HResults.COR_E_PATHTOOLONG; } - public PathTooLongException(String message) + public PathTooLongException(string message) : base(message) { HResult = __HResults.COR_E_PATHTOOLONG; } - public PathTooLongException(String message, Exception innerException) + public PathTooLongException(string message, Exception innerException) : base(message, innerException) { HResult = __HResults.COR_E_PATHTOOLONG; } - protected PathTooLongException(SerializationInfo info, StreamingContext context) : base(info, context) + protected PathTooLongException(SerializationInfo info, StreamingContext context) + : base(info, context) { } } diff --git a/src/coreclr/src/mscorlib/src/System/IO/SeekOrigin.cs b/src/coreclr/src/mscorlib/shared/System/IO/SeekOrigin.cs similarity index 64% rename from src/coreclr/src/mscorlib/src/System/IO/SeekOrigin.cs rename to src/coreclr/src/mscorlib/shared/System/IO/SeekOrigin.cs index efb319a..3798a0c 100644 --- a/src/coreclr/src/mscorlib/src/System/IO/SeekOrigin.cs +++ b/src/coreclr/src/mscorlib/shared/System/IO/SeekOrigin.cs @@ -2,26 +2,10 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -/*============================================================ -** -** Enum: SeekOrigin -** -** -** -** -** Purpose: Enum describing locations in a stream you could -** seek relative to. -** -** -===========================================================*/ - -using System; - namespace System.IO { // Provides seek reference points. To seek to the end of a stream, // call stream.Seek(0, SeekOrigin.End). - [Serializable] public enum SeekOrigin { // These constants match Win32's FILE_BEGIN, FILE_CURRENT, and FILE_END diff --git a/src/coreclr/src/mscorlib/src/System/MissingMethodException.cs b/src/coreclr/src/mscorlib/shared/System/MissingMethodException.cs similarity index 55% rename from src/coreclr/src/mscorlib/src/System/MissingMethodException.cs rename to src/coreclr/src/mscorlib/shared/System/MissingMethodException.cs index 580ec42..07d4289 100644 --- a/src/coreclr/src/mscorlib/src/System/MissingMethodException.cs +++ b/src/coreclr/src/mscorlib/shared/System/MissingMethodException.cs @@ -11,17 +11,12 @@ ** =============================================================================*/ - -using System; -using System.Runtime.Remoting; using System.Runtime.Serialization; -using System.Runtime.CompilerServices; -using System.Globalization; namespace System { [Serializable] - public class MissingMethodException : MissingMemberException, ISerializable + public class MissingMethodException : MissingMemberException { public MissingMethodException() : base(SR.Arg_MissingMethodException) @@ -29,46 +24,37 @@ namespace System HResult = __HResults.COR_E_MISSINGMETHOD; } - public MissingMethodException(String message) + public MissingMethodException(string message) : base(message) { HResult = __HResults.COR_E_MISSINGMETHOD; } - public MissingMethodException(String message, Exception inner) + public MissingMethodException(string message, Exception inner) : base(message, inner) { HResult = __HResults.COR_E_MISSINGMETHOD; } - protected MissingMethodException(SerializationInfo info, StreamingContext context) : base(info, context) + public MissingMethodException(string className, string methodName) { + ClassName = className; + MemberName = methodName; } - public override String Message + protected MissingMethodException(SerializationInfo info, StreamingContext context) + : base(info, context) { - get - { - if (ClassName == null) - { - return base.Message; - } - else - { - // do any desired fixups to classname here. - return SR.Format(SR.MissingMethod_Name, ClassName + "." + MemberName + (Signature != null ? " " + FormatSignature(Signature) : "")); - } - } } - public MissingMethodException(String className, String methodName) + public override string Message { - ClassName = className; - MemberName = methodName; + get + { + return ClassName == null ? base.Message : + SR.Format(SR.MissingMethod_Name, ClassName + "." + MemberName + + (Signature != null ? " " + FormatSignature(Signature) : string.Empty)); + } } - - // If ClassName != null, Message will construct on the fly using it - // and the other variables. This allows customization of the - // format depending on the language environment. } } diff --git a/src/coreclr/src/mscorlib/src/System/ParamsArray.cs b/src/coreclr/src/mscorlib/shared/System/ParamsArray.cs similarity index 57% rename from src/coreclr/src/mscorlib/src/System/ParamsArray.cs rename to src/coreclr/src/mscorlib/shared/System/ParamsArray.cs index ee28b91..1c73bc5 100644 --- a/src/coreclr/src/mscorlib/src/System/ParamsArray.cs +++ b/src/coreclr/src/mscorlib/shared/System/ParamsArray.cs @@ -9,74 +9,74 @@ namespace System // Sentinel fixed-length arrays eliminate the need for a "count" field keeping this // struct down to just 4 fields. These are only used for their "Length" property, // that is, their elements are never set or referenced. - private static readonly object[] oneArgArray = new object[1]; - private static readonly object[] twoArgArray = new object[2]; - private static readonly object[] threeArgArray = new object[3]; + private static readonly object[] s_oneArgArray = new object[1]; + private static readonly object[] s_twoArgArray = new object[2]; + private static readonly object[] s_threeArgArray = new object[3]; - private readonly object arg0; - private readonly object arg1; - private readonly object arg2; + private readonly object _arg0; + private readonly object _arg1; + private readonly object _arg2; // After construction, the first three elements of this array will never be accessed // because the indexer will retrieve those values from arg0, arg1, and arg2. - private readonly object[] args; + private readonly object[] _args; public ParamsArray(object arg0) { - this.arg0 = arg0; - arg1 = null; - arg2 = null; + _arg0 = arg0; + _arg1 = null; + _arg2 = null; // Always assign this.args to make use of its "Length" property - args = oneArgArray; + _args = s_oneArgArray; } public ParamsArray(object arg0, object arg1) { - this.arg0 = arg0; - this.arg1 = arg1; - arg2 = null; + _arg0 = arg0; + _arg1 = arg1; + _arg2 = null; // Always assign this.args to make use of its "Length" property - args = twoArgArray; + _args = s_twoArgArray; } public ParamsArray(object arg0, object arg1, object arg2) { - this.arg0 = arg0; - this.arg1 = arg1; - this.arg2 = arg2; + _arg0 = arg0; + _arg1 = arg1; + _arg2 = arg2; // Always assign this.args to make use of its "Length" property - args = threeArgArray; + _args = s_threeArgArray; } public ParamsArray(object[] args) { int len = args.Length; - arg0 = len > 0 ? args[0] : null; - arg1 = len > 1 ? args[1] : null; - arg2 = len > 2 ? args[2] : null; - this.args = args; + _arg0 = len > 0 ? args[0] : null; + _arg1 = len > 1 ? args[1] : null; + _arg2 = len > 2 ? args[2] : null; + _args = args; } public int Length { - get { return args.Length; } + get { return _args.Length; } } public object this[int index] { - get { return index == 0 ? arg0 : GetAtSlow(index); } + get { return index == 0 ? _arg0 : GetAtSlow(index); } } private object GetAtSlow(int index) { if (index == 1) - return arg1; + return _arg1; if (index == 2) - return arg2; - return args[index]; + return _arg2; + return _args[index]; } } } diff --git a/src/coreclr/src/mscorlib/src/System/Progress.cs b/src/coreclr/src/mscorlib/shared/System/Progress.cs similarity index 98% rename from src/coreclr/src/mscorlib/src/System/Progress.cs rename to src/coreclr/src/mscorlib/shared/System/Progress.cs index 755e771..48a6a35 100644 --- a/src/coreclr/src/mscorlib/src/System/Progress.cs +++ b/src/coreclr/src/mscorlib/shared/System/Progress.cs @@ -19,6 +19,9 @@ namespace System /// when the instance is constructed. If there is no current SynchronizationContext /// at the time of construction, the callbacks will be invoked on the ThreadPool. /// +#if PROJECTN + [Internal.Runtime.CompilerServices.RelocatedType("System.Runtime.Extensions")] +#endif public class Progress : IProgress { /// The synchronization context captured upon construction. This will never be null. diff --git a/src/coreclr/src/mscorlib/src/System/Random.cs b/src/coreclr/src/mscorlib/shared/System/Random.cs similarity index 91% rename from src/coreclr/src/mscorlib/src/System/Random.cs rename to src/coreclr/src/mscorlib/shared/System/Random.cs index a81a4f4..a66a9ea 100644 --- a/src/coreclr/src/mscorlib/src/System/Random.cs +++ b/src/coreclr/src/mscorlib/shared/System/Random.cs @@ -5,7 +5,6 @@ /*============================================================ ** ** -** ** Purpose: A random number generator. ** ** @@ -33,9 +32,9 @@ namespace System // // Member Variables // - private int inext; - private int inextp; - private int[] SeedArray = new int[56]; + private int _inext; + private int _inextp; + private int[] _seedArray = new int[56]; // // Public Constants @@ -68,15 +67,15 @@ namespace System //Initialize our Seed array. int subtraction = (Seed == Int32.MinValue) ? Int32.MaxValue : Math.Abs(Seed); mj = MSEED - subtraction; - SeedArray[55] = mj; + _seedArray[55] = mj; mk = 1; for (int i = 1; i < 55; i++) { //Apparently the range [1..55] is special (Knuth) and so we're wasting the 0'th position. if ((ii += 21) >= 55) ii -= 55; - SeedArray[ii] = mk; + _seedArray[ii] = mk; mk = mj - mk; if (mk < 0) mk += MBIG; - mj = SeedArray[ii]; + mj = _seedArray[ii]; } for (int k = 1; k < 5; k++) { @@ -84,12 +83,12 @@ namespace System { int n = i + 30; if (n >= 55) n -= 55; - SeedArray[i] -= SeedArray[1 + n]; - if (SeedArray[i] < 0) SeedArray[i] += MBIG; + _seedArray[i] -= _seedArray[1 + n]; + if (_seedArray[i] < 0) _seedArray[i] += MBIG; } } - inext = 0; - inextp = 21; + _inext = 0; + _inextp = 21; Seed = 1; } @@ -113,26 +112,25 @@ namespace System private int InternalSample() { int retVal; - int locINext = inext; - int locINextp = inextp; + int locINext = _inext; + int locINextp = _inextp; if (++locINext >= 56) locINext = 1; if (++locINextp >= 56) locINextp = 1; - retVal = SeedArray[locINext] - SeedArray[locINextp]; + retVal = _seedArray[locINext] - _seedArray[locINextp]; if (retVal == MBIG) retVal--; if (retVal < 0) retVal += MBIG; - SeedArray[locINext] = retVal; + _seedArray[locINext] = retVal; - inext = locINext; - inextp = locINextp; + _inext = locINext; + _inextp = locINextp; return retVal; } - [ThreadStatic] private static Random t_threadRandom; private static readonly Random s_globalRandom = new Random(GenerateGlobalSeed()); @@ -161,9 +159,11 @@ namespace System **Action: Creates a number to use as global seed. **Returns: An integer that is safe to use as seed values for thread-local seed generators. ==========================================================================================*/ - private static int GenerateGlobalSeed() + private static unsafe int GenerateGlobalSeed() { - return Guid.NewGuid().GetHashCode(); + int result; + Interop.GetRandomBytes((byte*)&result, sizeof(int)); + return result; } // @@ -258,7 +258,7 @@ namespace System /*==================================NextBytes=================================== **Action: Fills the byte array with random bytes [0..0x7f]. The entire array is filled. **Returns:Void - **Arugments: buffer -- the array to be filled. + **Arguments: buffer -- the array to be filled. **Exceptions: None ==============================================================================*/ public virtual void NextBytes(byte[] buffer) diff --git a/src/coreclr/src/mscorlib/src/System/Resources/IResourceReader.cs b/src/coreclr/src/mscorlib/shared/System/Resources/IResourceReader.cs similarity index 97% rename from src/coreclr/src/mscorlib/src/System/Resources/IResourceReader.cs rename to src/coreclr/src/mscorlib/shared/System/Resources/IResourceReader.cs index f18e5ba..543a5a6 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/IResourceReader.cs +++ b/src/coreclr/src/mscorlib/shared/System/Resources/IResourceReader.cs @@ -14,7 +14,6 @@ ===========================================================*/ using System; -using System.IO; using System.Collections; namespace System.Resources @@ -26,7 +25,6 @@ namespace System.Resources // This could close a network connection, a file, or do nothing. void Close(); - new IDictionaryEnumerator GetEnumerator(); } } diff --git a/src/coreclr/src/mscorlib/src/System/Resources/MissingManifestResourceException.cs b/src/coreclr/src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs similarity index 70% rename from src/coreclr/src/mscorlib/src/System/Resources/MissingManifestResourceException.cs rename to src/coreclr/src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs index c2a55cd..5ab2e13 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/MissingManifestResourceException.cs +++ b/src/coreclr/src/mscorlib/shared/System/Resources/MissingManifestResourceException.cs @@ -2,22 +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. -/*============================================================ -** -** -** -** -** -** Purpose: Exception for a missing assembly-level resource -** -** -===========================================================*/ - using System; using System.Runtime.Serialization; namespace System.Resources { +#if PROJECTN + [Internal.Runtime.CompilerServices.RelocatedType("System.Resources.ResourceManager")] +#endif [Serializable] public class MissingManifestResourceException : SystemException { @@ -27,19 +19,20 @@ namespace System.Resources HResult = System.__HResults.COR_E_MISSINGMANIFESTRESOURCE; } - public MissingManifestResourceException(String message) + public MissingManifestResourceException(string message) : base(message) { HResult = System.__HResults.COR_E_MISSINGMANIFESTRESOURCE; } - public MissingManifestResourceException(String message, Exception inner) + public MissingManifestResourceException(string message, Exception inner) : base(message, inner) { HResult = System.__HResults.COR_E_MISSINGMANIFESTRESOURCE; } - protected MissingManifestResourceException(SerializationInfo info, StreamingContext context) : base(info, context) + protected MissingManifestResourceException(SerializationInfo info, StreamingContext context) + : base(info, context) { } } diff --git a/src/coreclr/src/mscorlib/src/System/Resources/MissingSatelliteAssemblyException.cs b/src/coreclr/src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs similarity index 85% rename from src/coreclr/src/mscorlib/src/System/Resources/MissingSatelliteAssemblyException.cs rename to src/coreclr/src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs index df94f9e..b343e0c 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/MissingSatelliteAssemblyException.cs +++ b/src/coreclr/src/mscorlib/shared/System/Resources/MissingSatelliteAssemblyException.cs @@ -31,26 +31,27 @@ namespace System.Resources HResult = System.__HResults.COR_E_MISSINGSATELLITEASSEMBLY; } - public MissingSatelliteAssemblyException(String message) + public MissingSatelliteAssemblyException(string message) : base(message) { HResult = System.__HResults.COR_E_MISSINGSATELLITEASSEMBLY; } - public MissingSatelliteAssemblyException(String message, String cultureName) + public MissingSatelliteAssemblyException(string message, String cultureName) : base(message) { HResult = System.__HResults.COR_E_MISSINGSATELLITEASSEMBLY; _cultureName = cultureName; } - public MissingSatelliteAssemblyException(String message, Exception inner) + public MissingSatelliteAssemblyException(string message, Exception inner) : base(message, inner) { HResult = System.__HResults.COR_E_MISSINGSATELLITEASSEMBLY; } - protected MissingSatelliteAssemblyException(SerializationInfo info, StreamingContext context) : base(info, context) + protected MissingSatelliteAssemblyException(SerializationInfo info, StreamingContext context) + : base(info, context) { } diff --git a/src/coreclr/src/mscorlib/shared/System/Resources/NeutralResourcesLanguageAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Resources/NeutralResourcesLanguageAttribute.cs new file mode 100644 index 0000000..3248b84 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/Resources/NeutralResourcesLanguageAttribute.cs @@ -0,0 +1,36 @@ +// 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.Resources +{ +#if PROJECTN + [Internal.Runtime.CompilerServices.RelocatedType("System.Resources.ResourceManager")] +#endif + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] + public sealed class NeutralResourcesLanguageAttribute : Attribute + { + public NeutralResourcesLanguageAttribute(string cultureName) + { + if (cultureName == null) + throw new ArgumentNullException(nameof(cultureName)); + + CultureName = cultureName; + Location = UltimateResourceFallbackLocation.MainAssembly; + } + + public NeutralResourcesLanguageAttribute(string cultureName, UltimateResourceFallbackLocation location) + { + if (cultureName == null) + throw new ArgumentNullException(nameof(cultureName)); + if (!Enum.IsDefined(typeof(UltimateResourceFallbackLocation), location)) + throw new ArgumentException(SR.Format(SR.Arg_InvalidNeutralResourcesLanguage_FallbackLoc, location)); + + CultureName = cultureName; + Location = location; + } + + public string CultureName { get; } + public UltimateResourceFallbackLocation Location { get; } + } +} diff --git a/src/coreclr/src/mscorlib/src/System/Resources/ResourceTypeCode.cs b/src/coreclr/src/mscorlib/shared/System/Resources/ResourceTypeCode.cs similarity index 98% rename from src/coreclr/src/mscorlib/src/System/Resources/ResourceTypeCode.cs rename to src/coreclr/src/mscorlib/shared/System/Resources/ResourceTypeCode.cs index f9a8461..b0ceb61 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/ResourceTypeCode.cs +++ b/src/coreclr/src/mscorlib/shared/System/Resources/ResourceTypeCode.cs @@ -24,7 +24,6 @@ namespace System.Resources Note this data must be included in any documentation describing the internals of .resources files. */ - [Serializable] internal enum ResourceTypeCode { // Primitives diff --git a/src/coreclr/src/mscorlib/src/System/Resources/SatelliteContractVersionAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Resources/SatelliteContractVersionAttribute.cs similarity index 77% rename from src/coreclr/src/mscorlib/src/System/Resources/SatelliteContractVersionAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Resources/SatelliteContractVersionAttribute.cs index 4f1885e..890bb7f 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/SatelliteContractVersionAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Resources/SatelliteContractVersionAttribute.cs @@ -14,27 +14,21 @@ ** ===========================================================*/ -using System; -using System.Diagnostics.Contracts; - namespace System.Resources { +#if PROJECTN + [Internal.Runtime.CompilerServices.RelocatedType("System.Resources.ResourceManager")] +#endif [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] public sealed class SatelliteContractVersionAttribute : Attribute { - private String _version; - public SatelliteContractVersionAttribute(String version) { if (version == null) throw new ArgumentNullException(nameof(version)); - Contract.EndContractBlock(); - _version = version; + Version = version; } - public String Version - { - get { return _version; } - } + public String Version { get; } } } diff --git a/src/coreclr/src/mscorlib/src/System/Resources/UltimateResourceFallbackLocation.cs b/src/coreclr/src/mscorlib/shared/System/Resources/UltimateResourceFallbackLocation.cs similarity index 95% rename from src/coreclr/src/mscorlib/src/System/Resources/UltimateResourceFallbackLocation.cs rename to src/coreclr/src/mscorlib/shared/System/Resources/UltimateResourceFallbackLocation.cs index 43f9b88..83640ec 100644 --- a/src/coreclr/src/mscorlib/src/System/Resources/UltimateResourceFallbackLocation.cs +++ b/src/coreclr/src/mscorlib/shared/System/Resources/UltimateResourceFallbackLocation.cs @@ -4,10 +4,8 @@ /*============================================================ ** -** -** ** -** +** ** ** Purpose: Tells the ResourceManager where to find the ** ultimate fallback resources for your assembly. @@ -19,7 +17,6 @@ using System; namespace System.Resources { - [Serializable] public enum UltimateResourceFallbackLocation { MainAssembly, diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs similarity index 53% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs index fa6003d..25efcaf 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs @@ -2,30 +2,16 @@ // 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.Field)] public sealed class AccessedThroughPropertyAttribute : Attribute { - private readonly string propertyName; - public AccessedThroughPropertyAttribute(string propertyName) { - this.propertyName = propertyName; + PropertyName = propertyName; } - public string PropertyName - { - get - { - return propertyName; - } - } + public string PropertyName { get; } } } - diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs similarity index 79% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs index f1fc9ce..198ed3d 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs @@ -2,12 +2,10 @@ // 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.Method, Inherited = false, AllowMultiple = false)] + [Serializable] + [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] public sealed class AsyncStateMachineAttribute : StateMachineAttribute { public AsyncStateMachineAttribute(Type stateMachineType) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CallerFilePathAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CallerFilePathAttribute.cs similarity index 96% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CallerFilePathAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CallerFilePathAttribute.cs index 330934c..5858634 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CallerFilePathAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CallerFilePathAttribute.cs @@ -2,9 +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. - -using System; - namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs similarity index 96% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs index 9c87e8e..5bd2fcb 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs @@ -2,9 +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. - -using System; - namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs similarity index 96% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs index 4fc7090..8b04633 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs @@ -2,9 +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. - -using System; - namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs similarity index 73% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs index 31e9ade..3da2a95 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs @@ -2,9 +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. -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// - namespace System.Runtime.CompilerServices { [Serializable] @@ -14,4 +11,3 @@ namespace System.Runtime.CompilerServices public CompilerGeneratedAttribute() { } } } - diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs similarity index 72% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs index 9427e3d..4fc00e1 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs @@ -2,11 +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. -//------------------------------------------------------------------------------ -//------------------------------------------------------------------------------ - -using System; - namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false, Inherited = false)] diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/FixedBufferAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/FixedBufferAttribute.cs similarity index 69% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/FixedBufferAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/FixedBufferAttribute.cs index e4008b8..bb8f00f 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/FixedBufferAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/FixedBufferAttribute.cs @@ -20,29 +20,13 @@ namespace System.Runtime.CompilerServices [AttributeUsage(AttributeTargets.Field, Inherited = false)] public sealed class FixedBufferAttribute : Attribute { - private Type elementType; - private int length; - public FixedBufferAttribute(Type elementType, int length) { - this.elementType = elementType; - this.length = length; - } - - public Type ElementType - { - get - { - return elementType; - } + ElementType = elementType; + Length = length; } - public int Length - { - get - { - return length; - } - } + public Type ElementType { get; } + public int Length { get; } } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/IAsyncStateMachine.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/IAsyncStateMachine.cs similarity index 100% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/IAsyncStateMachine.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/IAsyncStateMachine.cs diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/INotifyCompletion.cs similarity index 100% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/INotifyCompletion.cs diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/IndexerNameAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/IndexerNameAttribute.cs similarity index 94% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/IndexerNameAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/IndexerNameAttribute.cs index cc8cb59..65653a4 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/IndexerNameAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/IndexerNameAttribute.cs @@ -2,8 +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. -using System; - namespace System.Runtime.CompilerServices { [Serializable] @@ -11,6 +9,7 @@ namespace System.Runtime.CompilerServices public sealed class IndexerNameAttribute : Attribute { public IndexerNameAttribute(String indexerName) - { } + { + } } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs similarity index 79% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs index 4bb9b4e..5ac3918 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs @@ -2,12 +2,10 @@ // 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.Method, Inherited = false, AllowMultiple = false)] + [Serializable] + [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] public sealed class IteratorStateMachineAttribute : StateMachineAttribute { public IteratorStateMachineAttribute(Type stateMachineType) diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs similarity index 80% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs index a007e38..6e307e7 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs @@ -13,28 +13,21 @@ ** ============================================================*/ -using System; - namespace System.Runtime.CompilerServices { [Serializable] [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] public sealed class ReferenceAssemblyAttribute : Attribute { - private String _description; // Maybe ".NET FX v4.0 SP1, partial trust"? - public ReferenceAssemblyAttribute() { } public ReferenceAssemblyAttribute(String description) { - _description = description; + Description = description; } - public String Description - { - get { return _description; } - } + public String Description { get; } } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs similarity index 63% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs index 42b2e51..55dba0d 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs @@ -2,8 +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. -//////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////// /*============================================================================= ** ** @@ -13,40 +11,21 @@ ** =============================================================================*/ - -using System; - namespace System.Runtime.CompilerServices { [Serializable] [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)] public sealed class RuntimeCompatibilityAttribute : Attribute { - // fields - private bool m_wrapNonExceptionThrows; - - // constructors public RuntimeCompatibilityAttribute() { - // legacy behavior is the default, and m_wrapNonExceptionThrows is implicitly + // legacy behavior is the default, and WrapNonExceptionThrows is implicitly // false thanks to the CLR's guarantee of zeroed memory. } - // properties - // If a non-CLSCompliant exception (i.e. one that doesn't derive from System.Exception) is // thrown, should it be wrapped up in a System.Runtime.CompilerServices.RuntimeWrappedException // instance when presented to catch handlers? - public bool WrapNonExceptionThrows - { - get - { - return m_wrapNonExceptionThrows; - } - set - { - m_wrapNonExceptionThrows = value; - } - } + public bool WrapNonExceptionThrows { get; set; } } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/StateMachineAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/StateMachineAttribute.cs similarity index 65% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/StateMachineAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/StateMachineAttribute.cs index 7c84009..94ed5b5 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/StateMachineAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/StateMachineAttribute.cs @@ -2,19 +2,19 @@ // 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.Method, Inherited = false, AllowMultiple = false)] + [Serializable] + [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] public class StateMachineAttribute : Attribute { - public Type StateMachineType { get; private set; } - public StateMachineAttribute(Type stateMachineType) { - this.StateMachineType = stateMachineType; + StateMachineType = stateMachineType; } + + public Type StateMachineType { get; } } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs similarity index 54% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs index 47ce32f..c4a8558 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs @@ -2,35 +2,16 @@ // 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 { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false, AllowMultiple = false)] public sealed class TypeForwardedFromAttribute : Attribute { - private string assemblyFullName; - - private TypeForwardedFromAttribute() - { - // Disallow default constructor - } - - public TypeForwardedFromAttribute(string assemblyFullName) { - if (String.IsNullOrEmpty(assemblyFullName)) - { - throw new ArgumentNullException(nameof(assemblyFullName)); - } - this.assemblyFullName = assemblyFullName; + AssemblyFullName = assemblyFullName; } - public string AssemblyFullName - { - get - { - return assemblyFullName; - } - } + public string AssemblyFullName { get; } } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs similarity index 65% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs index dca96c5..85d5c03 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs @@ -2,32 +2,16 @@ // 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.Reflection; - namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)] public sealed class TypeForwardedToAttribute : Attribute { - private Type _destination; - public TypeForwardedToAttribute(Type destination) { - _destination = destination; + Destination = destination; } - public Type Destination - { - get - { - return _destination; - } - } + public Type Destination { get; } } } - - - - diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs similarity index 96% rename from src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs index df71e7e..162676e 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs @@ -2,8 +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. -using System; - namespace System.Runtime.CompilerServices { [Serializable] diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CallingConvention.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/CallingConvention.cs similarity index 68% rename from src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CallingConvention.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/CallingConvention.cs index a4c12c1..3b18fde 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CallingConvention.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/CallingConvention.cs @@ -2,15 +2,9 @@ // 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.InteropServices { - // Used for the CallingConvention named argument to the DllImport attribute - [Serializable] + // Used for the CallingConvention named argument to the DllImport and NativeCallable attribute public enum CallingConvention { Winapi = 1, diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CharSet.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/CharSet.cs similarity index 70% rename from src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CharSet.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/CharSet.cs index 426296c..d587ec0 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/CharSet.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/CharSet.cs @@ -2,25 +2,20 @@ // 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.InteropServices { - // Use this in P/Direct function prototypes to specify + // Use this in P/Invoke function prototypes to specify // which character set to use when marshalling Strings. // Using Ansi will marshal the strings as 1 byte char*'s. // Using Unicode will marshal the strings as 2 byte wchar*'s. // Generally you probably want to use Auto, which does the // right thing 99% of the time. - [Serializable] + public enum CharSet { None = 1, // User didn't specify how to marshal strings. Ansi = 2, // Strings should be marshalled as ANSI 1 byte chars. - Unicode = 3, // Strings should be marshalled as Unicode 2 byte chars. + Unicode = 3, // Strings should be marshalled as Unicode 2 byte chars. Auto = 4, // Marshal Strings in the right way for the target system. } } diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ExternalException.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/ExternalException.cs similarity index 73% rename from src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ExternalException.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/ExternalException.cs index bd6b2f8..d7bde79 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/ExternalException.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/ExternalException.cs @@ -12,7 +12,6 @@ ** =============================================================================*/ - using System; using System.Globalization; using System.Runtime.Serialization; @@ -31,25 +30,26 @@ namespace System.Runtime.InteropServices HResult = __HResults.E_FAIL; } - public ExternalException(String message) + public ExternalException(string message) : base(message) { HResult = __HResults.E_FAIL; } - public ExternalException(String message, Exception inner) + public ExternalException(string message, Exception inner) : base(message, inner) { HResult = __HResults.E_FAIL; } - public ExternalException(String message, int errorCode) + public ExternalException(string message, int errorCode) : base(message) { HResult = errorCode; } - protected ExternalException(SerializationInfo info, StreamingContext context) : base(info, context) + protected ExternalException(SerializationInfo info, StreamingContext context) + : base(info, context) { } @@ -61,26 +61,25 @@ namespace System.Runtime.InteropServices } } - public override String ToString() + public override string ToString() { - String message = Message; - String s; - String _className = GetType().ToString(); - s = _className + " (0x" + HResult.ToString("X8", CultureInfo.InvariantCulture) + ")"; + string message = Message; + string className = GetType().ToString(); + + string s = className + " (0x" + HResult.ToString("X8", CultureInfo.InvariantCulture) + ")"; if (!(String.IsNullOrEmpty(message))) { s = s + ": " + message; } - Exception _innerException = InnerException; + Exception innerException = InnerException; - if (_innerException != null) + if (innerException != null) { - s = s + " ---> " + _innerException.ToString(); + s = s + " ---> " + innerException.ToString(); } - if (StackTrace != null) s += Environment.NewLine + StackTrace; diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/LayoutKind.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/LayoutKind.cs similarity index 52% rename from src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/LayoutKind.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/LayoutKind.cs index 7a170d4..dbd7ec6 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/InteropServices/LayoutKind.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/InteropServices/LayoutKind.cs @@ -2,19 +2,13 @@ // 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.InteropServices { // Used in the StructLayoutAttribute class - [Serializable] public enum LayoutKind { - Sequential = 0, // 0x00000008, - Explicit = 2, // 0x00000010, - Auto = 3, // 0x00000000, + Sequential = 0, + Explicit = 2, + Auto = 3, } } diff --git a/src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/IFormatterConverter.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/IFormatterConverter.cs new file mode 100644 index 0000000..c173144 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/IFormatterConverter.cs @@ -0,0 +1,28 @@ +// 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.Serialization +{ + [CLSCompliant(false)] + public interface IFormatterConverter + { + object Convert(object value, Type type); + object Convert(object value, TypeCode typeCode); + bool ToBoolean(object value); + char ToChar(object value); + sbyte ToSByte(object value); + byte ToByte(object value); + short ToInt16(object value); + ushort ToUInt16(object value); + int ToInt32(object value); + uint ToUInt32(object value); + long ToInt64(object value); + ulong ToUInt64(object value); + float ToSingle(object value); + double ToDouble(object value); + decimal ToDecimal(object value); + DateTime ToDateTime(object value); + string ToString(object value); + } +} diff --git a/src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/IObjectReference.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/IObjectReference.cs new file mode 100644 index 0000000..d41bc50 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/IObjectReference.cs @@ -0,0 +1,11 @@ +// 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.Serialization +{ + public interface IObjectReference + { + object GetRealObject(StreamingContext context); + } +} diff --git a/src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/ISerializable.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/ISerializable.cs new file mode 100644 index 0000000..383b3f0 --- /dev/null +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/Serialization/ISerializable.cs @@ -0,0 +1,11 @@ +// 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.Serialization +{ + public interface ISerializable + { + void GetObjectData(SerializationInfo info, StreamingContext context); + } +} diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Versioning/TargetFrameworkAttribute.cs b/src/coreclr/src/mscorlib/shared/System/Runtime/Versioning/TargetFrameworkAttribute.cs similarity index 99% rename from src/coreclr/src/mscorlib/src/System/Runtime/Versioning/TargetFrameworkAttribute.cs rename to src/coreclr/src/mscorlib/shared/System/Runtime/Versioning/TargetFrameworkAttribute.cs index 59fc15a..54ccdf2 100644 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Versioning/TargetFrameworkAttribute.cs +++ b/src/coreclr/src/mscorlib/shared/System/Runtime/Versioning/TargetFrameworkAttribute.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. -// /*============================================================ ** ** diff --git a/src/coreclr/src/mscorlib/src/System/Security/SafeBSTRHandle.cs b/src/coreclr/src/mscorlib/shared/System/Security/SafeBSTRHandle.cs similarity index 100% rename from src/coreclr/src/mscorlib/src/System/Security/SafeBSTRHandle.cs rename to src/coreclr/src/mscorlib/shared/System/Security/SafeBSTRHandle.cs diff --git a/src/coreclr/src/mscorlib/src/System/Security/VerificationException.cs b/src/coreclr/src/mscorlib/shared/System/Security/VerificationException.cs similarity index 80% rename from src/coreclr/src/mscorlib/src/System/Security/VerificationException.cs rename to src/coreclr/src/mscorlib/shared/System/Security/VerificationException.cs index 0cea0ec..9641e1a 100644 --- a/src/coreclr/src/mscorlib/src/System/Security/VerificationException.cs +++ b/src/coreclr/src/mscorlib/shared/System/Security/VerificationException.cs @@ -2,10 +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. -// - -using System.Security; -using System; using System.Runtime.Serialization; namespace System.Security @@ -19,19 +15,20 @@ namespace System.Security HResult = __HResults.COR_E_VERIFICATION; } - public VerificationException(String message) + public VerificationException(string message) : base(message) { HResult = __HResults.COR_E_VERIFICATION; } - public VerificationException(String message, Exception innerException) + public VerificationException(string message, Exception innerException) : base(message, innerException) { HResult = __HResults.COR_E_VERIFICATION; } - protected VerificationException(SerializationInfo info, StreamingContext context) : base(info, context) + protected VerificationException(SerializationInfo info, StreamingContext context) + : base(info, context) { } } diff --git a/src/coreclr/src/mscorlib/src/System/ValueTuple.cs b/src/coreclr/src/mscorlib/shared/System/ValueTuple.cs similarity index 99% rename from src/coreclr/src/mscorlib/src/System/ValueTuple.cs rename to src/coreclr/src/mscorlib/shared/System/ValueTuple.cs index abe119a..e0cd02e 100644 --- a/src/coreclr/src/mscorlib/src/System/ValueTuple.cs +++ b/src/coreclr/src/mscorlib/shared/System/ValueTuple.cs @@ -535,7 +535,7 @@ namespace System /// /// The implementation is called only if other is not , /// and if it can be successfully cast (in C#) or converted (in Visual Basic) to a - /// whose components are of the same types as those of the current instance. The IStructuralEquatable.Equals(Object, IEqualityComparer) method + /// whose components are of the same types as those of the current instance. The IStructuralEquatable.Equals(Object, IEqualityComparer) method /// first passes the values of the objects to be compared to the /// implementation. If this method call returns , the method is /// called again and passed the values of the two instances. @@ -2117,12 +2117,12 @@ namespace System if (rest == null) { return ValueTuple.CombineHashCodes(Item1?.GetHashCode() ?? 0, - Item2?.GetHashCode() ?? 0, - Item3?.GetHashCode() ?? 0, - Item4?.GetHashCode() ?? 0, - Item5?.GetHashCode() ?? 0, - Item6?.GetHashCode() ?? 0, - Item7?.GetHashCode() ?? 0); + Item2?.GetHashCode() ?? 0, + Item3?.GetHashCode() ?? 0, + Item4?.GetHashCode() ?? 0, + Item5?.GetHashCode() ?? 0, + Item6?.GetHashCode() ?? 0, + Item7?.GetHashCode() ?? 0); } int size = rest.Length; diff --git a/src/coreclr/src/mscorlib/src/System/Version.cs b/src/coreclr/src/mscorlib/shared/System/Version.cs similarity index 97% rename from src/coreclr/src/mscorlib/src/System/Version.cs rename to src/coreclr/src/mscorlib/shared/System/Version.cs index 9c31786..54b2052 100644 --- a/src/coreclr/src/mscorlib/src/System/Version.cs +++ b/src/coreclr/src/mscorlib/shared/System/Version.cs @@ -2,23 +2,13 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -/*============================================================ -** -** -** -** Purpose: -** -** -===========================================================*/ +using System.Globalization; +using System.Diagnostics; +using System.Diagnostics.Contracts; +using System.Text; namespace System { - using System.Diagnostics; - using System.Diagnostics.Contracts; - using System.Text; - using CultureInfo = System.Globalization.CultureInfo; - using NumberStyles = System.Globalization.NumberStyles; - // A Version object contains four hierarchical numeric components: major, minor, // build and revision. Build and revision may be unspecified, which is represented // internally as a -1. By definition, an unspecified component matches anything @@ -112,6 +102,11 @@ namespace System _Revision = version._Revision; } + public object Clone() + { + return new Version(this); + } + // Properties for setting and getting version numbers public int Major { @@ -143,11 +138,6 @@ namespace System get { return (short)(_Revision & 0xFFFF); } } - public Object Clone() - { - return new Version(this); - } - public int CompareTo(Object version) { if (version == null) diff --git a/src/coreclr/src/mscorlib/src/System/Diagnostics/CodeAnalysis/SuppressMessageAttribute.cs b/src/coreclr/src/mscorlib/src/System/Diagnostics/CodeAnalysis/SuppressMessageAttribute.cs deleted file mode 100644 index 59125dd..0000000 --- a/src/coreclr/src/mscorlib/src/System/Diagnostics/CodeAnalysis/SuppressMessageAttribute.cs +++ /dev/null @@ -1,75 +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. - -/*============================================================ -** -** -** -** An attribute to suppress violation messages/warnings -** by static code analysis tools. -** -** -===========================================================*/ - -using System; - -namespace System.Diagnostics.CodeAnalysis -{ - [AttributeUsage( - AttributeTargets.All, - Inherited = false, - AllowMultiple = true - ) - ] - [Conditional("CODE_ANALYSIS")] - public sealed class SuppressMessageAttribute : Attribute - { - private string category; - private string justification; - private string checkId; - private string scope; - private string target; - private string messageId; - - public SuppressMessageAttribute(string category, string checkId) - { - this.category = category; - this.checkId = checkId; - } - - public string Category - { - get { return category; } - } - - public string CheckId - { - get { return checkId; } - } - - public string Scope - { - get { return scope; } - set { scope = value; } - } - - public string Target - { - get { return target; } - set { target = value; } - } - - public string MessageId - { - get { return messageId; } - set { messageId = value; } - } - - public string Justification - { - get { return justification; } - set { justification = value; } - } - } -} diff --git a/src/coreclr/src/mscorlib/src/System/ICloneable.cs b/src/coreclr/src/mscorlib/src/System/ICloneable.cs deleted file mode 100644 index d50ba3b..0000000 --- a/src/coreclr/src/mscorlib/src/System/ICloneable.cs +++ /dev/null @@ -1,30 +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. - -/*============================================================ -** -** -** This interface is implemented by classes that support cloning. -** -===========================================================*/ - -using System; - -namespace System -{ - // Defines an interface indicating that an object may be cloned. Only objects - // that implement ICloneable may be cloned. The interface defines a single - // method which is called to create a clone of the object. Object defines a method - // MemberwiseClone to support default clone operations. - // - public interface ICloneable - { - // Interface does not need to be marked with the serializable attribute - // Make a new object which is a copy of the object instanced. This object may be either - // deep copy or a shallow copy depending on the implementation of clone. The default - // Object support for clone does a shallow copy. - // - Object Clone(); - } -} diff --git a/src/coreclr/src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs b/src/coreclr/src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs deleted file mode 100644 index d124389..0000000 --- a/src/coreclr/src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs +++ /dev/null @@ -1,67 +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: Tells the ResourceManager what language your main -** assembly's resources are written in. The -** ResourceManager won't try loading a satellite -** assembly for that culture, which helps perf. -** -** -** NOTE: -** -** This custom attribute is no longer implemented in managed code. As part of a perf optimization, -** it is now read in Module::GetNeutralResourcesLanguage, accessed from ManifestBasedResourceGroveler -** through an internal runtime call. -===========================================================*/ - -using System; -using System.Diagnostics.Contracts; - -namespace System.Resources -{ - [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] - public sealed class NeutralResourcesLanguageAttribute : Attribute - { - private String _culture; - private UltimateResourceFallbackLocation _fallbackLoc; - - public NeutralResourcesLanguageAttribute(String cultureName) - { - if (cultureName == null) - throw new ArgumentNullException(nameof(cultureName)); - Contract.EndContractBlock(); - - _culture = cultureName; - _fallbackLoc = UltimateResourceFallbackLocation.MainAssembly; - } - - public NeutralResourcesLanguageAttribute(String cultureName, UltimateResourceFallbackLocation location) - { - if (cultureName == null) - throw new ArgumentNullException(nameof(cultureName)); - if (!Enum.IsDefined(typeof(UltimateResourceFallbackLocation), location)) - throw new ArgumentException(SR.Format(SR.Arg_InvalidNeutralResourcesLanguage_FallbackLoc, location)); - Contract.EndContractBlock(); - - _culture = cultureName; - _fallbackLoc = location; - } - - public String CultureName - { - get { return _culture; } - } - - public UltimateResourceFallbackLocation Location - { - get { return _fallbackLoc; } - } - } -} diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IFormatterConverter.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IFormatterConverter.cs deleted file mode 100644 index 1f6f682..0000000 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IFormatterConverter.cs +++ /dev/null @@ -1,42 +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: The interface provides the connection between an -** instance of SerializationInfo and the formatter-provided -** class which knows how to parse the data inside the -** SerializationInfo. -** -** -============================================================*/ - -using System; - -namespace System.Runtime.Serialization -{ - [CLSCompliant(false)] - public interface IFormatterConverter - { - Object Convert(Object value, Type type); - Object Convert(Object value, TypeCode typeCode); - bool ToBoolean(Object value); - char ToChar(Object value); - sbyte ToSByte(Object value); - byte ToByte(Object value); - short ToInt16(Object value); - ushort ToUInt16(Object value); - int ToInt32(Object value); - uint ToUInt32(Object value); - long ToInt64(Object value); - ulong ToUInt64(Object value); - float ToSingle(Object value); - double ToDouble(Object value); - Decimal ToDecimal(Object value); - DateTime ToDateTime(Object value); - String ToString(Object value); - } -} diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IObjectReference.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IObjectReference.cs deleted file mode 100644 index b07f26f..0000000 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/IObjectReference.cs +++ /dev/null @@ -1,30 +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. - -/*============================================================ -** -** Interface: IObjectReference -** -** -** Purpose: Implemented by objects that are actually references -** to a different object which can't be discovered until -** this one is completely restored. During the fixup stage, -** any object implementing IObjectReference is asked for it's -** "real" object and that object is inserted into the graph. -** -** -===========================================================*/ - -using System; - -namespace System.Runtime.Serialization -{ - // Interface does not need to be marked with the serializable attribute - public interface IObjectReference - { - Object GetRealObject(StreamingContext context); - } -} - - diff --git a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializable.cs b/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializable.cs deleted file mode 100644 index 4e5873b..0000000 --- a/src/coreclr/src/mscorlib/src/System/Runtime/Serialization/ISerializable.cs +++ /dev/null @@ -1,31 +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. - -/*============================================================ -** -** Interface: ISerializable -** -** -** Purpose: Implemented by any object that needs to control its -** own serialization. -** -** -===========================================================*/ - -using System.Runtime.Remoting; -using System.Runtime.Serialization; -using System; -using System.Reflection; - -namespace System.Runtime.Serialization -{ - public interface ISerializable - { - void GetObjectData(SerializationInfo info, StreamingContext context); - } -} - - - - -- 2.7.4