Repository: MessagePack-CSharp/MessagePack-CSharp

Issue:
SourceGenerator recursion crash from recursive generic type constraints
Thank you for your hard work.

The fix for #2005 was fixed in v3.0.233-rc.1,
so I updated it with NgetForUnity,
but I got the following compile error:

```
Stack overflow.
   at System.Runtime.CompilerServices.CastHelpers.ChkCastAny(Void*, System.Object)
   at Microsoft.CodeAnalysis.CSharp.Symbols.SymbolExtensions.GetPublicSymbol[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](Microsoft.CodeAnalysis.CSharp.Symbol)
   at Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.Symbol.Microsoft.CodeAnalysis.ISymbol.get_ContainingNamespace()
   at MessagePack.SourceGenerator.AnalyzerUtilities.GetFullNamespaceName(Microsoft.CodeAnalysis.INamespaceSymbol)
   at MessagePack.SourceGenerator.AnalyzerUtilities.GetFullNamespaceName(Microsoft.CodeAnalysis.INamespaceSymbol)
   at MessagePack.SourceGenerator.AnalyzerUtilities.GetFullNamespaceName(Microsoft.CodeAnalysis.INamespaceSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities.GetTypeParameters(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities.GetTypeParameters(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities.GetTypeParameters(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities.GetTypeParameters(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities.GetTypeParameters(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon><message truncated>
```

Additional information

I tried to find the cause by following the setup procedure from the initial Unity project, but
it seems that this compilation error occurs when you install addressables from Unity's package manager.

