Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Task.Delay throws NullReferenceException on HTML5 exports #100740

Open
Bip901 opened this issue Dec 22, 2024 · 0 comments
Open

[3.x] Task.Delay throws NullReferenceException on HTML5 exports #100740

Bip901 opened this issue Dec 22, 2024 · 0 comments

Comments

@Bip901
Copy link

Bip901 commented Dec 22, 2024

Tested versions

Reproducible in: v3.6.stable.mono.official [de2f0f1]

  • Occurs both when "Export as Debug" is set and when it isn't.
  • Does not occur on Windows exports

System information

Windows 11 64-bit, Chrome 131.0.6778.205

Issue description

Awaiting Task.Delay works fine in editor builds, but crashes on HTML5 exports, showing the following message on the console (F12):

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at System.Threading.WasmRuntime.TimeoutCallback (System.Int32 id) <0x2f69080 + 0x0000a> in :0
timeout callback threw a System.NullReferenceException

Steps to reproduce

  • Open the attached minimal reproduction project in Godot
  • It contains a single script:
public override void _Ready() {
    Task.Run(async () => {
        GD.Print("Waiting...");
        await Task.Delay(1000);
        GD.Print("Done");
    });
}
  • Observe how it runs as expected in the editor
  • Export to HTML5, then run python -m http.server when cd-d into the exported directory
  • Browse http://localhost:8000, press F12 to keep the console window open
  • Click TaskDelayDemo.html and observe the errors in the console, and that "Done" is never printed

Minimal reproduction project (MRP)

TaskDelayDemo.zip

@AThousandShips AThousandShips changed the title Task.Delay throws NullReferenceException on HTML5 exports [3.x] Task.Delay throws NullReferenceException on HTML5 exports Dec 22, 2024
@AThousandShips AThousandShips added this to the 3.x milestone Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants