C# - User Settings broken

后端 未结 3 1710
情话喂你
情话喂你 2021-01-04 12:53

We had a rare exception occur when reading the standard .Net user settings (this are the ones found in \"project properties\" in VS 2008):

System.Configurati         


        
3条回答
  •  孤街浪徒
    2021-01-04 13:37

    [STAThread]
    private static void Main(string[] args)
    {
        try
        {
            // ...
        }
        catch (System.Configuration.ConfigurationErrorsException ex)
        {   
            var config = ((System.Configuration.ConfigurationErrorsException)ex.InnerException).Filename;
            // notify user, ask them to restart
            System.IO.File.Delete(config);
            Application.Exit();
        }
    }
    

提交回复
热议问题