diff --git a/src/IceRpc.ServiceGenerator/Internal/Parser.cs b/src/IceRpc.ServiceGenerator/Internal/Parser.cs index 210825f19..6755660f1 100644 --- a/src/IceRpc.ServiceGenerator/Internal/Parser.cs +++ b/src/IceRpc.ServiceGenerator/Internal/Parser.cs @@ -43,6 +43,10 @@ internal IReadOnlyList GetServiceDefinitions(IEnumerable(); + // Multiple partial declarations of the same class with [Service] applied to more than one part each yield + // their own ClassDeclarationSyntax from ForAttributeWithMetadataName. Process each class symbol once so we + // don't AddSource the same hint name twice. + var seenClassSymbols = new HashSet(SymbolEqualityComparer.Default); // we enumerate by syntax tree, to minimize the need to instantiate semantic models (since they're expensive) foreach (IGrouping group in classes.GroupBy(x => x.SyntaxTree)) { @@ -53,7 +57,7 @@ internal IReadOnlyList GetServiceDefinitions(IEnumerable