Skip to content

[RGen] Add ARKit trampoline tests. #22927

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mandel-macaque
Copy link
Member

Add the tests that show that the ARKit trampoline static class is correctly generated.

mandel-macaque and others added 4 commits May 28, 2025 11:38
This is the initial implementation of the trampoline emitter. It just
focuses on the delegate and the static class. A generic class has been
added but more tests will come per framework, we simply want to make the
diff manageable for the team, so we have not added all the tests in a
single PR.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add the tests that show that the ARKit trampoline static class is
correctly generated.
// Generate trampolines for compilation
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::ARKit.GetGeolocationCallback))]
unsafe internal delegate void DGetGeolocationCallback (global::System.IntPtr block_ptr, global::CoreLocation.CLLocationCoordinate2D coordinate, double altitude, global::ObjCRuntime.NativeHandle error);
Copy link
Member Author

@mandel-macaque mandel-macaque May 28, 2025

Choose a reason for hiding this comment

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

bgen generates the following code:

[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
[UserDelegateType (typeof (global::ARKit.GetGeolocationCallback))]
unsafe internal delegate void DGetGeolocationCallback (IntPtr block, global::CoreLocation.CLLocationCoordinate2D coordinate, double altitude, NativeHandle error);

Comment on lines +26 to +32
internal static unsafe void Invoke (global::System.IntPtr block_ptr, global::CoreLocation.CLLocationCoordinate2D coordinate, double altitude, global::ObjCRuntime.NativeHandle error)
{
var del = global::ObjCRuntime.BlockLiteral.GetTarget<global::ARKit.GetGeolocationCallback> (block_ptr);
if (del is not null)
{
del (coordinate, altitude, global::ObjCRuntime.Runtime.GetNSObject<global::Foundation.NSError> (error)!);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

bgen generates the following code:

internal static unsafe void Invoke (IntPtr block, global::CoreLocation.CLLocationCoordinate2D coordinate, double altitude, NativeHandle error) {
	var del = BlockLiteral.GetTarget<global::ARKit.GetGeolocationCallback> (block);
	if (del is not null) {
		del (coordinate, altitude,  Runtime.GetNSObject<NSError> (error)!);
	}
}

Comment on lines +43 to +47
internal static unsafe global::ObjCRuntime.BlockLiteral CreateBlock (global::ARKit.GetGeolocationCallback callback)
{
delegate* unmanaged<global::System.IntPtr, global::CoreLocation.CLLocationCoordinate2D, double, global::ObjCRuntime.NativeHandle, void> trampoline = &Invoke;
return new global::ObjCRuntime.BlockLiteral (trampoline, callback, typeof (SDGetGeolocationCallback), nameof (Invoke));
}
Copy link
Member Author

Choose a reason for hiding this comment

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

bgen generates the following code:

internal static unsafe BlockLiteral CreateBlock (global::ARKit.GetGeolocationCallback callback)
{
	delegate* unmanaged<IntPtr, global::CoreLocation.CLLocationCoordinate2D, double, NativeHandle, void> trampoline = &Invoke;
	return new BlockLiteral (trampoline, callback, typeof (SDGetGeolocationCallback), nameof (Invoke));
}

@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 #4a5e4c8] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 4a5e4c8d146f14b9f8e0e171f463ee7530a33acf [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

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

Pipeline on Agent
Hash: 4a5e4c8d146f14b9f8e0e171f463ee7530a33acf [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
Copy link
Collaborator

❌ [CI Build #4a5e4c8] Tests on macOS X64 - Mac Sonoma (14) failed ❌

Failed tests are:

  • monotouch-test

Pipeline on Agent
Hash: 4a5e4c8d146f14b9f8e0e171f463ee7530a33acf [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 4a5e4c8d146f14b9f8e0e171f463ee7530a33acf [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 4a5e4c8d146f14b9f8e0e171f463ee7530a33acf [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
Copy link
Collaborator

✅ [PR Build #587a806] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 587a8063e3f95ec8179a5f299aa8c075babc8077 [PR build]

@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

✅ 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: 587a8063e3f95ec8179a5f299aa8c075babc8077 [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
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 4a5e4c8d146f14b9f8e0e171f463ee7530a33acf [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
Copy link
Collaborator

🚀 [CI Build #4a5e4c8] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 126 tests passed 🎉

Tests counts

✅ 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
✅ 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 10 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 10 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: 4a5e4c8d146f14b9f8e0e171f463ee7530a33acf [PR build]

Base automatically changed from dev/mandel/trampoline-static-class-emitter to main May 29, 2025 13:13
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