Skip to content

Conversation

maraf
Copy link
Member

@maraf maraf commented Aug 22, 2025

Based on MinimalMarshalingTypeCompatibilityProvider.cs we mark enums as marshallable by lightweight marshaller on build.
We were missing enums when checking for supported types in marshal-ilgen-stub.c on runtime.

Fixes #115780
Contributes to #94187

@maraf maraf added this to the 11.0.0 milestone Aug 22, 2025
@maraf maraf self-assigned this Aug 22, 2025
@maraf maraf added arch-wasm WebAssembly architecture area-Interop-mono labels Aug 22, 2025
Copy link
Contributor

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

@maraf maraf marked this pull request as ready for review September 2, 2025 12:30
@Copilot Copilot AI review requested due to automatic review settings September 2, 2025 12:30
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 enables lightweight marshalling for enum types in WebAssembly builds. The fix addresses a runtime marshalling issue where enums were not being recognized as supported types by the lightweight marshaller, even though they were marked as marshallable during the build process.

Key changes:

  • Updated runtime marshalling logic to recognize enums as lightweight-marshallable types
  • Added test coverage for enum marshalling through ZipArchive interop functionality

Reviewed Changes

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

File Description
src/mono/mono/component/marshal-ilgen-stub.c Added enum type check to allow lightweight marshalling for enums
src/mono/wasm/testassets/WasmBasicTestApp/App/ZipArchiveInteropTest.cs Added test class that exercises enum marshalling through ZipArchive operations
src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js Added test case entry point for ZipArchiveInteropTest
src/mono/wasm/Wasm.Build.Tests/NativeBuildTests.cs Added test method to verify ZipArchive enum marshalling functionality

@maraf maraf requested a review from kg September 2, 2025 12:33
@lewing lewing enabled auto-merge (squash) September 2, 2025 23:26
@lewing lewing merged commit 20a932e into dotnet:main Sep 3, 2025
70 checks passed
@maraf
Copy link
Member Author

maraf commented Sep 3, 2025

/backport to release/10.0

Copy link
Contributor

github-actions bot commented Sep 3, 2025

Started backporting to release/10.0: https://github.com/dotnet/runtime/actions/runs/17425549273

@maraf maraf deleted the MonoInteropEnum branch September 3, 2025 06:55
filipnavara pushed a commit to filipnavara/runtime that referenced this pull request Sep 5, 2025
* Use lightweight marshal for enums

* Wasm build test

* Fix

* Fix test app build

* Fix test app build

* Fix test asserts

* Fix test case

* Build tests are not JS bundler friendly

* Update src/mono/mono/component/marshal-ilgen-stub.c

Co-authored-by: Larry Ewing <[email protected]>

* Update src/mono/wasm/testassets/WasmBasicTestApp/App/ZipArchiveInteropTest.cs

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Larry Ewing <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm WebAssembly architecture area-Interop-mono
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blazor WebAssembly - ZipArchiveEntry.Open causes unexpected termination at runtime in published app on .NET 10 Preview 3 and 4
3 participants