+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using System.Reflection;
-using System.Diagnostics;
-
-namespace Internal.Reflection.Tracing
-{
- internal interface ITraceableTypeMember
- {
- // Returns the Name value *without recursing into the public Name implementation.*
- string MemberName { get; }
-
- // Returns the DeclaringType value *without recursing into the public DeclaringType implementation.*
- Type ContainingType { get; }
- }
-}
<Compile Include="System\Reflection\Runtime\ParameterInfos\RuntimeSyntheticParameterInfo.cs" />
<Compile Include="System\Reflection\Runtime\PropertyInfos\NativeFormat\NativeFormatRuntimePropertyInfo.cs" />
<Compile Include="System\Reflection\Runtime\PropertyInfos\RuntimePropertyInfo.cs" />
- <Compile Include="System\Reflection\Runtime\Tracing\ReflectionEventSource.cs" />
<Compile Include="System\Reflection\Runtime\TypeInfos\NativeFormat\NativeFormatRuntimeNamedTypeInfo.cs" />
<Compile Include="System\Reflection\Runtime\TypeInfos\NativeFormat\NativeFormatRuntimeGenericParameterTypeInfo.cs" />
<Compile Include="System\Reflection\Runtime\TypeInfos\NativeFormat\NativeFormatRuntimeNamedTypeInfo.UnificationKey.cs" />
<Compile Include="Internal\Reflection\Core\Execution\ReflectionCoreExecution.cs" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Internal\Reflection\Tracing\ITraceableTypeMember.cs" />
- </ItemGroup>
- <ItemGroup>
<Compile Include="$(CommonPath)\System\NotImplemented.cs">
<Link>System\NotImplemented.cs</Link>
</Compile>
using Internal.Reflection.Core.Execution;
using Internal.Metadata.NativeFormat;
-using Internal.Reflection.Tracing;
-
namespace System.Reflection.Runtime.Assemblies.NativeFormat
{
internal partial class NativeFormatRuntimeAssembly
using Internal.Reflection.Core.Execution;
using Internal.Metadata.NativeFormat;
-using Internal.Reflection.Tracing;
-
namespace System.Reflection.Runtime.Assemblies.NativeFormat
{
internal partial class NativeFormatRuntimeAssembly
using Internal.Reflection.Core;
using Internal.Reflection.Core.Execution;
using Internal.Metadata.NativeFormat;
-using Internal.Reflection.Tracing;
namespace System.Reflection.Runtime.Assemblies.NativeFormat
{
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.Assembly_CustomAttributes(this);
-#endif
-
foreach (QScopeDefinition scope in AllScopes)
{
foreach (CustomAttributeData cad in RuntimeCustomAttributeData.GetCustomAttributes(scope.Reader, scope.ScopeDefinition.CustomAttributes))
[RequiresUnreferencedCode("Types might be removed")]
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.Assembly_DefinedTypes(this);
-#endif
-
foreach (QScopeDefinition scope in AllScopes)
{
MetadataReader reader = scope.Reader;
using Internal.Reflection.Core.Execution;
using Internal.Reflection.Core.NonPortable;
-using Internal.Reflection.Tracing;
using System.Security;
namespace System.Reflection.Runtime.Assemblies
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.Assembly_FullName(this);
-#endif
-
return GetName().FullName;
}
}
[RequiresUnreferencedCode("Types might be removed")]
public sealed override Type GetType(string name, bool throwOnError, bool ignoreCase)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.Assembly_GetType(this, name);
-#endif
-
if (name == null)
throw new ArgumentNullException();
if (name.Length == 0)
public sealed override AssemblyName GetName()
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.Assembly_GetName(this);
-#endif
return RuntimeAssemblyName.ToAssemblyName();
}
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
-using Internal.Reflection.Tracing;
-
namespace System.Reflection.Runtime.CustomAttributes
{
//
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.CustomAttributeData_ConstructorArguments(this);
-#endif
-
return new ReadOnlyCollection<CustomAttributeTypedArgument>(GetConstructorArguments(throwIfMissingMetadata: true));
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.CustomAttributeData_NamedArguments(this);
-#endif
-
return new ReadOnlyCollection<CustomAttributeNamedArgument>(GetNamedArguments(throwIfMissingMetadata: true));
}
}
using NativeFormatMethodSemanticsAttributes = global::Internal.Metadata.NativeFormat.MethodSemanticsAttributes;
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
namespace System.Reflection.Runtime.EventInfos.NativeFormat
{
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.EventInfo_CustomAttributes(this);
-#endif
-
return RuntimeCustomAttributeData.GetCustomAttributes(_reader, _event.CustomAttributes);
}
}
using System.Reflection.Runtime.CustomAttributes;
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
namespace System.Reflection.Runtime.EventInfos
{
// The runtime's implementation of EventInfo's
//
[DebuggerDisplay("{_debugName}")]
- internal abstract partial class RuntimeEventInfo : EventInfo, ITraceableTypeMember
+ internal abstract partial class RuntimeEventInfo : EventInfo
{
protected RuntimeEventInfo(RuntimeTypeInfo contextTypeInfo, RuntimeTypeInfo reflectedType)
{
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.EventInfo_AddMethod(this);
-#endif
-
MethodInfo adder = _lazyAdder;
if (adder == null)
{
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.EventInfo_DeclaringType(this);
-#endif
-
return ContextTypeInfo;
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.EventInfo_Name(this);
-#endif
-
return MetadataName;
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.EventInfo_RaiseMethod(this);
-#endif
-
return GetEventMethod(EventMethodSemantics.Fire);
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.EventInfo_RemoveMethod(this);
-#endif
-
MethodInfo remover = _lazyRemover;
if (remover == null)
{
return runtimeParameterInfo.ParameterTypeString + " " + this.Name;
}
- string ITraceableTypeMember.MemberName
- {
- get
- {
- return MetadataName;
- }
- }
-
- Type ITraceableTypeMember.ContainingType
- {
- get
- {
- return ContextTypeInfo;
- }
- }
-
protected RuntimeEventInfo WithDebugName()
{
bool populateDebugNames = DeveloperExperienceState.DeveloperExperienceModeEnabled;
using Internal.Reflection.Core;
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
using Internal.Runtime.TypeLoader;
using Internal.Reflection.Core;
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
-
namespace System.Reflection.Runtime.FieldInfos
{
//
// The Runtime's implementation of fields.
//
[DebuggerDisplay("{_debugName}")]
- internal abstract partial class RuntimeFieldInfo : FieldInfo, ITraceableTypeMember
+ internal abstract partial class RuntimeFieldInfo : FieldInfo
{
//
// contextType - the type that supplies the type context (i.e. substitutions for generic parameters.) Though you
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.FieldInfo_CustomAttributes(this);
-#endif
-
foreach (CustomAttributeData cad in TrueCustomAttributes)
yield return cad;
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.FieldInfo_DeclaringType(this);
-#endif
-
return _contextTypeInfo;
}
}
public sealed override object GetValue(object obj)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.FieldInfo_GetValue(this, obj);
-#endif
-
FieldAccessor fieldAccessor = this.FieldAccessor;
return fieldAccessor.GetField(obj);
}
public sealed override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, CultureInfo culture)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.FieldInfo_SetValue(this, obj, value);
-#endif
-
FieldAccessor fieldAccessor = this.FieldAccessor;
BinderBundle binderBundle = binder.ToBinderBundle(invokeAttr, culture);
fieldAccessor.SetField(obj, value, binderBundle);
fieldAccessor.SetFieldDirect(obj, value);
}
- Type ITraceableTypeMember.ContainingType
- {
- get
- {
- return _contextTypeInfo;
- }
- }
-
/// <summary>
/// Override to provide the metadata based name of a field. (Different from the Name
/// property in that it does not go into the reflection trace logic.)
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.FieldInfo_Name(this);
-#endif
-
- return MetadataName;
- }
- }
-
- string ITraceableTypeMember.MemberName
- {
- get
- {
return MetadataName;
}
}
if (_debugName == null)
{
_debugName = "Constructing..."; // Protect against any inadvertent reentrancy.
- _debugName = ((ITraceableTypeMember)this).MemberName;
+ _debugName = MetadataName;
}
return this;
}
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
-
namespace System.Reflection.Runtime.MethodInfos
{
//
public sealed override ParameterInfo[] GetParameters()
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodBase_GetParameters(this);
-#endif
-
RuntimeParameterInfo[] parameters = RuntimeParameters;
if (parameters.Length == 0)
return Array.Empty<ParameterInfo>();
[DebuggerGuidedStepThrough]
public sealed override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodBase_Invoke(this, obj, parameters);
-#endif
if (parameters == null)
parameters = Array.Empty<object>();
MethodInvoker methodInvoker;
using System.Reflection.Runtime.BindingFlagSupport;
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
namespace System.Reflection.Runtime.MethodInfos
{
// Abstract base class for RuntimeNamedMethodInfo, RuntimeConstructedGenericMethodInfo.
//
[DebuggerDisplay("{_debugName}")]
- internal abstract partial class RuntimeMethodInfo : MethodInfo, ITraceableTypeMember
+ internal abstract partial class RuntimeMethodInfo : MethodInfo
{
protected RuntimeMethodInfo()
{
// V4.5 api - Creates open delegates over static or instance methods.
public sealed override Delegate CreateDelegate(Type delegateType)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodInfo_CreateDelegate(this, delegateType);
-#endif
-
return CreateDelegateWorker(delegateType, null, allowClosed: false);
}
// V4.5 api - Creates open or closed delegates over static or instance methods.
public sealed override Delegate CreateDelegate(Type delegateType, object target)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodInfo_CreateDelegate(this, delegateType, target);
-#endif
-
return CreateDelegateWorker(delegateType, target, allowClosed: true);
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodBase_DeclaringType(this);
-#endif
-
return this.RuntimeDeclaringType;
}
}
public sealed override ParameterInfo[] GetParameters()
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodBase_GetParameters(this);
-#endif
-
RuntimeParameterInfo[] runtimeParameterInfos = RuntimeParameters;
if (runtimeParameterInfos.Length == 0)
return Array.Empty<ParameterInfo>();
[DebuggerGuidedStepThroughAttribute]
public sealed override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodBase_Invoke(this, obj, parameters);
-#endif
if (parameters == null)
parameters = Array.Empty<object>();
MethodInvoker methodInvoker = this.MethodInvoker;
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodBase_Name(this);
-#endif
return this.RuntimeName;
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodInfo_ReturnParameter(this);
-#endif
-
return this.RuntimeReturnParameter;
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodInfo_ReturnType(this);
-#endif
-
return ReturnParameter.ParameterType;
}
}
public abstract override RuntimeMethodHandle MethodHandle { get; }
- Type ITraceableTypeMember.ContainingType
- {
- get
- {
- return this.RuntimeDeclaringType;
- }
- }
-
- string ITraceableTypeMember.MemberName
- {
- get
- {
- return this.RuntimeName;
- }
- }
-
internal abstract RuntimeTypeInfo RuntimeDeclaringType
{
get;
if (_debugName == null)
{
_debugName = "Constructing..."; // Protect against any inadvertent reentrancy.
- _debugName = ((ITraceableTypeMember)this).MemberName;
+ _debugName = RuntimeName;
}
return this;
}
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
-
namespace System.Reflection.Runtime.MethodInfos
{
internal abstract class RuntimeNamedMethodInfo : RuntimeMethodInfo
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodBase_CustomAttributes(this);
-#endif
-
foreach (CustomAttributeData cad in _common.TrueCustomAttributes)
{
yield return cad;
[RequiresUnreferencedCode("If some of the generic arguments are annotated (either with DynamicallyAccessedMembersAttribute, or generic constraints), trimming can't validate that the requirements of those annotations are met.")]
public sealed override MethodInfo MakeGenericMethod(params Type[] typeArguments)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodInfo_MakeGenericMethod(this, typeArguments);
-#endif
-
if (typeArguments == null)
throw new ArgumentNullException(nameof(typeArguments));
if (GenericTypeParameters.Length == 0)
if (typeArguments.Length != GenericTypeParameters.Length)
throw new ArgumentException(SR.Format(SR.Argument_NotEnoughGenArguments, typeArguments.Length, GenericTypeParameters.Length));
RuntimeMethodInfo methodInfo = (RuntimeMethodInfo)RuntimeConstructedGenericMethodInfo.GetRuntimeConstructedGenericMethodInfo(this, genericTypeArguments);
- MethodInvoker methodInvoker = methodInfo.MethodInvoker; // For compatibility with other Make* apis, trigger any MissingMetadataExceptions now rather than later.
+ MethodInvoker _ = methodInfo.MethodInvoker; // For compatibility with other Make* apis, trigger any MissingMetadataExceptions now rather than later.
return methodInfo;
}
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
-
namespace System.Reflection.Runtime.MethodInfos
{
//
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodBase_CustomAttributes(this);
-#endif
-
return _common.TrueCustomAttributes;
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodBase_DeclaringType(this);
-#endif
-
return _common.DeclaringType;
}
}
[DebuggerGuidedStepThrough]
public sealed override object Invoke(BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.ConstructorInfo_Invoke(this, parameters);
-#endif
if (parameters == null)
parameters = Array.Empty<object>();
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.MethodBase_Name(this);
-#endif
-
return _common.Name;
}
}
using Internal.Reflection.Core;
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
-
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.PropertyInfo_CustomAttributes(this);
-#endif
-
return RuntimeCustomAttributeData.GetCustomAttributes(_reader, _property.GetCustomAttributes());
}
}
using Internal.Reflection.Core;
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
-
using Internal.Metadata.NativeFormat;
using NativeFormatMethodSemanticsAttributes = global::Internal.Metadata.NativeFormat.MethodSemanticsAttributes;
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.PropertyInfo_CustomAttributes(this);
-#endif
-
return RuntimeCustomAttributeData.GetCustomAttributes(_reader, _property.CustomAttributes);
}
}
using Internal.Reflection.Core;
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
-
-
namespace System.Reflection.Runtime.PropertyInfos
{
//
// The runtime's implementation of PropertyInfo's
//
[DebuggerDisplay("{_debugName}")]
- internal abstract partial class RuntimePropertyInfo : PropertyInfo, ITraceableTypeMember
+ internal abstract partial class RuntimePropertyInfo : PropertyInfo
{
//
// propertyHandle - the "tkPropertyDef" that identifies the property.
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.PropertyInfo_DeclaringType(this);
-#endif
-
return ContextTypeInfo;
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.PropertyInfo_GetMethod(this);
-#endif
-
return Getter;
}
}
public sealed override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.PropertyInfo_GetValue(this, obj, index);
-#endif
if (_lazyGetterInvoker == null)
{
if (!CanRead)
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.PropertyInfo_Name(this);
-#endif
-
return MetadataName;
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.PropertyInfo_PropertyType(this);
-#endif
-
Type propertyType = _lazyPropertyType;
if (propertyType == null)
{
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.PropertyInfo_SetMethod(this);
-#endif
-
return Setter;
}
}
public sealed override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, CultureInfo culture)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.PropertyInfo_SetValue(this, obj, value, index);
-#endif
if (_lazySetterInvoker == null)
{
if (!CanWrite)
return sb.ToString();
}
- string ITraceableTypeMember.MemberName
- {
- get
- {
- return MetadataName;
- }
- }
-
- Type ITraceableTypeMember.ContainingType
- {
- get
- {
- return ContextTypeInfo;
- }
- }
-
private RuntimeNamedMethodInfo Getter
{
get
private object GetConstantValue(bool raw)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.PropertyInfo_GetConstantValue(this);
-#endif
-
object defaultValue;
if (!GetDefaultValueIfAny(raw, out defaultValue))
{
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-using System;
-using System.Diagnostics.Tracing;
-
-namespace System.Reflection.Runtime.Tracing
-{
- [EventSource(Guid = "55B578AE-32B0-48F8-822F-B3245E6FA59C", Name = "System.Reflection.Runtime.Tracing")]
- internal sealed class ReflectionEventSource : EventSource
- {
- // Defines the singleton instance for the Resources ETW provider
- public static readonly ReflectionEventSource Log = new ReflectionEventSource();
-
- public static bool IsInitialized
- {
- get
- {
- return Log != null;
- }
- }
-
- private ReflectionEventSource() { }
-
-
- #region Reflection Event Handlers
- [Event(1)]
- public void TypeInfo_CustomAttributes(string typeName)
- {
- WriteEvent(1, typeName);
- }
-
- [Event(2)]
- public void TypeInfo_Name(string typeName)
- {
- WriteEvent(2, typeName);
- }
-
- [Event(3)]
- public void TypeInfo_BaseType(string typeName)
- {
- WriteEvent(3, typeName);
- }
-
- [Event(4)]
- public void TypeInfo_DeclaredConstructors(string typeName)
- {
- WriteEvent(4, typeName);
- }
-
- [Event(5)]
- public void TypeInfo_DeclaredEvents(string typeName)
- {
- WriteEvent(5, typeName);
- }
-
- [Event(6)]
- public void TypeInfo_DeclaredFields(string typeName)
- {
- WriteEvent(6, typeName);
- }
-
- [Event(7)]
- public void TypeInfo_DeclaredMembers(string typeName)
- {
- WriteEvent(7, typeName);
- }
-
- [Event(8)]
- public void TypeInfo_DeclaredMethods(string typeName)
- {
- WriteEvent(8, typeName);
- }
-
- [Event(9)]
- public void TypeInfo_DeclaredNestedTypes(string typeName)
- {
- WriteEvent(9, typeName);
- }
-
- [Event(10)]
- public void TypeInfo_DeclaredProperties(string typeName)
- {
- WriteEvent(10, typeName);
- }
-
- [Event(11)]
- public void TypeInfo_DeclaringMethod(string typeName)
- {
- WriteEvent(11, typeName);
- }
-
- [Event(12)]
- public void TypeInfo_FullName(string typeName)
- {
- WriteEvent(12, typeName);
- }
-
- [Event(13)]
- public void TypeInfo_Namespace(string typeName)
- {
- WriteEvent(13, typeName);
- }
-
- [Event(14)]
- public void TypeInfo_GetDeclaredEvent(string typeName, string eventName)
- {
- WriteEvent(14, typeName, eventName);
- }
-
- [Event(15)]
- public void TypeInfo_GetDeclaredField(string typeName, string fieldName)
- {
- WriteEvent(15, typeName, fieldName);
- }
-
- [Event(16)]
- public void TypeInfo_GetDeclaredMethod(string typeName, string methodName)
- {
- WriteEvent(16, typeName, methodName);
- }
-
- [Event(17)]
- public void TypeInfo_GetDeclaredProperty(string typeName, string propertyName)
- {
- WriteEvent(17, typeName, propertyName);
- }
-
- [Event(18)]
- public void TypeInfo_MakeArrayType(string typeName)
- {
- WriteEvent(18, typeName);
- }
-
- [Event(19)]
- public void TypeInfo_MakeByRefType(string typeName)
- {
- WriteEvent(19, typeName);
- }
-
- [Event(20)]
- public void TypeInfo_MakeGenericType(string typeName, string typeArguments)
- {
- WriteEvent(20, typeName, typeArguments);
- }
-
- [Event(21)]
- public void TypeInfo_MakePointerType(string typeName)
- {
- WriteEvent(21, typeName);
- }
-
- [Event(22)]
- public void Assembly_DefinedTypes(string assemblyName)
- {
- WriteEvent(22, assemblyName);
- }
-
- [Event(23)]
- public void Assembly_GetType(string assemblyName, string typeName)
- {
- WriteEvent(23, assemblyName, typeName);
- }
-
- [Event(24)]
- public void Assembly_CustomAttributes(string assemblyName)
- {
- WriteEvent(24, assemblyName);
- }
-
- [Event(25)]
- public void Assembly_FullName(string assemblyName)
- {
- WriteEvent(25, assemblyName);
- }
-
- [Event(26)]
- public void Assembly_GetName(string assemblyName)
- {
- WriteEvent(26, assemblyName);
- }
-
- [Event(27)]
- public void CustomAttributeData_ConstructorArguments(string caName)
- {
- WriteEvent(27, caName);
- }
-
- [Event(28)]
- public void CustomAttributeData_NamedArguments(string caName)
- {
- WriteEvent(28, caName);
- }
-
- [Event(29)]
- public void EventInfo_AddMethod(string typeName, string eventName)
- {
- WriteEvent(29, typeName, eventName);
- }
-
- [Event(30)]
- public void EventInfo_RaiseMethod(string typeName, string eventName)
- {
- WriteEvent(30, typeName, eventName);
- }
-
- [Event(31)]
- public void EventInfo_RemoveMethod(string typeName, string eventName)
- {
- WriteEvent(31, typeName, eventName);
- }
-
- [Event(32)]
- public void EventInfo_CustomAttributes(string typeName, string eventName)
- {
- WriteEvent(32, typeName, eventName);
- }
-
- [Event(33)]
- public void EventInfo_Name(string typeName, string eventName)
- {
- WriteEvent(33, typeName, eventName);
- }
-
- [Event(34)]
- public void EventInfo_DeclaringType(string typeName, string eventName)
- {
- WriteEvent(34, typeName, eventName);
- }
-
- [Event(35)]
- public void FieldInfo_SetValue(string typeName, string fieldName)
- {
- WriteEvent(35, typeName, fieldName);
- }
-
- [Event(36)]
- public void FieldInfo_GetValue(string typeName, string fieldName)
- {
- WriteEvent(36, typeName, fieldName);
- }
-
- [Event(37)]
- public void FieldInfo_CustomAttributes(string typeName, string fieldName)
- {
- WriteEvent(37, typeName, fieldName);
- }
-
- [Event(38)]
- public void FieldInfo_Name(string typeName, string fieldName)
- {
- WriteEvent(38, typeName, fieldName);
- }
-
- [Event(39)]
- public void FieldInfo_DeclaringType(string typeName, string fieldName)
- {
- WriteEvent(39, typeName, fieldName);
- }
-
- [Event(40)]
- public void MethodBase_CustomAttributes(string typeName, string methodName)
- {
- WriteEvent(40, typeName, methodName);
- }
-
- [Event(41)]
- public void MethodBase_Name(string typeName, string methodName)
- {
- WriteEvent(41, typeName, methodName);
- }
-
- [Event(42)]
- public void MethodBase_DeclaringType(string typeName, string methodName)
- {
- WriteEvent(42, typeName, methodName);
- }
-
- [Event(43)]
- public void MethodBase_GetParameters(string typeName, string methodName)
- {
- WriteEvent(43, typeName, methodName);
- }
-
- [Event(44)]
- public void MethodBase_Invoke(string typeName, string methodName)
- {
- WriteEvent(44, typeName, methodName);
- }
-
- [Event(45)]
- public void MethodInfo_ReturnParameter(string typeName, string methodName)
- {
- WriteEvent(45, typeName, methodName);
- }
-
- [Event(46)]
- public void MethodInfo_ReturnType(string typeName, string methodName)
- {
- WriteEvent(46, typeName, methodName);
- }
-
- [Event(47)]
- public void MethodInfo_MakeGenericMethod(string typeName, string methodName, string typeArguments)
- {
- WriteEvent(47, typeName, methodName, typeArguments);
- }
-
- [Event(48)]
- public void MethodInfo_CreateDelegate(string typeName, string methodName, string delegateTypeName)
- {
- WriteEvent(48, typeName, methodName, delegateTypeName);
- }
-
- [Event(49)]
- public void PropertyInfo_GetValue(string typeName, string propertyName)
- {
- WriteEvent(49, typeName, propertyName);
- }
-
- [Event(50)]
- public void PropertyInfo_SetValue(string typeName, string propertyName)
- {
- WriteEvent(50, typeName, propertyName);
- }
-
- [Event(51)]
- public void PropertyInfo_GetMethod(string typeName, string propertyName)
- {
- WriteEvent(51, typeName, propertyName);
- }
-
- [Event(52)]
- public void PropertyInfo_SetMethod(string typeName, string propertyName)
- {
- WriteEvent(52, typeName, propertyName);
- }
-
- [Event(53)]
- public void PropertyInfo_GetConstantValue(string typeName, string propertyName)
- {
- WriteEvent(53, typeName, propertyName);
- }
-
- [Event(54)]
- public void PropertyInfo_PropertyType(string typeName, string propertyName)
- {
- WriteEvent(54, typeName, propertyName);
- }
-
- [Event(55)]
- public void PropertyInfo_CustomAttributes(string typeName, string propertyName)
- {
- WriteEvent(55, typeName, propertyName);
- }
-
- [Event(56)]
- public void PropertyInfo_Name(string typeName, string propertyName)
- {
- WriteEvent(56, typeName, propertyName);
- }
-
- [Event(57)]
- public void PropertyInfo_DeclaringType(string typeName, string propertyName)
- {
- WriteEvent(57, typeName, propertyName);
- }
-
- [Event(58)]
- public void TypeInfo_AssemblyQualifiedName(string typeName)
- {
- WriteEvent(58, typeName);
- }
- #endregion
- }
-}
using System.Reflection.Runtime.TypeInfos;
using System.Reflection.Runtime.CustomAttributes;
-using Internal.Reflection.Tracing;
-
using Internal.Metadata.NativeFormat;
namespace System.Reflection.Runtime.TypeInfos.NativeFormat
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_CustomAttributes(this);
-#endif
-
return RuntimeCustomAttributeData.GetCustomAttributes(Reader, _genericParameter.CustomAttributes);
}
}
using System.Reflection.Runtime.MethodInfos;
using System.Reflection.Runtime.TypeInfos;
-using Internal.Reflection.Tracing;
-
using Internal.Metadata.NativeFormat;
namespace System.Reflection.Runtime.TypeInfos.NativeFormat
using System.Reflection.Runtime.MethodInfos;
using System.Reflection.Runtime.TypeInfos;
-
-using Internal.Reflection.Tracing;
-
using Internal.Metadata.NativeFormat;
namespace System.Reflection.Runtime.TypeInfos.NativeFormat
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_DeclaringMethod(this);
-#endif
return _declaringRuntimeNamedMethodInfo;
}
}
using System.Reflection.Runtime.General;
using System.Reflection.Runtime.TypeInfos;
-using Internal.Reflection.Tracing;
-
using Internal.Metadata.NativeFormat;
namespace System.Reflection.Runtime.TypeInfos.NativeFormat
using System.Reflection.Runtime.General;
using System.Reflection.Runtime.TypeInfos;
-using Internal.Reflection.Tracing;
-
using Internal.Metadata.NativeFormat;
namespace System.Reflection.Runtime.TypeInfos.NativeFormat
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_DeclaringMethod(this);
-#endif
return null;
}
}
using System.Reflection.Runtime.General;
using System.Reflection.Runtime.CustomAttributes;
-using Internal.Reflection.Tracing;
-
using Internal.Metadata.NativeFormat;
namespace System.Reflection.Runtime.TypeInfos.NativeFormat
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_Namespace(this);
-#endif
-
return NamespaceChain.NameSpace.EscapeTypeNameIdentifier();
}
}
return base.Equals(otherAsObject);
}
-#if ENABLE_REFLECTION_TRACE
- internal sealed override string TraceableTypeName
- {
- get
- {
- MetadataReader reader = Reader;
-
- String s = "";
- TypeDefinitionHandle typeDefinitionHandle = TypeDefinitionHandle;
- do
- {
- TypeDefinition typeDefinition = typeDefinitionHandle.GetTypeDefinition(reader);
- String name = typeDefinition.Name.GetString(reader);
- if (s == "")
- s = name;
- else
- s = name + "+" + s;
- typeDefinitionHandle = typeDefinition.EnclosingType;
- }
- while (!typeDefinitionHandle.IsNull(reader));
-
- String ns = NamespaceChain.NameSpace;
- if (ns != null)
- s = ns + "." + s;
- return s;
- }
- }
-#endif
-
internal sealed override QTypeDefRefOrSpec TypeDefinitionQHandle
{
get
using System.Reflection.Runtime.CustomAttributes;
using Internal.LowLevelLinq;
-using Internal.Reflection.Tracing;
using Internal.Reflection.Core.Execution;
using CharSet = System.Runtime.InteropServices.CharSet;
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_CustomAttributes(this);
-#endif
return Empty<CustomAttributeData>.Enumerable;
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_FullName(this);
-#endif
return GeneratedName;
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_Namespace(this);
-#endif
return null; // Reflection-blocked framework types report themselves as existing in the "root" namespace.
}
}
using System.Reflection.Runtime.MethodInfos;
using System.Runtime.InteropServices;
-using Internal.Reflection.Tracing;
using Internal.Reflection.Core.Execution;
namespace System.Reflection.Runtime.TypeInfos
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_CustomAttributes(this);
-#endif
-
return Empty<CustomAttributeData>.Enumerable;
}
}
using System.Reflection.Runtime.General;
using System.Reflection.Runtime.TypeInfos;
-using Internal.Reflection.Tracing;
using Internal.Reflection.Core.Execution;
using StructLayoutAttribute = System.Runtime.InteropServices.StructLayoutAttribute;
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_CustomAttributes(this);
-#endif
-
return GenericTypeDefinitionTypeInfo.CustomAttributes;
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_FullName(this);
-#endif
// Desktop quirk: open constructions don't have "fullNames".
if (ContainsGenericParameters)
return null;
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_Namespace(this);
-#endif
return GenericTypeDefinitionTypeInfo.Namespace;
}
}
using Internal.Reflection.Core;
using Internal.Reflection.Core.Execution;
-using Internal.Reflection.Tracing;
-
namespace System.Reflection.Runtime.TypeInfos
{
internal abstract class RuntimeGenericParameterTypeInfo : RuntimeTypeInfo
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_FullName(this);
-#endif
return null; // We return null as generic parameter types are not roundtrippable through Type.GetType().
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_Namespace(this);
-#endif
return DeclaringType.Namespace;
}
}
using System.Reflection.Runtime.General;
using System.Reflection.Runtime.TypeInfos;
-using Internal.Reflection.Tracing;
-
namespace System.Reflection.Runtime.TypeInfos
{
//
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_CustomAttributes(this);
-#endif
-
return Empty<CustomAttributeData>.Enumerable;
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_FullName(this);
-#endif
string elementFullName = _key.ElementType.FullName;
if (elementFullName == null)
return null;
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_Namespace(this);
-#endif
return _key.ElementType.Namespace;
}
}
using System.Reflection.Runtime.General;
using System.Reflection.Runtime.CustomAttributes;
-using Internal.Reflection.Tracing;
-
#pragma warning disable CA1067 // override Equals because it implements IEquatable<T>
namespace System.Reflection.Runtime.TypeInfos
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_CustomAttributes(this);
-#endif
-
foreach (CustomAttributeData cad in TrueCustomAttributes)
yield return cad;
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_FullName(this);
-#endif
-
Debug.Assert(!IsConstructedGenericType);
Debug.Assert(!IsGenericParameter);
Debug.Assert(!HasElementType);
}
}
-#if ENABLE_REFLECTION_TRACE
- internal abstract string TraceableTypeName { get; }
-#endif
-
/// <summary>
/// QTypeDefRefOrSpec handle that can be used to re-acquire this type. Must be implemented
/// for all metadata sourced type implementations.
using System.Reflection.Runtime.CustomAttributes;
using Internal.LowLevelLinq;
-using Internal.Reflection.Tracing;
using Internal.Reflection.Core.Execution;
using StructLayoutAttribute = System.Runtime.InteropServices.StructLayoutAttribute;
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_FullName(this);
-#endif
throw ReflectionCoreExecution.ExecutionDomain.CreateMissingMetadataException(this);
}
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_Namespace(this);
-#endif
throw ReflectionCoreExecution.ExecutionDomain.CreateMissingMetadataException(this);
}
}
using Internal.Reflection.Core.Execution;
using Internal.Reflection.Core.NonPortable;
-using Internal.Reflection.Tracing;
using Internal.Reflection.Augments;
using StructLayoutAttribute = System.Runtime.InteropServices.StructLayoutAttribute;
// shows up as build error.
//
[DebuggerDisplay("{_debugName}")]
- internal abstract partial class RuntimeTypeInfo : RuntimeType, ITraceableTypeMember, ICloneable
+ internal abstract partial class RuntimeTypeInfo : RuntimeType, ICloneable
{
protected RuntimeTypeInfo()
{
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_AssemblyQualifiedName(this);
-#endif
-
string fullName = FullName;
if (fullName == null) // Some Types (such as generic parameters) return null for FullName by design.
return null;
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_BaseType(this);
-#endif
-
// If this has a RuntimeTypeHandle, let the underlying runtime engine have the first crack. If it refuses, fall back to metadata.
RuntimeTypeHandle typeHandle = InternalTypeHandleIfAvailable;
if (!typeHandle.IsNull())
[RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public sealed override Type MakeArrayType()
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_MakeArrayType(this);
-#endif
-
// Do not implement this as a call to MakeArrayType(1) - they are not interchangable. MakeArrayType() returns a
// vector type ("SZArray") while MakeArrayType(1) returns a multidim array of rank 1. These are distinct types
// in the ECMA model and in CLR Reflection.
[RequiresDynamicCode("The code for an array of the specified type might not be available.")]
public sealed override Type MakeArrayType(int rank)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_MakeArrayType(this, rank);
-#endif
-
if (rank <= 0)
throw new IndexOutOfRangeException();
return this.GetMultiDimArrayTypeWithTypeHandle(rank);
public sealed override Type MakeByRefType()
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_MakeByRefType(this);
-#endif
return this.GetByRefType();
}
[RequiresUnreferencedCode("If some of the generic arguments are annotated (either with DynamicallyAccessedMembersAttribute, or generic constraints), trimming can't validate that the requirements of those annotations are met.")]
public sealed override Type MakeGenericType(params Type[] typeArguments)
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_MakeGenericType(this, typeArguments);
-#endif
-
if (typeArguments == null)
throw new ArgumentNullException(nameof(typeArguments));
public sealed override Type MakePointerType()
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_MakePointerType(this);
-#endif
-
return this.GetPointerType();
}
{
get
{
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- ReflectionTrace.TypeInfo_Name(this);
-#endif
-
Type rootCauseForFailure = null;
string name = InternalGetNameIfAvailable(ref rootCauseForFailure);
if (name == null)
return 0 != (Classification & TypeClassification.IsValueType);
}
- string ITraceableTypeMember.MemberName
- {
- get
- {
- string name = InternalNameIfAvailable;
- return name ?? string.Empty;
- }
- }
-
- Type ITraceableTypeMember.ContainingType
- {
- get
- {
- return this.InternalDeclaringType;
- }
- }
-
//
// Returns the anchoring typedef that declares the members that this type wants returned by the Declared*** properties.
// The Declared*** properties will project the anchoring typedef's members by overriding their DeclaringType property with "this"
{
_debugName = "Constructing..."; // Protect against any inadvertent reentrancy.
string debugName;
-#if ENABLE_REFLECTION_TRACE
- if (ReflectionTrace.Enabled)
- debugName = this.GetTraceString(); // If tracing on, call this.GetTraceString() which only gives you useful strings when metadata is available but doesn't pollute the ETW trace.
- else
-#endif
debugName = this.ToString();
if (debugName == null)
debugName = "";