dotnet / dotnet/macios

NSOrderedCollectionDifference binding in Xcode 13 has issue with generic MonoPInvokeCallback and generator

Open
#15,577 0 comments 0 reactions 0 assignees View on GitHub
api-bindings enhancement
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 13h
Merged PRs (30d)
96

Description

As part of Xcode 13's Foundation changes (originally in https://github.com/xamarin/xamarin-macios/pull/13328 but later in Xcode 14) this callback is needed:

```
internal delegate NSOrderedCollectionDifference? NSOrderedCollectionDifferenceGetDifferenceHandlerProxy (IntPtr blockLiteral, /* NSOrderedCollectionChange */ IntPtr change);
static readonly NSOrderedCollectionDifferenceGetDifferenceHandlerProxy static_ChangeAllback = GetDiffHandler;

[MonoPInvokeCallback (typeof (NSOrderedCollectionDifferenceGetDifferenceHandlerProxy))]
static NSOrderedCollectionDifference? GetDiffHandler (IntPtr block, IntPtr change)
```

However, both generator.cs and the cecil test `MonoPInvokeCallback` do not like the generic `` portion.

I removed it, and then the generator, cecil test, and Manuel's monotouch tests all pass however, we are not certain that is correct.

The base collection has:

```
public sealed partial class NSOrderedCollectionDifference : NSOrderedCollectionDifference
where TKey : class, INativeObject {
```

So it can in theory have INativeObjects that are not NSObjects.

Manuel and I were not confident, so we are disabling those bindings with this issue tracking.

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.