diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs index 37e070a4..0d2fc680 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs @@ -5521,7 +5521,8 @@ private static bool IsType(Cursor? cursor, Type type, [MaybeNullWhen(false)] } else if (templateSpecializationType.TemplateName.AsTemplateDecl is TemplateDecl templateDecl) { - if (templateDecl.TemplatedDecl is TypeDecl typeDecl) + // We exclude InjectedClassNameType here to avoid infinite recursion. + if ((templateDecl.TemplatedDecl is TypeDecl typeDecl) && (typeDecl.TypeForDecl is not InjectedClassNameType )) { return IsType(cursor, typeDecl.TypeForDecl, out value); }