From cedd4090b9ed19383e1dd5c7ba54c22627e57e26 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Wed, 1 Feb 2017 20:53:08 -0800 Subject: [PATCH] Synchronize part of System/* with CoreRT (dotnet/coreclr#9259) Commit migrated from https://github.com/dotnet/coreclr/commit/4718b8638561f26a5dbc6d71eb6ee52612d9c83f --- src/coreclr/src/mscorlib/corefx/SR.cs | 190 +++++++++++++++++++++ .../src/System/AccessViolationException.cs | 39 ++--- src/coreclr/src/mscorlib/src/System/Action.cs | 6 +- .../mscorlib/src/System/ApplicationException.cs | 40 ++--- .../src/mscorlib/src/System/ArgumentException.cs | 105 ++++++------ .../mscorlib/src/System/ArgumentNullException.cs | 47 +++-- .../src/mscorlib/src/System/ArithmeticException.cs | 39 +++-- .../src/System/ArrayTypeMismatchException.cs | 41 +++-- .../src/mscorlib/src/System/AsyncCallback.cs | 6 +- .../src/mscorlib/src/System/AttributeTargets.cs | 48 +++--- .../mscorlib/src/System/CLSCompliantAttribute.cs | 22 +-- .../src/mscorlib/src/System/CharEnumerator.cs | 84 ++++----- .../mscorlib/src/System/DataMisalignedException.cs | 34 ++-- .../src/mscorlib/src/System/DateTimeKind.cs | 6 +- src/coreclr/src/mscorlib/src/System/DayOfWeek.cs | 7 +- .../mscorlib/src/System/DivideByZeroException.cs | 40 ++--- .../src/System/DuplicateWaitObjectException.cs | 58 ++++--- .../src/System/EntryPointNotFoundException.cs | 44 ++--- src/coreclr/src/mscorlib/src/System/EventArgs.cs | 15 +- .../src/mscorlib/src/System/EventHandler.cs | 7 +- .../src/System/ExecutionEngineException.cs | 39 +++-- .../mscorlib/src/System/FieldAccessException.cs | 40 ++--- .../src/mscorlib/src/System/FlagsAttribute.cs | 7 +- .../src/mscorlib/src/System/FormatException.cs | 40 ++--- .../src/mscorlib/src/System/FormattableString.cs | 2 +- .../src/mscorlib/src/System/IAsyncResult.cs | 18 +- src/coreclr/src/mscorlib/src/System/IComparable.cs | 8 +- .../src/mscorlib/src/System/IConvertible.cs | 10 +- .../src/mscorlib/src/System/ICustomFormatter.cs | 11 +- src/coreclr/src/mscorlib/src/System/IDisposable.cs | 8 +- src/coreclr/src/mscorlib/src/System/IEquatable.cs | 8 +- .../src/mscorlib/src/System/IFormatProvider.cs | 8 +- .../src/mscorlib/src/System/IFormattable.cs | 9 +- src/coreclr/src/mscorlib/src/System/IObservable.cs | 13 -- src/coreclr/src/mscorlib/src/System/IObserver.cs | 14 -- src/coreclr/src/mscorlib/src/System/IProgress.cs | 11 -- .../src/System/IndexOutOfRangeException.cs | 39 ++--- .../System/InsufficientExecutionStackException.cs | 45 ++--- .../mscorlib/src/System/InvalidCastException.cs | 49 +++--- .../src/System/InvalidOperationException.cs | 37 ++-- .../mscorlib/src/System/InvalidProgramException.cs | 38 ++--- .../src/System/InvalidTimeZoneException.cs | 28 +-- .../src/mscorlib/src/System/MarshalByRefObject.cs | 21 +-- .../mscorlib/src/System/MemberAccessException.cs | 40 ++--- .../mscorlib/src/System/MethodAccessException.cs | 40 ++--- .../src/mscorlib/src/System/MidpointRounding.cs | 9 +- .../src/System/MulticastNotSupportedException.cs | 40 ++--- .../src/System/NotFiniteNumberException.cs | 62 +++---- .../mscorlib/src/System/NotImplementedException.cs | 32 ++-- .../mscorlib/src/System/NotSupportedException.cs | 36 ++-- .../mscorlib/src/System/NullReferenceException.cs | 41 ++--- .../mscorlib/src/System/ObjectDisposedException.cs | 79 +++++---- .../src/mscorlib/src/System/ObsoleteAttribute.cs | 43 ++--- .../src/mscorlib/src/System/OverflowException.cs | 41 +++-- .../src/mscorlib/src/System/ParamArrayAttribute.cs | 13 +- .../src/System/PlatformNotSupportedException.cs | 35 ++-- src/coreclr/src/mscorlib/src/System/Progress.cs | 36 ++-- .../src/mscorlib/src/System/RankException.cs | 36 ++-- .../mscorlib/src/System/StackOverflowException.cs | 41 ++--- .../src/mscorlib/src/System/StringComparison.cs | 9 +- .../src/mscorlib/src/System/StringSplitOptions.cs | 5 +- .../src/mscorlib/src/System/SystemException.cs | 37 ++-- .../src/mscorlib/src/System/ThreadAttributes.cs | 12 +- .../mscorlib/src/System/ThreadStaticAttribute.cs | 12 +- .../src/System/TimeZoneNotFoundException.cs | 33 ++-- .../src/mscorlib/src/System/TimeoutException.cs | 44 +++-- .../src/mscorlib/src/System/TupleExtensions.cs | 1 - .../src/mscorlib/src/System/TypeAccessException.cs | 24 +-- src/coreclr/src/mscorlib/src/System/TypeCode.cs | 10 +- .../src/System/TypeInitializationException.cs | 58 ++++--- .../src/System/UnauthorizedAccessException.cs | 36 ++-- .../src/System/UnhandledExceptionEventArgs.cs | 36 ++-- .../src/System/UnhandledExceptionEventHandler.cs | 6 +- src/coreclr/src/mscorlib/src/System/Void.cs | 9 +- 74 files changed, 1230 insertions(+), 1107 deletions(-) diff --git a/src/coreclr/src/mscorlib/corefx/SR.cs b/src/coreclr/src/mscorlib/corefx/SR.cs index 91cc0c6..686de82 100644 --- a/src/coreclr/src/mscorlib/corefx/SR.cs +++ b/src/coreclr/src/mscorlib/corefx/SR.cs @@ -625,4 +625,194 @@ internal static class SR { get { return Environment.GetResourceString("ObjectDisposed_StreamIsClosed"); } } + + internal static string Arg_SystemException + { + get { return Environment.GetResourceString("Arg_SystemException"); } + } + + internal static string Arg_StackOverflowException + { + get { return Environment.GetResourceString("Arg_StackOverflowException"); } + } + + internal static string Arg_DataMisalignedException + { + get { return Environment.GetResourceString("Arg_DataMisalignedException"); } + } + + internal static string Arg_ExecutionEngineException + { + get { return Environment.GetResourceString("Arg_ExecutionEngineException"); } + } + + internal static string Arg_AccessException + { + get { return Environment.GetResourceString("Arg_AccessException"); } + } + + internal static string Arg_AccessViolationException + { + get { return Environment.GetResourceString("Arg_AccessViolationException"); } + } + + internal static string Arg_ApplicationException + { + get { return Environment.GetResourceString("Arg_ApplicationException"); } + } + + internal static string Arg_ArgumentException + { + get { return Environment.GetResourceString("Arg_ArgumentException"); } + } + + internal static string Arg_ParamName_Name + { + get { return Environment.GetResourceString("Arg_ParamName_Name"); } + } + + internal static string ArgumentNull_Generic + { + get { return Environment.GetResourceString("ArgumentNull_Generic"); } + } + + internal static string Arg_ArithmeticException + { + get { return Environment.GetResourceString("Arg_ArithmeticException"); } + } + + internal static string Arg_ArrayTypeMismatchException + { + get { return Environment.GetResourceString("Arg_ArrayTypeMismatchException"); } + } + + internal static string Arg_DivideByZero + { + get { return Environment.GetResourceString("Arg_DivideByZero"); } + } + + internal static string Arg_DuplicateWaitObjectException + { + get { return Environment.GetResourceString("Arg_DuplicateWaitObjectException"); } + } + + internal static string Arg_EntryPointNotFoundException + { + get { return Environment.GetResourceString("Arg_EntryPointNotFoundException"); } + } + + internal static string Arg_FieldAccessException + { + get { return Environment.GetResourceString("Arg_FieldAccessException"); } + } + + internal static string Arg_FormatException + { + get { return Environment.GetResourceString("Arg_FormatException"); } + } + + internal static string Arg_IndexOutOfRangeException + { + get { return Environment.GetResourceString("Arg_IndexOutOfRangeException"); } + } + + internal static string Arg_InsufficientExecutionStackException + { + get { return Environment.GetResourceString("Arg_InsufficientExecutionStackException"); } + } + + internal static string Arg_InvalidCastException + { + get { return Environment.GetResourceString("Arg_InvalidCastException"); } + } + + internal static string Arg_InvalidOperationException + { + get { return Environment.GetResourceString("Arg_InvalidOperationException"); } + } + + internal static string InvalidProgram_Default + { + get { return Environment.GetResourceString("InvalidProgram_Default"); } + } + + internal static string Arg_MethodAccessException + { + get { return Environment.GetResourceString("Arg_MethodAccessException"); } + } + + internal static string Arg_MulticastNotSupportedException + { + get { return Environment.GetResourceString("Arg_MulticastNotSupportedException"); } + } + + internal static string Arg_NotFiniteNumberException + { + get { return Environment.GetResourceString("Arg_NotFiniteNumberException"); } + } + + internal static string Arg_NotImplementedException + { + get { return Environment.GetResourceString("Arg_NotImplementedException"); } + } + + internal static string Arg_NotSupportedException + { + get { return Environment.GetResourceString("Arg_NotSupportedException"); } + } + + internal static string Arg_NullReferenceException + { + get { return Environment.GetResourceString("Arg_NullReferenceException"); } + } + + internal static string ObjectDisposed_Generic + { + get { return Environment.GetResourceString("ObjectDisposed_Generic"); } + } + + internal static string ObjectDisposed_ObjectName_Name + { + get { return Environment.GetResourceString("ObjectDisposed_ObjectName_Name"); } + } + + internal static string Arg_OverflowException + { + get { return Environment.GetResourceString("Arg_OverflowException"); } + } + + internal static string Arg_PlatformNotSupported + { + get { return Environment.GetResourceString("Arg_PlatformNotSupported"); } + } + + internal static string Arg_RankException + { + get { return Environment.GetResourceString("Arg_RankException"); } + } + + internal static string Arg_TimeoutException + { + get { return Environment.GetResourceString("Arg_TimeoutException"); } + } + + internal static string Arg_TypeAccessException + { + get { return Environment.GetResourceString("Arg_TypeAccessException"); } + } + + internal static string TypeInitialization_Default + { + get { return Environment.GetResourceString("TypeInitialization_Default"); } + } + + internal static string TypeInitialization_Type + { + get { return Environment.GetResourceString("TypeInitialization_Type"); } + } + + internal static string Arg_UnauthorizedAccessException + { + get { return Environment.GetResourceString("Arg_UnauthorizedAccessException"); } + } } diff --git a/src/coreclr/src/mscorlib/src/System/AccessViolationException.cs b/src/coreclr/src/mscorlib/src/System/AccessViolationException.cs index 308d52e..12911c1 100644 --- a/src/coreclr/src/mscorlib/src/System/AccessViolationException.cs +++ b/src/coreclr/src/mscorlib/src/System/AccessViolationException.cs @@ -11,41 +11,38 @@ ** =============================================================================*/ -namespace System -{ - - using System; - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System; +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public class AccessViolationException : SystemException + public class AccessViolationException : SystemException { - public AccessViolationException() - : base(Environment.GetResourceString("Arg_AccessViolationException")) + public AccessViolationException() + : base(SR.Arg_AccessViolationException) { - SetErrorCode(__HResults.E_POINTER); + HResult = __HResults.E_POINTER; } - - public AccessViolationException(String message) - : base(message) + + public AccessViolationException(String message) + : base(message) { - SetErrorCode(__HResults.E_POINTER); + HResult = __HResults.E_POINTER; } - - public AccessViolationException(String message, Exception innerException) - : base(message, innerException) + + public AccessViolationException(String message, Exception innerException) + : base(message, innerException) { - SetErrorCode(__HResults.E_POINTER); + HResult = __HResults.E_POINTER; } - protected AccessViolationException(SerializationInfo info, StreamingContext context) : base(info, context) {} + protected AccessViolationException(SerializationInfo info, StreamingContext context) : base(info, context) { } #pragma warning disable 169 // Field is not used from managed. private IntPtr _ip; // Address of faulting instruction. private IntPtr _target; // Address that could not be accessed. private int _accessType; // 0:read, 1:write #pragma warning restore 169 - } - } diff --git a/src/coreclr/src/mscorlib/src/System/Action.cs b/src/coreclr/src/mscorlib/src/System/Action.cs index 27f7faf..23c7e93 100644 --- a/src/coreclr/src/mscorlib/src/System/Action.cs +++ b/src/coreclr/src/mscorlib/src/System/Action.cs @@ -6,8 +6,6 @@ namespace System { public delegate void Action(T obj); - // Action/Func delegates first shipped with .NET Framework 3.5 in System.Core.dll as part of LINQ - // These were type forwarded to mscorlib.dll in .NET Framework 4.0 and in Silverlight 5.0 public delegate void Action(); public delegate void Action(T1 arg1, T2 arg2); public delegate void Action(T1 arg1, T2 arg2, T3 arg3); @@ -32,8 +30,6 @@ namespace System public delegate int Comparison(T x, T y); public delegate TOutput Converter(TInput input); - - public delegate bool Predicate(T obj); + public delegate bool Predicate(T obj); } - diff --git a/src/coreclr/src/mscorlib/src/System/ApplicationException.cs b/src/coreclr/src/mscorlib/src/System/ApplicationException.cs index c56746f..900feb5 100644 --- a/src/coreclr/src/mscorlib/src/System/ApplicationException.cs +++ b/src/coreclr/src/mscorlib/src/System/ApplicationException.cs @@ -12,9 +12,10 @@ ** =============================================================================*/ -namespace System { - - using System.Runtime.Serialization; +using System.Runtime.Serialization; + +namespace System +{ // The ApplicationException is the base class for nonfatal, // application errors that occur. These exceptions are generated // (i.e., thrown) by an application, not the Runtime. Applications that need @@ -22,35 +23,34 @@ namespace System { // ApplicationException extends but adds no new functionality to // RecoverableException. // - [System.Runtime.InteropServices.ComVisible(true)] [Serializable] - public class ApplicationException : Exception { - + public class ApplicationException : Exception + { // Creates a new ApplicationException with its message string set to // the empty string, its HRESULT set to COR_E_APPLICATION, // and its ExceptionInfo reference set to null. - public ApplicationException() - : base(Environment.GetResourceString("Arg_ApplicationException")) { - SetErrorCode(__HResults.COR_E_APPLICATION); + public ApplicationException() + : base(SR.Arg_ApplicationException) + { + HResult = __HResults.COR_E_APPLICATION; } - + // Creates a new ApplicationException with its message string set to // message, its HRESULT set to COR_E_APPLICATION, // and its ExceptionInfo reference set to null. // - public ApplicationException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_APPLICATION); - } - - public ApplicationException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_APPLICATION); + public ApplicationException(String message) + : base(message) + { + HResult = __HResults.COR_E_APPLICATION; } - protected ApplicationException(SerializationInfo info, StreamingContext context) : base(info, context) { + public ApplicationException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_APPLICATION; } + protected ApplicationException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - } diff --git a/src/coreclr/src/mscorlib/src/System/ArgumentException.cs b/src/coreclr/src/mscorlib/src/System/ArgumentException.cs index f37b769..fe054a9 100644 --- a/src/coreclr/src/mscorlib/src/System/ArgumentException.cs +++ b/src/coreclr/src/mscorlib/src/System/ArgumentException.cs @@ -11,84 +11,87 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Remoting; - using System.Runtime.Serialization; - using System.Globalization; - using System.Security.Permissions; - using System.Diagnostics.Contracts; +using System.Globalization; +using System.Runtime.Serialization; + +namespace System +{ // The ArgumentException is thrown when an argument does not meet // the contract of the method. Ideally it should give a meaningful error // message describing what was wrong and which parameter is incorrect. // - [System.Runtime.InteropServices.ComVisible(true)] [Serializable] - public class ArgumentException : SystemException, ISerializable { - private String m_paramName; - + public class ArgumentException : SystemException, ISerializable + { + private String _paramName; + // Creates a new ArgumentException with its message // string set to the empty string. - public ArgumentException() - : base(Environment.GetResourceString("Arg_ArgumentException")) { - SetErrorCode(__HResults.COR_E_ARGUMENT); + public ArgumentException() + : base(SR.Arg_ArgumentException) + { + HResult = __HResults.COR_E_ARGUMENT; } - + // Creates a new ArgumentException with its message // string set to message. // - public ArgumentException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_ARGUMENT); + public ArgumentException(String message) + : base(message) + { + HResult = __HResults.COR_E_ARGUMENT; } - - public ArgumentException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_ARGUMENT); + + public ArgumentException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_ARGUMENT; } - public ArgumentException(String message, String paramName, Exception innerException) - : base(message, innerException) { - m_paramName = paramName; - SetErrorCode(__HResults.COR_E_ARGUMENT); + public ArgumentException(String message, String paramName, Exception innerException) + : base(message, innerException) + { + _paramName = paramName; + HResult = __HResults.COR_E_ARGUMENT; } - - public ArgumentException (String message, String paramName) - - : base (message) { - m_paramName = paramName; - SetErrorCode(__HResults.COR_E_ARGUMENT); + + public ArgumentException(String message, String paramName) + : base(message) + { + _paramName = paramName; + HResult = __HResults.COR_E_ARGUMENT; } - protected ArgumentException(SerializationInfo info, StreamingContext context) : base(info, context) { - m_paramName = info.GetString("ParamName"); + protected ArgumentException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + _paramName = info.GetString("ParamName"); } - + + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue("ParamName", _paramName, typeof(String)); + } + public override String Message { - get { + get + { String s = base.Message; - if (!String.IsNullOrEmpty(m_paramName)) { - String resourceString = Environment.GetResourceString("Arg_ParamName_Name", m_paramName); + if (!String.IsNullOrEmpty(_paramName)) + { + String resourceString = SR.Format(SR.Arg_ParamName_Name, _paramName); return s + Environment.NewLine + resourceString; } else return s; } } - - public virtual String ParamName { - get { return m_paramName; } - } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) { - if (info==null) { - throw new ArgumentNullException(nameof(info)); - } - Contract.EndContractBlock(); - base.GetObjectData(info, context); - info.AddValue("ParamName", m_paramName, typeof(String)); + + public virtual String ParamName + { + get { return _paramName; } } } } diff --git a/src/coreclr/src/mscorlib/src/System/ArgumentNullException.cs b/src/coreclr/src/mscorlib/src/System/ArgumentNullException.cs index 661ebd2..3a86223 100644 --- a/src/coreclr/src/mscorlib/src/System/ArgumentNullException.cs +++ b/src/coreclr/src/mscorlib/src/System/ArgumentNullException.cs @@ -11,44 +11,43 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; - using System.Runtime.Remoting; - using System.Security.Permissions; - +using System.Runtime.Serialization; + +namespace System +{ // The ArgumentException is thrown when an argument // is null when it shouldn't be. // - [System.Runtime.InteropServices.ComVisible(true)] [Serializable] public class ArgumentNullException : ArgumentException { // Creates a new ArgumentNullException with its message // string set to a default message explaining an argument was null. - public ArgumentNullException() - : base(Environment.GetResourceString("ArgumentNull_Generic")) { - // Use E_POINTER - COM used that for null pointers. Description is "invalid pointer" - SetErrorCode(__HResults.E_POINTER); + public ArgumentNullException() + : base(SR.ArgumentNull_Generic) + { + // Use E_POINTER - COM used that for null pointers. Description is "invalid pointer" + HResult = __HResults.E_POINTER; } - public ArgumentNullException(String paramName) - : base(Environment.GetResourceString("ArgumentNull_Generic"), paramName) { - SetErrorCode(__HResults.E_POINTER); + public ArgumentNullException(String paramName) + : base(SR.ArgumentNull_Generic, paramName) + { + HResult = __HResults.E_POINTER; } - public ArgumentNullException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.E_POINTER); - } - - public ArgumentNullException(String paramName, String message) - : base(message, paramName) { - SetErrorCode(__HResults.E_POINTER); + public ArgumentNullException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.E_POINTER; } - protected ArgumentNullException(SerializationInfo info, StreamingContext context) : base(info, context) { + public ArgumentNullException(String paramName, String message) + : base(message, paramName) + { + HResult = __HResults.E_POINTER; } + + protected ArgumentNullException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/ArithmeticException.cs b/src/coreclr/src/mscorlib/src/System/ArithmeticException.cs index f536093..081ba45 100644 --- a/src/coreclr/src/mscorlib/src/System/ArithmeticException.cs +++ b/src/coreclr/src/mscorlib/src/System/ArithmeticException.cs @@ -11,42 +11,41 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; +using System.Runtime.Serialization; + +namespace System +{ // The ArithmeticException is thrown when overflow or underflow // occurs. // - [System.Runtime.InteropServices.ComVisible(true)] [Serializable] public class ArithmeticException : SystemException - { + { // Creates a new ArithmeticException with its message string set to // the empty string, its HRESULT set to COR_E_ARITHMETIC, // and its ExceptionInfo reference set to null. - public ArithmeticException() - : base(Environment.GetResourceString("Arg_ArithmeticException")) { - SetErrorCode(__HResults.COR_E_ARITHMETIC); + public ArithmeticException() + : base(SR.Arg_ArithmeticException) + { + HResult = __HResults.COR_E_ARITHMETIC; } - + // Creates a new ArithmeticException with its message string set to // message, its HRESULT set to COR_E_ARITHMETIC, // and its ExceptionInfo reference set to null. // - public ArithmeticException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_ARITHMETIC); - } - - public ArithmeticException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_ARITHMETIC); + public ArithmeticException(String message) + : base(message) + { + HResult = __HResults.COR_E_ARITHMETIC; } - protected ArithmeticException(SerializationInfo info, StreamingContext context) : base(info, context) { + public ArithmeticException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_ARITHMETIC; } + protected ArithmeticException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - } diff --git a/src/coreclr/src/mscorlib/src/System/ArrayTypeMismatchException.cs b/src/coreclr/src/mscorlib/src/System/ArrayTypeMismatchException.cs index 4f24b9d..3e941fd 100644 --- a/src/coreclr/src/mscorlib/src/System/ArrayTypeMismatchException.cs +++ b/src/coreclr/src/mscorlib/src/System/ArrayTypeMismatchException.cs @@ -11,42 +11,41 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; +using System.Runtime.Serialization; + +namespace System +{ // The ArrayMismatchException is thrown when an attempt to store // an object of the wrong type within an array occurs. // - [System.Runtime.InteropServices.ComVisible(true)] [Serializable] - public class ArrayTypeMismatchException : SystemException { - + public class ArrayTypeMismatchException : SystemException + { // Creates a new ArrayMismatchException with its message string set to // the empty string, its HRESULT set to COR_E_ARRAYTYPEMISMATCH, // and its ExceptionInfo reference set to null. - public ArrayTypeMismatchException() - : base(Environment.GetResourceString("Arg_ArrayTypeMismatchException")) { - SetErrorCode(__HResults.COR_E_ARRAYTYPEMISMATCH); + public ArrayTypeMismatchException() + : base(SR.Arg_ArrayTypeMismatchException) + { + HResult = __HResults.COR_E_ARRAYTYPEMISMATCH; } - + // Creates a new ArrayMismatchException with its message string set to // message, its HRESULT set to COR_E_ARRAYTYPEMISMATCH, // and its ExceptionInfo reference set to null. // - public ArrayTypeMismatchException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_ARRAYTYPEMISMATCH); - } - - public ArrayTypeMismatchException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_ARRAYTYPEMISMATCH); + public ArrayTypeMismatchException(String message) + : base(message) + { + HResult = __HResults.COR_E_ARRAYTYPEMISMATCH; } - protected ArrayTypeMismatchException(SerializationInfo info, StreamingContext context) : base(info, context) { + public ArrayTypeMismatchException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_ARRAYTYPEMISMATCH; } + protected ArrayTypeMismatchException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - } diff --git a/src/coreclr/src/mscorlib/src/System/AsyncCallback.cs b/src/coreclr/src/mscorlib/src/System/AsyncCallback.cs index 69a0381..5c49535 100644 --- a/src/coreclr/src/mscorlib/src/System/AsyncCallback.cs +++ b/src/coreclr/src/mscorlib/src/System/AsyncCallback.cs @@ -9,9 +9,9 @@ ** Purpose: Type of callback for async operations ** ===========================================================*/ -namespace System { + +namespace System +{ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public delegate void AsyncCallback(IAsyncResult ar); - } diff --git a/src/coreclr/src/mscorlib/src/System/AttributeTargets.cs b/src/coreclr/src/mscorlib/src/System/AttributeTargets.cs index 33617e9..fdfa4ab 100644 --- a/src/coreclr/src/mscorlib/src/System/AttributeTargets.cs +++ b/src/coreclr/src/mscorlib/src/System/AttributeTargets.cs @@ -4,37 +4,33 @@ //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -namespace System { - - using System; - + +namespace System +{ // Enum used to indicate all the elements of the // VOS it is valid to attach this element to. -[Serializable] [Flags] -[System.Runtime.InteropServices.ComVisible(true)] + [Serializable] public enum AttributeTargets { - Assembly = 0x0001, - Module = 0x0002, - Class = 0x0004, - Struct = 0x0008, - Enum = 0x0010, - Constructor = 0x0020, - Method = 0x0040, - Property = 0x0080, - Field = 0x0100, - Event = 0x0200, - Interface = 0x0400, - Parameter = 0x0800, - Delegate = 0x1000, - ReturnValue = 0x2000, - //@todo GENERICS: document GenericParameter + Assembly = 0x0001, + Module = 0x0002, + Class = 0x0004, + Struct = 0x0008, + Enum = 0x0010, + Constructor = 0x0020, + Method = 0x0040, + Property = 0x0080, + Field = 0x0100, + Event = 0x0200, + Interface = 0x0400, + Parameter = 0x0800, + Delegate = 0x1000, + ReturnValue = 0x2000, GenericParameter = 0x4000, - - - All = Assembly | Module | Class | Struct | Enum | Constructor | - Method | Property | Field | Event | Interface | Parameter | - Delegate | ReturnValue | GenericParameter, + + All = Assembly | Module | Class | Struct | Enum | Constructor | + Method | Property | Field | Event | Interface | Parameter | + Delegate | ReturnValue | GenericParameter } } diff --git a/src/coreclr/src/mscorlib/src/System/CLSCompliantAttribute.cs b/src/coreclr/src/mscorlib/src/System/CLSCompliantAttribute.cs index e902049..e03600d 100644 --- a/src/coreclr/src/mscorlib/src/System/CLSCompliantAttribute.cs +++ b/src/coreclr/src/mscorlib/src/System/CLSCompliantAttribute.cs @@ -11,23 +11,23 @@ ** =============================================================================*/ -namespace System { -[Serializable] - [AttributeUsage (AttributeTargets.All, Inherited=true, AllowMultiple=false)] -[System.Runtime.InteropServices.ComVisible(true)] - public sealed class CLSCompliantAttribute : Attribute +namespace System +{ + [Serializable] + [AttributeUsage(AttributeTargets.All, Inherited = true, AllowMultiple = false)] + public sealed class CLSCompliantAttribute : Attribute { - private bool m_compliant; + private bool _compliant; - public CLSCompliantAttribute (bool isCompliant) + public CLSCompliantAttribute(bool isCompliant) { - m_compliant = isCompliant; + _compliant = isCompliant; } - public bool IsCompliant + public bool IsCompliant { - get + get { - return m_compliant; + return _compliant; } } } diff --git a/src/coreclr/src/mscorlib/src/System/CharEnumerator.cs b/src/coreclr/src/mscorlib/src/System/CharEnumerator.cs index d25294c..689ed7e 100644 --- a/src/coreclr/src/mscorlib/src/System/CharEnumerator.cs +++ b/src/coreclr/src/mscorlib/src/System/CharEnumerator.cs @@ -11,65 +11,71 @@ ** ** ============================================================*/ -namespace System { - using System.Collections; - using System.Collections.Generic; - using System.Diagnostics.Contracts; +using System.Collections; +using System.Collections.Generic; -[System.Runtime.InteropServices.ComVisible(true)] - [Serializable] - public sealed class CharEnumerator : IEnumerator, ICloneable, IEnumerator, IDisposable { - private String str; - private int index; - private char currentElement; +namespace System +{ + public sealed class CharEnumerator : IEnumerator, IEnumerator, IDisposable, ICloneable + { + private String _str; + private int _index; + private char _currentElement; - internal CharEnumerator(String str) { - Contract.Requires(str != null); - this.str = str; - this.index = -1; + internal CharEnumerator(String str) + { + _str = str; + _index = -1; } - public Object Clone() { + public object Clone() + { return MemberwiseClone(); } - - public bool MoveNext() { - if (index < (str.Length-1)) { - index++; - currentElement = str[index]; + + public bool MoveNext() + { + if (_index < (_str.Length - 1)) + { + _index++; + _currentElement = _str[_index]; return true; } else - index = str.Length; + _index = _str.Length; return false; - } - public void Dispose() { - if (str != null) - index = str.Length; - str = null; + public void Dispose() + { + if (_str != null) + _index = _str.Length; + _str = null; } - + /// - Object IEnumerator.Current { + Object IEnumerator.Current + { get { return Current; } } - - public char Current { - get { - if (index == -1) - throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumNotStarted)); - if (index >= str.Length) - throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumEnded)); - return currentElement; + + public char Current + { + get + { + if (_index == -1) + throw new InvalidOperationException(SR.InvalidOperation_EnumNotStarted); + if (_index >= _str.Length) + throw new InvalidOperationException(SR.InvalidOperation_EnumEnded); + return _currentElement; } } - public void Reset() { - currentElement = (char)0; - index = -1; + public void Reset() + { + _currentElement = (char)0; + _index = -1; } } } diff --git a/src/coreclr/src/mscorlib/src/System/DataMisalignedException.cs b/src/coreclr/src/mscorlib/src/System/DataMisalignedException.cs index e5332bb..a3653e7 100644 --- a/src/coreclr/src/mscorlib/src/System/DataMisalignedException.cs +++ b/src/coreclr/src/mscorlib/src/System/DataMisalignedException.cs @@ -9,37 +9,31 @@ ** =============================================================================*/ -namespace System -{ - using System; - using System.Runtime.Serialization; +using System.Runtime.Serialization; +namespace System +{ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public sealed class DataMisalignedException : SystemException { - public DataMisalignedException() - : base(Environment.GetResourceString("Arg_DataMisalignedException")) - { - SetErrorCode(__HResults.COR_E_DATAMISALIGNED); - } - - public DataMisalignedException(String message) - : base(message) + public DataMisalignedException() + : base(SR.Arg_DataMisalignedException) { - SetErrorCode(__HResults.COR_E_DATAMISALIGNED); + HResult = __HResults.COR_E_DATAMISALIGNED; } - public DataMisalignedException(String message, Exception innerException) - : base(message, innerException) + public DataMisalignedException(String message) + : base(message) { - SetErrorCode(__HResults.COR_E_DATAMISALIGNED); + HResult = __HResults.COR_E_DATAMISALIGNED; } - internal DataMisalignedException(SerializationInfo info, StreamingContext context) - : base (info, context) + public DataMisalignedException(String message, Exception innerException) + : base(message, innerException) { + HResult = __HResults.COR_E_DATAMISALIGNED; } - } + internal DataMisalignedException(SerializationInfo info, StreamingContext context) : base(info, context) { } + } } diff --git a/src/coreclr/src/mscorlib/src/System/DateTimeKind.cs b/src/coreclr/src/mscorlib/src/System/DateTimeKind.cs index 1a8a4ff..6b5e690 100644 --- a/src/coreclr/src/mscorlib/src/System/DateTimeKind.cs +++ b/src/coreclr/src/mscorlib/src/System/DateTimeKind.cs @@ -2,14 +2,12 @@ // 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 { - +namespace System +{ // This enum is used to indentify DateTime instances in cases when they are known to be in local time, // UTC time or if this information has not been specified or is not applicable. [Serializable] -[System.Runtime.InteropServices.ComVisible(true)] public enum DateTimeKind { Unspecified = 0, diff --git a/src/coreclr/src/mscorlib/src/System/DayOfWeek.cs b/src/coreclr/src/mscorlib/src/System/DayOfWeek.cs index 37b8f89..5d84257 100644 --- a/src/coreclr/src/mscorlib/src/System/DayOfWeek.cs +++ b/src/coreclr/src/mscorlib/src/System/DayOfWeek.cs @@ -10,11 +10,12 @@ ** ** ============================================================*/ -namespace System { +namespace System +{ [Serializable] -[System.Runtime.InteropServices.ComVisible(true)] - public enum DayOfWeek { + public enum DayOfWeek + { Sunday = 0, Monday = 1, Tuesday = 2, diff --git a/src/coreclr/src/mscorlib/src/System/DivideByZeroException.cs b/src/coreclr/src/mscorlib/src/System/DivideByZeroException.cs index b975e81..4abd43a 100644 --- a/src/coreclr/src/mscorlib/src/System/DivideByZeroException.cs +++ b/src/coreclr/src/mscorlib/src/System/DivideByZeroException.cs @@ -11,29 +11,31 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; -[System.Runtime.InteropServices.ComVisible(true)] +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public class DivideByZeroException : ArithmeticException { - public DivideByZeroException() - : base(Environment.GetResourceString("Arg_DivideByZero")) { - SetErrorCode(__HResults.COR_E_DIVIDEBYZERO); - } - - public DivideByZeroException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_DIVIDEBYZERO); + public class DivideByZeroException : ArithmeticException + { + public DivideByZeroException() + : base(SR.Arg_DivideByZero) + { + HResult = __HResults.COR_E_DIVIDEBYZERO; } - - public DivideByZeroException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_DIVIDEBYZERO); + + public DivideByZeroException(String message) + : base(message) + { + HResult = __HResults.COR_E_DIVIDEBYZERO; } - protected DivideByZeroException(SerializationInfo info, StreamingContext context) : base(info, context) { + public DivideByZeroException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_DIVIDEBYZERO; } + + protected DivideByZeroException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/DuplicateWaitObjectException.cs b/src/coreclr/src/mscorlib/src/System/DuplicateWaitObjectException.cs index d358d96..da29e2a 100644 --- a/src/coreclr/src/mscorlib/src/System/DuplicateWaitObjectException.cs +++ b/src/coreclr/src/mscorlib/src/System/DuplicateWaitObjectException.cs @@ -11,53 +11,55 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Remoting; - using System.Runtime.Serialization; +using System.Runtime.Serialization; +namespace System +{ // The DuplicateWaitObjectException is thrown when an object // appears more than once in the list of objects to WaitAll or WaitAny. // - [System.Runtime.InteropServices.ComVisible(true)] [Serializable] - public class DuplicateWaitObjectException : ArgumentException { + public class DuplicateWaitObjectException : ArgumentException + { + private static volatile String s_duplicateWaitObjectMessage = null; - private static volatile String _duplicateWaitObjectMessage = null; - - private static String DuplicateWaitObjectMessage { - get { - if (_duplicateWaitObjectMessage == null) - _duplicateWaitObjectMessage = Environment.GetResourceString("Arg_DuplicateWaitObjectException"); - return _duplicateWaitObjectMessage; + private static String DuplicateWaitObjectMessage + { + get + { + if (s_duplicateWaitObjectMessage == null) + s_duplicateWaitObjectMessage = SR.Arg_DuplicateWaitObjectException; + return s_duplicateWaitObjectMessage; } } // Creates a new DuplicateWaitObjectException with its message // string set to a default message. - public DuplicateWaitObjectException() - : base(DuplicateWaitObjectMessage) { - SetErrorCode(__HResults.COR_E_DUPLICATEWAITOBJECT); + public DuplicateWaitObjectException() + : base(DuplicateWaitObjectMessage) + { + HResult = __HResults.COR_E_DUPLICATEWAITOBJECT; } - public DuplicateWaitObjectException(String parameterName) - : base(DuplicateWaitObjectMessage, parameterName) { - SetErrorCode(__HResults.COR_E_DUPLICATEWAITOBJECT); + public DuplicateWaitObjectException(String parameterName) + : base(DuplicateWaitObjectMessage, parameterName) + { + HResult = __HResults.COR_E_DUPLICATEWAITOBJECT; } - public DuplicateWaitObjectException(String parameterName, String message) - : base(message, parameterName) { - SetErrorCode(__HResults.COR_E_DUPLICATEWAITOBJECT); + public DuplicateWaitObjectException(String parameterName, String message) + : base(message, parameterName) + { + HResult = __HResults.COR_E_DUPLICATEWAITOBJECT; } - public DuplicateWaitObjectException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_DUPLICATEWAITOBJECT); + public DuplicateWaitObjectException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_DUPLICATEWAITOBJECT; } // This constructor is required for serialization - protected DuplicateWaitObjectException(SerializationInfo info, StreamingContext context) : base (info, context) { - } + protected DuplicateWaitObjectException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/EntryPointNotFoundException.cs b/src/coreclr/src/mscorlib/src/System/EntryPointNotFoundException.cs index a65d800..835d334 100644 --- a/src/coreclr/src/mscorlib/src/System/EntryPointNotFoundException.cs +++ b/src/coreclr/src/mscorlib/src/System/EntryPointNotFoundException.cs @@ -11,32 +11,32 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System; +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public class EntryPointNotFoundException : TypeLoadException { - public EntryPointNotFoundException() - : base(Environment.GetResourceString("Arg_EntryPointNotFoundException")) { - SetErrorCode(__HResults.COR_E_ENTRYPOINTNOTFOUND); - } - - public EntryPointNotFoundException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_ENTRYPOINTNOTFOUND); + public class EntryPointNotFoundException : TypeLoadException + { + public EntryPointNotFoundException() + : base(SR.Arg_EntryPointNotFoundException) + { + HResult = __HResults.COR_E_ENTRYPOINTNOTFOUND; } - - public EntryPointNotFoundException(String message, Exception inner) - : base(message, inner) { - SetErrorCode(__HResults.COR_E_ENTRYPOINTNOTFOUND); + + public EntryPointNotFoundException(String message) + : base(message) + { + HResult = __HResults.COR_E_ENTRYPOINTNOTFOUND; } - protected EntryPointNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { + public EntryPointNotFoundException(String message, Exception inner) + : base(message, inner) + { + HResult = __HResults.COR_E_ENTRYPOINTNOTFOUND; } - - - } + protected EntryPointNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { } + } } diff --git a/src/coreclr/src/mscorlib/src/System/EventArgs.cs b/src/coreclr/src/mscorlib/src/System/EventArgs.cs index 349de85..c035661 100644 --- a/src/coreclr/src/mscorlib/src/System/EventArgs.cs +++ b/src/coreclr/src/mscorlib/src/System/EventArgs.cs @@ -2,16 +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. -namespace System { - - using System; +using System; + +namespace System +{ // The base class for all event classes. [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] - public class EventArgs { + public class EventArgs + { public static readonly EventArgs Empty = new EventArgs(); - - public EventArgs() + + public EventArgs() { } } diff --git a/src/coreclr/src/mscorlib/src/System/EventHandler.cs b/src/coreclr/src/mscorlib/src/System/EventHandler.cs index 517e1f7..e6923cf 100644 --- a/src/coreclr/src/mscorlib/src/System/EventHandler.cs +++ b/src/coreclr/src/mscorlib/src/System/EventHandler.cs @@ -2,10 +2,11 @@ // 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 { - +using System; + +namespace System +{ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public delegate void EventHandler(Object sender, EventArgs e); [Serializable] diff --git a/src/coreclr/src/mscorlib/src/System/ExecutionEngineException.cs b/src/coreclr/src/mscorlib/src/System/ExecutionEngineException.cs index 5b2592c..bebfd49 100644 --- a/src/coreclr/src/mscorlib/src/System/ExecutionEngineException.cs +++ b/src/coreclr/src/mscorlib/src/System/ExecutionEngineException.cs @@ -15,30 +15,33 @@ ** =============================================================================*/ -namespace System { +using System; +using System.Runtime.Serialization; - using System; - using System.Runtime.Serialization; +namespace System +{ [Obsolete("This type previously indicated an unspecified fatal error in the runtime. The runtime no longer raises this exception so this type is obsolete.")] - [System.Runtime.InteropServices.ComVisible(true)] [Serializable] - public sealed class ExecutionEngineException : SystemException { - public ExecutionEngineException() - : base(Environment.GetResourceString("Arg_ExecutionEngineException")) { - SetErrorCode(__HResults.COR_E_EXECUTIONENGINE); + public sealed class ExecutionEngineException : SystemException + { + public ExecutionEngineException() + : base(SR.Arg_ExecutionEngineException) + { + HResult = __HResults.COR_E_EXECUTIONENGINE; } - - public ExecutionEngineException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_EXECUTIONENGINE); - } - - public ExecutionEngineException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_EXECUTIONENGINE); + + public ExecutionEngineException(String message) + : base(message) + { + HResult = __HResults.COR_E_EXECUTIONENGINE; } - internal ExecutionEngineException(SerializationInfo info, StreamingContext context) : base(info, context) { + public ExecutionEngineException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_EXECUTIONENGINE; } + + internal ExecutionEngineException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/FieldAccessException.cs b/src/coreclr/src/mscorlib/src/System/FieldAccessException.cs index fbc3b1f..ac62c0f 100644 --- a/src/coreclr/src/mscorlib/src/System/FieldAccessException.cs +++ b/src/coreclr/src/mscorlib/src/System/FieldAccessException.cs @@ -9,31 +9,31 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public class FieldAccessException : MemberAccessException { - public FieldAccessException() - : base(Environment.GetResourceString("Arg_FieldAccessException")) { - SetErrorCode(__HResults.COR_E_FIELDACCESS); - } - - public FieldAccessException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_FIELDACCESS); + public class FieldAccessException : MemberAccessException + { + public FieldAccessException() + : base(SR.Arg_FieldAccessException) + { + HResult = __HResults.COR_E_FIELDACCESS; } - - public FieldAccessException(String message, Exception inner) - : base(message, inner) { - SetErrorCode(__HResults.COR_E_FIELDACCESS); + + public FieldAccessException(String message) + : base(message) + { + HResult = __HResults.COR_E_FIELDACCESS; } - protected FieldAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { + public FieldAccessException(String message, Exception inner) + : base(message, inner) + { + HResult = __HResults.COR_E_FIELDACCESS; } + protected FieldAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - } diff --git a/src/coreclr/src/mscorlib/src/System/FlagsAttribute.cs b/src/coreclr/src/mscorlib/src/System/FlagsAttribute.cs index cb955cf..5f8c108 100644 --- a/src/coreclr/src/mscorlib/src/System/FlagsAttribute.cs +++ b/src/coreclr/src/mscorlib/src/System/FlagsAttribute.cs @@ -4,16 +4,15 @@ //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// -namespace System { - - using System; + +namespace System +{ // Custom attribute to indicate that the enum // should be treated as a bitfield (or set of flags). // An IDE may use this information to provide a richer // development experience. [Serializable] [AttributeUsage(AttributeTargets.Enum, Inherited = false)] - [System.Runtime.InteropServices.ComVisible(true)] public class FlagsAttribute : Attribute { public FlagsAttribute() diff --git a/src/coreclr/src/mscorlib/src/System/FormatException.cs b/src/coreclr/src/mscorlib/src/System/FormatException.cs index 2e1c8a9..c5758e1 100644 --- a/src/coreclr/src/mscorlib/src/System/FormatException.cs +++ b/src/coreclr/src/mscorlib/src/System/FormatException.cs @@ -10,30 +10,32 @@ ** ** ===========================================================*/ -namespace System { - - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] + +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public class FormatException : SystemException { - public FormatException() - : base(Environment.GetResourceString("Arg_FormatException")) { - SetErrorCode(__HResults.COR_E_FORMAT); - } - - public FormatException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_FORMAT); + public class FormatException : SystemException + { + public FormatException() + : base(SR.Arg_FormatException) + { + HResult = __HResults.COR_E_FORMAT; } - - public FormatException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_FORMAT); + + public FormatException(String message) + : base(message) + { + HResult = __HResults.COR_E_FORMAT; } - protected FormatException(SerializationInfo info, StreamingContext context) : base(info, context) { + public FormatException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_FORMAT; } + protected FormatException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - } diff --git a/src/coreclr/src/mscorlib/src/System/FormattableString.cs b/src/coreclr/src/mscorlib/src/System/FormattableString.cs index 294b2c1..6369363 100644 --- a/src/coreclr/src/mscorlib/src/System/FormattableString.cs +++ b/src/coreclr/src/mscorlib/src/System/FormattableString.cs @@ -4,13 +4,13 @@ /*============================================================ ** -** Class: FormattableString ** ** ** Purpose: implementation of the FormattableString ** class. ** ===========================================================*/ + namespace System { /// diff --git a/src/coreclr/src/mscorlib/src/System/IAsyncResult.cs b/src/coreclr/src/mscorlib/src/System/IAsyncResult.cs index 2591c72..0abeaca 100644 --- a/src/coreclr/src/mscorlib/src/System/IAsyncResult.cs +++ b/src/coreclr/src/mscorlib/src/System/IAsyncResult.cs @@ -10,11 +10,12 @@ ** operation ** ===========================================================*/ -namespace System { - - using System; - using System.Threading; -[System.Runtime.InteropServices.ComVisible(true)] + +using System; +using System.Threading; + +namespace System +{ public interface IAsyncResult { bool IsCompleted { get; } @@ -22,11 +23,8 @@ namespace System { WaitHandle AsyncWaitHandle { get; } - Object AsyncState { get; } + Object AsyncState { get; } - bool CompletedSynchronously { get; } - - + bool CompletedSynchronously { get; } } - } diff --git a/src/coreclr/src/mscorlib/src/System/IComparable.cs b/src/coreclr/src/mscorlib/src/System/IComparable.cs index 111d892..72aeeb0 100644 --- a/src/coreclr/src/mscorlib/src/System/IComparable.cs +++ b/src/coreclr/src/mscorlib/src/System/IComparable.cs @@ -2,18 +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 { - - using System; +namespace System +{ // The IComparable interface is implemented by classes that support an // ordering of instances of the class. The ordering represented by // IComparable can be used to sort arrays and collections of objects // that implement the interface. // -[System.Runtime.InteropServices.ComVisible(true)] public interface IComparable { - // Interface does not need to be marked with the serializable attribute + // Interface does not need to be marked with the serializable attribute // Compares this object to another object, returning an integer that // indicates the relationship. An implementation of this method must return // a value less than zero if this is less than object, zero diff --git a/src/coreclr/src/mscorlib/src/System/IConvertible.cs b/src/coreclr/src/mscorlib/src/System/IConvertible.cs index 174b25b..8735112 100644 --- a/src/coreclr/src/mscorlib/src/System/IConvertible.cs +++ b/src/coreclr/src/mscorlib/src/System/IConvertible.cs @@ -2,15 +2,12 @@ // 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 { - - using System.Diagnostics.Contracts; - using System.Threading; - +namespace System +{ // The IConvertible interface represents an object that contains a value. This // interface is implemented by the following types in the System namespace: // Boolean, Char, SByte, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, - // Single, Double, Decimal, DateTime, TimeSpan, and String. The interface may + // Single, Double, Decimal, DateTime, and String. The interface may // be implemented by other types that are to be considered values. For example, // a library of nullable database types could implement IConvertible. // @@ -23,7 +20,6 @@ namespace System { // IConvertible implementation should simply throw an InvalidCastException. [CLSCompliant(false)] - [System.Runtime.InteropServices.ComVisible(true)] public interface IConvertible { // Returns the type code of this object. An implementation of this method diff --git a/src/coreclr/src/mscorlib/src/System/ICustomFormatter.cs b/src/coreclr/src/mscorlib/src/System/ICustomFormatter.cs index cbc3816a..47340f3 100644 --- a/src/coreclr/src/mscorlib/src/System/ICustomFormatter.cs +++ b/src/coreclr/src/mscorlib/src/System/ICustomFormatter.cs @@ -11,15 +11,14 @@ ** ** ===========================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System; + +namespace System +{ public interface ICustomFormatter { // Interface does not need to be marked with the serializable attribute - String Format (String format, Object arg, IFormatProvider formatProvider); + String Format(String format, Object arg, IFormatProvider formatProvider); } } diff --git a/src/coreclr/src/mscorlib/src/System/IDisposable.cs b/src/coreclr/src/mscorlib/src/System/IDisposable.cs index fcb65be..24f0740 100644 --- a/src/coreclr/src/mscorlib/src/System/IDisposable.cs +++ b/src/coreclr/src/mscorlib/src/System/IDisposable.cs @@ -11,7 +11,9 @@ ** ** ===========================================================*/ -namespace System { + +namespace System +{ // IDisposable is an attempt at helping to solve problems with deterministic // finalization. The GC of course doesn't leave any way to deterministically // know when a finalizer will run. This forces classes that hold onto OS @@ -51,8 +53,8 @@ namespace System { // data buffered by the StreamWriter cannot be written to the Stream. In this // case, it doesn't make much sense to provide a finalizer on the StreamWriter // since you cannot solve this problem correctly. -[System.Runtime.InteropServices.ComVisible(true)] - public interface IDisposable { + public interface IDisposable + { void Dispose(); } } diff --git a/src/coreclr/src/mscorlib/src/System/IEquatable.cs b/src/coreclr/src/mscorlib/src/System/IEquatable.cs index aa034da..1264fdd 100644 --- a/src/coreclr/src/mscorlib/src/System/IEquatable.cs +++ b/src/coreclr/src/mscorlib/src/System/IEquatable.cs @@ -2,13 +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. -namespace System { - - using System; +using System; + +namespace System +{ public interface IEquatable { bool Equals(T other); } - } diff --git a/src/coreclr/src/mscorlib/src/System/IFormatProvider.cs b/src/coreclr/src/mscorlib/src/System/IFormatProvider.cs index a5cc783..0c17354 100644 --- a/src/coreclr/src/mscorlib/src/System/IFormatProvider.cs +++ b/src/coreclr/src/mscorlib/src/System/IFormatProvider.cs @@ -10,11 +10,11 @@ ** ** ============================================================*/ -namespace System { - - using System; - [System.Runtime.InteropServices.ComVisible(true)] +using System; + +namespace System +{ public interface IFormatProvider { // Interface does not need to be marked with the serializable attribute diff --git a/src/coreclr/src/mscorlib/src/System/IFormattable.cs b/src/coreclr/src/mscorlib/src/System/IFormattable.cs index 414b468..28a7d70 100644 --- a/src/coreclr/src/mscorlib/src/System/IFormattable.cs +++ b/src/coreclr/src/mscorlib/src/System/IFormattable.cs @@ -2,12 +2,11 @@ // 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 { - - using System; - using System.Diagnostics.Contracts; +using System; +using System.Diagnostics.Contracts; - [System.Runtime.InteropServices.ComVisible(true)] +namespace System +{ public interface IFormattable { [Pure] diff --git a/src/coreclr/src/mscorlib/src/System/IObservable.cs b/src/coreclr/src/mscorlib/src/System/IObservable.cs index c231c45..aabb0b8 100644 --- a/src/coreclr/src/mscorlib/src/System/IObservable.cs +++ b/src/coreclr/src/mscorlib/src/System/IObservable.cs @@ -2,23 +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. -/*============================================================ -** -** -** -** -** -** Purpose: Interface for exposing an Observable in the -** Observer pattern -** -** -===========================================================*/ - namespace System { public interface IObservable { IDisposable Subscribe(IObserver observer); } - } diff --git a/src/coreclr/src/mscorlib/src/System/IObserver.cs b/src/coreclr/src/mscorlib/src/System/IObserver.cs index 7f55ce0..39e123d 100644 --- a/src/coreclr/src/mscorlib/src/System/IObserver.cs +++ b/src/coreclr/src/mscorlib/src/System/IObserver.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. -/*============================================================ -** -** -** -** -** -** Purpose: Interface for exposing an Observer in the -** Observer pattern -** -** -===========================================================*/ - -using System; - namespace System { public interface IObserver diff --git a/src/coreclr/src/mscorlib/src/System/IProgress.cs b/src/coreclr/src/mscorlib/src/System/IProgress.cs index e104301..724c7bd 100644 --- a/src/coreclr/src/mscorlib/src/System/IProgress.cs +++ b/src/coreclr/src/mscorlib/src/System/IProgress.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: Interface for providing progress updates. -** -** -===========================================================*/ - namespace System { /// Defines a provider for progress updates. diff --git a/src/coreclr/src/mscorlib/src/System/IndexOutOfRangeException.cs b/src/coreclr/src/mscorlib/src/System/IndexOutOfRangeException.cs index e641b5e..4969c2b 100644 --- a/src/coreclr/src/mscorlib/src/System/IndexOutOfRangeException.cs +++ b/src/coreclr/src/mscorlib/src/System/IndexOutOfRangeException.cs @@ -11,30 +11,31 @@ ** =============================================================================*/ -namespace System { - - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public sealed class IndexOutOfRangeException : SystemException { - public IndexOutOfRangeException() - : base(Environment.GetResourceString("Arg_IndexOutOfRangeException")) { - SetErrorCode(__HResults.COR_E_INDEXOUTOFRANGE); - } - - public IndexOutOfRangeException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_INDEXOUTOFRANGE); + public sealed class IndexOutOfRangeException : SystemException + { + public IndexOutOfRangeException() + : base(SR.Arg_IndexOutOfRangeException) + { + HResult = __HResults.COR_E_INDEXOUTOFRANGE; } - - public IndexOutOfRangeException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_INDEXOUTOFRANGE); + + public IndexOutOfRangeException(String message) + : base(message) + { + HResult = __HResults.COR_E_INDEXOUTOFRANGE; } - internal IndexOutOfRangeException(SerializationInfo info, StreamingContext context) : base(info, context) { + public IndexOutOfRangeException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_INDEXOUTOFRANGE; } + internal IndexOutOfRangeException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - } diff --git a/src/coreclr/src/mscorlib/src/System/InsufficientExecutionStackException.cs b/src/coreclr/src/mscorlib/src/System/InsufficientExecutionStackException.cs index 6b02f46..b9a4a12 100644 --- a/src/coreclr/src/mscorlib/src/System/InsufficientExecutionStackException.cs +++ b/src/coreclr/src/mscorlib/src/System/InsufficientExecutionStackException.cs @@ -2,46 +2,31 @@ // 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 exception class used when there is insufficient execution stack -** to allow most Framework methods to execute. -** -** -=============================================================================*/ - -namespace System { - - using System; - using System.Runtime.Serialization; +using System.Runtime.Serialization; +namespace System +{ [Serializable] - public sealed class InsufficientExecutionStackException : SystemException + public sealed class InsufficientExecutionStackException : SystemException { public InsufficientExecutionStackException() - : base(Environment.GetResourceString("Arg_InsufficientExecutionStackException")) - { - SetErrorCode(__HResults.COR_E_INSUFFICIENTEXECUTIONSTACK); - } - - public InsufficientExecutionStackException(String message) - : base(message) + : base(SR.Arg_InsufficientExecutionStackException) { - SetErrorCode(__HResults.COR_E_INSUFFICIENTEXECUTIONSTACK); + HResult = __HResults.COR_E_INSUFFICIENTEXECUTIONSTACK; } - - public InsufficientExecutionStackException(String message, Exception innerException) - : base(message, innerException) + + public InsufficientExecutionStackException(String message) + : base(message) { - SetErrorCode(__HResults.COR_E_INSUFFICIENTEXECUTIONSTACK); + HResult = __HResults.COR_E_INSUFFICIENTEXECUTIONSTACK; } - private InsufficientExecutionStackException(SerializationInfo info, StreamingContext context) - : base(info, context) + public InsufficientExecutionStackException(String message, Exception innerException) + : base(message, innerException) { + HResult = __HResults.COR_E_INSUFFICIENTEXECUTIONSTACK; } - + + internal InsufficientExecutionStackException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/InvalidCastException.cs b/src/coreclr/src/mscorlib/src/System/InvalidCastException.cs index ba7b722..01d92b2 100644 --- a/src/coreclr/src/mscorlib/src/System/InvalidCastException.cs +++ b/src/coreclr/src/mscorlib/src/System/InvalidCastException.cs @@ -4,42 +4,41 @@ /*============================================================================= ** -** -** -** Purpose: Exception class for bad cast conditions! -** +** Purpose: Exception class for invalid cast conditions! ** =============================================================================*/ -namespace System { - - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public class InvalidCastException : SystemException { - public InvalidCastException() - : base(Environment.GetResourceString("Arg_InvalidCastException")) { - SetErrorCode(__HResults.COR_E_INVALIDCAST); - } - - public InvalidCastException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_INVALIDCAST); + public class InvalidCastException : SystemException + { + public InvalidCastException() + : base(SR.Arg_InvalidCastException) + { + HResult = __HResults.COR_E_INVALIDCAST; } - public InvalidCastException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_INVALIDCAST); + public InvalidCastException(String message) + : base(message) + { + HResult = __HResults.COR_E_INVALIDCAST; } - protected InvalidCastException(SerializationInfo info, StreamingContext context) : base(info, context) { + public InvalidCastException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_INVALIDCAST; } - public InvalidCastException(String message, int errorCode) - : base(message) { - SetErrorCode(errorCode); + public InvalidCastException(String message, int errorCode) + : base(message) + { + HResult = errorCode; } + protected InvalidCastException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - } diff --git a/src/coreclr/src/mscorlib/src/System/InvalidOperationException.cs b/src/coreclr/src/mscorlib/src/System/InvalidOperationException.cs index 5f29e79..24a08c8 100644 --- a/src/coreclr/src/mscorlib/src/System/InvalidOperationException.cs +++ b/src/coreclr/src/mscorlib/src/System/InvalidOperationException.cs @@ -11,31 +11,32 @@ ** ** =============================================================================*/ -namespace System { - - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] + +using System.Runtime.Serialization; + +namespace System +{ [Serializable] public class InvalidOperationException : SystemException { - public InvalidOperationException() - : base(Environment.GetResourceString("Arg_InvalidOperationException")) { - SetErrorCode(__HResults.COR_E_INVALIDOPERATION); - } - - public InvalidOperationException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_INVALIDOPERATION); + public InvalidOperationException() + : base(SR.Arg_InvalidOperationException) + { + HResult = __HResults.COR_E_INVALIDOPERATION; } - - public InvalidOperationException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_INVALIDOPERATION); + + public InvalidOperationException(String message) + : base(message) + { + HResult = __HResults.COR_E_INVALIDOPERATION; } - protected InvalidOperationException(SerializationInfo info, StreamingContext context) : base(info, context) { + public InvalidOperationException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_INVALIDOPERATION; } + protected InvalidOperationException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } - diff --git a/src/coreclr/src/mscorlib/src/System/InvalidProgramException.cs b/src/coreclr/src/mscorlib/src/System/InvalidProgramException.cs index 649849a..401b3a0 100644 --- a/src/coreclr/src/mscorlib/src/System/InvalidProgramException.cs +++ b/src/coreclr/src/mscorlib/src/System/InvalidProgramException.cs @@ -11,31 +11,31 @@ ** =============================================================================*/ -namespace System { +using System.Runtime.Serialization; - using System; - using System.Runtime.Serialization; +namespace System +{ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] - public sealed class InvalidProgramException : SystemException { - public InvalidProgramException() - : base(Environment.GetResourceString("InvalidProgram_Default")) { - SetErrorCode(__HResults.COR_E_INVALIDPROGRAM); + public sealed class InvalidProgramException : SystemException + { + public InvalidProgramException() + : base(SR.InvalidProgram_Default) + { + HResult = __HResults.COR_E_INVALIDPROGRAM; } - - public InvalidProgramException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_INVALIDPROGRAM); - } - - public InvalidProgramException(String message, Exception inner) - : base(message, inner) { - SetErrorCode(__HResults.COR_E_INVALIDPROGRAM); + + public InvalidProgramException(String message) + : base(message) + { + HResult = __HResults.COR_E_INVALIDPROGRAM; } - internal InvalidProgramException(SerializationInfo info, StreamingContext context) : base(info, context) { + public InvalidProgramException(String message, Exception inner) + : base(message, inner) + { + HResult = __HResults.COR_E_INVALIDPROGRAM; } + internal InvalidProgramException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - } diff --git a/src/coreclr/src/mscorlib/src/System/InvalidTimeZoneException.cs b/src/coreclr/src/mscorlib/src/System/InvalidTimeZoneException.cs index f334754..8f0751c 100644 --- a/src/coreclr/src/mscorlib/src/System/InvalidTimeZoneException.cs +++ b/src/coreclr/src/mscorlib/src/System/InvalidTimeZoneException.cs @@ -6,19 +6,23 @@ using System.Runtime.Serialization; namespace System { - [Serializable] - [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] - public class InvalidTimeZoneException : Exception - { - public InvalidTimeZoneException(String message) - : base(message) { } + [Serializable] + public class InvalidTimeZoneException : Exception + { + public InvalidTimeZoneException() + { + } - public InvalidTimeZoneException(String message, Exception innerException) - : base(message, innerException) { } + public InvalidTimeZoneException(String message) + : base(message) + { + } - protected InvalidTimeZoneException(SerializationInfo info, StreamingContext context) - : base(info, context) { } + public InvalidTimeZoneException(String message, Exception innerException) + : base(message, innerException) + { + } - public InvalidTimeZoneException() { } - } + protected InvalidTimeZoneException(SerializationInfo info, StreamingContext context) : base(info, context) { } + } } diff --git a/src/coreclr/src/mscorlib/src/System/MarshalByRefObject.cs b/src/coreclr/src/mscorlib/src/System/MarshalByRefObject.cs index 53ebda7..9014de0 100644 --- a/src/coreclr/src/mscorlib/src/System/MarshalByRefObject.cs +++ b/src/coreclr/src/mscorlib/src/System/MarshalByRefObject.cs @@ -2,32 +2,25 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -/*============================================================ -** -** -** -** -** Purpose: Defines the root type for all marshal by reference aka -** AppDomain bound types -** -** -** -===========================================================*/ namespace System { [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] - public abstract class MarshalByRefObject + public abstract class MarshalByRefObject { - protected MarshalByRefObject() { } + protected MarshalByRefObject() + { + } + public object GetLifetimeService() { throw new PlatformNotSupportedException(); } + public virtual object InitializeLifetimeService() { throw new PlatformNotSupportedException(); } + protected MarshalByRefObject MemberwiseClone(bool cloneIdentity) { MarshalByRefObject mbr = (MarshalByRefObject)base.MemberwiseClone(); diff --git a/src/coreclr/src/mscorlib/src/System/MemberAccessException.cs b/src/coreclr/src/mscorlib/src/System/MemberAccessException.cs index bc21248..54eee67 100644 --- a/src/coreclr/src/mscorlib/src/System/MemberAccessException.cs +++ b/src/coreclr/src/mscorlib/src/System/MemberAccessException.cs @@ -8,41 +8,41 @@ // access, due to it being removed, private or something similar. //////////////////////////////////////////////////////////////////////////////// -namespace System { - - using System; - using System.Runtime.Serialization; +using System.Runtime.Serialization; + +namespace System +{ // The MemberAccessException is thrown when trying to access a class // member fails. // - [System.Runtime.InteropServices.ComVisible(true)] [Serializable] - public class MemberAccessException : SystemException { - + public class MemberAccessException : SystemException + { // Creates a new MemberAccessException with its message string set to // the empty string, its HRESULT set to COR_E_MEMBERACCESS, // and its ExceptionInfo reference set to null. - public MemberAccessException() - : base(Environment.GetResourceString("Arg_AccessException")) { - SetErrorCode(__HResults.COR_E_MEMBERACCESS); + public MemberAccessException() + : base(SR.Arg_AccessException) + { + HResult = __HResults.COR_E_MEMBERACCESS; } - + // Creates a new MemberAccessException with its message string set to // message, its HRESULT set to COR_E_ACCESS, // and its ExceptionInfo reference set to null. // - public MemberAccessException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_MEMBERACCESS); - } - - public MemberAccessException(String message, Exception inner) - : base(message, inner) { - SetErrorCode(__HResults.COR_E_MEMBERACCESS); + public MemberAccessException(String message) + : base(message) + { + HResult = __HResults.COR_E_MEMBERACCESS; } - protected MemberAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { + public MemberAccessException(String message, Exception inner) + : base(message, inner) + { + HResult = __HResults.COR_E_MEMBERACCESS; } + protected MemberAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/MethodAccessException.cs b/src/coreclr/src/mscorlib/src/System/MethodAccessException.cs index 3feaf3e..2ecbd14 100644 --- a/src/coreclr/src/mscorlib/src/System/MethodAccessException.cs +++ b/src/coreclr/src/mscorlib/src/System/MethodAccessException.cs @@ -9,31 +9,31 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public class MethodAccessException : MemberAccessException { - public MethodAccessException() - : base(Environment.GetResourceString("Arg_MethodAccessException")) { - SetErrorCode(__HResults.COR_E_METHODACCESS); - } - - public MethodAccessException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_METHODACCESS); + public class MethodAccessException : MemberAccessException + { + public MethodAccessException() + : base(SR.Arg_MethodAccessException) + { + HResult = __HResults.COR_E_METHODACCESS; } - - public MethodAccessException(String message, Exception inner) - : base(message, inner) { - SetErrorCode(__HResults.COR_E_METHODACCESS); + + public MethodAccessException(String message) + : base(message) + { + HResult = __HResults.COR_E_METHODACCESS; } - protected MethodAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { + public MethodAccessException(String message, Exception inner) + : base(message, inner) + { + HResult = __HResults.COR_E_METHODACCESS; } + protected MethodAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - } diff --git a/src/coreclr/src/mscorlib/src/System/MidpointRounding.cs b/src/coreclr/src/mscorlib/src/System/MidpointRounding.cs index ff70924..a75de43 100644 --- a/src/coreclr/src/mscorlib/src/System/MidpointRounding.cs +++ b/src/coreclr/src/mscorlib/src/System/MidpointRounding.cs @@ -2,11 +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. - -namespace System { - -[System.Runtime.InteropServices.ComVisible(true)] - public enum MidpointRounding { +namespace System +{ + public enum MidpointRounding + { ToEven = 0, AwayFromZero = 1, } diff --git a/src/coreclr/src/mscorlib/src/System/MulticastNotSupportedException.cs b/src/coreclr/src/mscorlib/src/System/MulticastNotSupportedException.cs index ad8eeeb..4fcaa98 100644 --- a/src/coreclr/src/mscorlib/src/System/MulticastNotSupportedException.cs +++ b/src/coreclr/src/mscorlib/src/System/MulticastNotSupportedException.cs @@ -7,31 +7,31 @@ // This is thrown when you add multiple callbacks to a non-multicast delegate. //////////////////////////////////////////////////////////////////////////////// -namespace System { - - using System; - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public sealed class MulticastNotSupportedException : SystemException { - - public MulticastNotSupportedException() - : base(Environment.GetResourceString("Arg_MulticastNotSupportedException")) { - SetErrorCode(__HResults.COR_E_MULTICASTNOTSUPPORTED); - } - - public MulticastNotSupportedException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_MULTICASTNOTSUPPORTED); + public sealed class MulticastNotSupportedException : SystemException + { + public MulticastNotSupportedException() + : base(SR.Arg_MulticastNotSupportedException) + { + HResult = __HResults.COR_E_MULTICASTNOTSUPPORTED; } - - public MulticastNotSupportedException(String message, Exception inner) - : base(message, inner) { - SetErrorCode(__HResults.COR_E_MULTICASTNOTSUPPORTED); + + public MulticastNotSupportedException(String message) + : base(message) + { + HResult = __HResults.COR_E_MULTICASTNOTSUPPORTED; } - internal MulticastNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { + public MulticastNotSupportedException(String message, Exception inner) + : base(message, inner) + { + HResult = __HResults.COR_E_MULTICASTNOTSUPPORTED; } + internal MulticastNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/NotFiniteNumberException.cs b/src/coreclr/src/mscorlib/src/System/NotFiniteNumberException.cs index 3a896ce..68e8f88 100644 --- a/src/coreclr/src/mscorlib/src/System/NotFiniteNumberException.cs +++ b/src/coreclr/src/mscorlib/src/System/NotFiniteNumberException.cs @@ -2,68 +2,70 @@ // 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 { - - using System; - using System.Runtime.Serialization; - using System.Security.Permissions; - using System.Diagnostics.Contracts; +using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +namespace System +{ [Serializable] - public class NotFiniteNumberException : ArithmeticException { + public class NotFiniteNumberException : ArithmeticException + { private double _offendingNumber; public NotFiniteNumberException() - : base(Environment.GetResourceString("Arg_NotFiniteNumberException")) { + : base(SR.Arg_NotFiniteNumberException) + { _offendingNumber = 0; - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + HResult = __HResults.COR_E_NOTFINITENUMBER; } public NotFiniteNumberException(double offendingNumber) - : base() { + : base() + { _offendingNumber = offendingNumber; - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + HResult = __HResults.COR_E_NOTFINITENUMBER; } public NotFiniteNumberException(String message) - : base(message) { + : base(message) + { _offendingNumber = 0; - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + HResult = __HResults.COR_E_NOTFINITENUMBER; } public NotFiniteNumberException(String message, double offendingNumber) - : base(message) { + : base(message) + { _offendingNumber = offendingNumber; - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + HResult = __HResults.COR_E_NOTFINITENUMBER; } public NotFiniteNumberException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + : base(message, innerException) + { + HResult = __HResults.COR_E_NOTFINITENUMBER; } public NotFiniteNumberException(String message, double offendingNumber, Exception innerException) - : base(message, innerException) { + : base(message, innerException) + { _offendingNumber = offendingNumber; - SetErrorCode(__HResults.COR_E_NOTFINITENUMBER); + HResult = __HResults.COR_E_NOTFINITENUMBER; } - protected NotFiniteNumberException(SerializationInfo info, StreamingContext context) : base(info, context) { + protected NotFiniteNumberException(SerializationInfo info, StreamingContext context) : base(info, context) + { _offendingNumber = info.GetInt32("OffendingNumber"); } - public double OffendingNumber { - get { return _offendingNumber; } - } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) { - if (info==null) { - throw new ArgumentNullException(nameof(info)); - } - Contract.EndContractBlock(); + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { base.GetObjectData(info, context); info.AddValue("OffendingNumber", _offendingNumber, typeof(Int32)); } + + public double OffendingNumber + { + get { return _offendingNumber; } + } } } diff --git a/src/coreclr/src/mscorlib/src/System/NotImplementedException.cs b/src/coreclr/src/mscorlib/src/System/NotImplementedException.cs index d6c9668..4d141ea 100644 --- a/src/coreclr/src/mscorlib/src/System/NotImplementedException.cs +++ b/src/coreclr/src/mscorlib/src/System/NotImplementedException.cs @@ -12,29 +12,29 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; +using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +namespace System +{ [Serializable] public class NotImplementedException : SystemException { - public NotImplementedException() - : base(Environment.GetResourceString("Arg_NotImplementedException")) { - SetErrorCode(__HResults.E_NOTIMPL); + public NotImplementedException() + : base(SR.Arg_NotImplementedException) + { + HResult = __HResults.E_NOTIMPL; } - public NotImplementedException(String message) - : base(message) { - SetErrorCode(__HResults.E_NOTIMPL); + public NotImplementedException(String message) + : base(message) + { + HResult = __HResults.E_NOTIMPL; } - public NotImplementedException(String message, Exception inner) - : base(message, inner) { - SetErrorCode(__HResults.E_NOTIMPL); + public NotImplementedException(String message, Exception inner) + : base(message, inner) + { + HResult = __HResults.E_NOTIMPL; } - protected NotImplementedException(SerializationInfo info, StreamingContext context) : base(info, context) { - } + protected NotImplementedException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/NotSupportedException.cs b/src/coreclr/src/mscorlib/src/System/NotSupportedException.cs index ecef1d1..21b2d54 100644 --- a/src/coreclr/src/mscorlib/src/System/NotSupportedException.cs +++ b/src/coreclr/src/mscorlib/src/System/NotSupportedException.cs @@ -11,31 +11,31 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System.Runtime.Serialization; + +namespace System +{ [Serializable] public class NotSupportedException : SystemException { - public NotSupportedException() - : base(Environment.GetResourceString("Arg_NotSupportedException")) { - SetErrorCode(__HResults.COR_E_NOTSUPPORTED); - } - - public NotSupportedException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_NOTSUPPORTED); + public NotSupportedException() + : base(SR.Arg_NotSupportedException) + { + HResult = __HResults.COR_E_NOTSUPPORTED; } - - public NotSupportedException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_NOTSUPPORTED); + + public NotSupportedException(String message) + : base(message) + { + HResult = __HResults.COR_E_NOTSUPPORTED; } - protected NotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { + public NotSupportedException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_NOTSUPPORTED; } + protected NotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/NullReferenceException.cs b/src/coreclr/src/mscorlib/src/System/NullReferenceException.cs index d66ad9c..0aa5c61 100644 --- a/src/coreclr/src/mscorlib/src/System/NullReferenceException.cs +++ b/src/coreclr/src/mscorlib/src/System/NullReferenceException.cs @@ -11,30 +11,31 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public class NullReferenceException : SystemException { - public NullReferenceException() - : base(Environment.GetResourceString("Arg_NullReferenceException")) { - SetErrorCode(__HResults.COR_E_NULLREFERENCE); - } - - public NullReferenceException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_NULLREFERENCE); + public class NullReferenceException : SystemException + { + public NullReferenceException() + : base(SR.Arg_NullReferenceException) + { + HResult = __HResults.COR_E_NULLREFERENCE; } - - public NullReferenceException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_NULLREFERENCE); + + public NullReferenceException(String message) + : base(message) + { + HResult = __HResults.COR_E_NULLREFERENCE; } - protected NullReferenceException(SerializationInfo info, StreamingContext context) : base(info, context) {} + public NullReferenceException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_NULLREFERENCE; + } + protected NullReferenceException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - } diff --git a/src/coreclr/src/mscorlib/src/System/ObjectDisposedException.cs b/src/coreclr/src/mscorlib/src/System/ObjectDisposedException.cs index d2eca37..1f77b1f 100644 --- a/src/coreclr/src/mscorlib/src/System/ObjectDisposedException.cs +++ b/src/coreclr/src/mscorlib/src/System/ObjectDisposedException.cs @@ -2,72 +2,81 @@ // 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 { - using System; - using System.Runtime.Serialization; - using System.Globalization; - using System.Security.Permissions; +using System.Globalization; +using System.Runtime.Serialization; +namespace System +{ /// /// The exception that is thrown when accessing an object that was /// disposed. /// - [System.Runtime.InteropServices.ComVisible(true)] [Serializable] - public class ObjectDisposedException : InvalidOperationException { - private String objectName; + public class ObjectDisposedException : InvalidOperationException + { + private String _objectName; // This constructor should only be called by the EE (COMPlusThrow) - private ObjectDisposedException() : - this(null ,Environment.GetResourceString("ObjectDisposed_Generic")) { + private ObjectDisposedException() : + this(null, SR.ObjectDisposed_Generic) + { } - public ObjectDisposedException(String objectName) : - this(objectName, Environment.GetResourceString("ObjectDisposed_Generic")) { + public ObjectDisposedException(String objectName) : + this(objectName, SR.ObjectDisposed_Generic) + { } - public ObjectDisposedException(String objectName, String message) : base(message) { - SetErrorCode(__HResults.COR_E_OBJECTDISPOSED); - this.objectName = objectName; + public ObjectDisposedException(String objectName, String message) : base(message) + { + HResult = __HResults.COR_E_OBJECTDISPOSED; + _objectName = objectName; } - public ObjectDisposedException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_OBJECTDISPOSED); + public ObjectDisposedException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_OBJECTDISPOSED; + } + + protected ObjectDisposedException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + _objectName = info.GetString("ObjectName"); + } + + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue("ObjectName",ObjectName,typeof(String)); } /// /// Gets the text for the message for this exception. /// - public override String Message { - get { + public override String Message + { + get + { String name = ObjectName; if (name == null || name.Length == 0) return base.Message; - String objectDisposed = Environment.GetResourceString("ObjectDisposed_ObjectName_Name", name); + String objectDisposed = SR.Format(SR.ObjectDisposed_ObjectName_Name, name); return base.Message + Environment.NewLine + objectDisposed; } } - public String ObjectName { - get { - if (objectName == null) + public String ObjectName + { + get + { + if ((_objectName == null)) // && !CompatibilitySwitches.IsAppEarlierThanWindowsPhone8) { return String.Empty; } - return objectName; + return _objectName; } } - - protected ObjectDisposedException(SerializationInfo info, StreamingContext context) : base(info, context) { - objectName = info.GetString("ObjectName"); - } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) { - base.GetObjectData(info, context); - info.AddValue("ObjectName",ObjectName,typeof(String)); - } - } } diff --git a/src/coreclr/src/mscorlib/src/System/ObsoleteAttribute.cs b/src/coreclr/src/mscorlib/src/System/ObsoleteAttribute.cs index 679e32a..f183685 100644 --- a/src/coreclr/src/mscorlib/src/System/ObsoleteAttribute.cs +++ b/src/coreclr/src/mscorlib/src/System/ObsoleteAttribute.cs @@ -10,51 +10,52 @@ ** ** ===========================================================*/ -namespace System { - - using System; - using System.Runtime.Remoting; + +using System; + +namespace System +{ // This attribute is attached to members that are not to be used any longer. // Message is some human readable explanation of what to use // Error indicates if the compiler should treat usage of such a method as an // error. (this would be used if the actual implementation of the obsolete // method's implementation had changed). // -[Serializable] -[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | - AttributeTargets.Interface | AttributeTargets.Constructor | AttributeTargets.Method| AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Delegate + [Serializable] + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | + AttributeTargets.Interface | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Delegate , Inherited = false)] -[System.Runtime.InteropServices.ComVisible(true)] public sealed class ObsoleteAttribute : Attribute { private String _message; private bool _error; - - public ObsoleteAttribute () + + public ObsoleteAttribute() { _message = null; _error = false; } - - public ObsoleteAttribute (String message) + + public ObsoleteAttribute(String message) { _message = message; _error = false; } - - public ObsoleteAttribute (String message, bool error) + + public ObsoleteAttribute(String message, bool error) { _message = message; _error = error; } - - public String Message { - get {return _message;} + + public String Message + { + get { return _message; } } - - public bool IsError{ - get {return _error;} + + public bool IsError + { + get { return _error; } } - } } diff --git a/src/coreclr/src/mscorlib/src/System/OverflowException.cs b/src/coreclr/src/mscorlib/src/System/OverflowException.cs index ab717fb..e28c688 100644 --- a/src/coreclr/src/mscorlib/src/System/OverflowException.cs +++ b/src/coreclr/src/mscorlib/src/System/OverflowException.cs @@ -11,32 +11,31 @@ ** =============================================================================*/ -namespace System { - - - using System; - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public class OverflowException : ArithmeticException { - public OverflowException() - : base(Environment.GetResourceString("Arg_OverflowException")) { - SetErrorCode(__HResults.COR_E_OVERFLOW); - } - - public OverflowException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_OVERFLOW); + public class OverflowException : ArithmeticException + { + public OverflowException() + : base(SR.Arg_OverflowException) + { + HResult = __HResults.COR_E_OVERFLOW; } - - public OverflowException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_OVERFLOW); + + public OverflowException(String message) + : base(message) + { + HResult = __HResults.COR_E_OVERFLOW; } - protected OverflowException(SerializationInfo info, StreamingContext context) : base(info, context) { + public OverflowException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_OVERFLOW; } + protected OverflowException(SerializationInfo info, StreamingContext context) : base(info, context) { } } - } diff --git a/src/coreclr/src/mscorlib/src/System/ParamArrayAttribute.cs b/src/coreclr/src/mscorlib/src/System/ParamArrayAttribute.cs index 3a8e2e8..d3c3d46 100644 --- a/src/coreclr/src/mscorlib/src/System/ParamArrayAttribute.cs +++ b/src/coreclr/src/mscorlib/src/System/ParamArrayAttribute.cs @@ -10,13 +10,12 @@ ** ** =============================================================================*/ + namespace System { -//This class contains only static members and does not need to be serializable - [AttributeUsage (AttributeTargets.Parameter, Inherited=true, AllowMultiple=false)] -[System.Runtime.InteropServices.ComVisible(true)] - public sealed class ParamArrayAttribute : Attribute - { - public ParamArrayAttribute () {} - } + [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] + public sealed class ParamArrayAttribute : Attribute + { + public ParamArrayAttribute() { } + } } diff --git a/src/coreclr/src/mscorlib/src/System/PlatformNotSupportedException.cs b/src/coreclr/src/mscorlib/src/System/PlatformNotSupportedException.cs index 75d6d1d..d2370b3 100644 --- a/src/coreclr/src/mscorlib/src/System/PlatformNotSupportedException.cs +++ b/src/coreclr/src/mscorlib/src/System/PlatformNotSupportedException.cs @@ -11,32 +11,31 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; +using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +namespace System +{ [Serializable] public class PlatformNotSupportedException : NotSupportedException { - public PlatformNotSupportedException() - : base(Environment.GetResourceString("Arg_PlatformNotSupported")) { - SetErrorCode(__HResults.COR_E_PLATFORMNOTSUPPORTED); + public PlatformNotSupportedException() + : base(SR.Arg_PlatformNotSupported) + { + HResult = __HResults.COR_E_PLATFORMNOTSUPPORTED; } - - public PlatformNotSupportedException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_PLATFORMNOTSUPPORTED); - } - - public PlatformNotSupportedException(String message, Exception inner) - : base(message, inner) { - SetErrorCode(__HResults.COR_E_PLATFORMNOTSUPPORTED); + + public PlatformNotSupportedException(String message) + : base(message) + { + HResult = __HResults.COR_E_PLATFORMNOTSUPPORTED; } - protected PlatformNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { + public PlatformNotSupportedException(String message, Exception inner) + : base(message, inner) + { + HResult = __HResults.COR_E_PLATFORMNOTSUPPORTED; } + protected PlatformNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/Progress.cs b/src/coreclr/src/mscorlib/src/System/Progress.cs index 72c43c3..755e771 100644 --- a/src/coreclr/src/mscorlib/src/System/Progress.cs +++ b/src/coreclr/src/mscorlib/src/System/Progress.cs @@ -2,21 +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. -/*============================================================ -** -** -** -** -** -** Purpose: Event-based implementation of IProgress. -** -** -===========================================================*/ - using System; using System.Threading; using System.Diagnostics; -using System.Diagnostics.Contracts; namespace System { @@ -34,22 +22,20 @@ namespace System public class Progress : IProgress { /// The synchronization context captured upon construction. This will never be null. - private readonly SynchronizationContext m_synchronizationContext; + private readonly SynchronizationContext _synchronizationContext; /// The handler specified to the constructor. This may be null. - private readonly Action m_handler; + private readonly Action _handler; /// A cached delegate used to post invocation to the synchronization context. - private readonly SendOrPostCallback m_invokeHandlers; + private readonly SendOrPostCallback _invokeHandlers; /// Initializes the . public Progress() { - // Capture the current synchronization context. "current" is determined by CurrentNoFlow, - // which doesn't consider the sync ctx flown with an ExecutionContext, avoiding - // sync ctx reference identity issues where the sync ctx for one thread could be Current on another. + // Capture the current synchronization context. // If there is no current context, we use a default instance targeting the ThreadPool. - m_synchronizationContext = SynchronizationContext.CurrentNoFlow ?? ProgressStatics.DefaultContext; - Debug.Assert(m_synchronizationContext != null); - m_invokeHandlers = new SendOrPostCallback(InvokeHandlers); + _synchronizationContext = SynchronizationContext.Current ?? ProgressStatics.DefaultContext; + Debug.Assert(_synchronizationContext != null); + _invokeHandlers = new SendOrPostCallback(InvokeHandlers); } /// Initializes the with the specified callback. @@ -64,7 +50,7 @@ namespace System public Progress(Action handler) : this() { if (handler == null) throw new ArgumentNullException(nameof(handler)); - m_handler = handler; + _handler = handler; } /// Raised for each reported progress value. @@ -81,13 +67,13 @@ namespace System // If there's no handler, don't bother going through the sync context. // Inside the callback, we'll need to check again, in case // an event handler is removed between now and then. - Action handler = m_handler; + Action handler = _handler; EventHandler changedEvent = ProgressChanged; if (handler != null || changedEvent != null) { // Post the processing to the sync context. // (If T is a value type, it will get boxed here.) - m_synchronizationContext.Post(m_invokeHandlers, value); + _synchronizationContext.Post(_invokeHandlers, value); } } @@ -101,7 +87,7 @@ namespace System { T value = (T)state; - Action handler = m_handler; + Action handler = _handler; EventHandler changedEvent = ProgressChanged; if (handler != null) handler(value); diff --git a/src/coreclr/src/mscorlib/src/System/RankException.cs b/src/coreclr/src/mscorlib/src/System/RankException.cs index 8639bba..612d0f0 100644 --- a/src/coreclr/src/mscorlib/src/System/RankException.cs +++ b/src/coreclr/src/mscorlib/src/System/RankException.cs @@ -12,31 +12,31 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System.Runtime.Serialization; + +namespace System +{ [Serializable] public class RankException : SystemException { - public RankException() - : base(Environment.GetResourceString("Arg_RankException")) { - SetErrorCode(__HResults.COR_E_RANK); - } - - public RankException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_RANK); + public RankException() + : base(SR.Arg_RankException) + { + HResult = __HResults.COR_E_RANK; } - - public RankException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_RANK); + + public RankException(String message) + : base(message) + { + HResult = __HResults.COR_E_RANK; } - protected RankException(SerializationInfo info, StreamingContext context) : base(info, context) { + public RankException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_RANK; } + protected RankException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/StackOverflowException.cs b/src/coreclr/src/mscorlib/src/System/StackOverflowException.cs index 4a20527..0a875e7 100644 --- a/src/coreclr/src/mscorlib/src/System/StackOverflowException.cs +++ b/src/coreclr/src/mscorlib/src/System/StackOverflowException.cs @@ -11,30 +11,31 @@ ** =============================================================================*/ -namespace System { - - using System; - using System.Runtime.Serialization; - [System.Runtime.InteropServices.ComVisible(true)] +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - public sealed class StackOverflowException : SystemException { - public StackOverflowException() - : base(Environment.GetResourceString("Arg_StackOverflowException")) { - SetErrorCode(__HResults.COR_E_STACKOVERFLOW); - } - - public StackOverflowException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_STACKOVERFLOW); + public sealed class StackOverflowException : SystemException + { + public StackOverflowException() + : base(SR.Arg_StackOverflowException) + { + HResult = __HResults.COR_E_STACKOVERFLOW; } - - public StackOverflowException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_STACKOVERFLOW); + + public StackOverflowException(String message) + : base(message) + { + HResult = __HResults.COR_E_STACKOVERFLOW; } - internal StackOverflowException(SerializationInfo info, StreamingContext context) : base (info, context) { + public StackOverflowException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_STACKOVERFLOW; } - + + internal StackOverflowException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/StringComparison.cs b/src/coreclr/src/mscorlib/src/System/StringComparison.cs index aa83e39..c654f72 100644 --- a/src/coreclr/src/mscorlib/src/System/StringComparison.cs +++ b/src/coreclr/src/mscorlib/src/System/StringComparison.cs @@ -13,11 +13,12 @@ ** ** ===========================================================*/ -namespace System{ - + +namespace System +{ [Serializable] -[System.Runtime.InteropServices.ComVisible(true)] - public enum StringComparison { + public enum StringComparison + { CurrentCulture = 0, CurrentCultureIgnoreCase = 1, InvariantCulture = 2, diff --git a/src/coreclr/src/mscorlib/src/System/StringSplitOptions.cs b/src/coreclr/src/mscorlib/src/System/StringSplitOptions.cs index ae95aae..43b626a 100644 --- a/src/coreclr/src/mscorlib/src/System/StringSplitOptions.cs +++ b/src/coreclr/src/mscorlib/src/System/StringSplitOptions.cs @@ -2,15 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Runtime.InteropServices; - namespace System { - [ComVisible(false)] [Flags] public enum StringSplitOptions { None = 0, RemoveEmptyEntries = 1 } -} +} \ No newline at end of file diff --git a/src/coreclr/src/mscorlib/src/System/SystemException.cs b/src/coreclr/src/mscorlib/src/System/SystemException.cs index 8a54124..f4779a2 100644 --- a/src/coreclr/src/mscorlib/src/System/SystemException.cs +++ b/src/coreclr/src/mscorlib/src/System/SystemException.cs @@ -2,30 +2,31 @@ // 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 { - - using System; - using System.Runtime.Serialization; +using System.Runtime.Serialization; + +namespace System +{ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public class SystemException : Exception { - public SystemException() - : base(Environment.GetResourceString("Arg_SystemException")) { - SetErrorCode(__HResults.COR_E_SYSTEM); - } - - public SystemException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_SYSTEM); + public SystemException() + : base(SR.Arg_SystemException) + { + HResult = __HResults.COR_E_SYSTEM; } - - public SystemException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_SYSTEM); + + public SystemException(String message) + : base(message) + { + HResult = __HResults.COR_E_SYSTEM; } - protected SystemException(SerializationInfo info, StreamingContext context) : base(info, context) { + public SystemException(String message, Exception innerException) + : base(message, innerException) + { + HResult = __HResults.COR_E_SYSTEM; } + + protected SystemException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/ThreadAttributes.cs b/src/coreclr/src/mscorlib/src/System/ThreadAttributes.cs index bbd859c..6248736 100644 --- a/src/coreclr/src/mscorlib/src/System/ThreadAttributes.cs +++ b/src/coreclr/src/mscorlib/src/System/ThreadAttributes.cs @@ -4,16 +4,13 @@ /*============================================================================= ** -** -** ** Purpose: For Threads-related custom attributes. ** -** =============================================================================*/ -namespace System { - [AttributeUsage (AttributeTargets.Method)] -[System.Runtime.InteropServices.ComVisible(true)] +namespace System +{ + [AttributeUsage(AttributeTargets.Method)] public sealed class STAThreadAttribute : Attribute { public STAThreadAttribute() @@ -21,8 +18,7 @@ namespace System { } } - [AttributeUsage (AttributeTargets.Method)] -[System.Runtime.InteropServices.ComVisible(true)] + [AttributeUsage(AttributeTargets.Method)] public sealed class MTAThreadAttribute : Attribute { public MTAThreadAttribute() diff --git a/src/coreclr/src/mscorlib/src/System/ThreadStaticAttribute.cs b/src/coreclr/src/mscorlib/src/System/ThreadStaticAttribute.cs index 58842ee..3755e65 100644 --- a/src/coreclr/src/mscorlib/src/System/ThreadStaticAttribute.cs +++ b/src/coreclr/src/mscorlib/src/System/ThreadStaticAttribute.cs @@ -12,14 +12,14 @@ ** ** ===========================================================*/ -namespace System { - - using System; -[Serializable] +using System; + +namespace System +{ + [Serializable] [AttributeUsage(AttributeTargets.Field, Inherited = false)] -[System.Runtime.InteropServices.ComVisible(true)] - public class ThreadStaticAttribute : Attribute + public class ThreadStaticAttribute : Attribute { public ThreadStaticAttribute() { diff --git a/src/coreclr/src/mscorlib/src/System/TimeZoneNotFoundException.cs b/src/coreclr/src/mscorlib/src/System/TimeZoneNotFoundException.cs index cabcc15..ee21c25 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeZoneNotFoundException.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeZoneNotFoundException.cs @@ -2,22 +2,27 @@ // 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 { - using System.Runtime.Serialization; - using System.Runtime.CompilerServices; +using System.Runtime.Serialization; - [Serializable] - [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] - public class TimeZoneNotFoundException : Exception { - public TimeZoneNotFoundException(String message) - : base(message) { } +namespace System +{ + [Serializable] + public class TimeZoneNotFoundException : Exception + { + public TimeZoneNotFoundException() + { + } - public TimeZoneNotFoundException(String message, Exception innerException) - : base(message, innerException) { } + public TimeZoneNotFoundException(String message) + : base(message) + { + } - protected TimeZoneNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) { } + public TimeZoneNotFoundException(String message, Exception innerException) + : base(message, innerException) + { + } - public TimeZoneNotFoundException() { } - } + protected TimeZoneNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) { } + } } diff --git a/src/coreclr/src/mscorlib/src/System/TimeoutException.cs b/src/coreclr/src/mscorlib/src/System/TimeoutException.cs index 0b45f62..32775a1 100644 --- a/src/coreclr/src/mscorlib/src/System/TimeoutException.cs +++ b/src/coreclr/src/mscorlib/src/System/TimeoutException.cs @@ -11,35 +11,31 @@ ** =============================================================================*/ -namespace System -{ - using System.Runtime.Serialization; +using System.Runtime.Serialization; +namespace System +{ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] - public class TimeoutException : SystemException { - - public TimeoutException() - : base(Environment.GetResourceString("Arg_TimeoutException")) { - SetErrorCode(__HResults.COR_E_TIMEOUT); + public class TimeoutException : SystemException + { + public TimeoutException() + : base(SR.Arg_TimeoutException) + { + HResult = __HResults.COR_E_TIMEOUT; } - - public TimeoutException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_TIMEOUT); + + public TimeoutException(String message) + : base(message) + { + HResult = __HResults.COR_E_TIMEOUT; } - + public TimeoutException(String message, Exception innerException) - : base(message, innerException) { - SetErrorCode(__HResults.COR_E_TIMEOUT); - } - - // - //This constructor is required for serialization. - // - protected TimeoutException(SerializationInfo info, StreamingContext context) - : base(info, context) { + : base(message, innerException) + { + HResult = __HResults.COR_E_TIMEOUT; } + + protected TimeoutException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } - diff --git a/src/coreclr/src/mscorlib/src/System/TupleExtensions.cs b/src/coreclr/src/mscorlib/src/System/TupleExtensions.cs index 27a8760..b63cb41 100644 --- a/src/coreclr/src/mscorlib/src/System/TupleExtensions.cs +++ b/src/coreclr/src/mscorlib/src/System/TupleExtensions.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using System.ComponentModel; - using System.Runtime.CompilerServices; namespace System diff --git a/src/coreclr/src/mscorlib/src/System/TypeAccessException.cs b/src/coreclr/src/mscorlib/src/System/TypeAccessException.cs index 5ddc9a7..32afbdf 100644 --- a/src/coreclr/src/mscorlib/src/System/TypeAccessException.cs +++ b/src/coreclr/src/mscorlib/src/System/TypeAccessException.cs @@ -2,9 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. - using System.Runtime.Serialization; -using System.Security; namespace System { @@ -14,27 +12,23 @@ namespace System public class TypeAccessException : TypeLoadException { public TypeAccessException() - : base(Environment.GetResourceString("Arg_TypeAccessException")) + : base(SR.Arg_TypeAccessException) { - SetErrorCode(__HResults.COR_E_TYPEACCESS); + HResult = __HResults.COR_E_TYPEACCESS; } - public TypeAccessException(string message) + public TypeAccessException(string message) : base(message) { - SetErrorCode(__HResults.COR_E_TYPEACCESS); + HResult = __HResults.COR_E_TYPEACCESS; } - - public TypeAccessException(string message, Exception inner) + + public TypeAccessException(string message, Exception inner) : base(message, inner) { - SetErrorCode(__HResults.COR_E_TYPEACCESS); + HResult = __HResults.COR_E_TYPEACCESS; } - - protected TypeAccessException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - SetErrorCode(__HResults.COR_E_TYPEACCESS); - } + + protected TypeAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/TypeCode.cs b/src/coreclr/src/mscorlib/src/System/TypeCode.cs index bf71c2f..293eb1f 100644 --- a/src/coreclr/src/mscorlib/src/System/TypeCode.cs +++ b/src/coreclr/src/mscorlib/src/System/TypeCode.cs @@ -20,10 +20,12 @@ // These types of values are instead represented as classes. When the type code // of an object is TypeCode.Object, a further instance-of check can be used to // determine if the object is one of these values. -namespace System { + +namespace System +{ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] - public enum TypeCode { + public enum TypeCode + { Empty = 0, // Null reference Object = 1, // Instance that isn't a value DBNull = 2, // Database null value @@ -44,5 +46,3 @@ namespace System { String = 18, // Unicode character string } } - - diff --git a/src/coreclr/src/mscorlib/src/System/TypeInitializationException.cs b/src/coreclr/src/mscorlib/src/System/TypeInitializationException.cs index bcc1c3e..9191028 100644 --- a/src/coreclr/src/mscorlib/src/System/TypeInitializationException.cs +++ b/src/coreclr/src/mscorlib/src/System/TypeInitializationException.cs @@ -13,53 +13,67 @@ ** ** =============================================================================*/ -using System; -using System.Runtime.Serialization; + using System.Globalization; -using System.Security.Permissions; +using System.Runtime.Serialization; -namespace System { +namespace System +{ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] - public sealed class TypeInitializationException : SystemException { + public sealed class TypeInitializationException : SystemException + { private String _typeName; // This exception is not creatable without specifying the // inner exception. private TypeInitializationException() - : base(Environment.GetResourceString("TypeInitialization_Default")) { - SetErrorCode(__HResults.COR_E_TYPEINITIALIZATION); + : base(SR.TypeInitialization_Default) + { + HResult = __HResults.COR_E_TYPEINITIALIZATION; + } + + + public TypeInitializationException(String fullTypeName, Exception innerException) + : this(fullTypeName, SR.Format(SR.TypeInitialization_Type, fullTypeName), innerException) + { } // This is called from within the runtime. I believe this is necessary // for Interop only, though it's not particularly useful. - private TypeInitializationException(String message) : base(message) { - SetErrorCode(__HResults.COR_E_TYPEINITIALIZATION); + internal TypeInitializationException(String message) : base(message) + { + HResult = __HResults.COR_E_TYPEINITIALIZATION; } - - public TypeInitializationException(String fullTypeName, Exception innerException) : base(Environment.GetResourceString("TypeInitialization_Type", fullTypeName), innerException) { + + internal TypeInitializationException(String fullTypeName, String message, Exception innerException) + : base(message, innerException) + { _typeName = fullTypeName; - SetErrorCode(__HResults.COR_E_TYPEINITIALIZATION); + HResult = __HResults.COR_E_TYPEINITIALIZATION; } - internal TypeInitializationException(SerializationInfo info, StreamingContext context) : base(info, context) { + internal TypeInitializationException(SerializationInfo info, StreamingContext context) + : base(info, context) + { _typeName = info.GetString("TypeName"); } + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue("TypeName", TypeName, typeof(String)); + } + public String TypeName { - get { - if (_typeName == null) { + get + { + if (_typeName == null) + { return String.Empty; } return _typeName; } } - - public override void GetObjectData(SerializationInfo info, StreamingContext context) { - base.GetObjectData(info, context); - info.AddValue("TypeName",TypeName,typeof(String)); - } - } } diff --git a/src/coreclr/src/mscorlib/src/System/UnauthorizedAccessException.cs b/src/coreclr/src/mscorlib/src/System/UnauthorizedAccessException.cs index 07e95d5..9973588 100644 --- a/src/coreclr/src/mscorlib/src/System/UnauthorizedAccessException.cs +++ b/src/coreclr/src/mscorlib/src/System/UnauthorizedAccessException.cs @@ -13,31 +13,33 @@ ** ===========================================================*/ -using System; using System.Runtime.Serialization; -namespace System { +namespace System +{ // The UnauthorizedAccessException is thrown when access errors // occur from IO or other OS methods. [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] - public class UnauthorizedAccessException : SystemException { - public UnauthorizedAccessException() - : base(Environment.GetResourceString("Arg_UnauthorizedAccessException")) { - SetErrorCode(__HResults.COR_E_UNAUTHORIZEDACCESS); + public class UnauthorizedAccessException : SystemException + { + public UnauthorizedAccessException() + : base(SR.Arg_UnauthorizedAccessException) + { + HResult = __HResults.COR_E_UNAUTHORIZEDACCESS; } - - public UnauthorizedAccessException(String message) - : base(message) { - SetErrorCode(__HResults.COR_E_UNAUTHORIZEDACCESS); - } - - public UnauthorizedAccessException(String message, Exception inner) - : base(message, inner) { - SetErrorCode(__HResults.COR_E_UNAUTHORIZEDACCESS); + + public UnauthorizedAccessException(String message) + : base(message) + { + HResult = __HResults.COR_E_UNAUTHORIZEDACCESS; } - protected UnauthorizedAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { + public UnauthorizedAccessException(String message, Exception inner) + : base(message, inner) + { + HResult = __HResults.COR_E_UNAUTHORIZEDACCESS; } + + protected UnauthorizedAccessException(SerializationInfo info, StreamingContext context) : base(info, context) { } } } diff --git a/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventArgs.cs b/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventArgs.cs index e155ffc..d338301 100644 --- a/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventArgs.cs +++ b/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventArgs.cs @@ -2,28 +2,28 @@ // 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 { - - using System; - using System.Runtime.ConstrainedExecution; - +namespace System +{ [Serializable] -[System.Runtime.InteropServices.ComVisible(true)] - public class UnhandledExceptionEventArgs : EventArgs { - private Object _Exception; - private bool _IsTerminating; + public class UnhandledExceptionEventArgs : EventArgs + { + private Object _exception; + private bool _isTerminating; - public UnhandledExceptionEventArgs(Object exception, bool isTerminating) { - _Exception = exception; - _IsTerminating = isTerminating; + public UnhandledExceptionEventArgs(Object exception, bool isTerminating) + { + _exception = exception; + _isTerminating = isTerminating; } - public Object ExceptionObject { - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - get { return _Exception; } + + public Object ExceptionObject + { + get { return _exception; } } - public bool IsTerminating { - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - get { return _IsTerminating; } + + public bool IsTerminating + { + get { return _isTerminating; } } } } diff --git a/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventHandler.cs b/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventHandler.cs index 8c27982..b99414c 100644 --- a/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventHandler.cs +++ b/src/coreclr/src/mscorlib/src/System/UnhandledExceptionEventHandler.cs @@ -2,10 +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. -namespace System { - - using System; +namespace System +{ [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] public delegate void UnhandledExceptionEventHandler(Object sender, UnhandledExceptionEventArgs e); } diff --git a/src/coreclr/src/mscorlib/src/System/Void.cs b/src/coreclr/src/mscorlib/src/System/Void.cs index 51df878..5c20f63 100644 --- a/src/coreclr/src/mscorlib/src/System/Void.cs +++ b/src/coreclr/src/mscorlib/src/System/Void.cs @@ -7,12 +7,11 @@ // This class represents the void return type //////////////////////////////////////////////////////////////////////////////// -namespace System { - - using System; +namespace System +{ + // This class represents the void return type [Serializable] - [System.Runtime.InteropServices.ComVisible(true)] - public struct Void + public struct Void { } } -- 2.7.4