Luau: Auto-indenting relatively after the end of an assignment whose value starts at the beginning of a line closes Studio

To reproduce:

  1. In Studio Settings, in the Script Editor tab, in the General section, enable Format on Type and set Auto Indent Rule to Relative.
  2. Replace the contents of a Script with the following, make sure the caret is after the {} and press Enter:
local x =
{}

Upon doing this, Studio hangs for a few seconds and closes abruptly with no crash dump, relevant entry in the log (in %LocalAppData%\Roblox\logs). There will be no pop-up most of the time.

The crash happens 100% of the time in the above-mentioned conditions.

From here onward, I will refer to this as a crash, even though it might instead be a segfault or similar.

A video of the crash being reproduced:

I do not know when this started happening, as I do not put opening braces, brackets or values in general on new lines after an assignment, so I would not have normally stumbled upon this bug.

The assignment must not be part of a syntax error.
The assignment can be anywhere in the script.

If there is a pop-up after the crash, it will be one of Windows’s “RobloxStudio has stopped working” dialogs. There will never be an “An unexpected error occurred” pop-up.

These will be the last two lines in the log, caused by opening the script to edit it:

2022-07-23T06:50:05.888Z,27.888092,10ac,6 [FLog::Output] Info: RobloxScriptDoc::open - start
2022-07-23T06:50:05.987Z,27.987154,10ac,6 [FLog::Output] Info: RobloxScriptDoc::activate - start

This does not change if there had been a pop-up.
This is distinct from closing (but not terminating!) Studio from the Task Manager, in which case the last four lines will be:

2022-07-23T08:19:28.177Z,17.177906,0b98,6 [FLog::Output] Info: RobloxScriptDoc::open - start
2022-07-23T08:19:28.274Z,17.274742,0b98,6 [FLog::Output] Info: RobloxScriptDoc::activate - start
2022-07-23T08:19:31.860Z,20.860058,0b98,6 [FLog::Output] Info: RobloxMainWindow::closeEvent
2022-07-23T08:19:31.860Z,20.860058,0b98,6 [FLog::Output] RobloxMainWindow::requestDocClose doc.docType=0

I also get the former result when terminating Studio’s process from the Task Manager, so it’s terminating about as abruptly.

This happens regardless of whether the script is a Script, LocalScript or ModuleScript.

This happens regardless of whether plugins are disabled (as with RobloxStudioBeta.exe -disableLoadUserPlugins).

Other examples that cause a crash:

x =
1
x =
workspace[]
local x
=
Instance.new()

In this example, the crash also happens when the cursor is between new and () because x = Instance.new is a valid assignment.

x =
{}
local x =
()
local x =
(1)
local x =
();
local x =
{
	
	}
local x =
{
} + 1
local x =
{} -- testing
local
x
=
{
}
local x =
{
	y =
{}
}

(In this case, the crash happens at either of the closing braces, as both of them are assignments followed by the value at the beginning of a new line)

local y = )(
local x =
()

There is a syntax error, but not at the braces where the bug happens.

Examples that do not cause a crash:

local x =
	{}

The { is not at the beginning of a line.

local x = {
}

The { is not at the beginning of a line.

print
()

There is no assignment.

(workspace)

There is no assignment.

local x =
(})

The brackets are part of a syntax error.

Thank you for the report and all the examples. We now have a fix for this issue ready for the Roblox Studio update next week.
Unfortunately you’ll have to avoid Relative auto-indent until the fix.

2 Likes

Following up on this!

The issue should be resolved now as of the 541 patch!

Thanks for the report! @Eestlane771

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.