KEMBAR78
[RGen] Fix the argument generation for a non nullable ref value type. by mandel-macaque · Pull Request #22894 · dotnet/macios · GitHub
Skip to content

Conversation

@mandel-macaque
Copy link
Member

The code was not creating a pointer declaration when the type was not nullable because we were missing a switch option.

Updated the way we generate the pointer in a more generic way by calling the GetLowerMethod which will work for all possible types.

The code was not creating a pointer declaration when the type was not
nullable because we were missing a switch option.

Updated the way we generate the pointer in a more generic way by calling
the GetLowerMethod which will work for all possible types.
@mandel-macaque mandel-macaque requested a review from Copilot May 23, 2025 23:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the pointer generation logic for non nullable ref value types by using a more generic approach through GetLowLevelType.

  • Updated pointer generation logic in BindingSyntaxFactory.Trampoline to handle both nullable and non-nullable types correctly.
  • Added new test cases in BindingSyntaxFactoryTrampolineTests to validate the changes for int and boolean types.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryTrampolineTests.cs Added test cases for pointer generation with nullable and non-nullable int types
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.Trampoline.cs Modified pointer generation logic to use GetLowLevelType for improved type handling
Comments suppressed due to low confidence (1)

tests/rgen/Microsoft.Macios.Generator.Tests/Emitters/BindingSyntaxFactoryTrampolineTests.cs:2932

  • [nitpick] The delegate parameter name 'outNullableInt' is misleading given that its type is now non-nullable; consider renaming it to 'outInt' for improved clarity.
public delegate void Callback (out int outNullableInt);

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #866598c] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 866598c7ddd828214bc328eccd64320ac5680b0b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #866598c] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 866598c7ddd828214bc328eccd64320ac5680b0b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET ( No breaking changes )

✅ API diff vs stable

.NET ( No breaking changes )

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 866598c7ddd828214bc328eccd64320ac5680b0b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #866598c] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 866598c7ddd828214bc328eccd64320ac5680b0b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #866598c] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 866598c7ddd828214bc328eccd64320ac5680b0b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #866598c] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 866598c7ddd828214bc328eccd64320ac5680b0b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #866598c] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 866598c7ddd828214bc328eccd64320ac5680b0b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #866598c] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 866598c7ddd828214bc328eccd64320ac5680b0b [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build #866598c] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 1 tests failed, 114 tests passed.

Failures

❌ dotnettests tests (MacCatalyst)

1 tests failed, 0 tests passed.
  • DotNet tests: Failed (Execution failed with exit code 1)

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 8 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 8 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 866598c7ddd828214bc328eccd64320ac5680b0b [PR build]

@mandel-macaque mandel-macaque merged commit 8935aab into main May 27, 2025
42 of 44 checks passed
@mandel-macaque mandel-macaque deleted the dev/mandel/fix-out-int-ptrs branch May 27, 2025 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants