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

Date.now() returns null in extremely rare occurances #2013

Closed
LovelyA72 opened this issue Dec 12, 2024 · 4 comments
Closed

Date.now() returns null in extremely rare occurances #2013

LovelyA72 opened this issue Dec 12, 2024 · 4 comments

Comments

@LovelyA72
Copy link

Version used

4.1.0

Describe the bug

Date.now() sometimes return null and crashes the entire software

To Reproduce

repeatedly call Date.now() in a long time span and it might happen. It happened twice on me, one time when debugging in Visual Studio and the other time while running without a debugger attached.

Expected behavior

Date.now() working as expected

Additional context

.NET 8.0 WPF software on Windows 11 Workstation Edition

@Genteure
Copy link
Contributor

Are you calling the same engine from multiple threads by any chance?

@LovelyA72
Copy link
Author

LovelyA72 commented Dec 13, 2024

It's a WPF app so there's a possibility? What should I do to mitigate this?

@sebastienros
Copy link
Owner

@LovelyA72 don't declare a static or share and instance of Engine. Or if you do call Execute on a shared instance (because you need to evolve its state) then lock these usages.

@LovelyA72
Copy link
Author

I used lock on all those usages, also I (should probably do this earlier) wrapped all the script executions with try catch. Everything seems fine now. Thank you!

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

No branches or pull requests

3 participants