I filed an issue for this at: https://github.com/microsoft/pxt-microbit/issues/2664 but a little confused why this happens:
let command = "X100\r\n"
let cmdArgs = helpers.stringSplit(command.substr(1, command.length), " ")
serial.writeLine("original: " + cmdArgs[0])
let cmdId = parseInt(cmdArgs[0])
serial.writeLine("parsed: " + cmdId)
shows different results between the device and the console simulator. I had some issues with my serial command parser and noticed that X100 \r\n
made my code work on the device. :-/