Game crash when loading smaller script into PB, after looking at a larger script

Decker_MMIV shared this bug 3 years ago

- Viewing a larger (many lines) script in the Programmable Block, and having the cursor/caret positioned many lines down (like at the last line of the script), possibly having scrolled down.

- Without leaving the PB editor, then when loading another script that is shorter (fewer lines), it causes SE to crash-to-desktop.

Problem could be, that the cursor/caret is not reset to top-left when loading a newscript into the PB.

From SpaceEngineers.log file:

Thread:   1 ->  Exception occured: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Text.StringBuilder.get_Chars(Int32 index)
   at System.Text.StringBuilderExtensions_Format.AppendSubstring(StringBuilder stringBuilder, StringBuilder append, Int32 start, Int32 count)
   at Sandbox.Graphics.GUI.MyGuiControlMultilineEditableText.GetCarriageOffset(Int32 idx)
   at Sandbox.Graphics.GUI.MyGuiControlMultilineText.ScrollToShowCarriage()
   at Sandbox.Graphics.GUI.MyGuiControlMultilineEditableText.set_Text(StringBuilder value)
   at Sandbox.Game.Gui.MyGuiScreenEditor.ScriptSelected(String scriptPath)
   at Sandbox.Game.Gui.MyGuiIngameScriptsPage.OnScriptDownloaded()
   at ParallelTasks.Parallel.RunCallbacks()
   at Sandbox.Game.World.MySession.Update(MyTimeSpan updateTime)
   at Sandbox.MySandboxGame.Update()
   at Sandbox.Engine.Platform.Game.UpdateInternal()
   at Sandbox.Engine.Platform.Game.RunSingleFrame()
   at Sandbox.Engine.Platform.FixedLoop.<>c__DisplayClass1.<Run>b__0()
   at Sandbox.Engine.Platform.GenericLoop.Run(VoidAction tickCallback)
   at Sandbox.Engine.Platform.Game.RunLoop()
   at Sandbox.MySandboxGame.Run(Boolean customRenderLoop, Action disposeSplashScreen)
   at SpaceEngineers.MyProgram.Main(String[] args)

Replies (2)



Could you please provide us with more information regarding the issue you reported? I wasn't able to reproduce it. If it still happens to you, could you please provide both scripts and eventually also a video with the issue would help us.

Thank you.

Kind Regards

Keen Software House: QA Department


SE v1.187.204

1) Subscribe to the following in-game scripts. - Please note that these are only used here as examples for reproducing this issue. Any other 'big/small' scripts will also cause it:

2) Make sure that these settings are enabled (as PB only exist in 'experimental mode'):

  • 'Experimental mode'
  • 'In-game scripts'

3) Create a new empty world (remember to enable 'in-game scripts'), with 'creative'.

4) Place a Programmable Block and begin editing its script.

5) Browse scripts, select the 'big script'; "Automatic LCDs 2" and press 'ok' to load it into the PBs code-editor.


6) Important for the bug to occur. In the PB code-editor with this 'big script', scroll down to the bottom and explicitly place the cursor at a source-line that will be past the number of source-lines of the 'smaller script'.


7) Browse scripts again, now select the 'small script'; "Isy's Ship Refuler" and press 'ok'.


8) Crash happens, where log contains the exception/stacktrace provided in the first post of this bug-report.


Thank you Decker! I was finally able to reproduce it. Thanks for detailed reproduction steps, it helped. I reported it into our system and we will share more information regarding any progress made on this issue with you once we have more information.

Kind RegardsKeen Software House: QA Department


Issue has been fixed in version 188.

Leave a Comment
Attach a file