-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Enums are not considered blittable by Emscripten / Blazor WASM AOT #61144
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsDescriptionIn P/Invoke callbacks, Enums are not considered blittable. Reproduction StepsAttempt to compile a method like [UnmanagedCallersOnly]
public static void M(StringComparison myEnum) { } using Emscripten / WASM AOT Expected behaviorThe above code should be possible. Enums should be considered blittable. Actual behaviorAn error is shown, enums are not considered blittable. Regression?No response Known WorkaroundsUse the underlying type of the enum (usually int) instead and manually cast. ConfigurationTested in .NET 6 RC2 Other informationNo response
|
related to #61146 |
I think the code in the runtime handles this. There just needs to be an IsEnum check in the pinvoke table generator. |
Fixes #61144. Co-authored-by: Zoltan Varga <vargaz@gmail.com>
Description
In P/Invoke callbacks, Enums are not considered blittable.
This means no enums can be used as parameters of P/Invoke callbacks.
Reproduction Steps
Attempt to compile a method like
using Emscripten / WASM AOT
Expected behavior
The above code should be possible. Enums should be considered blittable.
Actual behavior
An error is shown, enums are not considered blittable.
Regression?
No response
Known Workarounds
Use the underlying type of the enum (usually int) instead and manually cast.
Configuration
Tested in .NET 6 RC2
Other information
No response
The text was updated successfully, but these errors were encountered: