From 9f3211281c64cc3f5f570b99381245ad9475677f Mon Sep 17 00:00:00 2001 From: Katy Coe Date: Mon, 10 Feb 2020 06:29:48 +0100 Subject: [PATCH] Model: Ensure all custom attributes are loaded --- Il2CppInspector.Common/Reflection/Il2CppModel.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Il2CppInspector.Common/Reflection/Il2CppModel.cs b/Il2CppInspector.Common/Reflection/Il2CppModel.cs index 7c9f1aa..7b891dd 100644 --- a/Il2CppInspector.Common/Reflection/Il2CppModel.cs +++ b/Il2CppInspector.Common/Reflection/Il2CppModel.cs @@ -105,6 +105,15 @@ namespace Il2CppInspector.Reflection } } + // Find all custom attribute generators (populate AttributesByIndices) (use ToList() to force evaluation) + var allAssemblyAttributes = Assemblies.Select(a => a.CustomAttributes).ToList(); + var allTypeAttributes = TypesByDefinitionIndex.Select(t => t.CustomAttributes).ToList(); + var allEventAttributes = TypesByDefinitionIndex.SelectMany(t => t.DeclaredEvents).Select(e => e.CustomAttributes).ToList(); + var allFieldAttributes = TypesByDefinitionIndex.SelectMany(t => t.DeclaredFields).Select(f => f.CustomAttributes).ToList(); + var allPropertyAttributes = TypesByDefinitionIndex.SelectMany(t => t.DeclaredProperties).Select(p => p.CustomAttributes).ToList(); + var allMethodAttributes = MethodsByDefinitionIndex.Select(m => m.CustomAttributes).ToList(); + var allParameterAttributes = MethodsByDefinitionIndex.SelectMany(m => m.DeclaredParameters).Select(p => p.CustomAttributes).ToList(); + // Create method invokers (one per signature, in invoker index order) foreach (var method in MethodsByDefinitionIndex) { var index = package.GetInvokerIndex(method.DeclaringType.Assembly.ModuleDefinition, method.Definition);