[ObjCRuntime] Make BlockLiteral a ref struct in XAMCORE_5_0.#17658
Conversation
A ref struct has a few limitations that makes a lot of sense for blocks: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/ref-struct, so by making BlockLiteral a ref struct, we're getting the C# compiler to help us not writing broken code by accident. The limitations also mean that it's a breaking change, so we can't do it before XAMCORE_5_0.
❌ [PR Build] Tests on macOS M1 - Mac Ventura (13.0) failed ❌Failed tests are:
Pipeline on Agent |
✅ API diff for current PR / commitLegacy Xamarin (No breaking changes)
NET (empty diffs)
✅ API diff vs stableLegacy Xamarin (No breaking changes).NET (No breaking changes)✅ Generator diffGenerator diff is empty Pipeline on Agent |
💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻✅ All tests on macOS M1 - Mac Big Sur (11.5) passed. Pipeline on Agent |
dalexsoto
left a comment
There was a problem hiding this comment.
Maybe we can consider this for .NET 8? We can document breaking changes
This comment has been minimized.
This comment has been minimized.
I believe every third-party binding project (if they use blocks at least) would have to be rebuilt, which makes it a pretty big breaking change... |
🔥 [CI Build] Test results 🔥Test results❌ Tests failed on VSTS: simulator tests 0 tests crashed, 2 tests failed, 223 tests passed. Failures❌ monotouch tests [attempt 2]Details
Html Report (VSDrops) Download Successes✅ bcl: All 69 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
|
Test failures are unrelated (#17649). |
A ref struct has a few limitations that makes a lot of sense for blocks:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/ref-struct,
so by making BlockLiteral a ref struct, we're getting the C# compiler to help
us not writing broken code by accident.
The limitations also mean that it's a breaking change, so we can't do it
before XAMCORE_5_0.