dotnet / dotnet/macios

Add a Selector.GetHandle overload that takes a ReadOnlySpan<byte>

Open
#17,630 0 comments 0 reactions 0 assignees View on GitHub
dotnet-external-dependency enhancement
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 12h
Merged PRs (30d)
123

Description

We'd like to add a `Selector.GetHandle` overload that takes a `ReadOnlySpan`:

```cs
public extern static IntPtr GetHandle (/* const char* */ ReadOnlySpan name);
```

where the `name` argument is a UTF8 string, used like this:

```cs
Selector.GetHandle ("mySelector"u8);
```

Note that UTF8 literals were introduced in C# 11, shipped with .NET 7, so this would not include support in legacy Xamarin.

The main problem is that the AOT compiler is optimizing calls to Selector.GetHandle, and the current code doesn't take arguments into account, so we'll break the AOT compiler by adding another overload - thus we need support in the AOT compiler first: https://github.com/dotnet/runtime/issues/82717

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.