xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.48k stars 515 forks source link

Detect and fix returning fixed pointers from a function/property. #17020

Open rolfbjarne opened 1 year ago

rolfbjarne commented 1 year ago

This pattern is not GC safe:

https://github.com/xamarin/xamarin-macios/blob/cbf459a608ff18304cc9616ea7bfde0c8d14c018/src/CoreMidi/MidiServices.cs#L848-L850

because the p pointer is only valid (fixed) inside the fixed statement.

We have to find all such patterns, and fix them to not return fixed pointers.

Ravina-Deogadkar commented 1 year ago

Can I take a look at this issue?

rolfbjarne commented 1 year ago

@Ravina-Deogadkar yep, feel free to have a look!

Ravina-Deogadkar commented 1 year ago

Thanks, I'll possibly update by weekend