I have the following assemblyscript function:
export function echo(str: string) : string {
  return str;
}
and I have the following C# function (using wasmtime lib) to send and receive a string:
    public string Echo(string str)
    {
        using var engine = new Engine();
        using var module = Module.FromFile(engine, "./test.wasm");
        using var store = new Store(engine);
        using var linker = new Linker(engine);
        var instance = linker.Instantiate(store, module);
        var func = instance.GetFunction<string, string>("echo");
        var res = func("Hello world!");
        return str;
    }
the func variable is always null whether I pass GetFunction<,>  string, string or IntPtr, IntPtr.  Not sure what I'm supposed to pass in there?  The wasm (wat) file shows the echo signature as u32 returning a u32...  a bit confused here.
The furthest I got was using this code but it blows up when invoking the func:
var processStringFunc = instance.GetFunction<int, int>("echo");
        // Pass the string to the WebAssembly module
        const string inputString = "Hello, WebAssembly!";
        var stringBytes = Encoding.UTF8.GetBytes(inputString);
        var stringPtr = Marshal.AllocHGlobal(stringBytes.Length << 1);
        Marshal.Copy(stringBytes, 0, stringPtr, stringBytes.Length);
            var resultPtr = processStringFunc?.Invoke(stringPtr.ToInt32());