When loading the config, razor would create a default profile, razor would load the variables and then call ScriptVariables.ClearAll(). This would lead to the ClearAll method iterating over _variables, calling UnregisterVariable(), which in turn would remove the variable from the _variables dictionary. This then lead to an InvalidOperationException.
This bug could be the reason so many people have experienced problems with razor not starting anymore after some time of using it when they first added a script variable.
Bug reproduction:
Reason for crash/exception:
When loading the config, razor would create a default profile, razor would load the variables and then call ScriptVariables.ClearAll(). This would lead to the ClearAll method iterating over _variables, calling UnregisterVariable(), which in turn would remove the variable from the _variables dictionary. This then lead to an InvalidOperationException.
This bug could be the reason so many people have experienced problems with razor not starting anymore after some time of using it when they first added a script variable.