Skip to content

Commit

Permalink
Use fully qualified namespace for Color reference in TextToColorGener…
Browse files Browse the repository at this point in the history
…ator (#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 <[email protected]>
Co-authored-by: Brandon Minnick <[email protected]>
  • Loading branch information
3 people authored Aug 10, 2023
1 parent 4a580e5 commit 272bb46
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -115,7 +116,7 @@ namespace {{textStyleClassMetadata.Namespace}};
/// <param name="length">The duration, in milliseconds, of the animation</param>
/// <param name="easing">The easing function to be used in the animation</param>
/// <returns>Value indicating if the animation completed successfully or not</returns>
public static Task<bool> 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<bool> 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);
Expand Down

0 comments on commit 272bb46

Please sign in to comment.