Skip to content

Commit 8fe5fc9

Browse files
authored
Merge pull request MessagePack-CSharp#1462 from gllebede/user/gllebede/skip_properties_with_MessagePackFormatterAttribute
Skip type collection if property has MessagePackFormatterAttribute
2 parents eab5122 + ebb2040 commit 8fe5fc9

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)