Skip to content

Commit ebb2040

Browse files
committed
Skip type collection if property has MessagePackFormatterAttribute
1 parent eab5122 commit ebb2040

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/MessagePack.GeneratorCore/CodeAnalysis/TypeCollector.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,12 @@ private ObjectSerializationInfo GetObjectInfo(INamedTypeSymbol type)
720720
stringMembers.Add(member.StringKey, member);
721721
}
722722

723-
this.CollectCore(item.Type); // recursive collect
723+
var messagePackFormatter = item.GetAttributes().FirstOrDefault(x => x.AttributeClass.ApproximatelyEqual(this.typeReferences.MessagePackFormatterAttribute))?.ConstructorArguments[0];
724+
725+
if (messagePackFormatter == null)
726+
{
727+
this.CollectCore(item.Type); // recursive collect
728+
}
724729
}
725730

726731
foreach (IFieldSymbol item in type.GetAllMembers().OfType<IFieldSymbol>())

0 commit comments

Comments
 (0)