Skip to content
This repository has been archived by the owner on Jul 13, 2024. It is now read-only.

Some function calls fail on Uncaught RuntimeError #7

Closed
stanoddly opened this issue Dec 6, 2022 · 4 comments
Closed

Some function calls fail on Uncaught RuntimeError #7

stanoddly opened this issue Dec 6, 2022 · 4 comments
Labels
blocker We can't move forward without that.

Comments

@stanoddly
Copy link
Owner

I found that plenty of function call fails on Uncaught RuntimeError: null function or function signature mismatch. The most absurd occasion I found is a call to Raylib.ColorAlpha, which is a very simple function accepting Color and float. It's from this example:
https://disketteman.github.io/DotnetRaylibWasm/raylib.html?arg=Camera3dFree

My wild guess is that it got trimmed for whatever reason during a build, but more investigation is needed. It's possible to find what specifically failed using this approach:
emscripten-core/emscripten#16305 (comment)

No need for EM_ASM({ Module.wasmTable = wasmTable; });, the table is already generated by --emit-symbol-map.

@stanoddly stanoddly added the blocker We can't move forward without that. label Dec 6, 2022
@stanoddly
Copy link
Owner Author

When running on debug without -O2:
image

3875 translates into call to ICU:

3875:icu::Hashtable::nextElement\28int&\29\20const

I checked few other examples and it was about ICU calls too. I'm not sure how ICU fits into this since the call doesn't use any string whatsoever.

@stanoddly
Copy link
Owner Author

This is really bizarre, looks like ColorAlpha is failing indeed.

I tweaked this line:
https://github.com/disketteman/DotnetRaylibWasm/blob/6ccfd24ce7cec603cbb69c8c6b84026724f0af28/Examples/Core/Camera3dFree.cs#L73

Into this:

                Console.WriteLine("Before ColorAlpha");
                Color color = ColorAlpha(SKYBLUE, 0.5f);
                Console.WriteLine("After ColorAlpha");

And it fails indeed:
image

@stanoddly
Copy link
Owner Author

So for some really odd reason replacing a call to Raylib.ColorAlpha with this snippet:

                Color color = SKYBLUE;
                color.a = (byte)(color.a * 0.5f);

here:
https://github.com/disketteman/DotnetRaylibWasm/blob/6ccfd24ce7cec603cbb69c8c6b84026724f0af28/Examples/Core/Camera3dFree.cs#L73

Makes this example work. Puzzling.

@stanoddly
Copy link
Owner Author

So it turned out that the result of:

dotnet build

is actually buggy (❓ ).

To create something which REALLY works publish needs to be used.

dotnet publish

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocker We can't move forward without that.
Projects
None yet
Development

No branches or pull requests

1 participant