-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[mono][wasm] Use [UnmanagedCallersOnly] in GetDelegateForFunctionPoin… #89334
Conversation
…terTests so it works on wasm. Fixes dotnet#39187.
Tagging subscribers to this area: @dotnet/interop-contrib Issue Details…terTests so it works on wasm. Fixes #39187.
|
Looks like the tests only pass in non-aot mode if compiled with /p:WasmBuildNative=true. |
That makes some sense given how we use the table generator for this attribute. We might be able to add a check to a platform analyzer, but we should definitely document it. |
@vargaz what's the plan here? |
Not sure, this test will not pass in non-aot mode on wasm even with these changes. |
cc @kg |
We could run the table generator and check if any new entries were added over the default and emit an error if WasmBuildNative is not enabled. |
|
||
private static void Method(string s) { } | ||
[UnmanagedCallersOnly] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NativeAOT uses UnmanagedFunctionPointerAttribute
on the delegate definitions to make delegate stubs available to the AOT compiler when they can't figure it out directly from arguments to GetFunctionPointerForDelegate
or GetDelegateForFunctionPointer
I'm not sure how I feel about this test change. We're narrowing our test coverage to no longer cover "what happens when you pass a managed type across the boundary". I guess we probably have enough comprehensive test coverage for p/invoke that it's fine to do so? |
The string->int change is needed because UnmanagedCallersOnly requires blittable types. |
I guess my concern is that it feels like we're replacing test A with a new test B, when we could leave A disabled and add the new test alongside it to avoid reducing our test coverage. Then if we fix string support later we can turn the existing test on. |
This test is supposed to test GetDelegateForFunctionPointer, not pinvoke in general. |
/azp run runtime |
/azp run runtime-wasm |
Azure Pipelines successfully started running 1 pipeline(s). |
1 similar comment
Azure Pipelines successfully started running 1 pipeline(s). |
This will not work in non-aot mode even with these changes, closing. |
…terTests so it works on wasm.
Fixes #39187.