summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtsushi Kanamori <AtsushiKan@users.noreply.github.com>2017-03-22 10:51:46 -0700
committerGitHub <noreply@github.com>2017-03-22 10:51:46 -0700
commit2e970d8c53b4750c46ea00ea4c044af57e6b53df (patch)
treecd0323dc7e9757f57771e84f0749c2dd74d7a5d6
parentb94328c2428ce27aa4b813faf6c4a2ebd25822f1 (diff)
downloadcoreclr-2e970d8c53b4750c46ea00ea4c044af57e6b53df.tar.gz
coreclr-2e970d8c53b4750c46ea00ea4c044af57e6b53df.tar.bz2
coreclr-2e970d8c53b4750c46ea00ea4c044af57e6b53df.zip
Reconcile the "easy" System\Reflection .cs files with their CoreRT versions. (#10387)
Files to be moved the shared partition (after CoreRT side is in) AmbiguousMatchException.cs AssemblyAttributes.cs AssemblyContentType.cs AssemblyNameFlags.cs Binder.cs BindingFlags.cs CallingConventions.cs CustomAttributeFormatException.cs DefaultMemberAttribute.cs EventAttributes.cs ExceptionHandlingClauseOptions.cs FieldAttributes.cs GenericParameterAttributes.cs ICustomAttributeProvider.cs ImageFileMachine.cs InterfaceMapping.cs IntrospectionExtensions.cs InvalidFilterCriteriaException.cs IReflectableType.cs ManifestResourceInfo.cs MemberFilter.cs MemberTypes.cs MethodAttributes.cs MethodImplAttributes.cs Missing.cs ModuleResolveEventHandler.cs ParameterAttributes.cs ParameterModifier.cs PortableExecutableKinds.cs ProcessorArchitecture.cs PropertyAttributes.cs ReflectionContext.cs ReflectionTypeLoadException.cs ResourceAttributes.cs ResourceLocation.cs StrongNameKeyPair.cs TargetException.cs TargetInvocationException.cs TargetParameterCountException.cs TypeAttributes.cs TypeFilter.cs
-rw-r--r--src/mscorlib/System.Private.CoreLib.csproj6
-rw-r--r--src/mscorlib/src/System/Reflection/AmbiguousMatchException.cs28
-rw-r--r--src/mscorlib/src/System/Reflection/AssemblyAttributes.cs254
-rw-r--r--src/mscorlib/src/System/Reflection/AssemblyContentType.cs13
-rw-r--r--src/mscorlib/src/System/Reflection/AssemblyNameFlags.cs36
-rw-r--r--src/mscorlib/src/System/Reflection/Binder.cs48
-rw-r--r--src/mscorlib/src/System/Reflection/BindingFlags.cs30
-rw-r--r--src/mscorlib/src/System/Reflection/CallingConventions.cs13
-rw-r--r--src/mscorlib/src/System/Reflection/CustomAttributeFormatException.cs28
-rw-r--r--src/mscorlib/src/System/Reflection/DefaultMemberAttribute.cs26
-rw-r--r--src/mscorlib/src/System/Reflection/EventAttributes.cs18
-rw-r--r--src/mscorlib/src/System/Reflection/ExceptionHandlingClause.cs93
-rw-r--r--src/mscorlib/src/System/Reflection/ExceptionHandlingClauseOptions.cs16
-rw-r--r--src/mscorlib/src/System/Reflection/FieldAttributes.cs9
-rw-r--r--src/mscorlib/src/System/Reflection/GenericParameterAttributes.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/ICustomAttributeProvider.cs25
-rw-r--r--src/mscorlib/src/System/Reflection/IReflectableType.cs12
-rw-r--r--src/mscorlib/src/System/Reflection/ImageFileMachine.cs2
-rw-r--r--src/mscorlib/src/System/Reflection/InterfaceMapping.cs19
-rw-r--r--src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs23
-rw-r--r--src/mscorlib/src/System/Reflection/InvalidFilterCriteriaException.cs30
-rw-r--r--src/mscorlib/src/System/Reflection/LocalVariableInfo.cs38
-rw-r--r--src/mscorlib/src/System/Reflection/ManifestResourceInfo.cs63
-rw-r--r--src/mscorlib/src/System/Reflection/MemberFilter.cs15
-rw-r--r--src/mscorlib/src/System/Reflection/MemberTypes.cs19
-rw-r--r--src/mscorlib/src/System/Reflection/MethodAttributes.cs10
-rw-r--r--src/mscorlib/src/System/Reflection/MethodBody.cs129
-rw-r--r--src/mscorlib/src/System/Reflection/MethodImplAttributes.cs8
-rw-r--r--src/mscorlib/src/System/Reflection/Missing.cs11
-rw-r--r--src/mscorlib/src/System/Reflection/ModuleResolveEventHandler.cs4
-rw-r--r--src/mscorlib/src/System/Reflection/ParameterAttributes.cs22
-rw-r--r--src/mscorlib/src/System/Reflection/ParameterModifier.cs24
-rw-r--r--src/mscorlib/src/System/Reflection/PortableExecutableKinds.cs2
-rw-r--r--src/mscorlib/src/System/Reflection/ProcessorArchitecture.cs16
-rw-r--r--src/mscorlib/src/System/Reflection/PropertyAttributes.cs21
-rw-r--r--src/mscorlib/src/System/Reflection/ReflectionContext.cs14
-rw-r--r--src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs67
-rw-r--r--src/mscorlib/src/System/Reflection/ResourceAttributes.cs13
-rw-r--r--src/mscorlib/src/System/Reflection/ResourceLocation.cs15
-rw-r--r--src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs30
-rw-r--r--src/mscorlib/src/System/Reflection/TargetException.cs29
-rw-r--r--src/mscorlib/src/System/Reflection/TargetInvocationException.cs40
-rw-r--r--src/mscorlib/src/System/Reflection/TargetParameterCountException.cs28
-rw-r--r--src/mscorlib/src/System/Reflection/TypeAttributes.cs7
-rw-r--r--src/mscorlib/src/System/Reflection/TypeFilter.cs13
45 files changed, 410 insertions, 961 deletions
diff --git a/src/mscorlib/System.Private.CoreLib.csproj b/src/mscorlib/System.Private.CoreLib.csproj
index d72dd0b8ab..9ca26e5fe3 100644
--- a/src/mscorlib/System.Private.CoreLib.csproj
+++ b/src/mscorlib/System.Private.CoreLib.csproj
@@ -437,6 +437,7 @@
<Compile Include="$(BclSourcesRoot)\System\Reflection\AmbiguousMatchException.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Assembly.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyAttributes.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyContentType.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyName.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\AssemblyNameFlags.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Associates.cs" />
@@ -449,6 +450,8 @@
<Compile Include="$(BclSourcesRoot)\System\Reflection\CustomAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\DefaultMemberAttribute.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\EventAttributes.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\ExceptionHandlingClause.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\ExceptionHandlingClauseOptions.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\FieldAttributes.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\FieldInfo.CoreCLR.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\GenericParameterAttributes.cs" />
@@ -461,6 +464,7 @@
<Compile Include="$(BclSourcesRoot)\System\Reflection\INVOCATION_FLAGS.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\IReflect.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\LoaderAllocator.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\LocalVariableInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\ManifestResourceInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MdConstant.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\MdFieldInfo.cs" />
@@ -479,10 +483,12 @@
<Compile Include="$(BclSourcesRoot)\System\Reflection\ParameterModifier.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\Pointer.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\PortableExecutableKinds.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\ProcessorArchitecture.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\PropertyAttributes.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\ReflectionContext.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\ReflectionTypeLoadException.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\ResourceAttributes.cs" />
+ <Compile Include="$(BclSourcesRoot)\System\Reflection\ResourceLocation.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RtFieldInfo.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeAssembly.cs" />
<Compile Include="$(BclSourcesRoot)\System\Reflection\RuntimeConstructorInfo.cs" />
diff --git a/src/mscorlib/src/System/Reflection/AmbiguousMatchException.cs b/src/mscorlib/src/System/Reflection/AmbiguousMatchException.cs
index 11abf8ddda..07b2323dd4 100644
--- a/src/mscorlib/src/System/Reflection/AmbiguousMatchException.cs
+++ b/src/mscorlib/src/System/Reflection/AmbiguousMatchException.cs
@@ -2,40 +2,26 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// AmbiguousMatchException is thrown when binding to a method results in more
-//
-// than one method matching the binding criteria. This exception is thrown in
-// general when something is Ambiguous.
-//
-//
-//
-//
+using System.Runtime.Serialization;
namespace System.Reflection
{
- using System;
- using SystemException = System.SystemException;
- using System.Runtime.Serialization;
[Serializable]
public sealed class AmbiguousMatchException : SystemException
{
- public AmbiguousMatchException()
- : base(SR.RFLCT_Ambiguous)
+ public AmbiguousMatchException() : base(SR.RFLCT_Ambiguous)
{
- SetErrorCode(__HResults.COR_E_AMBIGUOUSMATCH);
+ HResult = __HResults.COR_E_AMBIGUOUSMATCH;
}
- public AmbiguousMatchException(String message) : base(message)
+ public AmbiguousMatchException(string message) : base(message)
{
- SetErrorCode(__HResults.COR_E_AMBIGUOUSMATCH);
+ HResult = __HResults.COR_E_AMBIGUOUSMATCH;
}
- public AmbiguousMatchException(String message, Exception inner) : base(message, inner)
+ public AmbiguousMatchException(string message, Exception inner) : base(message, inner)
{
- SetErrorCode(__HResults.COR_E_AMBIGUOUSMATCH);
+ HResult = __HResults.COR_E_AMBIGUOUSMATCH;
}
internal AmbiguousMatchException(SerializationInfo info, StreamingContext context) : base(info, context)
diff --git a/src/mscorlib/src/System/Reflection/AssemblyAttributes.cs b/src/mscorlib/src/System/Reflection/AssemblyAttributes.cs
index fc1d025240..1554403350 100644
--- a/src/mscorlib/src/System/Reflection/AssemblyAttributes.cs
+++ b/src/mscorlib/src/System/Reflection/AssemblyAttributes.cs
@@ -2,388 +2,258 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*=============================================================================
-**
-**
-**
-**
-**
-** Purpose: For Assembly-related custom attributes.
-**
-**
-=============================================================================*/
-
-
-using System;
using System.Configuration.Assemblies;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyCopyrightAttribute : Attribute
{
- private String m_copyright;
-
- public AssemblyCopyrightAttribute(String copyright)
+ public AssemblyCopyrightAttribute(string copyright)
{
- m_copyright = copyright;
+ Copyright = copyright;
}
- public String Copyright
- {
- get { return m_copyright; }
- }
+ public string Copyright { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyTrademarkAttribute : Attribute
{
- private String m_trademark;
-
- public AssemblyTrademarkAttribute(String trademark)
+ public AssemblyTrademarkAttribute(string trademark)
{
- m_trademark = trademark;
+ Trademark = trademark;
}
- public String Trademark
- {
- get { return m_trademark; }
- }
+ public string Trademark { get; }
}
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyProductAttribute : Attribute
{
- private String m_product;
-
- public AssemblyProductAttribute(String product)
+ public AssemblyProductAttribute(string product)
{
- m_product = product;
+ Product = product;
}
- public String Product
- {
- get { return m_product; }
- }
+ public string Product { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyCompanyAttribute : Attribute
{
- private String m_company;
-
- public AssemblyCompanyAttribute(String company)
+ public AssemblyCompanyAttribute(string company)
{
- m_company = company;
+ Company = company;
}
- public String Company
- {
- get { return m_company; }
- }
+ public string Company { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyDescriptionAttribute : Attribute
{
- private String m_description;
-
- public AssemblyDescriptionAttribute(String description)
+ public AssemblyDescriptionAttribute(string description)
{
- m_description = description;
+ Description = description;
}
- public String Description
- {
- get { return m_description; }
- }
+ public string Description { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyTitleAttribute : Attribute
{
- private String m_title;
-
- public AssemblyTitleAttribute(String title)
+ public AssemblyTitleAttribute(string title)
{
- m_title = title;
+ Title = title;
}
- public String Title
- {
- get { return m_title; }
- }
+ public string Title { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyConfigurationAttribute : Attribute
{
- private String m_configuration;
-
- public AssemblyConfigurationAttribute(String configuration)
+ public AssemblyConfigurationAttribute(string configuration)
{
- m_configuration = configuration;
+ Configuration = configuration;
}
- public String Configuration
- {
- get { return m_configuration; }
- }
+ public string Configuration { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyDefaultAliasAttribute : Attribute
{
- private String m_defaultAlias;
-
- public AssemblyDefaultAliasAttribute(String defaultAlias)
+ public AssemblyDefaultAliasAttribute(string defaultAlias)
{
- m_defaultAlias = defaultAlias;
+ DefaultAlias = defaultAlias;
}
- public String DefaultAlias
- {
- get { return m_defaultAlias; }
- }
+ public string DefaultAlias { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyInformationalVersionAttribute : Attribute
{
- private String m_informationalVersion;
-
- public AssemblyInformationalVersionAttribute(String informationalVersion)
+ public AssemblyInformationalVersionAttribute(string informationalVersion)
{
- m_informationalVersion = informationalVersion;
+ InformationalVersion = informationalVersion;
}
- public String InformationalVersion
- {
- get { return m_informationalVersion; }
- }
+ public string InformationalVersion { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyFileVersionAttribute : Attribute
{
- private String _version;
-
- public AssemblyFileVersionAttribute(String version)
+ public AssemblyFileVersionAttribute(string version)
{
if (version == null)
throw new ArgumentNullException(nameof(version));
- Contract.EndContractBlock();
- _version = version;
+ Version = version;
}
- public String Version
- {
- get { return _version; }
- }
+ public string Version { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public unsafe sealed class AssemblyCultureAttribute : Attribute
{
- private String m_culture;
-
- public AssemblyCultureAttribute(String culture)
+ public AssemblyCultureAttribute(string culture)
{
- m_culture = culture;
+ Culture = culture;
}
- public String Culture
- {
- get { return m_culture; }
- }
+ public string Culture { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public unsafe sealed class AssemblyVersionAttribute : Attribute
{
- private String m_version;
-
- public AssemblyVersionAttribute(String version)
+ public AssemblyVersionAttribute(string version)
{
- m_version = version;
+ Version = version;
}
- public String Version
- {
- get { return m_version; }
- }
+ public string Version { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyKeyFileAttribute : Attribute
{
- private String m_keyFile;
-
- public AssemblyKeyFileAttribute(String keyFile)
+ public AssemblyKeyFileAttribute(string keyFile)
{
- m_keyFile = keyFile;
+ KeyFile = keyFile;
}
- public String KeyFile
- {
- get { return m_keyFile; }
- }
+ public string KeyFile { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyDelaySignAttribute : Attribute
{
- private bool m_delaySign;
-
public AssemblyDelaySignAttribute(bool delaySign)
{
- m_delaySign = delaySign;
+ DelaySign = delaySign;
}
- public bool DelaySign
- {
- get
- { return m_delaySign; }
- }
+ public bool DelaySign { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public unsafe sealed class AssemblyAlgorithmIdAttribute : Attribute
{
- private uint m_algId;
-
public AssemblyAlgorithmIdAttribute(AssemblyHashAlgorithm algorithmId)
{
- m_algId = (uint)algorithmId;
+ AlgorithmId = (uint)algorithmId;
}
[CLSCompliant(false)]
public AssemblyAlgorithmIdAttribute(uint algorithmId)
{
- m_algId = algorithmId;
+ AlgorithmId = algorithmId;
}
[CLSCompliant(false)]
- public uint AlgorithmId
- {
- get { return m_algId; }
- }
+ public uint AlgorithmId { get; }
}
-
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public unsafe sealed class AssemblyFlagsAttribute : Attribute
{
- private AssemblyNameFlags m_flags;
+ private AssemblyNameFlags _flags;
[Obsolete("This constructor has been deprecated. Please use AssemblyFlagsAttribute(AssemblyNameFlags) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[CLSCompliant(false)]
public AssemblyFlagsAttribute(uint flags)
{
- m_flags = (AssemblyNameFlags)flags;
+ _flags = (AssemblyNameFlags)flags;
}
[Obsolete("This property has been deprecated. Please use AssemblyFlags instead. http://go.microsoft.com/fwlink/?linkid=14202")]
[CLSCompliant(false)]
public uint Flags
{
- get { return (uint)m_flags; }
+ get { return (uint)_flags; }
}
- // This, of course, should be typed as AssemblyNameFlags. The compat police don't allow such changes.
public int AssemblyFlags
{
- get { return (int)m_flags; }
+ get { return (int)_flags; }
}
[Obsolete("This constructor has been deprecated. Please use AssemblyFlagsAttribute(AssemblyNameFlags) instead. http://go.microsoft.com/fwlink/?linkid=14202")]
public AssemblyFlagsAttribute(int assemblyFlags)
{
- m_flags = (AssemblyNameFlags)assemblyFlags;
+ _flags = (AssemblyNameFlags)assemblyFlags;
}
-
public AssemblyFlagsAttribute(AssemblyNameFlags assemblyFlags)
{
- m_flags = assemblyFlags;
+ _flags = assemblyFlags;
}
}
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
public sealed class AssemblyMetadataAttribute : Attribute
{
- private String m_key;
- private String m_value;
-
public AssemblyMetadataAttribute(string key, string value)
{
- m_key = key;
- m_value = value;
+ Key = key;
+ Value = value;
}
- public string Key
- {
- get { return m_key; }
- }
+ public string Key { get; }
- public string Value
- {
- get { return m_value; }
- }
+ public string Value { get; }
}
[AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)]
public sealed class AssemblySignatureKeyAttribute : Attribute
{
- private String _publicKey;
- private String _countersignature;
-
- public AssemblySignatureKeyAttribute(String publicKey, String countersignature)
+ public AssemblySignatureKeyAttribute(string publicKey, string countersignature)
{
- _publicKey = publicKey;
- _countersignature = countersignature;
+ PublicKey = publicKey;
+ Countersignature = countersignature;
}
- public String PublicKey
- {
- get { return _publicKey; }
- }
+ public string PublicKey { get; }
- public String Countersignature
- {
- get { return _countersignature; }
- }
+ public string Countersignature { get; }
}
[AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
public sealed class AssemblyKeyNameAttribute : Attribute
{
- private String m_keyName;
-
- public AssemblyKeyNameAttribute(String keyName)
+ public AssemblyKeyNameAttribute(string keyName)
{
- m_keyName = keyName;
+ KeyName = keyName;
}
- public String KeyName
- {
- get { return m_keyName; }
- }
+ public string KeyName { get; }
}
}
diff --git a/src/mscorlib/src/System/Reflection/AssemblyContentType.cs b/src/mscorlib/src/System/Reflection/AssemblyContentType.cs
new file mode 100644
index 0000000000..2ee1a00818
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/AssemblyContentType.cs
@@ -0,0 +1,13 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Reflection
+{
+ public enum AssemblyContentType
+ {
+ Default = 0,
+ WindowsRuntime = 1,
+ }
+}
+
diff --git a/src/mscorlib/src/System/Reflection/AssemblyNameFlags.cs b/src/mscorlib/src/System/Reflection/AssemblyNameFlags.cs
index dd4fc4baf4..d321032031 100644
--- a/src/mscorlib/src/System/Reflection/AssemblyNameFlags.cs
+++ b/src/mscorlib/src/System/Reflection/AssemblyNameFlags.cs
@@ -2,25 +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: Flags controlling how an AssemblyName is used
-** during binding
-**
-**
-===========================================================*/
-
-using System;
-
namespace System.Reflection
{
- [Serializable]
- [FlagsAttribute()]
+ [Flags]
public enum AssemblyNameFlags
{
None = 0x0000,
@@ -34,22 +18,4 @@ namespace System.Reflection
Retargetable = 0x0100,
//ContentType = 0x0E00, // Bits describing the ContentType are accessible via AssemblyName.ContentType
}
-
- [Serializable]
- public enum AssemblyContentType
- {
- Default = 0x0000,
- WindowsRuntime = 0x0001
- }
-
- [Serializable]
- public enum ProcessorArchitecture
- {
- None = 0x0000,
- MSIL = 0x0001,
- X86 = 0x0002,
- IA64 = 0x0003,
- Amd64 = 0x0004,
- Arm = 0x0005
- }
}
diff --git a/src/mscorlib/src/System/Reflection/Binder.cs b/src/mscorlib/src/System/Reflection/Binder.cs
index 002e9e1d41..3dc5665d52 100644
--- a/src/mscorlib/src/System/Reflection/Binder.cs
+++ b/src/mscorlib/src/System/Reflection/Binder.cs
@@ -2,50 +2,18 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-// This interface defines a set of methods which interact with reflection
-// during the binding process. This control allows systems to apply language
-// specific semantics to the binding and invocation process.
-//
-//
+using System.Globalization;
namespace System.Reflection
{
- using System;
- using System.Runtime.InteropServices;
- using CultureInfo = System.Globalization.CultureInfo;
-
- [Serializable]
public abstract class Binder
{
- // Given a set of methods that match the basic criteria, select a method to
- // invoke. When this method is finished, we should have
- public abstract MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref Object[] args,
- ParameterModifier[] modifiers, CultureInfo culture, String[] names, out Object state);
-
- // Given a set of methods that match the basic criteria, select a method to
- // invoke. When this method is finished, we should have
- public abstract FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match,
- Object value, CultureInfo culture);
-
- // Given a set of methods that match the base criteria, select a method based
- // upon an array of types. This method should return null if no method matchs
- // the criteria.
- public abstract MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match,
- Type[] types, ParameterModifier[] modifiers);
-
-
- // Given a set of propreties that match the base criteria, select one.
- public abstract PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match,
- Type returnType, Type[] indexes, ParameterModifier[] modifiers);
-
- // ChangeType
- // This method will convert the value into the property type.
- // It throws a cast exception if this fails.
- public abstract Object ChangeType(Object value, Type type, CultureInfo culture);
-
- public abstract void ReorderArgumentArray(ref Object[] args, Object state);
+ protected Binder() { }
+ public abstract FieldInfo BindToField(BindingFlags bindingAttr, FieldInfo[] match, object value, CultureInfo culture);
+ public abstract MethodBase BindToMethod(BindingFlags bindingAttr, MethodBase[] match, ref object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] names, out object state);
+ public abstract object ChangeType(object value, Type type, CultureInfo culture);
+ public abstract void ReorderArgumentArray(ref object[] args, object state);
+ public abstract MethodBase SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[] modifiers);
+ public abstract PropertyInfo SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type returnType, Type[] indexes, ParameterModifier[] modifiers);
}
}
diff --git a/src/mscorlib/src/System/Reflection/BindingFlags.cs b/src/mscorlib/src/System/Reflection/BindingFlags.cs
index 45f7f662df..26c875d0f9 100644
--- a/src/mscorlib/src/System/Reflection/BindingFlags.cs
+++ b/src/mscorlib/src/System/Reflection/BindingFlags.cs
@@ -2,22 +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.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// BindingFlags are a set of flags that control the binding and invocation process
-//
-// in Reflection. There are two processes. The first is selection of a Member which
-// is the binding phase. The second, is invocation. These flags control how this
-// process works.
-//
-//
-
-using System;
-
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum BindingFlags
{
@@ -28,13 +14,13 @@ namespace System.Reflection
Default = 0x00,
// These flags indicate what to search for when binding
- IgnoreCase = 0x01, // Ignore the case of Names while searching
+ IgnoreCase = 0x01, // Ignore the case of Names while searching
DeclaredOnly = 0x02, // Only look at the members declared on the Type
- Instance = 0x04, // Include Instance members in search
- Static = 0x08, // Include Static members in search
- Public = 0x10, // Include Public members in search
- NonPublic = 0x20, // Include Non-Public members in search
- FlattenHierarchy = 0x40, // Rollup the statics into the class.
+ Instance = 0x04, // Include Instance members in search
+ Static = 0x08, // Include Static members in search
+ Public = 0x10, // Include Public members in search
+ NonPublic = 0x20, // Include Non-Public members in search
+ FlattenHierarchy = 0x40, // Rollup the statics into the class.
// These flags are used by InvokeMember to determine
// what type of member we are trying to Invoke.
@@ -51,7 +37,7 @@ namespace System.Reflection
PutDispProperty = 0x4000,
PutRefDispProperty = 0x8000,
- ExactBinding = 0x010000, // Bind with Exact Type matching, No Change type
+ ExactBinding = 0x010000, // Bind with Exact Type matching, No Change type
SuppressChangeType = 0x020000,
// DefaultValueBinding will return the set of methods having ArgCount or
@@ -59,6 +45,6 @@ namespace System.Reflection
OptionalParamBinding = 0x040000,
// These are a couple of misc attributes used
- IgnoreReturn = 0x01000000, // This is used in COM Interop
+ IgnoreReturn = 0x01000000, // This is used in COM Interop
}
}
diff --git a/src/mscorlib/src/System/Reflection/CallingConventions.cs b/src/mscorlib/src/System/Reflection/CallingConventions.cs
index 2fbf2f3362..bb6d6cd809 100644
--- a/src/mscorlib/src/System/Reflection/CallingConventions.cs
+++ b/src/mscorlib/src/System/Reflection/CallingConventions.cs
@@ -2,21 +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.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// CallingConventions is a set of Bits representing the calling conventions
-//
-// in the system.
-//
-//
-
-using System.Runtime.InteropServices;
-using System;
+// CallingConventions is a set of Bits representing the calling conventions in the system.
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum CallingConventions
{
diff --git a/src/mscorlib/src/System/Reflection/CustomAttributeFormatException.cs b/src/mscorlib/src/System/Reflection/CustomAttributeFormatException.cs
index 7f88e0c286..47752af5a6 100644
--- a/src/mscorlib/src/System/Reflection/CustomAttributeFormatException.cs
+++ b/src/mscorlib/src/System/Reflection/CustomAttributeFormatException.cs
@@ -2,41 +2,29 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// CustomAttributeFormatException is thrown when the binary format of a
-//
-// custom attribute is invalid.
-//
-//
+using System.Runtime.Serialization;
namespace System.Reflection
{
- using System;
- using ApplicationException = System.ApplicationException;
- using System.Runtime.Serialization;
[Serializable]
public class CustomAttributeFormatException : FormatException
{
public CustomAttributeFormatException()
- : base(SR.Arg_CustomAttributeFormatException)
+ : this(SR.Arg_CustomAttributeFormatException)
{
- SetErrorCode(__HResults.COR_E_CUSTOMATTRIBUTEFORMAT);
}
- public CustomAttributeFormatException(String message) : base(message)
+ public CustomAttributeFormatException(string message)
+ : this(message, null)
{
- SetErrorCode(__HResults.COR_E_CUSTOMATTRIBUTEFORMAT);
}
- public CustomAttributeFormatException(String message, Exception inner) : base(message, inner)
+ public CustomAttributeFormatException(string message, Exception inner)
+ : base(message, inner)
{
- SetErrorCode(__HResults.COR_E_CUSTOMATTRIBUTEFORMAT);
+ HResult = __HResults.COR_E_CUSTOMATTRIBUTEFORMAT;
}
- protected CustomAttributeFormatException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ protected CustomAttributeFormatException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
diff --git a/src/mscorlib/src/System/Reflection/DefaultMemberAttribute.cs b/src/mscorlib/src/System/Reflection/DefaultMemberAttribute.cs
index 3a0fdbf48d..3511433713 100644
--- a/src/mscorlib/src/System/Reflection/DefaultMemberAttribute.cs
+++ b/src/mscorlib/src/System/Reflection/DefaultMemberAttribute.cs
@@ -2,41 +2,21 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// DefaultMemberAttribute is defines the Member of a Type that is the "default"
-//
-// member used by Type.InvokeMember. The default member is simply a name given
-// to a type.
-//
-//
-//
-//
-
-using System;
-
namespace System.Reflection
{
[Serializable]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface)]
public sealed class DefaultMemberAttribute : Attribute
{
- // The name of the member
- private String m_memberName;
-
// You must provide the name of the member, this is required
- public DefaultMemberAttribute(String memberName)
+ public DefaultMemberAttribute(string memberName)
{
- m_memberName = memberName;
+ MemberName = memberName;
}
// A get accessor to return the name from the attribute.
// NOTE: There is no setter because the name must be provided
// to the constructor. The name is not optional.
- public String MemberName
- {
- get { return m_memberName; }
- }
+ public string MemberName { get; }
}
}
diff --git a/src/mscorlib/src/System/Reflection/EventAttributes.cs b/src/mscorlib/src/System/Reflection/EventAttributes.cs
index fcf14786c4..fbc2972f69 100644
--- a/src/mscorlib/src/System/Reflection/EventAttributes.cs
+++ b/src/mscorlib/src/System/Reflection/EventAttributes.cs
@@ -2,21 +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.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// EventAttributes are an enum defining the attributes associated with
-//
-// and Event. These are defined in CorHdr.h and are a combination of
-// bits and enums.
-//
-//
-
-using System;
+// EventAttributes are an enum defining the attributes associated with and Event.
+// These are defined in CorHdr.h and are a combination of bits and enums.
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum EventAttributes
{
@@ -25,8 +15,8 @@ namespace System.Reflection
// This Enum matchs the CorEventAttr defined in CorHdr.h
SpecialName = 0x0200, // event is special. Name describes how.
- // Reserved flags for Runtime use only.
- ReservedMask = 0x0400,
RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
+
+ ReservedMask = 0x0400,
}
}
diff --git a/src/mscorlib/src/System/Reflection/ExceptionHandlingClause.cs b/src/mscorlib/src/System/Reflection/ExceptionHandlingClause.cs
new file mode 100644
index 0000000000..9bb45aebb2
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/ExceptionHandlingClause.cs
@@ -0,0 +1,93 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System.Globalization;
+using System.Diagnostics.Contracts;
+
+namespace System.Reflection
+{
+ public class ExceptionHandlingClause
+ {
+ #region costructor
+ // This class can only be created from inside the EE.
+ protected ExceptionHandlingClause() { }
+ #endregion
+
+ #region Private Data Members
+ private MethodBody m_methodBody;
+ [ContractPublicPropertyName("Flags")]
+ private ExceptionHandlingClauseOptions m_flags;
+ private int m_tryOffset;
+ private int m_tryLength;
+ private int m_handlerOffset;
+ private int m_handlerLength;
+ private int m_catchMetadataToken;
+ private int m_filterOffset;
+ #endregion
+
+ #region Public Members
+ public virtual ExceptionHandlingClauseOptions Flags { get { return m_flags; } }
+ public virtual int TryOffset { get { return m_tryOffset; } }
+ public virtual int TryLength { get { return m_tryLength; } }
+ public virtual int HandlerOffset { get { return m_handlerOffset; } }
+ public virtual int HandlerLength { get { return m_handlerLength; } }
+
+ public virtual int FilterOffset
+ {
+ get
+ {
+ if (m_flags != ExceptionHandlingClauseOptions.Filter)
+ throw new InvalidOperationException(SR.Arg_EHClauseNotFilter);
+
+ return m_filterOffset;
+ }
+ }
+
+ public virtual Type CatchType
+ {
+ get
+ {
+ if (m_flags != ExceptionHandlingClauseOptions.Clause)
+ throw new InvalidOperationException(SR.Arg_EHClauseNotClause);
+
+ Type type = null;
+
+ if (!MetadataToken.IsNullToken(m_catchMetadataToken))
+ {
+ Type declaringType = m_methodBody.m_methodBase.DeclaringType;
+ Module module = (declaringType == null) ? m_methodBody.m_methodBase.Module : declaringType.Module;
+ type = module.ResolveType(m_catchMetadataToken, (declaringType == null) ? null : declaringType.GetGenericArguments(),
+ m_methodBody.m_methodBase is MethodInfo ? m_methodBody.m_methodBase.GetGenericArguments() : null);
+ }
+
+ return type;
+ }
+ }
+ #endregion
+
+ #region Object Overrides
+ public override string ToString()
+ {
+ if (Flags == ExceptionHandlingClauseOptions.Clause)
+ {
+ return String.Format(CultureInfo.CurrentUICulture,
+ "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, CatchType={5}",
+ Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, CatchType);
+ }
+
+ if (Flags == ExceptionHandlingClauseOptions.Filter)
+ {
+ return String.Format(CultureInfo.CurrentUICulture,
+ "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, FilterOffset={5}",
+ Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, FilterOffset);
+ }
+
+ return String.Format(CultureInfo.CurrentUICulture,
+ "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}",
+ Flags, TryOffset, TryLength, HandlerOffset, HandlerLength);
+ }
+ #endregion
+ }
+}
+
diff --git a/src/mscorlib/src/System/Reflection/ExceptionHandlingClauseOptions.cs b/src/mscorlib/src/System/Reflection/ExceptionHandlingClauseOptions.cs
new file mode 100644
index 0000000000..22c141b456
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/ExceptionHandlingClauseOptions.cs
@@ -0,0 +1,16 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Reflection
+{
+ [Flags()]
+ public enum ExceptionHandlingClauseOptions : int
+ {
+ Clause = 0x0,
+ Filter = 0x1,
+ Finally = 0x2,
+ Fault = 0x4,
+ }
+}
+
diff --git a/src/mscorlib/src/System/Reflection/FieldAttributes.cs b/src/mscorlib/src/System/Reflection/FieldAttributes.cs
index 02bfbece2d..048d0e7031 100644
--- a/src/mscorlib/src/System/Reflection/FieldAttributes.cs
+++ b/src/mscorlib/src/System/Reflection/FieldAttributes.cs
@@ -2,13 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
-
namespace System.Reflection
{
// This Enum matchs the CorFieldAttr defined in CorHdr.h
- [Serializable]
- [Flags()]
+ [Flags]
public enum FieldAttributes
{
// member access mask - Use this mask to retrieve accessibility information.
@@ -33,11 +30,11 @@ namespace System.Reflection
// interop attributes
PinvokeImpl = 0x2000, // Implementation is forwarded through pinvoke.
- // Reserved flags for runtime use only.
- ReservedMask = 0x9500,
RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
HasFieldMarshal = 0x1000, // Field has marshalling information.
HasDefault = 0x8000, // Field has default.
HasFieldRVA = 0x0100, // Field has RVA.
+
+ ReservedMask = 0x9500,
}
}
diff --git a/src/mscorlib/src/System/Reflection/GenericParameterAttributes.cs b/src/mscorlib/src/System/Reflection/GenericParameterAttributes.cs
index 0dfc4b676d..4b579d273e 100644
--- a/src/mscorlib/src/System/Reflection/GenericParameterAttributes.cs
+++ b/src/mscorlib/src/System/Reflection/GenericParameterAttributes.cs
@@ -2,11 +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.
-//
-
namespace System.Reflection
{
- [Flags()]
+ [Flags]
public enum GenericParameterAttributes
{
None = 0x0000,
diff --git a/src/mscorlib/src/System/Reflection/ICustomAttributeProvider.cs b/src/mscorlib/src/System/Reflection/ICustomAttributeProvider.cs
index 1e3f675126..3cae295bc4 100644
--- a/src/mscorlib/src/System/Reflection/ICustomAttributeProvider.cs
+++ b/src/mscorlib/src/System/Reflection/ICustomAttributeProvider.cs
@@ -2,31 +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.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// ICustomAttributeProvider is an interface that is implemented by reflection
-//
-// objects which support custom attributes.
-//
-//
-
-using System;
-
namespace System.Reflection
{
- // Interface does not need to be marked with the serializable attribute
public interface ICustomAttributeProvider
{
- // Return an array of custom attributes identified by Type
- Object[] GetCustomAttributes(Type attributeType, bool inherit);
-
-
- // Return an array of all of the custom attributes (named attributes are not included)
- Object[] GetCustomAttributes(bool inherit);
-
-
- // Returns true if one or more instance of attributeType is defined on this member.
+ object[] GetCustomAttributes(bool inherit);
+ object[] GetCustomAttributes(Type attributeType, bool inherit);
bool IsDefined(Type attributeType, bool inherit);
}
-}
+} \ No newline at end of file
diff --git a/src/mscorlib/src/System/Reflection/IReflectableType.cs b/src/mscorlib/src/System/Reflection/IReflectableType.cs
index 72b1b871fc..5e2c0edab4 100644
--- a/src/mscorlib/src/System/Reflection/IReflectableType.cs
+++ b/src/mscorlib/src/System/Reflection/IReflectableType.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.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// IReflectableType is an interface that is implemented by a Type produced
-// by a ReflectionContext
-//
-
-//
-
-using System;
-
namespace System.Reflection
{
public interface IReflectableType
@@ -20,3 +9,4 @@ namespace System.Reflection
TypeInfo GetTypeInfo();
}
}
+
diff --git a/src/mscorlib/src/System/Reflection/ImageFileMachine.cs b/src/mscorlib/src/System/Reflection/ImageFileMachine.cs
index 5e3deacd9c..230bc952e5 100644
--- a/src/mscorlib/src/System/Reflection/ImageFileMachine.cs
+++ b/src/mscorlib/src/System/Reflection/ImageFileMachine.cs
@@ -4,7 +4,6 @@
namespace System.Reflection
{
- [Serializable]
public enum ImageFileMachine
{
I386 = 0x014c,
@@ -13,3 +12,4 @@ namespace System.Reflection
ARM = 0x01c4,
}
}
+
diff --git a/src/mscorlib/src/System/Reflection/InterfaceMapping.cs b/src/mscorlib/src/System/Reflection/InterfaceMapping.cs
index a1fdbde8f6..2e0c0d8a28 100644
--- a/src/mscorlib/src/System/Reflection/InterfaceMapping.cs
+++ b/src/mscorlib/src/System/Reflection/InterfaceMapping.cs
@@ -2,24 +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.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-//
-// Interface Map. This struct returns the mapping of an interface into the actual methods on a class
-// that implement that interface.
-//
-//
-
-using System;
-
namespace System.Reflection
{
public struct InterfaceMapping
{
- public Type TargetType; // The type implementing the interface
- public Type InterfaceType; // The type representing the interface
- public MethodInfo[] TargetMethods; // The methods implementing the interface
- public MethodInfo[] InterfaceMethods; // The methods defined on the interface
+ public Type TargetType; // The type implementing the interface
+ public Type InterfaceType; // The type representing the interface
+ public MethodInfo[] TargetMethods; // The methods implementing the interface
+ public MethodInfo[] InterfaceMethods; // The methods defined on the interface
}
}
diff --git a/src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs b/src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs
index 79316bcadc..3329360c4b 100644
--- a/src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs
+++ b/src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs
@@ -2,16 +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.
-/*=============================================================================
-**
-**
-**
-**
-**
-** Purpose: Get the underlying TypeInfo from a Type
-**
-**
-=============================================================================*/
+using System.Diagnostics;
namespace System.Reflection
{
@@ -19,11 +10,19 @@ namespace System.Reflection
{
public static TypeInfo GetTypeInfo(this Type type)
{
+ IReflectableType reflectableType = type as IReflectableType;
+ if (reflectableType != null)
+ return reflectableType.GetTypeInfo();
+
if (type == null)
throw new ArgumentNullException(nameof(type));
- var rcType = (IReflectableType)type;
- return rcType.GetTypeInfo();
+ // This is bizarre but compatible with the desktop which casts "type" to IReflectableType without checking and
+ // thus, throws an InvalidCastException.
+ object ignore = (IReflectableType)type;
+ Debug.Fail("Did not expect to get here.");
+ throw new InvalidOperationException();
}
}
}
+
diff --git a/src/mscorlib/src/System/Reflection/InvalidFilterCriteriaException.cs b/src/mscorlib/src/System/Reflection/InvalidFilterCriteriaException.cs
index dc1d19b13d..19738ec3d8 100644
--- a/src/mscorlib/src/System/Reflection/InvalidFilterCriteriaException.cs
+++ b/src/mscorlib/src/System/Reflection/InvalidFilterCriteriaException.cs
@@ -2,43 +2,29 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// InvalidFilterCriteriaException is thrown in FindMembers when the
-//
-// filter criteria is not valid for the type of filter being used.
-//
-//
-//
-//
+using System.Runtime.Serialization;
namespace System.Reflection
{
- using System;
- using System.Runtime.Serialization;
- using ApplicationException = System.ApplicationException;
[Serializable]
public class InvalidFilterCriteriaException : ApplicationException
{
public InvalidFilterCriteriaException()
- : base(SR.Arg_InvalidFilterCriteriaException)
+ : this(SR.Arg_InvalidFilterCriteriaException)
{
- SetErrorCode(__HResults.COR_E_INVALIDFILTERCRITERIA);
}
- public InvalidFilterCriteriaException(String message) : base(message)
+ public InvalidFilterCriteriaException(string message)
+ : this(message, null)
{
- SetErrorCode(__HResults.COR_E_INVALIDFILTERCRITERIA);
}
- public InvalidFilterCriteriaException(String message, Exception inner) : base(message, inner)
+ public InvalidFilterCriteriaException(string message, Exception inner)
+ : base(message, inner)
{
- SetErrorCode(__HResults.COR_E_INVALIDFILTERCRITERIA);
+ HResult = __HResults.COR_E_INVALIDFILTERCRITERIA;
}
- protected InvalidFilterCriteriaException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ protected InvalidFilterCriteriaException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
diff --git a/src/mscorlib/src/System/Reflection/LocalVariableInfo.cs b/src/mscorlib/src/System/Reflection/LocalVariableInfo.cs
new file mode 100644
index 0000000000..41d7477f99
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/LocalVariableInfo.cs
@@ -0,0 +1,38 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Reflection
+{
+ public class LocalVariableInfo
+ {
+ #region Private Data Members
+ private RuntimeType m_type;
+ private int m_isPinned;
+ private int m_localIndex;
+ #endregion
+
+ #region Constructor
+ protected LocalVariableInfo() { }
+ #endregion
+
+ #region Object Overrides
+ public override string ToString()
+ {
+ string toString = LocalType.ToString() + " (" + LocalIndex + ")";
+
+ if (IsPinned)
+ toString += " (pinned)";
+
+ return toString;
+ }
+ #endregion
+
+ #region Public Members
+ public virtual Type LocalType { get { Debug.Assert(m_type != null, "type must be set!"); return m_type; } }
+ public virtual bool IsPinned { get { return m_isPinned != 0; } }
+ public virtual int LocalIndex { get { return m_localIndex; } }
+ #endregion
+ }
+}
+
diff --git a/src/mscorlib/src/System/Reflection/ManifestResourceInfo.cs b/src/mscorlib/src/System/Reflection/ManifestResourceInfo.cs
index 792d054d44..b9c56ab857 100644
--- a/src/mscorlib/src/System/Reflection/ManifestResourceInfo.cs
+++ b/src/mscorlib/src/System/Reflection/ManifestResourceInfo.cs
@@ -2,69 +2,22 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*=============================================================================
-**
-**
-**
-**
-**
-** Purpose: For info regarding a manifest resource's topology.
-**
-**
-=============================================================================*/
-
-using System;
-
namespace System.Reflection
{
public class ManifestResourceInfo
{
- private Assembly _containingAssembly;
- private String _containingFileName;
- private ResourceLocation _resourceLocation;
-
public ManifestResourceInfo(Assembly containingAssembly,
- String containingFileName,
+ string containingFileName,
ResourceLocation resourceLocation)
{
- _containingAssembly = containingAssembly;
- _containingFileName = containingFileName;
- _resourceLocation = resourceLocation;
- }
-
- public virtual Assembly ReferencedAssembly
- {
- get
- {
- return _containingAssembly;
- }
+ ReferencedAssembly = containingAssembly;
+ FileName = containingFileName;
+ ResourceLocation = resourceLocation;
}
- public virtual String FileName
- {
- get
- {
- return _containingFileName;
- }
- }
-
- public virtual ResourceLocation ResourceLocation
- {
- get
- {
- return _resourceLocation;
- }
- }
- }
-
- // The ResourceLocation is a combination of these flags, set or not.
- // Linked means not Embedded.
- [Serializable]
- [Flags]
- public enum ResourceLocation
- {
- Embedded = 0x1,
- ContainedInAnotherAssembly = 0x2,
- ContainedInManifestFile = 0x4
+ public virtual Assembly ReferencedAssembly { get; }
+ public virtual string FileName { get; }
+ public virtual ResourceLocation ResourceLocation { get; }
}
}
+
diff --git a/src/mscorlib/src/System/Reflection/MemberFilter.cs b/src/mscorlib/src/System/Reflection/MemberFilter.cs
index 707ce9b584..bb1b15796a 100644
--- a/src/mscorlib/src/System/Reflection/MemberFilter.cs
+++ b/src/mscorlib/src/System/Reflection/MemberFilter.cs
@@ -2,18 +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.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// MemberFilter is a delegate used to filter Members. This delegate is used
-//
-// as a callback from Type.FindMembers.
-//
-//
-
namespace System.Reflection
{
- // Define the delegate
- [Serializable]
- public delegate bool MemberFilter(MemberInfo m, Object filterCriteria);
-}
+ public delegate bool MemberFilter(MemberInfo m, object filterCriteria);
+} \ No newline at end of file
diff --git a/src/mscorlib/src/System/Reflection/MemberTypes.cs b/src/mscorlib/src/System/Reflection/MemberTypes.cs
index aac59ecf35..57072dcfbe 100644
--- a/src/mscorlib/src/System/Reflection/MemberTypes.cs
+++ b/src/mscorlib/src/System/Reflection/MemberTypes.cs
@@ -2,26 +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.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// MemberTypes is an bit mask marking each type of Member that is defined as
-//
-// a subclass of MemberInfo. These are returned by MemberInfo.MemberType and
-// are useful in switch statements.
-//
-//
-
-using System;
-
namespace System.Reflection
{
- // This Enum matchs the CorTypeAttr defined in CorHdr.h
- [Serializable]
- [Flags()]
+ [Flags]
public enum MemberTypes
{
- // The following are the known classes which extend MemberInfo
Constructor = 0x01,
Event = 0x02,
Field = 0x04,
@@ -32,4 +17,4 @@ namespace System.Reflection
NestedType = 0x80,
All = Constructor | Event | Field | Method | Property | TypeInfo | NestedType,
}
-}
+} \ No newline at end of file
diff --git a/src/mscorlib/src/System/Reflection/MethodAttributes.cs b/src/mscorlib/src/System/Reflection/MethodAttributes.cs
index 38b35ff151..1a7c7bf154 100644
--- a/src/mscorlib/src/System/Reflection/MethodAttributes.cs
+++ b/src/mscorlib/src/System/Reflection/MethodAttributes.cs
@@ -2,14 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-//
-
-using System;
-
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum MethodAttributes
{
@@ -48,9 +42,9 @@ namespace System.Reflection
UnmanagedExport = 0x0008, // Managed method exported via thunk to unmanaged code.
RTSpecialName = 0x1000, // Runtime should check name encoding.
- // Reserved flags for runtime use only.
- ReservedMask = 0xd000,
HasSecurity = 0x4000, // Method has security associate with it.
RequireSecObject = 0x8000, // Method calls another method containing security code.
+
+ ReservedMask = 0xd000,
}
}
diff --git a/src/mscorlib/src/System/Reflection/MethodBody.cs b/src/mscorlib/src/System/Reflection/MethodBody.cs
index 275e4f86c0..4335177efb 100644
--- a/src/mscorlib/src/System/Reflection/MethodBody.cs
+++ b/src/mscorlib/src/System/Reflection/MethodBody.cs
@@ -2,108 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Globalization;
using System.Collections.Generic;
-using System.Diagnostics;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
- [Flags()]
- public enum ExceptionHandlingClauseOptions : int
- {
- Clause = 0x0,
- Filter = 0x1,
- Finally = 0x2,
- Fault = 0x4,
- }
-
- public class ExceptionHandlingClause
- {
- #region costructor
- // This class can only be created from inside the EE.
- protected ExceptionHandlingClause() { }
- #endregion
-
- #region Private Data Members
- private MethodBody m_methodBody;
- [ContractPublicPropertyName("Flags")]
- private ExceptionHandlingClauseOptions m_flags;
- private int m_tryOffset;
- private int m_tryLength;
- private int m_handlerOffset;
- private int m_handlerLength;
- private int m_catchMetadataToken;
- private int m_filterOffset;
- #endregion
-
- #region Public Members
- public virtual ExceptionHandlingClauseOptions Flags { get { return m_flags; } }
- public virtual int TryOffset { get { return m_tryOffset; } }
- public virtual int TryLength { get { return m_tryLength; } }
- public virtual int HandlerOffset { get { return m_handlerOffset; } }
- public virtual int HandlerLength { get { return m_handlerLength; } }
-
- public virtual int FilterOffset
- {
- get
- {
- if (m_flags != ExceptionHandlingClauseOptions.Filter)
- throw new InvalidOperationException(SR.Arg_EHClauseNotFilter);
-
- return m_filterOffset;
- }
- }
-
- public virtual Type CatchType
- {
- get
- {
- if (m_flags != ExceptionHandlingClauseOptions.Clause)
- throw new InvalidOperationException(SR.Arg_EHClauseNotClause);
-
- Type type = null;
-
- if (!MetadataToken.IsNullToken(m_catchMetadataToken))
- {
- Type declaringType = m_methodBody.m_methodBase.DeclaringType;
- Module module = (declaringType == null) ? m_methodBody.m_methodBase.Module : declaringType.Module;
- type = module.ResolveType(m_catchMetadataToken, (declaringType == null) ? null : declaringType.GetGenericArguments(),
- m_methodBody.m_methodBase is MethodInfo ? m_methodBody.m_methodBase.GetGenericArguments() : null);
- }
-
- return type;
- }
- }
- #endregion
-
- #region Object Overrides
- public override string ToString()
- {
- if (Flags == ExceptionHandlingClauseOptions.Clause)
- {
- return String.Format(CultureInfo.CurrentUICulture,
- "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, CatchType={5}",
- Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, CatchType);
- }
-
- if (Flags == ExceptionHandlingClauseOptions.Filter)
- {
- return String.Format(CultureInfo.CurrentUICulture,
- "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}, FilterOffset={5}",
- Flags, TryOffset, TryLength, HandlerOffset, HandlerLength, FilterOffset);
- }
-
- return String.Format(CultureInfo.CurrentUICulture,
- "Flags={0}, TryOffset={1}, TryLength={2}, HandlerOffset={3}, HandlerLength={4}",
- Flags, TryOffset, TryLength, HandlerOffset, HandlerLength);
- }
- #endregion
- }
-
public class MethodBody
{
#region costructor
@@ -130,36 +32,5 @@ namespace System.Reflection
public virtual IList<ExceptionHandlingClause> ExceptionHandlingClauses { get { return Array.AsReadOnly(m_exceptionHandlingClauses); } }
#endregion
}
-
- public class LocalVariableInfo
- {
- #region Private Data Members
- private RuntimeType m_type;
- private int m_isPinned;
- private int m_localIndex;
- #endregion
-
- #region Constructor
- protected LocalVariableInfo() { }
- #endregion
-
- #region Object Overrides
- public override string ToString()
- {
- string toString = LocalType.ToString() + " (" + LocalIndex + ")";
-
- if (IsPinned)
- toString += " (pinned)";
-
- return toString;
- }
- #endregion
-
- #region Public Members
- public virtual Type LocalType { get { Debug.Assert(m_type != null, "type must be set!"); return m_type; } }
- public virtual bool IsPinned { get { return m_isPinned != 0; } }
- public virtual int LocalIndex { get { return m_localIndex; } }
- #endregion
- }
}
diff --git a/src/mscorlib/src/System/Reflection/MethodImplAttributes.cs b/src/mscorlib/src/System/Reflection/MethodImplAttributes.cs
index a22735725b..0a67e2cade 100644
--- a/src/mscorlib/src/System/Reflection/MethodImplAttributes.cs
+++ b/src/mscorlib/src/System/Reflection/MethodImplAttributes.cs
@@ -2,15 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
-
-using System;
-
namespace System.Reflection
{
// This Enum matchs the CorMethodImpl defined in CorHdr.h
- [Serializable]
public enum MethodImplAttributes
{
// code impl mask
@@ -39,6 +33,6 @@ namespace System.Reflection
AggressiveInlining = 0x0100, // Method should be inlined if possible.
NoOptimization = 0x0040, // Method may not be optimized.
- MaxMethodImplVal = 0xFFFF, // Range check value
+ MaxMethodImplVal = 0xffff,
}
}
diff --git a/src/mscorlib/src/System/Reflection/Missing.cs b/src/mscorlib/src/System/Reflection/Missing.cs
index 1a8a641765..fa32d43ccb 100644
--- a/src/mscorlib/src/System/Reflection/Missing.cs
+++ b/src/mscorlib/src/System/Reflection/Missing.cs
@@ -2,34 +2,23 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-//
-
-using System;
-using System.Runtime.Remoting;
using System.Runtime.Serialization;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
- // This is not serializable because it is a reflection command.
[Serializable]
public sealed class Missing : ISerializable
{
public static readonly Missing Value = new Missing();
- #region Constructor
private Missing() { }
- #endregion
- #region ISerializable
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException(nameof(info));
- Contract.EndContractBlock();
UnitySerializationHolder.GetUnitySerializationInfo(info, this);
}
- #endregion
}
}
diff --git a/src/mscorlib/src/System/Reflection/ModuleResolveEventHandler.cs b/src/mscorlib/src/System/Reflection/ModuleResolveEventHandler.cs
index 31cc799621..eb8926b5db 100644
--- a/src/mscorlib/src/System/Reflection/ModuleResolveEventHandler.cs
+++ b/src/mscorlib/src/System/Reflection/ModuleResolveEventHandler.cs
@@ -4,6 +4,6 @@
namespace System.Reflection
{
- [Serializable]
- public delegate Module ModuleResolveEventHandler(Object sender, ResolveEventArgs e);
+ public delegate Module ModuleResolveEventHandler(object sender, ResolveEventArgs e);
}
+
diff --git a/src/mscorlib/src/System/Reflection/ParameterAttributes.cs b/src/mscorlib/src/System/Reflection/ParameterAttributes.cs
index e4f3476d59..ce195897c2 100644
--- a/src/mscorlib/src/System/Reflection/ParameterAttributes.cs
+++ b/src/mscorlib/src/System/Reflection/ParameterAttributes.cs
@@ -2,21 +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.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
// ParameterAttributes is an enum defining the attributes that may be
-//
-// associated with a Parameter. These are defined in CorHdr.h.
-//
-//
-
-using System;
+// associated with a Parameter. These are defined in CorHdr.h.
namespace System.Reflection
{
// This Enum matchs the CorParamAttr defined in CorHdr.h
- [Serializable]
[Flags]
public enum ParameterAttributes
{
@@ -24,14 +15,15 @@ namespace System.Reflection
In = 0x0001, // Param is [In]
Out = 0x0002, // Param is [Out]
Lcid = 0x0004, // Param is [lcid]
- Retval = 0x0008, // Param is [Retval]
+
+ Retval = 0x0008, // Param is [Retval]
Optional = 0x0010, // Param is optional
- // Reserved flags for Runtime use only.
- ReservedMask = 0xf000,
HasDefault = 0x1000, // Param has default value.
HasFieldMarshal = 0x2000, // Param has FieldMarshal.
- Reserved3 = 0x4000, // reserved bit
- Reserved4 = 0x8000 // reserved bit
+
+ Reserved3 = 0x4000,
+ Reserved4 = 0x8000,
+ ReservedMask = 0xf000,
}
}
diff --git a/src/mscorlib/src/System/Reflection/ParameterModifier.cs b/src/mscorlib/src/System/Reflection/ParameterModifier.cs
index 70abf75ea0..cdd25da8e5 100644
--- a/src/mscorlib/src/System/Reflection/ParameterModifier.cs
+++ b/src/mscorlib/src/System/Reflection/ParameterModifier.cs
@@ -2,45 +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.
-using System.Diagnostics.Contracts;
-using System;
-
namespace System.Reflection
{
[Serializable]
public struct ParameterModifier
{
- #region Private Data Members
- private bool[] _byRef;
- #endregion
-
- #region Constructor
public ParameterModifier(int parameterCount)
{
if (parameterCount <= 0)
throw new ArgumentException(SR.Arg_ParmArraySize);
- Contract.EndContractBlock();
- _byRef = new bool[parameterCount];
+ IsByRefArray = new bool[parameterCount];
}
- #endregion
- #region Internal Members
- internal bool[] IsByRefArray { get { return _byRef; } }
- #endregion
-
- #region Public Members
public bool this[int index]
{
get
{
- return _byRef[index];
+ return IsByRefArray[index];
}
set
{
- _byRef[index] = value;
+ IsByRefArray[index] = value;
}
}
- #endregion
+
+ internal bool[] IsByRefArray { get; }
}
}
diff --git a/src/mscorlib/src/System/Reflection/PortableExecutableKinds.cs b/src/mscorlib/src/System/Reflection/PortableExecutableKinds.cs
index 4c38c02923..79be338685 100644
--- a/src/mscorlib/src/System/Reflection/PortableExecutableKinds.cs
+++ b/src/mscorlib/src/System/Reflection/PortableExecutableKinds.cs
@@ -5,7 +5,6 @@
namespace System.Reflection
{
[Flags]
- [Serializable]
public enum PortableExecutableKinds
{
NotAPortableExecutableImage = 0x0,
@@ -16,3 +15,4 @@ namespace System.Reflection
Preferred32Bit = 0x10,
}
}
+
diff --git a/src/mscorlib/src/System/Reflection/ProcessorArchitecture.cs b/src/mscorlib/src/System/Reflection/ProcessorArchitecture.cs
new file mode 100644
index 0000000000..becb346c4f
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/ProcessorArchitecture.cs
@@ -0,0 +1,16 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Reflection
+{
+ public enum ProcessorArchitecture
+ {
+ None = 0x0000,
+ MSIL = 0x0001,
+ X86 = 0x0002,
+ IA64 = 0x0003,
+ Amd64 = 0x0004,
+ Arm = 0x0005
+ }
+}
diff --git a/src/mscorlib/src/System/Reflection/PropertyAttributes.cs b/src/mscorlib/src/System/Reflection/PropertyAttributes.cs
index 188bc0e87e..31e7a653bb 100644
--- a/src/mscorlib/src/System/Reflection/PropertyAttributes.cs
+++ b/src/mscorlib/src/System/Reflection/PropertyAttributes.cs
@@ -2,33 +2,24 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
// PropertyAttributes is an enum which defines the attributes that may be associated
-//
-// with a property. The values here are defined in Corhdr.h.
-//
-//
-
-using System;
+// with a property. The values here are defined in Corhdr.h.
namespace System.Reflection
{
// This Enum matchs the CorPropertyAttr defined in CorHdr.h
- [Serializable]
[Flags]
public enum PropertyAttributes
{
None = 0x0000,
SpecialName = 0x0200, // property is special. Name describes how.
- // Reserved flags for Runtime use only.
- ReservedMask = 0xf400,
RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
HasDefault = 0x1000, // Property has default
- Reserved2 = 0x2000, // reserved bit
- Reserved3 = 0x4000, // reserved bit
- Reserved4 = 0x8000 // reserved bit
+
+ Reserved2 = 0x2000,
+ Reserved3 = 0x4000,
+ Reserved4 = 0x8000,
+ ReservedMask = 0xf400,
}
}
diff --git a/src/mscorlib/src/System/Reflection/ReflectionContext.cs b/src/mscorlib/src/System/Reflection/ReflectionContext.cs
index e11480d6cf..e9e93dab81 100644
--- a/src/mscorlib/src/System/Reflection/ReflectionContext.cs
+++ b/src/mscorlib/src/System/Reflection/ReflectionContext.cs
@@ -2,19 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*=============================================================================
-**
-**
-**
-**
-**
-** Purpose: For Assembly-related stuff.
-**
-**
-=============================================================================*/
-
-using System;
-
namespace System.Reflection
{
public abstract class ReflectionContext
@@ -34,3 +21,4 @@ namespace System.Reflection
}
}
}
+
diff --git a/src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs b/src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs
index 4dca8de86d..4bfd98559e 100644
--- a/src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs
+++ b/src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs
@@ -2,79 +2,42 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// ReflectionTypeLoadException is thrown when multiple TypeLoadExceptions may occur.
-//
-// Specifically, when you call Module.GetTypes() this causes multiple class loads to occur.
-// If there are failures, we continue to load classes and build an array of the successfully
-// loaded classes. We also build an array of the errors that occur. Then we throw this exception
-// which exposes both the array of classes and the array of TypeLoadExceptions.
-//
-//
-//
-//
-
-using System;
using System.Runtime.Serialization;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
[Serializable]
public sealed class ReflectionTypeLoadException : SystemException, ISerializable
{
- private Type[] _classes;
- private Exception[] _exceptions;
-
- // private constructor. This is not called.
- private ReflectionTypeLoadException()
- : base(SR.ReflectionTypeLoad_LoadFailed)
- {
- SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD);
- }
-
public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions) : base(null)
{
- _classes = classes;
- _exceptions = exceptions;
- SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD);
+ Types = classes;
+ LoaderExceptions = exceptions;
+ HResult = __HResults.COR_E_REFLECTIONTYPELOAD;
}
- public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions, String message) : base(message)
+ public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions, string message) : base(message)
{
- _classes = classes;
- _exceptions = exceptions;
- SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD);
+ Types = classes;
+ LoaderExceptions = exceptions;
+ HResult = __HResults.COR_E_REFLECTIONTYPELOAD;
}
internal ReflectionTypeLoadException(SerializationInfo info, StreamingContext context) : base(info, context)
{
- _classes = (Type[])(info.GetValue("Types", typeof(Type[])));
- _exceptions = (Exception[])(info.GetValue("Exceptions", typeof(Exception[])));
- }
-
- public Type[] Types
- {
- get { return _classes; }
- }
-
- public Exception[] LoaderExceptions
- {
- get { return _exceptions; }
+ Types = (Type[])(info.GetValue("Types", typeof(Type[])));
+ LoaderExceptions = (Exception[])(info.GetValue("Exceptions", typeof(Exception[])));
}
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
- if (info == null)
- {
- throw new ArgumentNullException(nameof(info));
- }
- Contract.EndContractBlock();
base.GetObjectData(info, context);
- info.AddValue("Types", _classes, typeof(Type[]));
- info.AddValue("Exceptions", _exceptions, typeof(Exception[]));
+ info.AddValue("Types", Types, typeof(Type[]));
+ info.AddValue("Exceptions", LoaderExceptions, typeof(Exception[]));
}
+
+ public Type[] Types { get; }
+
+ public Exception[] LoaderExceptions { get; }
}
}
diff --git a/src/mscorlib/src/System/Reflection/ResourceAttributes.cs b/src/mscorlib/src/System/Reflection/ResourceAttributes.cs
index d751a54278..2d03f42ba0 100644
--- a/src/mscorlib/src/System/Reflection/ResourceAttributes.cs
+++ b/src/mscorlib/src/System/Reflection/ResourceAttributes.cs
@@ -2,20 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// ResourceAttributes is an enum which defines the attributes that may be associated
-//
-// with a manifest resource. The values here are defined in Corhdr.h.
-//
-//
-
-using System;
-
namespace System.Reflection
{
- [Serializable]
[Flags]
public enum ResourceAttributes
{
@@ -23,3 +11,4 @@ namespace System.Reflection
Private = 0x0002,
}
}
+
diff --git a/src/mscorlib/src/System/Reflection/ResourceLocation.cs b/src/mscorlib/src/System/Reflection/ResourceLocation.cs
new file mode 100644
index 0000000000..4902333ac0
--- /dev/null
+++ b/src/mscorlib/src/System/Reflection/ResourceLocation.cs
@@ -0,0 +1,15 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Reflection
+{
+ [Flags]
+ public enum ResourceLocation
+ {
+ ContainedInAnotherAssembly = 2,
+ ContainedInManifestFile = 4,
+ Embedded = 1,
+ }
+}
+
diff --git a/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs b/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs
index 280e1c04f4..8d2bf1f886 100644
--- a/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs
+++ b/src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs
@@ -2,28 +2,8 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-/*============================================================
-**
-**
-**
-**
-**
-** Purpose: Encapsulate access to a public/private key pair
-** used to sign strong name assemblies.
-**
-**
-===========================================================*/
-
-using System;
using System.IO;
-using System.Runtime.CompilerServices;
-using System.Runtime.ConstrainedExecution;
-using System.Runtime.InteropServices;
using System.Runtime.Serialization;
-using System.Security;
-using System.Runtime.Versioning;
-using Microsoft.Win32;
-using System.Diagnostics.Contracts;
namespace System.Reflection
{
@@ -32,7 +12,7 @@ namespace System.Reflection
{
private bool _keyPairExported;
private byte[] _keyPairArray;
- private String _keyPairContainer;
+ private string _keyPairContainer;
private byte[] _publicKey;
// Build key pair from file.
@@ -40,7 +20,6 @@ namespace System.Reflection
{
if (keyPairFile == null)
throw new ArgumentNullException(nameof(keyPairFile));
- Contract.EndContractBlock();
int length = (int)keyPairFile.Length;
_keyPairArray = new byte[length];
@@ -54,7 +33,6 @@ namespace System.Reflection
{
if (keyPairArray == null)
throw new ArgumentNullException(nameof(keyPairArray));
- Contract.EndContractBlock();
_keyPairArray = new byte[keyPairArray.Length];
Array.Copy(keyPairArray, _keyPairArray, keyPairArray.Length);
@@ -70,7 +48,7 @@ namespace System.Reflection
_publicKey = (byte[])info.GetValue("_publicKey", typeof(byte[]));
}
- public StrongNameKeyPair(String keyPairContainer)
+ public StrongNameKeyPair(string keyPairContainer)
{
throw new PlatformNotSupportedException();
}
@@ -83,7 +61,6 @@ namespace System.Reflection
}
}
- /// <internalonly/>
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("_keyPairExported", _keyPairExported);
@@ -92,7 +69,6 @@ namespace System.Reflection
info.AddValue("_publicKey", _publicKey);
}
- /// <internalonly/>
- void IDeserializationCallback.OnDeserialization(Object sender) { }
+ void IDeserializationCallback.OnDeserialization(object sender) { }
}
}
diff --git a/src/mscorlib/src/System/Reflection/TargetException.cs b/src/mscorlib/src/System/Reflection/TargetException.cs
index 537d1680f4..0f1aa71a23 100644
--- a/src/mscorlib/src/System/Reflection/TargetException.cs
+++ b/src/mscorlib/src/System/Reflection/TargetException.cs
@@ -2,19 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TargetException is thrown when the target to an Invoke is invalid. This may
-//
-// occur because the caller doesn't have access to the member, or the target doesn't
-// define the member, etc.
-//
-//
-//
-//
-
-using System;
using System.Runtime.Serialization;
namespace System.Reflection
@@ -22,23 +9,21 @@ namespace System.Reflection
[Serializable]
public class TargetException : ApplicationException
{
- public TargetException() : base()
+ public TargetException()
+ : this(null)
{
- SetErrorCode(__HResults.COR_E_TARGET);
}
- public TargetException(String message) : base(message)
+ public TargetException(string message)
+ : this(message, null)
{
- SetErrorCode(__HResults.COR_E_TARGET);
}
- public TargetException(String message, Exception inner) : base(message, inner)
+ public TargetException(string message, Exception inner) : base(message, inner)
{
- SetErrorCode(__HResults.COR_E_TARGET);
+ HResult = __HResults.COR_E_TARGET;
}
- protected TargetException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ protected TargetException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
diff --git a/src/mscorlib/src/System/Reflection/TargetInvocationException.cs b/src/mscorlib/src/System/Reflection/TargetInvocationException.cs
index 38c5b7d008..aa9a5b1b41 100644
--- a/src/mscorlib/src/System/Reflection/TargetInvocationException.cs
+++ b/src/mscorlib/src/System/Reflection/TargetInvocationException.cs
@@ -2,19 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TargetInvocationException is used to report an exception that was thrown
-//
-// by the target of an invocation.
-//
-//
-//
-//
-
-
-using System;
using System.Runtime.Serialization;
namespace System.Reflection
@@ -22,33 +9,18 @@ namespace System.Reflection
[Serializable]
public sealed class TargetInvocationException : ApplicationException
{
- // This exception is not creatable without specifying the
- // inner exception.
- private TargetInvocationException()
- : base(SR.Arg_TargetInvocationException)
- {
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
- }
-
- // This is called from within the runtime.
- private TargetInvocationException(String message) : base(message)
- {
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
- }
-
- public TargetInvocationException(System.Exception inner)
+ public TargetInvocationException(Exception inner)
: base(SR.Arg_TargetInvocationException, inner)
{
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
+ HResult = __HResults.COR_E_TARGETINVOCATION;
}
- public TargetInvocationException(String message, Exception inner) : base(message, inner)
+ public TargetInvocationException(string message, Exception inner)
+ : base(message, inner)
{
- SetErrorCode(__HResults.COR_E_TARGETINVOCATION);
+ HResult = __HResults.COR_E_TARGETINVOCATION;
}
- internal TargetInvocationException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ internal TargetInvocationException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
diff --git a/src/mscorlib/src/System/Reflection/TargetParameterCountException.cs b/src/mscorlib/src/System/Reflection/TargetParameterCountException.cs
index 5e315f91ff..19c4b2c916 100644
--- a/src/mscorlib/src/System/Reflection/TargetParameterCountException.cs
+++ b/src/mscorlib/src/System/Reflection/TargetParameterCountException.cs
@@ -2,45 +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.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TargetParameterCountException is thrown when the number of parameter to an
-//
-// invocation doesn't match the number expected.
-//
-//
-//
-//
+using System.Runtime.Serialization;
namespace System.Reflection
{
- using System;
- using SystemException = System.SystemException;
- using System.Runtime.Serialization;
[Serializable]
public sealed class TargetParameterCountException : ApplicationException
{
public TargetParameterCountException()
: base(SR.Arg_TargetParameterCountException)
{
- SetErrorCode(__HResults.COR_E_TARGETPARAMCOUNT);
+ HResult = __HResults.COR_E_TARGETPARAMCOUNT;
}
- public TargetParameterCountException(String message)
+ public TargetParameterCountException(string message)
: base(message)
{
- SetErrorCode(__HResults.COR_E_TARGETPARAMCOUNT);
+ HResult = __HResults.COR_E_TARGETPARAMCOUNT;
}
- public TargetParameterCountException(String message, Exception inner)
+ public TargetParameterCountException(string message, Exception inner)
: base(message, inner)
{
- SetErrorCode(__HResults.COR_E_TARGETPARAMCOUNT);
+ HResult = __HResults.COR_E_TARGETPARAMCOUNT;
}
- internal TargetParameterCountException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- }
+ internal TargetParameterCountException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}
diff --git a/src/mscorlib/src/System/Reflection/TypeAttributes.cs b/src/mscorlib/src/System/Reflection/TypeAttributes.cs
index ad7d29dd1f..aa30331856 100644
--- a/src/mscorlib/src/System/Reflection/TypeAttributes.cs
+++ b/src/mscorlib/src/System/Reflection/TypeAttributes.cs
@@ -3,12 +3,10 @@
// See the LICENSE file in the project root for more information.
using System.Runtime.InteropServices;
-using System;
namespace System.Reflection
{
// This Enum matchs the CorTypeAttr defined in CorHdr.h
- [Serializable]
[Flags]
public enum TypeAttributes
{
@@ -43,7 +41,6 @@ namespace System.Reflection
// Implementation attributes.
Import = 0x00001000, // Class / interface is imported
Serializable = 0x00002000, // The class is Serializable.
-
WindowsRuntime = 0x00004000, // Type is a Windows Runtime type.
// Use tdStringFormatMask to retrieve string information for native interop
@@ -58,9 +55,9 @@ namespace System.Reflection
BeforeFieldInit = 0x00100000, // Initialize the class any time before first static field access.
- // Flags reserved for runtime use.
- ReservedMask = 0x00040800,
RTSpecialName = 0x00000800, // Runtime should check name encoding.
HasSecurity = 0x00040000, // Class has security associate with it.
+
+ ReservedMask = 0x00040800,
}
}
diff --git a/src/mscorlib/src/System/Reflection/TypeFilter.cs b/src/mscorlib/src/System/Reflection/TypeFilter.cs
index 97a089978a..eb049f81f9 100644
--- a/src/mscorlib/src/System/Reflection/TypeFilter.cs
+++ b/src/mscorlib/src/System/Reflection/TypeFilter.cs
@@ -2,18 +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.
-////////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////////
-//
-// TypeFilter defines a delegate that is as a callback function for filtering
-//
-// a list of Types.
-//
-//
-
namespace System.Reflection
{
- // Define the delegate
- [Serializable]
- public delegate bool TypeFilter(Type m, Object filterCriteria);
+ public delegate bool TypeFilter(Type m, object filterCriteria);
}