Skip to content

[BUG] TextAlignment Extension Throwing Compiler Error #182

Closed

Description

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

if I extend the base Label class and implement the ILabel interface,

public class MyLabel : Label, ILabel
{

}

if I try to use the extended MyLabel class, text alignment extension will throw this exception

public MainPage()
{
	Content = new MyLabel
	{

	}.Center().TextCenter();
}
[CS0121](classifiedtextelementview-invokeaction:0): The call is ambiguous between the following methods or properties:
 'TextAlignmentExtensions_MyLabel.TextCenter<TAssignable>(TAssignable)' and 
'TextAlignmentExtensions_Label.TextCenter<TAssignable>(TAssignable)'

Expected Behavior

No compiler Error

Steps To Reproduce

See above

Link to public reproduction project repository

https://github.com/danielftz/BugExample.MCTMarkupTextAlignment

Environment

- .NET MAUI C# Markup CommunityToolkit:
- OS: MacOS
- .NET MAUI: Latest CUrrent

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions