[01.189.044][Modding] Misleading error reporting on missing Data folder (loaded only 1/6 phases)

Digi shared this bug 18 months ago
Considered

Problem is that the errors are vague and people don't know what they're doing wrong.


In this particular case I was able to track down to:

// MyDefinitionManager.LoadDefinitions(List<MyModContext> contexts, ...)

List<List<Tuple<MyObjectBuilder_Definitions, string>>> list = new List<List<Tuple<MyObjectBuilder_Definitions, string>>>();

// ...

if (!MyFileSystem.DirectoryExists(contexts[i].ModPathData))
{
  list.Add(null);
}

//...

try
{
  foreach (Tuple<MyObjectBuilder_Definitions, string> current in list[k])
  {
    contexts[k].CurrentFile = current.Item2;
    Action<MyObjectBuilder_Definitions, MyModContext, MyDefinitionManager.DefinitionSet, bool> action = array[j];
    action(current.Item1, contexts[k], definitionSets[k], failOnDebug);
  }
}
catch (Exception innerException)
{
  MyDefinitionManager.FailModLoading(contexts[k], j, array.Length, innerException);
}


If it checks for the data folder why not just do a warning that the data folder is missing and then don't add anything to the list.


Adding null to the list is likely what causes the vague NRE, because it tries to foreach a null list.

Comments (1)

photo
1

Hello, Engineer!


Thank you for your feedback! Your topic has been added between considered issues.

Please keep voting for the issue as it will help us to identify the most serious bugs.


We really appreciate your patience.


Kind Regards

Keen Software House: QA Department