CommunityToolkit / Maui

The .NET MAUI Community Toolkit is a community-created library that contains .NET MAUI Extensions, Advanced UI/UX Controls, and Behaviors to help make your life as a .NET MAUI developer easier
https://learn.microsoft.com/dotnet/communitytoolkit/maui
MIT License
2.09k stars 337 forks source link

[BUG] The SelectAllTextBehavior cannot be referenced from a project that runs .NET without a native runtime #1847

Open bijington opened 1 month ago

bijington commented 1 month ago

Is there an existing issue for this?

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

The SelectAllTextBehavior cannot be referenced from a project that runs .NET without a native runtime. Because of the way unit tests run in Maui, it's common to have a version of .NET as the target framework.

Based on the initial PR for the docs highlighting the behavior (pun intended) https://github.com/MicrosoftDocs/CommunityToolkit/pull/411#issuecomment-2081680258

Expected Behavior

You should be able to refer to SelectAllTextBehavior in a net8.0 project target just like all other Behaviors.

Steps To Reproduce

  1. Open SelectAllTextBehaviorTest/SelectAllTextBehaviorTest.sln
  2. Uncomment the Entry.Behavior in Project2/MyControl
  3. Build the solution for a native runtime, I've been using iOS.
  4. The build will fail saying Error: XLS0414: The type 'toolkit:SelectAllTextBehavior' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

Link to public reproduction project repository

https://github.com/TrueMoniker/maui_SelectAllTextBehavior_Test/tree/main

Environment

- .NET MAUI CommunityToolkit: 8.0.1
- OS: macOS
- .NET MAUI: 8.0.x

Anything else?

No response