Unable to resolve" String was not recognized as a valid DateTime issue" c#
<p>My program was working fine, now I've started receiving </p>

<blockquote>
  <p>String was not recognized as a valid DateTime.</p>
</blockquote>

<p>errors which I can't seem to get around. I've have searched high and low for a solution, but nothing fixes the problem. Any advice would be greatly appreciated.</p>

<pre><code>public Form1()
{
    InitializeComponent();

    DirectoryInfo dir = new DirectoryInfo(@"../Debug/");
    FileInfo[] files = dir.GetFiles("*.txt");

    Dictionary&lt;FileInfo, DateTime&gt; filesWithDueDate = new Dictionary&lt;FileInfo, DateTime&gt;();

    foreach (FileInfo file in files)
    {
        string dueDate = File.ReadAllText(file.FullName);

        Regex regex = new Regex(@"\d{2}/\d{2}/\d{4}");
        Match mat = regex.Match(dueDate);

        // Error happens here //
        DateTime duedate = Convert.ToDateTime(mat.ToString());

        filesWithDueDate.Add(file, duedate);
    }

    var sortedFiles = filesWithDueDate.OrderBy(a =&gt; a.Value).Select(b =&gt; b.Key.Name).ToArray();

    listBox1.Items.AddRange(sortedFiles);
}
</code></pre>