I'm trying to repro https://github.com/dotnet/runtimelab/issues/3247 with the latest version of wasi/wit-bindgen/nativeaot-llvm etc, but I'm hitting this error at runtime
C:\github\dotnet-3247-repro>node --stack-size=8192 test-host.mjs
file:///C:/github/dotnet-3247-repro/dist/ThreadStaticRepro.js:2081
const { taskID } = _getGlobalCurrentTaskMeta(componentIdx);
^
TypeError: Cannot destructure property 'taskID' of '_getGlobalCurrentTaskMeta(...)' as it is undefined.
at _lowerImportBackwardsCompat (file:///C:/github/dotnet-3247-repro/dist/ThreadStaticRepro.js:2081:11)
at wasm://wasm/81ba884a:wasm-function[9]:0x112
at ThreadStaticRepro.wasm.environment_get_environment (wasm://wasm/ThreadStaticRepro.wasm-01be54de:wasm-function[7685]:0x32f681)
at ThreadStaticRepro.wasm.__wasilibc_initialize_environ (wasm://wasm/ThreadStaticRepro.wasm-01be54de:wasm-function[7664]:0x32f0c5)
at ThreadStaticRepro.wasm.__wasilibc_initialize_environ_eagerly (wasm://wasm/ThreadStaticRepro.wasm-01be54de:wasm-function[7665]:0x32f220)
at ThreadStaticRepro.wasm.__wasm_call_ctors (wasm://wasm/ThreadStaticRepro.wasm-01be54de:wasm-function[32]:0x363a)
at ThreadStaticRepro.wasm._initialize (wasm://wasm/ThreadStaticRepro.wasm-01be54de:wasm-function[33]:0x3680)
at _initGenerator (file:///C:/github/dotnet-3247-repro/dist/ThreadStaticRepro.js:7752:36)
at _initGenerator.next (<anonymous>)
at runNext (file:///C:/github/dotnet-3247-repro/dist/ThreadStaticRepro.js:7808:32)
Node.js v24.14.0
Is this an incompatibility between versions of jco and something else, wasi libc?
Hey Scott I'm not sure, but if I could get the component I could take a look and try to track it down. What version of Jco are you using?
To me it just looks like backwards compat that that broke/isn't working properly... But I'm not sure why it would be happening -- in general it seems like somehow an export was entered without a current task, but I can't say much more other than that
Can I use this reproduction ?
When I try to run through the reproduction in that repo above, I get a similar error as the user in that thread, but going all the way back to Jco 1.14.0, believe it or not:
Calling operation-a...
CRASH on operation-a: null function or function signature mismatch
Stack: RuntimeError: null function or function signature mismatch
at .tmpwfZReW.GcAllocInternal(MethodTable*, unsigned int, unsigned long, Thread*) (wasm://wasm/.tmpwfZReW-009c7d96:wasm-function[110]:0x33d6)
at .tmpwfZReW.RhpGcAlloc (wasm://wasm/.tmpwfZReW-009c7d96:wasm-function[109]:0x32f9)
at .tmpwfZReW.AllocateObject(void*, MethodTable*, unsigned int, unsigned long) (wasm://wasm/.tmpwfZReW-009c7d96:wasm-function[923]:0x39139)
at .tmpwfZReW.RhpNewArray (wasm://wasm/.tmpwfZReW-009c7d96:wasm-function[925]:0x3929a)
at .tmpwfZReW.S_P_CoreLib_Internal_Runtime_ThreadStatics__GetUninlinedThreadStaticBaseForTypeSlow (wasm://wasm/.tmpwfZReW-009c7d96:wasm-function[1825]:0x7e2e0)
at .tmpwfZReW.S_P_CoreLib_Internal_Runtime_ThreadStatics__GetUninlinedThreadStaticBaseForType (wasm://wasm/.tmpwfZReW-009c7d96:wasm-function[1378]:0x5d47c)
at .tmpwfZReW.S_P_CoreLib_Internal_Runtime_ThreadStatics__GetThreadStaticBaseForType (wasm://wasm/.tmpwfZReW-009c7d96:wasm-function[1060]:0x44f9c)
at .tmpwfZReW.__GetThreadStaticBase_S_P_CoreLib_System_Threading_ManagedThreadId (wasm://wasm/.tmpwfZReW-009c7d96:wasm-function[861]:0x38aef)
at .tmpwfZReW.S_P_CoreLib_System_Threading_Lock__EnterAndGetCurrentThreadId (wasm://wasm/.tmpwfZReW-009c7d96:wasm-function[1388]:0x5e28c)
at .tmpwfZReW.S_P_CoreLib_System_Runtime_CompilerServices_ClassConstructorRunner_Cctor__GetCctor (wasm://wasm/.tmpwfZReW-009c7d96:wasm-function[1826]:0x7e514)
Fatal error. Invalid Program: attempted to call a UnmanagedCallersOnly method from managed code.
Follow-up call also failed: unreachable
Is there something you did to get the error you're looking at above? Is there something about my environment that doesn't match what you're doing?
I'm assuming that this issue does actually exist so I updated to the latest version of Jco 1.17.4 (just released) and I don't even see that line (_getGlobalCurrentTaskMeta(...) in the output at all
So we do use that intrinsic (that's used for async tasks) but maybe I'm building the example repro incorrectly because I don't get that intrinsic generated when I run the component. If you could give me the component directly that would save some time, but AFAICT I followed the build instructions correctly and ran dotnet correctly.
It seems like when your export is attempting to call an import it's failing around here:
But upon entering the export there should have been a task already set...
That particular intrinsic is used by EnterSymmetricSyncGuestCall (upstream this is called Trampoline::EnterSyncCall) which is relatively new (compared to the rest of the machinery) -- is that implemented on your side? That should get called beforehand, and it's the intrinsic (on the Jco side) that sets that global current task meta.
That said, this feels like it might likely be a regression in that I need to make sure that Jco keeps working whether that trampoline is actually there or not (like it has in the past, I think if you can get the component to run properly on a previous version of Jco -- I could not)
ThreadStaticRepro.wasm
Using jco 1.16.1
I will upgrade jco to the latest and see what happens. I have started with that repo, but using latest wit-bindgen and nativeaot-llvm compiler as componentize-dotnet is a little out of date
WASI SDK 29
let me start with something basic, how do I install the latest jco, should I build from source?
cargo install jco doesn't seem to be what I want
C:\github\jco>npx
Entering npm script environment at location:
C:\github\jco
Type 'exit' or ^D when finished
Microsoft Windows [Version 10.0.26200.7840]
(c) Microsoft Corporation. All rights reserved.
C:\github\jco>^D
and npm run build doesn't seem to find npx
C:\github\jco>npm run build
> build
> cargo xtask build debug
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.12s
Running `target\debug\xtask.exe build debug`
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.27s
Error: command not found: `npx`
error: process didn't exit successfully: `target\debug\xtask.exe build debug` (exit code: 1)
Last updated: Mar 23 2026 at 18:16 UTC