diff --git a/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs b/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs index 59cb048..aa8d409 100644 --- a/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs +++ b/Il2CppInspector.Common/Cpp/CppDeclarationGenerator.cs @@ -351,7 +351,17 @@ public class CppDeclarationGenerator foreach (var mi in GetFilledVTable(ti)) { - if (mi is { ContainsGenericParameters: false }) + // The VirtualAddress: not null constraint is a workaround for a much bigger issue: + // circular generic argument references that cause loops when inflating the types. + // ex. Class -> member Class -> instantiates Class -> member Class -> instantiates Class -> ... + // or Class -> member Class> -> instantiates Class> -> member Class>> -> ... + + // The only game (issue #49) that currently encounters this uses the MetaXR Unity SDK, + // which defines OVRTask which has a method that returns OVRTask. + // This filters out methods like that, as they get folded through generic sharing + // in the actual runtime. + + if (mi is { ContainsGenericParameters: false, VirtualAddress: not null }) IncludeMethod(mi); }