Is your feature request related to a problem? Please describe.
GenerateNotificationsAttribute targets only AttributeTargets.Class and its generator processes field declarations. C# record types (both record class and record struct) are increasingly used as lightweight view-model / DTO bases, and users cannot apply [GenerateNotifications] to them today.
Describe the solution you'd like
- Extend attribute usage and generator predicate to also accept
RecordDeclarationSyntax.
- For records, generate notification-enabled init-only properties via
init setters (or set if the attribute opts in) to keep the record semantic intact.
- Raise a
DiagnosticDescriptor warning when [GenerateNotifications] is applied to a positional record (primary-constructor params cannot easily be intercepted).
Describe alternatives you've considered
Converting records to regular classes — defeats the benefit of the concise record syntax.
Additional context
Affected files: src/BB84.SourceGenerators/NotificationsGenerator.cs, src/BB84.SourceGenerators/Attributes/GenerateNotificationsAttribute.cs, src/BB84.SourceGenerators/Analyzers/DiagnosticDescriptors.cs.
Is your feature request related to a problem? Please describe.
GenerateNotificationsAttributetargets onlyAttributeTargets.Classand its generator processes field declarations. C#recordtypes (bothrecord classandrecord struct) are increasingly used as lightweight view-model / DTO bases, and users cannot apply[GenerateNotifications]to them today.Describe the solution you'd like
RecordDeclarationSyntax.initsetters (orsetif the attribute opts in) to keep the record semantic intact.DiagnosticDescriptorwarning when[GenerateNotifications]is applied to a positional record (primary-constructor params cannot easily be intercepted).Describe alternatives you've considered
Converting records to regular classes — defeats the benefit of the concise record syntax.
Additional context
Affected files:
src/BB84.SourceGenerators/NotificationsGenerator.cs,src/BB84.SourceGenerators/Attributes/GenerateNotificationsAttribute.cs,src/BB84.SourceGenerators/Analyzers/DiagnosticDescriptors.cs.