Skip to content

Exception when storing a List<string> in the PersistentDataStore #6

@rkunze

Description

@rkunze

Environment: Clean KSP 1.12.4 install with only ModuleManager and ContractConfigurator

Minimal contract type that reproduces the bug:

CONTRACT_TYPE {
    name = PersistentDataStoreBug
    title = "Trigger an Exception in the PersistentDataStore"
    description = "Build and launch any vessel. The exception is triggered after completing the contract and switching back to the space center scene."
    prestige = Trivial
    synopsis = Just testing.
    completedMessage = "Quicksave now and look at quicksafe.sfs to see the broken entry in the persistent data store."
    PARAMETER {
        type = NewVessel
    }

    BEHAVIOUR {
        type = Expression
        CONTRACT_COMPLETED_SUCCESS {
            type = List<string>
            brokenEntry = [ "any string will do to break it" ]
        }
    }
}

Steps to reproduce:

  • Launch the game with the test contract installed
  • Start a new career game
  • Accept the test contract
  • Build and launch any vessel
    • Optional: Quicksave after completing the contract to analyze the state of the PersistentDataStore
  • Change back to the space center scene.

This will trigger the following exception after changing back to the space center:

Exception occured while loading ScenarioModule 'PersistentDataStore':
System.Exception: Error parsing statement.
Error occurred near '*':
[ any string will do to break it ]
..................................* <-- HERE ---> System.ArgumentException: Expected ',' or ']', got end of statement.
  at ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseList[TResult] () [0x00167] in <acee7c1cecb143188a2b003e7f2fafc9>:0 
  at ContractConfigurator.ExpressionParser.ListExpressionParser`1[T].ParseList[TResult] () [0x00007] in <acee7c1cecb143188a2b003e7f2fafc9>:0 
  at ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseSimpleStatement[TResult] () [0x0037e] in <acee7c1cecb143188a2b003e7f2fafc9>:0 
  at ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatementInner[TResult] () [0x0005c] in <acee7c1cecb143188a2b003e7f2fafc9>:0 
  at ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseStatement[TResult] () [0x000f3] in <acee7c1cecb143188a2b003e7f2fafc9>:0 
  at ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) [0x00026] in <acee7c1cecb143188a2b003e7f2fafc9>:0 
--- End of inner exception stack trace ---
  at ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseExpression (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) [0x00089] in <acee7c1cecb143188a2b003e7f2fafc9>:0 
  at ContractConfigurator.ExpressionParser.ExpressionParser`1[T].ParseExpressionGeneric (System.String key, System.String expression, ContractConfigurator.ExpressionParser.DataNode dataNode) [0x00000] in <acee7c1cecb143188a2b003e7f2fafc9>:0 
  at ContractConfigurator.PersistentDataStore.OnLoad (ConfigNode node) [0x000e0] in <acee7c1cecb143188a2b003e7f2fafc9>:0 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions