Skip to content

[RGen] Generate the static class for the trampolines. #22890

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

mandel-macaque
Copy link
Member

This change just makes sure that the static class needed by the trampoline is correctly generated. The comment ignores the fact that the getters of the trampolines is incorrect, this is because we want to be able first to generate the helper classes.

The code generates the trampoline.g.cs file with the SD* classes but is missing the NID* ones which will be generated in comming PRs.

mandel-macaque and others added 8 commits May 22, 2025 21:23
Upate the code generation of rgen to use the 'global::' allias based in
the generator configuration. The tests classes have been updated to
ensure that if we switch off the use of the alias, the tests do not need
to be udpdated.
This change just makes sure that the static class needed by the
trampoline is correctly generated. The comment ignores the fact that the
getters of the trampolines is incorrect, this is because we want to be
able first to generate the helper classes.

The code generates the trampoline.g.cs file with the SD* classes but is
missing the NID* ones which will be generated in comming PRs.
@mandel-macaque mandel-macaque requested a review from Copilot May 23, 2025 18:45
Copy link
Contributor

@Copilot 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 introduces the static class generation for trampolines while updating test classes and binding syntax to support the trampoline helper generation. Key changes include the addition of new trampoline properties in the test files, extended expected trampoline outputs and selectors, and updates to the TrampolineEmitter along with relevant documentation and known types.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/TrampolinePropertyTests.cs Adds new trampoline properties and duplicate handler declarations for different delegate types
tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/ExpectedTrampolinePropertyTestsTrampolines.cs Extends generated trampoline delegates and exposes potential missing return in a delegate
tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/ExpectedTrampolinePropertyTests.cs Adds new selector handles and duplicate property definitions for trampoline callbacks
src/rgen/Microsoft.Macios.Generator/Emitters/TrampolineEmitter.cs Implements static trampoline class and delegate emission logic
src/rgen/Microsoft.Macios.Generator/Emitters/Documentation.cs Updates documentation methods for the trampoline static class
src/rgen/Microsoft.Macios.Generator/Emitters/BindingSyntaxFactory.KnownTypes.cs Adds a new TypeSyntax for BlockLiteral
Comments suppressed due to low confidence (2)

tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/ExpectedTrampolinePropertyTests.cs:285

  • There is a duplicate definition for the 'KernelRoiCallback' property which may lead to ambiguity. Consider consolidating these definitions or renaming one if they represent separate behaviors.
public partial global::CoreImage.CIKernelRoiCallback KernelRoiCallback

tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/TrampolinePropertyTests.cs:46

  • There are duplicate export declarations for 'imageGeneratorCompletionHandler' with different delegate types. Ensure that each property export has a unique name or intended delegate type to avoid conflicts.
[Export<Property>("imageGeneratorCompletionHandler", ArgumentSemantic.Copy)]

Comment on lines 66 to 67
}
}
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

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

The delegate SDCIKernelRoiCallback.Invoke is missing a return statement for the computed CGRect value. Add a 'return ret;' after calling the delegate to ensure the method returns a value.

Suggested change
}
}
return ret;
}
return global::CoreGraphics.CGRect.Empty;

Copilot uses AI. Check for mistakes.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@mandel-macaque mandel-macaque force-pushed the dev/mandel/generate-static-class branch from f1fca5b to dad1b42 Compare May 23, 2025 18:58
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@mandel-macaque mandel-macaque force-pushed the dev/mandel/generate-static-class branch from bef44ac to 27f16f0 Compare May 23, 2025 19:19
@mandel-macaque mandel-macaque marked this pull request as draft May 23, 2025 19:19
Base automatically changed from dev/mandel/global-all-the-things to main May 23, 2025 19:20
@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.

@mandel-macaque mandel-macaque force-pushed the dev/mandel/generate-static-class branch from 75762c4 to 969439b Compare May 27, 2025 21:42
@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

✅ [PR Build #969439b] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 969439b48e01b1af69b59e79f046a78084f269a4 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #c5d209d] Build passed (Build packages) ✅

Pipeline on Agent
Hash: c5d209d88f69dff61932542c218e10e0a6a1aedd [PR build]

@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 #c5d209d] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: c5d209d88f69dff61932542c218e10e0a6a1aedd [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: c5d209d88f69dff61932542c218e10e0a6a1aedd [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: c5d209d88f69dff61932542c218e10e0a6a1aedd [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: c5d209d88f69dff61932542c218e10e0a6a1aedd [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: 969439b48e01b1af69b59e79f046a78084f269a4 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 969439b48e01b1af69b59e79f046a78084f269a4 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build #c5d209d] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

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

Failures

❌ generator tests

1 tests failed, 4 tests passed.
  • Roslyn Generator 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 (MacCatalyst): 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
✅ 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: c5d209d88f69dff61932542c218e10e0a6a1aedd [PR build]

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.

2 participants