public static TraceLoggingTypeInfo <DataType> CreateDefaultTypeInfo <DataType>(List <Type> recursionCheck) { Type type = typeof(DataType); if (recursionCheck.Contains(type)) { throw new NotSupportedException(Environment.GetResourceString("EventSource_RecursiveTypeDefinition")); } recursionCheck.Add(type); EventDataAttribute customAttribute = Statics.GetCustomAttribute <EventDataAttribute>(type); TraceLoggingTypeInfo traceLoggingTypeInfo; if (customAttribute != null || Statics.GetCustomAttribute <CompilerGeneratedAttribute>(type) != null) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new InvokeTypeInfo <DataType>(new TypeAnalysis(type, customAttribute, recursionCheck)); } else if (type.IsArray) { Type elementType = type.GetElementType(); if (elementType == typeof(bool)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new BooleanArrayTypeInfo(); } else if (elementType == typeof(byte)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new ByteArrayTypeInfo(); } else if (elementType == typeof(sbyte)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new SByteArrayTypeInfo(); } else if (elementType == typeof(short)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new Int16ArrayTypeInfo(); } else if (elementType == typeof(ushort)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new UInt16ArrayTypeInfo(); } else if (elementType == typeof(int)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new Int32ArrayTypeInfo(); } else if (elementType == typeof(uint)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new UInt32ArrayTypeInfo(); } else if (elementType == typeof(long)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new Int64ArrayTypeInfo(); } else if (elementType == typeof(ulong)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new UInt64ArrayTypeInfo(); } else if (elementType == typeof(char)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new CharArrayTypeInfo(); } else if (elementType == typeof(double)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new DoubleArrayTypeInfo(); } else if (elementType == typeof(float)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new SingleArrayTypeInfo(); } else if (elementType == typeof(IntPtr)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new IntPtrArrayTypeInfo(); } else if (elementType == typeof(UIntPtr)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new UIntPtrArrayTypeInfo(); } else if (elementType == typeof(Guid)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new GuidArrayTypeInfo(); } else { traceLoggingTypeInfo = (TraceLoggingTypeInfo)Statics.CreateInstance(typeof(ArrayTypeInfo <>).MakeGenericType(elementType), (object)Statics.GetTypeInfoInstance(elementType, recursionCheck)); } } else if (Statics.IsEnum(type)) { Type underlyingType = Enum.GetUnderlyingType(type); if (underlyingType == typeof(int)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new EnumInt32TypeInfo <DataType>(); } else if (underlyingType == typeof(uint)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new EnumUInt32TypeInfo <DataType>(); } else if (underlyingType == typeof(byte)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new EnumByteTypeInfo <DataType>(); } else if (underlyingType == typeof(sbyte)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new EnumSByteTypeInfo <DataType>(); } else if (underlyingType == typeof(short)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new EnumInt16TypeInfo <DataType>(); } else if (underlyingType == typeof(ushort)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new EnumUInt16TypeInfo <DataType>(); } else if (underlyingType == typeof(long)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new EnumInt64TypeInfo <DataType>(); } else if (underlyingType == typeof(ulong)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new EnumUInt64TypeInfo <DataType>(); } else { throw new NotSupportedException(Environment.GetResourceString("EventSource_NotSupportedEnumType", (object)type.Name, (object)underlyingType.Name)); } } else if (type == typeof(string)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new StringTypeInfo(); } else if (type == typeof(bool)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new BooleanTypeInfo(); } else if (type == typeof(byte)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new ByteTypeInfo(); } else if (type == typeof(sbyte)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new SByteTypeInfo(); } else if (type == typeof(short)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new Int16TypeInfo(); } else if (type == typeof(ushort)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new UInt16TypeInfo(); } else if (type == typeof(int)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new Int32TypeInfo(); } else if (type == typeof(uint)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new UInt32TypeInfo(); } else if (type == typeof(long)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new Int64TypeInfo(); } else if (type == typeof(ulong)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new UInt64TypeInfo(); } else if (type == typeof(char)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new CharTypeInfo(); } else if (type == typeof(double)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new DoubleTypeInfo(); } else if (type == typeof(float)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new SingleTypeInfo(); } else if (type == typeof(DateTime)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new DateTimeTypeInfo(); } else if (type == typeof(Decimal)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new DecimalTypeInfo(); } else if (type == typeof(IntPtr)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new IntPtrTypeInfo(); } else if (type == typeof(UIntPtr)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new UIntPtrTypeInfo(); } else if (type == typeof(Guid)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new GuidTypeInfo(); } else if (type == typeof(TimeSpan)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new TimeSpanTypeInfo(); } else if (type == typeof(DateTimeOffset)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new DateTimeOffsetTypeInfo(); } else if (type == typeof(EmptyStruct)) { traceLoggingTypeInfo = (TraceLoggingTypeInfo) new NullTypeInfo <EmptyStruct>(); } else if (Statics.IsGenericMatch(type, (object)typeof(KeyValuePair <,>))) { Type[] genericArguments = Statics.GetGenericArguments(type); traceLoggingTypeInfo = (TraceLoggingTypeInfo)Statics.CreateInstance(typeof(KeyValuePairTypeInfo <,>).MakeGenericType(genericArguments[0], genericArguments[1]), (object)recursionCheck); } else if (Statics.IsGenericMatch(type, (object)typeof(Nullable <>))) { traceLoggingTypeInfo = (TraceLoggingTypeInfo)Statics.CreateInstance(typeof(NullableTypeInfo <>).MakeGenericType(Statics.GetGenericArguments(type)[0]), (object)recursionCheck); } else { Type enumerableElementType = Statics.FindEnumerableElementType(type); if (enumerableElementType != (Type)null) { traceLoggingTypeInfo = (TraceLoggingTypeInfo)Statics.CreateInstance(typeof(EnumerableTypeInfo <,>).MakeGenericType(type, enumerableElementType), (object)Statics.GetTypeInfoInstance(enumerableElementType, recursionCheck)); } else { throw new ArgumentException(Environment.GetResourceString("EventSource_NonCompliantTypeError", (object)type.Name)); } } return((TraceLoggingTypeInfo <DataType>)traceLoggingTypeInfo); }