feat(csharp): add map type support#1603
Open
yordis wants to merge 6 commits intobytecodealliance:mainfrom
Open
feat(csharp): add map type support#1603yordis wants to merge 6 commits intobytecodealliance:mainfrom
yordis wants to merge 6 commits intobytecodealliance:mainfrom
Conversation
Dictionary<K,V> provides a familiar, zero-dependency host representation for WIT maps in C#, and unblocks runtime interop with components that use them without requiring a custom collection type. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
The `map<K, V>` WIT syntax is a gated feature that the default wit-parser used by wasm-component-ld's `--component-type` flag cannot parse, so the text-based component type path was blocking any world that uses maps. Switching to the same object-file approach already used by the C and C++ backends lets the component type flow through as a custom section without round-tripping through the text parser. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
5f4aa9e to
1388017
Compare
Earlier attempt used `NativeFileReference` on the component-type object, but NativeAOT's LLVM pipeline did not propagate the custom section into the final module, leaving every C# component import unresolvable. Using a binary-encoded WIT package (which `wasm-component-ld --component-type` accepts alongside the text form) preserves the existing linker path and also lets map<K,V> round-trip since decoding skips the default WIT parser that rejects gated features. Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
3f349cc to
00b67da
Compare
yowl
reviewed
Apr 23, 2026
Collaborator
yowl
left a comment
There was a problem hiding this comment.
Thanks! Do we need the cargo.lock changes?
996ba04 to
00b67da
Compare
yowl
reviewed
Apr 23, 2026
|
|
||
| files.push( | ||
| &format!("{world_namespace}_component_type.o"), | ||
| wit_bindgen_c::component_type_object::object( |
Collaborator
There was a problem hiding this comment.
Why does adding map support mean we need this library?
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dictionary<K,V>provides a familiar, zero-dependency host representation for WIT maps in C# and unblocks runtime interop with components that use them without requiring a custom collection type.should_fail_verifyas new features land.