Skip to content

Fix SilkMarshal.DelegateToPtr for NativeAOT #2428

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

Merged
merged 3 commits into from
Feb 27, 2025

Conversation

aquagoose
Copy link
Contributor

Summary of the PR

Fixes a marshalling exception when calling SilkMarshal.DelegateToPtr under certain circumstances. This issue specifically seems to occur in Silk.NET.Vulkan. I am unsure as to why, however this should fix it.

This PR adds a generic overload to the method which Marshal.GetFunctionPointerForDelegate() recommends in NativeAOT environments.

Related issues, Discord discussions, or proposals

https://discord.com/channels/521092042781229087/607634593201520651/1344092431464927263

Further Comments

This will unfortunately require regeneration of at least the Vulkan project, and any other projects that decide to use the overload.

@aquagoose aquagoose requested a review from a team as a code owner February 26, 2025 17:41
@aquagoose
Copy link
Contributor Author

@dotnet-policy-service agree

@aquagoose
Copy link
Contributor Author

I forgot that C# doesn't require you to specify the generic pararmeters if it can work them out itself. So this overload may not actually require regeneration after all. Not 100% certain though.

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Silk.NET Development Tracker Feb 27, 2025
@Perksey Perksey merged commit 7cfc7b3 into dotnet:main Feb 27, 2025
3 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Silk.NET Development Tracker Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants