Jurassic producing undefined behavior - solved

Jul 26, 2013 at 6:50 AM
Edited Jul 26, 2013 at 7:27 AM
Nevermind!

Why can't you delete posts? My mistake was so dumb it wasn't worth publishing...

For the curious:
So, I was getting invalid strings (prematurely ending in \0) from a file read in by JS, and so I had thought it was a Jurassic issue. Xamarin's debugger didn't spot it because it excluded the \0's, but MS's .NET debugger finally helped me. :) C# strings don't necessarily have to end in \0.
Jul 26, 2013 at 12:48 PM
Console.WriteLine is not atomic, mind you. It is however guaranteed to be thread-safe. Results like that are actually not that uncommon. Though in a single-threaded program they are fairly rare. I don't know how threading is done (if it's done at all) in jurassic though.
Also, this is typically not behaviour one sees in "debug"-builds of compiled C# code, however, since jurassic compiles the js-code itself, wether or not VS is in "debug" mode has no effect. So it might be optimized heavily enough that Console.WriteLine is called too fast.


Jul 26, 2013 at 11:47 PM
Edited Jul 26, 2013 at 11:48 PM
How are you responding to that post Alxandr!? My original post was edited more than 5 hours before you posted! Talk about a slow server or inconsistent time-stamping. (The output you saw looked like a threading issue, that was all). Plus I was using Xamarin's output window, I didn't know if it was their fault or not since there are still many bugs yet to be ironed out on the IDE.
Jul 27, 2013 at 12:01 AM

No, well, I respond by mail. So I don't get new content on updates.