CommunityToolkit / CommunityToolkit/Maui

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

Open
#1,847 7 comments 1 reaction 0 assignees View on GitHub
area/behaviors bug unverified
Dominant language
C#
Stars
2.7k
Forks
500
Avg merge
2d 14h
Merged PRs (30d)
7

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

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

- [X] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug

### 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
1. Uncomment the Entry.Behavior in Project2/MyControl
1. Build the solution for a native runtime, I've been using iOS.
1. 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

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

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with SelectAllTextBehaviorTest/SelectAllTextBehaviorTest.sln and Project2/MyControl, then reproduce the build after uncommenting Entry.Behavior for a native runtime. Compare that failure with a net8.0 target and the other Behaviors. Done means SelectAllTextBehavior can be referenced and the solution builds without XLS0414.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, ios
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.