dotnet / dotnet/macios

Redundant dispatch to UI thread for thread-safe objects finalizers

Open
#7,534 5 comments 0 reactions 0 assignees View on GitHub
enhancement iOS macOS
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 13h
Merged PRs (30d)
96

Description

### Steps to Reproduce

1. Create a thread-safe object, i.e. `NSString`
2. Don't dispose it
3. Observe that finalizer queues [disposal on the UI thread](https://github.com/xamarin/xamarin-macios/blob/bc6735374b1bb31d58e228304ea89815c57004a1/src/Foundation/NSObject2.cs#L781-L792)

### Expected Behavior

Thread-safe types don't need to be released on the UI thread.

### Possible Problem

NSString is not sealed, thus subclasses can become thread-unsafe. ~One example of this is NSMutableString.~ NSMutableString is also not sealed.

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.