```
"com.unity.addressables": "2.1.0"
```
```
Stack overflow.
   at System.Linq.Enumerable.Select[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>, System.Func`2<System.__Canon,System.__Canon>)
   at System.Linq.ImmutableArrayExtensions.Select[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Immutable.ImmutableArray`1<System.__Canon>, System.Func`2<System.__Canon,System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities.GetTypeParameters(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities.GetTypeParameters(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities.GetTypeParameters(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities.GetTypeParameters(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities.GetTypeParameters(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo..ctor(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities+<>c.<GetTypeParameters>b__9_0(Microsoft.CodeAnalysis.ITypeParameterSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.ToImmutableArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at MessagePack.SourceGenerator.CodeAnalysis.CodeAnalysisUtilities.GetTypeParameters(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedNamedTypeName..ctor(Microsoft.CodeAnalysis.INamedTypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.QualifiedTypeName.Create(Microsoft.CodeAnalysis.ITypeSymbol)
   at MessagePack.SourceGenerator.CodeAnalysis.GenericTypeParameterInfo+<>c.<.ctor>b__8_0(Microsoft.CodeAnalysis.ITypeSymbol)
   at System.Linq.Enumerable+SelectArrayIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ToArray()
   at System.Linq.Enumerable.ToArray[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
   at System.Collections.Immutable.ImmutableArray.CreateRange[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, Public<message truncated>
```
Unity 6000.0.10f1
Message Pack v3.0.233-rc.1


Hints:
Thanks for reporting. 
Here is the repro I contrived from the callstack:

```cs
using System;
using MessagePack;

[MessagePackObject]
public class A<T>
    where T : IEquatable<A<T>>
{
}
```

Patch:
diff --git a/src/MessagePack.SourceGenerator/CodeAnalysis/CodeAnalysisUtilities.cs b/src/MessagePack.SourceGenerator/CodeAnalysis/CodeAnalysisUtilities.cs
index b08594f66..94033e030 100644
--- a/src/MessagePack.SourceGenerator/CodeAnalysis/CodeAnalysisUtilities.cs
+++ b/src/MessagePack.SourceGenerator/CodeAnalysis/CodeAnalysisUtilities.cs
@@ -2,7 +2,6 @@
 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
 
 using System.Collections.Immutable;
-using System.Text;
 using Microsoft.CodeAnalysis;
 using Microsoft.CodeAnalysis.CSharp.Syntax;
 
@@ -81,20 +80,20 @@ internal static int GetArity(ITypeSymbol dataType)
             _ => throw new NotSupportedException(),
         };
 
-    internal static ImmutableArray<GenericTypeParameterInfo> GetTypeParameters(ITypeSymbol dataType)
+    internal static ImmutableArray<GenericTypeParameterInfo> GetTypeParameters(ITypeSymbol dataType, ImmutableStack<GenericTypeParameterInfo>? recursionGuard = null)
         => dataType switch
         {
-            INamedTypeSymbol namedType => namedType.TypeParameters.Select(t => new GenericTypeParameterInfo(t)).ToImmutableArray(),
+            INamedTypeSymbol namedType => namedType.TypeParameters.Select(t => GenericTypeParameterInfo.Create(t, recursionGuard)).ToImmutableArray(),
             IArrayTypeSymbol arrayType => GetTypeParameters(arrayType.ElementType),
             ITypeParameterSymbol => ImmutableArray<GenericTypeParameterInfo>.Empty,
             _ => throw new NotSupportedException(),
         };
 
-    internal static ImmutableArray<QualifiedTypeName> GetTypeArguments(ITypeSymbol dataType)
+    internal static ImmutableArray<QualifiedTypeName> GetTypeArguments(ITypeSymbol dataType, ImmutableStack<GenericTypeParameterInfo>? recursionGuard = null)
         => dataType switch
         {
-            INamedTypeSymbol namedType => namedType.TypeArguments.Select(QualifiedTypeName.Create).ToImmutableArray(),
-            IArrayTypeSymbol arrayType => GetTypeArguments(arrayType.ElementType),
+            INamedTypeSymbol namedType => namedType.TypeArguments.Select(t => QualifiedTypeName.Create(t, recursionGuard)).ToImmutableArray(),
+            IArrayTypeSymbol arrayType => GetTypeArguments(arrayType.ElementType, recursionGuard),
             ITypeParameterSymbol => ImmutableArray<QualifiedTypeName>.Empty,
             _ => throw new NotSupportedException(),
         };
diff --git a/src/MessagePack.SourceGenerator/CodeAnalysis/GenericTypeParameterInfo.cs b/src/MessagePack.SourceGenerator/CodeAnalysis/GenericTypeParameterInfo.cs
index bd85069ae..361959503 100644
--- a/src/MessagePack.SourceGenerator/CodeAnalysis/GenericTypeParameterInfo.cs
+++ b/src/MessagePack.SourceGenerator/CodeAnalysis/GenericTypeParameterInfo.cs
@@ -11,18 +11,30 @@ public record GenericTypeParameterInfo(string Name) : IComparable<GenericTypePar
 {
     private string? constraints;
 
-    public GenericTypeParameterInfo(ITypeParameterSymbol typeParameter)
+    private GenericTypeParameterInfo(ITypeParameterSymbol typeParameter, ImmutableStack<GenericTypeParameterInfo> recursionGuard)
         : this(typeParameter.Name)
     {
+        recursionGuard = recursionGuard.Push(this);
+
         this.HasUnmanagedTypeConstraint = typeParameter.HasUnmanagedTypeConstraint;
         this.HasReferenceTypeConstraint = typeParameter.HasReferenceTypeConstraint;
         this.HasValueTypeConstraint = typeParameter.HasValueTypeConstraint;
         this.HasNotNullConstraint = typeParameter.HasNotNullConstraint;
-        this.ConstraintTypes = typeParameter.ConstraintTypes.Select(t => QualifiedTypeName.Create(t)).ToImmutableArray();
+        this.ConstraintTypes = typeParameter.ConstraintTypes.Select(t => QualifiedTypeName.Create(t, recursionGuard)).ToImmutableArray();
         this.HasConstructorConstraint = typeParameter.HasConstructorConstraint;
         this.ReferenceTypeConstraintNullableAnnotation = typeParameter.ReferenceTypeConstraintNullableAnnotation;
     }
 
+    public static GenericTypeParameterInfo Create(ITypeParameterSymbol typeParameter, ImmutableStack<GenericTypeParameterInfo>? recursionGuard = null)
+    {
+        if (recursionGuard?.FirstOrDefault(tpi => tpi.Name == typeParameter.Name) is { } existing)
+        {
+            return existing;
+        }
+
+        return new(typeParameter, recursionGuard ?? ImmutableStack<GenericTypeParameterInfo>.Empty);
+    }
+
     public string Constraints => this.constraints ??= this.ConstructConstraintString();
 
     public bool HasConstraints => this.Constraints.Length > 0;
diff --git a/src/MessagePack.SourceGenerator/CodeAnalysis/QualifiedNamedTypeName.cs b/src/MessagePack.SourceGenerator/CodeAnalysis/QualifiedNamedTypeName.cs
index 5023ed837..97d51d976 100644
--- a/src/MessagePack.SourceGenerator/CodeAnalysis/QualifiedNamedTypeName.cs
+++ b/src/MessagePack.SourceGenerator/CodeAnalysis/QualifiedNamedTypeName.cs
@@ -3,8 +3,6 @@
 
 #pragma warning disable SA1402 // File may only contain a single type
 
-using System;
-using System.Collections.Generic;
 using System.Collections.Immutable;
 using System.Diagnostics;
 using System.Diagnostics.CodeAnalysis;
@@ -39,7 +37,7 @@ public QualifiedNamedTypeName(TypeKind kind, bool isRecord = false)
     }
 
     [SetsRequiredMembers]
-    public QualifiedNamedTypeName(INamedTypeSymbol symbol)
+    public QualifiedNamedTypeName(INamedTypeSymbol symbol, ImmutableStack<GenericTypeParameterInfo>? recursionGuard = null)
     {
         this.Name = symbol.Name;
         this.Kind = symbol.TypeKind;
@@ -47,8 +45,8 @@ public QualifiedNamedTypeName(INamedTypeSymbol symbol)
         this.Container = symbol.ContainingType is { } nesting ? new NestingTypeContainer(new(nesting)) :
             symbol.ContainingNamespace?.GetFullNamespaceName() is string ns ? new NamespaceTypeContainer(ns) :
             null;
-        this.TypeParameters = CodeAnalysisUtilities.GetTypeParameters(symbol);
-        this.TypeArguments = CodeAnalysisUtilities.GetTypeArguments(symbol);
+        this.TypeParameters = CodeAnalysisUtilities.GetTypeParameters(symbol, recursionGuard);
+        this.TypeArguments = CodeAnalysisUtilities.GetTypeArguments(symbol, recursionGuard);
         this.ReferenceTypeNullableAnnotation = symbol.NullableAnnotation;
     }
 
diff --git a/src/MessagePack.SourceGenerator/CodeAnalysis/QualifiedTypeName.cs b/src/MessagePack.SourceGenerator/CodeAnalysis/QualifiedTypeName.cs
index d2d5679fe..5eda4f6cf 100644
--- a/src/MessagePack.SourceGenerator/CodeAnalysis/QualifiedTypeName.cs
+++ b/src/MessagePack.SourceGenerator/CodeAnalysis/QualifiedTypeName.cs
@@ -2,10 +2,7 @@
 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
 
 using System.Collections.Immutable;
-using System.Diagnostics;
-using System.Text;
 using Microsoft.CodeAnalysis;
-using Microsoft.CodeAnalysis.CSharp.Syntax;
 
 namespace MessagePack.SourceGenerator.CodeAnalysis;
 
@@ -18,17 +15,21 @@ public abstract record QualifiedTypeName : IComparable<QualifiedTypeName>
     /// Initializes a new instance of the <see cref="QualifiedTypeName"/> class.
     /// </summary>
     /// <param name="symbol">The symbol this instance will identify.</param>
-    public static QualifiedTypeName Create(ITypeSymbol symbol)
+    /// <param name="recursionGuard">A stack of objects that serves to avoid infinite recursion when generic constraints are written in terms of themselves.</param>
+    public static QualifiedTypeName Create(ITypeSymbol symbol, ImmutableStack<GenericTypeParameterInfo>? recursionGuard = null)
     {
         return symbol switch
         {
             IArrayTypeSymbol arrayType => new QualifiedArrayTypeName(arrayType),
-            INamedTypeSymbol namedType => new QualifiedNamedTypeName(namedType),
+            INamedTypeSymbol namedType => new QualifiedNamedTypeName(namedType, recursionGuard),
             ITypeParameterSymbol typeParam => new TypeParameter(typeParam),
             _ => throw new NotSupportedException(),
         };
     }
 
+    /// <inheritdoc cref="Create(ITypeSymbol, ImmutableStack{GenericTypeParameterInfo}?)"/>
+    public static QualifiedTypeName Create(ITypeSymbol symbol) => Create(symbol, null);
+
     /// <summary>
     /// Gets the kind of type.
     /// </summary>
diff --git a/src/MessagePack.SourceGenerator/CodeAnalysis/TypeCollector.cs b/src/MessagePack.SourceGenerator/CodeAnalysis/TypeCollector.cs
index 2d7da5a63..50565ad91 100644
--- a/src/MessagePack.SourceGenerator/CodeAnalysis/TypeCollector.cs
+++ b/src/MessagePack.SourceGenerator/CodeAnalysis/TypeCollector.cs
@@ -5,13 +5,11 @@
 #pragma warning disable SA1649 // File name should match first type name
 
 using System.Collections.Immutable;
-using System.ComponentModel;
 using System.Reflection;
 using System.Text.RegularExpressions;
 using Microsoft.CodeAnalysis;
 using Microsoft.CodeAnalysis.CSharp;
 using Microsoft.CodeAnalysis.CSharp.Syntax;
-using Microsoft.CodeAnalysis.Operations;
 
 namespace MessagePack.SourceGenerator.CodeAnalysis;
 
@@ -1407,7 +1405,7 @@ void ReportNonUniqueNameIfApplicable(ISymbol item, string stringKey)
             formattedType,
             isClass: isClass,
             nestedFormatterRequired: nestedFormatterRequired,
-            genericTypeParameters: formattedType.IsGenericType ? formattedType.TypeParameters.Select(t => new GenericTypeParameterInfo(t)).ToArray() : Array.Empty<GenericTypeParameterInfo>(),
+            genericTypeParameters: formattedType.IsGenericType ? formattedType.TypeParameters.Select(t => GenericTypeParameterInfo.Create(t)).ToArray() : Array.Empty<GenericTypeParameterInfo>(),
             constructorParameters: constructorParameters.ToArray(),
             isIntKey: isIntKey,
             members: isIntKey ? intMembers.Values.Select(v => v.Info).ToArray() : stringMembers.Values.Select(v => v.Info).ToArray(),


Test patch:
diff --git a/tests/MessagePack.SourceGenerator.Tests/GenericsFormatterTests.cs b/tests/MessagePack.SourceGenerator.Tests/GenericsFormatterTests.cs
index 57ae40582..283622c59 100644
--- a/tests/MessagePack.SourceGenerator.Tests/GenericsFormatterTests.cs
+++ b/tests/MessagePack.SourceGenerator.Tests/GenericsFormatterTests.cs
@@ -493,4 +493,24 @@ public class MyObjectNested
             },
         }.RunAsync();
     }
+
+    /// <summary>
+    /// Asserts that the generator can handle directly recursive generic constraints.
+    /// </summary>
+    [Fact]
+    public async Task RecursiveGenerics_Direct()
+    {
+        string testSource = /* lang=c#-test */ """
+            using System;
+            using MessagePack;
+
+            [MessagePackObject]
+            public class A<T>
+                where T : IEquatable<A<T>>
+            {
+            }
+            """;
+
+        await VerifyCS.Test.RunDefaultAsync(this.testOutputHelper, testSource);
+    }
 }
diff --git a/tests/MessagePack.SourceGenerator.Tests/Resources/RecursiveGenerics_Direct/Formatters.MessagePack.GeneratedMessagePackResolver.AFormatter`1.g.cs b/tests/MessagePack.SourceGenerator.Tests/Resources/RecursiveGenerics_Direct/Formatters.MessagePack.GeneratedMessagePackResolver.AFormatter`1.g.cs
new file mode 100644
index 000000000..1e400bc4e
--- /dev/null
+++ b/tests/MessagePack.SourceGenerator.Tests/Resources/RecursiveGenerics_Direct/Formatters.MessagePack.GeneratedMessagePackResolver.AFormatter`1.g.cs
@@ -0,0 +1,39 @@
+﻿// <auto-generated />
+
+#pragma warning disable 618, 612, 414, 168, CS1591, SA1129, SA1309, SA1312, SA1403, SA1649
+
+#pragma warning disable CS8669 // We may leak nullable annotations into generated code.
+
+using MsgPack = global::MessagePack;
+
+namespace MessagePack {
+partial class GeneratedMessagePackResolver {
+
+	internal sealed class AFormatter<T> : MsgPack::Formatters.IMessagePackFormatter<global::A<T>>
+		where T : global::System.IEquatable<global::A<T>>
+	{
+
+		public void Serialize(ref MsgPack::MessagePackWriter writer, global::A<T> value, MsgPack::MessagePackSerializerOptions options)
+		{
+			if (value == null)
+			{
+				writer.WriteNil();
+				return;
+			}
+
+			writer.WriteArrayHeader(0);
+		}
+
+		public global::A<T> Deserialize(ref MsgPack::MessagePackReader reader, MsgPack::MessagePackSerializerOptions options)
+		{
+			if (reader.TryReadNil())
+			{
+				return null;
+			}
+
+			reader.Skip();
+			return new global::A<T>();
+		}
+	}
+}
+}
diff --git a/tests/MessagePack.SourceGenerator.Tests/Resources/RecursiveGenerics_Direct/MessagePack.GeneratedMessagePackResolver.g.cs b/tests/MessagePack.SourceGenerator.Tests/Resources/RecursiveGenerics_Direct/MessagePack.GeneratedMessagePackResolver.g.cs
new file mode 100644
index 000000000..186f7d6b2
--- /dev/null
+++ b/tests/MessagePack.SourceGenerator.Tests/Resources/RecursiveGenerics_Direct/MessagePack.GeneratedMessagePackResolver.g.cs
@@ -0,0 +1,63 @@
+﻿// <auto-generated />
+
+#pragma warning disable 618, 612, 414, 168, CS1591, SA1129, SA1309, SA1312, SA1403, SA1649
+
+using MsgPack = global::MessagePack;
+
+[assembly: MsgPack::Internal.GeneratedAssemblyMessagePackResolverAttribute(typeof(MessagePack.GeneratedMessagePackResolver), 3, 0)]
+
+namespace MessagePack {
+
+/// <summary>A MessagePack resolver that uses generated formatters for types in this assembly.</summary>
+partial class GeneratedMessagePackResolver : MsgPack::IFormatterResolver
+{
+	/// <summary>An instance of this resolver that only returns formatters specifically generated for types in this assembly.</summary>
+	public static readonly MsgPack::IFormatterResolver Instance = new GeneratedMessagePackResolver();
+
+	private GeneratedMessagePackResolver()
+	{
+	}
+
+	public MsgPack::Formatters.IMessagePackFormatter<T> GetFormatter<T>()
+	{
+		return FormatterCache<T>.Formatter;
+	}
+
+	private static class FormatterCache<T>
+	{
+		internal static readonly MsgPack::Formatters.IMessagePackFormatter<T> Formatter;
+
+		static FormatterCache()
+		{
+			var f = GeneratedMessagePackResolverGetFormatterHelper.GetFormatter(typeof(T));
+			if (f != null)
+			{
+				Formatter = (MsgPack::Formatters.IMessagePackFormatter<T>)f;
+			}
+		}
+	}
+
+	private static class GeneratedMessagePackResolverGetFormatterHelper
+	{
+		private static readonly global::System.Collections.Generic.Dictionary<global::System.Type, int> openTypeLookup = new global::System.Collections.Generic.Dictionary<global::System.Type, int>(1)
+		{
+			{ typeof(global::A<>), 0 },
+		};
+
+		internal static object GetFormatter(global::System.Type t)
+		{
+			if (t.IsGenericType && openTypeLookup.TryGetValue(t.GetGenericTypeDefinition(), out int openKey))
+			{
+				switch (openKey)
+				{
+					case 0: return global::System.Activator.CreateInstance(typeof(global::MessagePack.GeneratedMessagePackResolver.AFormatter<>).MakeGenericType(t.GenericTypeArguments));
+					default: return null; // unreachable
+				};
+			}
+
+			return null;
+		}
+	}
+}
+
+}