I have a settings class that looks like the following:
/// <summary>
/// Class for pipeline settings
/// </summary>
public class PipelineSettings
{
    /// <summary>
    /// List of jobs to process
    /// </summary>
    [JsonProperty("jobs")]
    public List<PipelineJob> Jobs;
    // todo: make private and create FetchCredentials(id)
    /// <summary>
    /// List of credentials information cataloged by id
    /// </summary>
    [JsonProperty("credentials")]
    public List<PipelineCredentials> Credentials;
}
And a credentials class that looks like the following:
/// <summary>
/// Class to hold credentials for pipeline jobs
/// </summary>
public class PipelineCredentials
{
    /// <summary>
    ///  The id for the current credential  to be used when referring to it within
    ///  other areas of json settings files
    /// </summary>
    [JsonProperty("id")]
    public int Id;
    /// <summary>
    /// Username or login string for the current system
    /// </summary>
    [JsonProperty("username")]
    public string Username;
    // refine: AES auto encrypt?
    /// <summary>
    /// The password for the active authentication. If not encrypted then it
    /// will be automatically converted into an AES encrypted string
    /// </summary>
    [JsonProperty("password")]
    public string Password;
    [JsonProperty("path")]
    public string UNCPath;
}
I've built the following to try to add a new credential to my list:
var settings = new PipelineSettings();
// Build credentials for storage
var credentials = new PipelineCredentials();
credentials.Id = 1;
credentials.Username = "testUsername";
credentials.Password = "test_password";
credentials.UNCPath = null;
// Add credentials to the current settings class
settings.Credentials.Add(credentials);
var json = new JsonSerializeHelper();
Console.Write(json.Serialize(settings));
Console.ReadKey();
And when I do, I'm receiving a null reference exception on the following line:
settings.Credentials.Add(credentials);
I don't know what I don't know - how should I be adding new items into a list if they're prebuilt?
 
     
    