xamarin / binding-tools-for-swift

MIT License
160 stars 21 forks source link

fix issues marshaling booleans #823

Closed stephen-hawley closed 9 months ago

stephen-hawley commented 9 months ago

In dotnet land, bools aren't blittable and every [UnmanagedCallersOnly] method that took a bool was failing a runtime check because of the bool - which is weird - you would think that the compiler would catch that as it does with other types, but not in this case.

The fix is in two parts:

  1. redo the code that generates the signature of the C# receiver. This is just a case of macro changing the return type and argument types from bool to nint.
  2. redo the code that marshals from receivers to C# and return the code that marshals the C# return value to swift.

This fixes 10 tests.

rolfbjarne commented 9 months ago

you would think that the compiler would catch that as it does with other types, but not in this case.

Yes, you would think... https://github.com/dotnet/roslyn/issues/64086