Improve module backtraces for C# and C++ bindings by clockwork-labs-bot · Pull Request #4786 · clockworklabs/SpacetimeDB
Mirror the backtrace improvements from PR #577 (Rust/TS) to the C# and C++ module bindings so that stack traces captured by the host show actual reducer/procedure/view function names instead of anonymous wrappers. C# changes: - Add [MethodImpl(NoInlining)] to all generated Invoke() methods in reducer, procedure, and view dispatcher classes. This prevents the JIT/AOT from inlining these frames away, ensuring they appear as named WASM functions in wasmtime-captured backtraces. - Add Log.Error() in the reducer error handler for consistency with procedures and views, which already log full exceptions. C++ changes: - Add __attribute__((noinline)) to user function definitions in all macro variants: SPACETIMEDB_REDUCER, SPACETIMEDB_REDUCER_NAMED, SPACETIMEDB_INIT, SPACETIMEDB_CLIENT_CONNECTED, SPACETIMEDB_CLIENT_DISCONNECTED, SPACETIMEDB_VIEW, SPACETIMEDB_VIEW_NAMED, SPACETIMEDB_PROCEDURE, and SPACETIMEDB_PROCEDURE_NAMED. This ensures the actual user function name appears as a distinct frame in WASM backtraces rather than being optimized into the surrounding lambda wrappers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>