-
Notifications
You must be signed in to change notification settings - Fork 36
Plans to stabilize this package? #50
Comments
We are now tentatively starting on work to bring all of this inside the main dotnet/runtime repo and make it all fully stable and work for real. However we haven't yet confirmed any specific official support level or shipping timeframe - it remains an open question pending feedback from the .NET community. If you would plan to build real software with .NET on WASI, it would certainly be interesting to hear more from you about it, as it helps to justify the investment needed for a particular level of support. |
IMHO, when MSFT ships this product, this will really take off. I love this project; I really hope MSFT makes adequate investment on it. |
Hi there! We would also love to see this getting stabilized. We are currently integrating For this, we define an API that consists of WASM functions that the host provides as imports, and of functions that the WASM module may export (e.g. to handle callbacks). We plan to create a custom SDK that customers can use in order to create .NET WASM plugins for our application (in addition to SDKs for other languages like C/C++, AssemblyScript etc. that can compile to WebAssembly), where this custom SDK would include the nessary bindings to integrate with our WASM API (e.g. an .NET interop layer that contains a high-level .NET API, that gets translated to the low-level WASM API provided by the host). In our tests this worked already pretty well with
Is there any fix for this? Additionally, I noticed that it doesn't seem to be possibile to use
Currently, I work-around this by defining the .NET functions as taking a __attribute__((__import_module__("codabix_wasm_v1.error"), __import_name__("GetLastErrorMessage")))
extern void __codabix_wasm_v1_error_GetLastErrorMessage(uint64_t bufferPtr, int64_t bufferLength, int32_t stringEncoding, int32_t includeNullTerminator);
void call_codabix_wasm_v1_error_GetLastErrorMessage(uint64_t* bufferPtrPtr, int64_t* bufferLengthPtr, int32_t stringEncoding, int32_t includeNullTerminator) {
__codabix_wasm_v1_error_GetLastErrorMessage(*bufferPtrPtr, *bufferLengthPtr, stringEncoding, includeNullTerminator);
}
void attach_internal_calls()
{
mono_add_internal_call("Codabix.Interop::GetLastErrorMessageCore", call_codabix_wasm_v1_error_GetLastErrorMessage);
} [MethodImpl(MethodImplOptions.InternalCall)]
private static extern unsafe void GetLastErrorMessageCore(ulong* bufferPtrPtr, long* bufferLengthPtr, int stringEncoding, int includeNullTerminator);
// When calling the function:
string errorMessage = string.Create<object?>(stringLength, null, (span, _) => {
fixed (char* spanPtr = span) {
ulong spanPtrLong = (nuint)spanPtr;
long bufferLengthLong = (long)span.Length * sizeof(char);
GetLastErrorMessageCore(
&spanPtrLong,
&bufferLengthLong,
(int)HostStringEncoding,
0);
}
}); Furthermore, it would be good to know whether the host should define additional (non-WASI) functions that may be required by the .NET runtime for certain scenarios, and how they should behave. Note that the execution model of our host is that an "entrypoint" WASM function will be called, which is expected to return fast (as we don't use a event loop model with a blocking host function that will run the loop within WASM). Once the function returns, the host may call other WASM functions at a later time, for example when a timer or other event occurs. Currently, our host application already provides such functions that allow to schedule a WASM callback to be called later (e.g. using a timeout/interval, or by adding an event handler), which seems to work, athough the WASM produced by the .NET WASI SDK seems to use the "component" WASI model with an Thank you! |
My interest for this would be to use .NET with Cloudflare Workers. Cloudflare Pages supports Blazor, however you must still write APIs in JS or something that compiles to WASM. This would be perfect to have an entirely .NET solution that can run on Cloudflare. |
We have a use-case that will require support for the WebAssembly Component Model, which would allow Wasm components written in C#/.NET to integrate with Wasm components written in other languages, and defined using a common interface definition language called WIT. See also the wit-bindgen project. |
This package is a very cool proof of concept, and it would be very useful for my team if it was ever stabilized. Currently, some features are missing, notably the
args
array is always empty andConsole.ReadLine
throws an exception.Are there plans to do further work on this package? Is there some kind of documentation we can study to get an idea of how everything is working so we can help push the project forward?
The text was updated successfully, but these errors were encountered: