Skip to content

Improve C# WASM runtime binding loading and logging#147

Open
Arnold-Seb wants to merge 1 commit intothoth-tech:mainfrom
Arnold-Seb:fix/csharp-binding-rewire
Open

Improve C# WASM runtime binding loading and logging#147
Arnold-Seb wants to merge 1 commit intothoth-tech:mainfrom
Arnold-Seb:fix/csharp-binding-rewire

Conversation

@Arnold-Seb
Copy link
Copy Markdown

@Arnold-Seb Arnold-Seb commented Apr 11, 2026

Description

This change improves the stability of the C# WebAssembly runtime in SplashKit Online by addressing issues in the JavaScript binding layer.

During testing, the runtime failed to initialise reliably due to the binding loader attempting to resolve all generated SplashKit functions using eval(). Since many of these functions are not available in the browser runtime, this resulted in runtime crashes and prevented C# programs from executing correctly.

The binding logic in CSharpWasmExpo/main.js has been updated to safely check for function availability before assignment. Missing functions are now skipped, and warnings are logged instead of causing failures. This allows the runtime to initialise successfully even when bindings are incomplete.

Additionally, basic handling for process_events has been introduced to improve debugging visibility when the function is not properly wired.

This change resolves the runtime initialisation crash and provides clearer insight into missing bindings, supporting further investigation of incomplete API coverage in the C# runtime.

Fixes # (runtime initialisation crash caused by missing JS bindings)


Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation (update or new)

How Has This Been Tested?

The changes were tested locally using the SplashKit Online development environment.

Steps:

  1. Clone the repository
  2. Start the server using npm start
  3. Open the application in the browser (localhost:8000)
  4. Select C# and run a sample program

Expected / Observed Results:

  • Runtime initialises without crashing
  • Previously failing executions now proceed without fatal errors
  • Missing functions are logged clearly in the browser console
  • Identified that process_events is still not fully wired, confirming improved debugging visibility

Testing Checklist

  • Tested in latest Chrome

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Copy link
Copy Markdown

@kottochii kottochii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes are legitimate and solve the problem of quiet failures, exposing the root problems with method referencing.

I, however, would like to keep an issue in the backlog to resolve the missing bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants