From 272bb46c58414f7b33e86a1bacc0e92d94a363b4 Mon Sep 17 00:00:00 2001 From: Wolf <132034537+wolfgang-ironsoftware@users.noreply.github.com> Date: Fri, 11 Aug 2023 01:41:31 +0700 Subject: [PATCH] Use fully qualified namespace for Color reference in TextToColorGenerator (#1332) * Use fully qualified namespace for Color reference in TextToColorGenerator to prevent collisions This change should prevent "ambiguous reference" error to occur when other packages are included in a MAUI project that provide their own Color objects * added global prefix to be safer --------- Co-authored-by: Pedro Jesus Co-authored-by: Brandon Minnick <13558917+brminnick@users.noreply.github.com> --- .../Generators/TextColorToGenerator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs b/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs index 751b4c934..47773f94d 100644 --- a/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs +++ b/src/CommunityToolkit.Maui.SourceGenerators/Generators/TextColorToGenerator.cs @@ -24,6 +24,7 @@ class TextColorToGenerator : IIncrementalGenerator const string iTextStyleInterface = "Microsoft.Maui.ITextStyle"; const string iAnimatableInterface = "Microsoft.Maui.Controls.IAnimatable"; const string mauiControlsAssembly = "Microsoft.Maui.Controls"; + const string mauiColorFullName = "global::Microsoft.Maui.Graphics.Color"; public void Initialize(IncrementalGeneratorInitializationContext context) { @@ -115,7 +116,7 @@ namespace {{textStyleClassMetadata.Namespace}}; /// The duration, in milliseconds, of the animation /// The easing function to be used in the animation /// Value indicating if the animation completed successfully or not - public static Task TextColorTo{{textStyleClassMetadata.GenericArguments}}(this {{textStyleClassMetadata.Namespace}}.{{textStyleClassMetadata.ClassName}}{{textStyleClassMetadata.GenericArguments}} element, Color color, uint rate = 16u, uint length = 250u, Easing? easing = null) + public static Task TextColorTo{{textStyleClassMetadata.GenericArguments}}(this global::{{textStyleClassMetadata.Namespace}}.{{textStyleClassMetadata.ClassName}}{{textStyleClassMetadata.GenericArguments}} element, {{mauiColorFullName}} color, uint rate = 16u, uint length = 250u, Easing? easing = null) {{textStyleClassMetadata.GenericConstraints}} { ArgumentNullException.ThrowIfNull(element);