Computator.NET is a special kind of numerical software that is fast and easy to use but not worse than others feature-wise. It's features include: - Real and complex functions charts - Real and complex calculator - Real functions numerical calculations including different methods - Over 107 Elementary functions - Over 141 Special functions - Over 21 Matrix functions and operations - Scripting language with power to easy computations including matrices - You can declare your own custom functions with scripting language
GNU General Public License v3.0
234
stars
51
forks
source link
Corrupted settings file will cause application to hang indefinitely and make it unable to even start #66
Basically in method Settings.Load() we do not close settings file stream before attempting to remove corrupted file. So it will hang indefinitely as we get exception in catch.
private static Settings Load()
{
if (File.Exists(AppInformation.SettingsPath))
{
var fs = new FileStream(AppInformation.SettingsPath, FileMode.Open);
try
{
var settings = (Settings)new BinaryFormatter().Deserialize(fs);
settings.RestoreDirectories();
return settings;
}
catch (Exception exception)
{
Logger.Error(exception, "Loading settings failed. Will remove corrupted settings file.");
File.Delete(AppInformation.SettingsPath);
}
}
return new Settings();
}
Resolution is quite simple actually.
private static Settings Load()
{
if (!File.Exists(AppInformation.SettingsPath))
return new Settings();
try
{
using (var fs = new FileStream(AppInformation.SettingsPath, FileMode.Open))
{
var settings = (Settings) new BinaryFormatter().Deserialize(fs);
settings.RestoreDirectories();
return settings;
}
}
catch (Exception exception)
{
Logger.Error(exception, "Loading settings failed. Will remove corrupted settings file.");
File.Delete(AppInformation.SettingsPath);
}
return new Settings();
}
But that needs to be delivered fast as it may affect our users in a hard way - not being able to even run our app.
Basically in method
Settings.Load()
we do not close settings file stream before attempting to remove corrupted file. So it will hang indefinitely as we get exception in catch.Resolution is quite simple actually.
But that needs to be delivered fast as it may affect our users in a hard way - not being able to even run our app.