diff --git a/CommunityToolkit.Mvvm.SourceGenerators/Attributes/NullabilityAttributesGenerator.cs b/CommunityToolkit.Mvvm.SourceGenerators/Attributes/NullabilityAttributesGenerator.cs index 147e9a95e..cfb540200 100644 --- a/CommunityToolkit.Mvvm.SourceGenerators/Attributes/NullabilityAttributesGenerator.cs +++ b/CommunityToolkit.Mvvm.SourceGenerators/Attributes/NullabilityAttributesGenerator.cs @@ -44,7 +44,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) { string source = LoadAttributeSourceWithMetadataName(NotNullAttributeMetadataName); - context.AddSource(NotNullAttributeMetadataName, source); + context.AddSource($"{NotNullAttributeMetadataName}.g.cs", source); }); // Check whether [NotNullIfNotNull] is not available @@ -57,7 +57,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) { string source = LoadAttributeSourceWithMetadataName(NotNullIfNotNullAttributeMetadataName); - context.AddSource(NotNullIfNotNullAttributeMetadataName, source); + context.AddSource($"{NotNullIfNotNullAttributeMetadataName}.g.cs", source); }); } diff --git a/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservablePropertyGenerator.cs b/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservablePropertyGenerator.cs index bcb375227..e250abdac 100644 --- a/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservablePropertyGenerator.cs +++ b/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservablePropertyGenerator.cs @@ -95,7 +95,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) // Insert all members into the same partial type declaration CompilationUnitSyntax compilationUnit = item.Hierarchy.GetCompilationUnit(memberDeclarations); - context.AddSource(item.Hierarchy.FilenameHint, compilationUnit.GetText(Encoding.UTF8)); + context.AddSource($"{item.Hierarchy.FilenameHint}.g.cs", compilationUnit.GetText(Encoding.UTF8)); }); // Gather all property changing names @@ -113,7 +113,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) if (compilationUnit is not null) { - context.AddSource("__KnownINotifyPropertyChangingArgs", compilationUnit.GetText(Encoding.UTF8)); + context.AddSource("__KnownINotifyPropertyChangingArgs.g.cs", compilationUnit.GetText(Encoding.UTF8)); } }); @@ -132,7 +132,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) if (compilationUnit is not null) { - context.AddSource("__KnownINotifyPropertyChangedArgs", compilationUnit.GetText(Encoding.UTF8)); + context.AddSource("__KnownINotifyPropertyChangedArgs.g.cs", compilationUnit.GetText(Encoding.UTF8)); } }); } diff --git a/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservableValidatorValidateAllPropertiesGenerator.cs b/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservableValidatorValidateAllPropertiesGenerator.cs index 6273285e6..42029748b 100644 --- a/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservableValidatorValidateAllPropertiesGenerator.cs +++ b/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/ObservableValidatorValidateAllPropertiesGenerator.cs @@ -59,7 +59,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) { CompilationUnitSyntax compilationUnit = Execute.GetSyntax(item); - context.AddSource("__ObservableValidatorExtensions", compilationUnit.GetText(Encoding.UTF8)); + context.AddSource("__ObservableValidatorExtensions.g.cs", compilationUnit.GetText(Encoding.UTF8)); }); // Generate the class with all validation methods @@ -67,7 +67,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) { CompilationUnitSyntax compilationUnit = Execute.GetSyntax(item); - context.AddSource(item.FilenameHint, compilationUnit.GetText(Encoding.UTF8)); + context.AddSource($"{item.FilenameHint}.g.cs", compilationUnit.GetText(Encoding.UTF8)); }); } } diff --git a/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/TransitiveMembersGenerator.cs b/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/TransitiveMembersGenerator.cs index 17316ab35..82bdfbd87 100644 --- a/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/TransitiveMembersGenerator.cs +++ b/CommunityToolkit.Mvvm.SourceGenerators/ComponentModel/TransitiveMembersGenerator.cs @@ -122,7 +122,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) ImmutableArray filteredMemberDeclarations = FilterDeclaredMembers(item.Info, sourceMemberDeclarations); CompilationUnitSyntax compilationUnit = item.Hierarchy.GetCompilationUnit(filteredMemberDeclarations, this.classDeclaration.BaseList); - context.AddSource(item.Hierarchy.FilenameHint, compilationUnit.GetText(Encoding.UTF8)); + context.AddSource($"{item.Hierarchy.FilenameHint}.g.cs", compilationUnit.GetText(Encoding.UTF8)); }); } diff --git a/CommunityToolkit.Mvvm.SourceGenerators/Input/ICommandGenerator.cs b/CommunityToolkit.Mvvm.SourceGenerators/Input/ICommandGenerator.cs index 0cc82aa90..0d9f7a6c5 100644 --- a/CommunityToolkit.Mvvm.SourceGenerators/Input/ICommandGenerator.cs +++ b/CommunityToolkit.Mvvm.SourceGenerators/Input/ICommandGenerator.cs @@ -69,7 +69,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) ImmutableArray memberDeclarations = Execute.GetSyntax(item.Info); CompilationUnitSyntax compilationUnit = item.Hierarchy.GetCompilationUnit(memberDeclarations); - context.AddSource($"{item.Hierarchy.FilenameHint}.{item.Info.MethodName}", compilationUnit.GetText(Encoding.UTF8)); + context.AddSource($"{item.Hierarchy.FilenameHint}.{item.Info.MethodName}.g.cs", compilationUnit.GetText(Encoding.UTF8)); }); } } diff --git a/CommunityToolkit.Mvvm.SourceGenerators/Messaging/IMessengerRegisterAllGenerator.cs b/CommunityToolkit.Mvvm.SourceGenerators/Messaging/IMessengerRegisterAllGenerator.cs index b3029c2db..dcb5f6633 100644 --- a/CommunityToolkit.Mvvm.SourceGenerators/Messaging/IMessengerRegisterAllGenerator.cs +++ b/CommunityToolkit.Mvvm.SourceGenerators/Messaging/IMessengerRegisterAllGenerator.cs @@ -67,7 +67,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) { CompilationUnitSyntax compilationUnit = Execute.GetSyntax(item); - context.AddSource("__IMessengerExtensions", compilationUnit.GetText(Encoding.UTF8)); + context.AddSource("__IMessengerExtensions.g.cs", compilationUnit.GetText(Encoding.UTF8)); }); // Generate the class with all registration methods @@ -75,7 +75,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) { CompilationUnitSyntax compilationUnit = Execute.GetSyntax(item); - context.AddSource(item.FilenameHint, compilationUnit.GetText(Encoding.UTF8)); + context.AddSource($"{item.FilenameHint}.g.cs", compilationUnit.GetText(Encoding.UTF8)); }); } }