public static void SerializeSafely <T>( [NotNull] this FileInfo fileInfo, [CanBeNull] T obj, JsonSerializerSettings?settings = default ) { fileInfo.Backup(true); fileInfo.SerializeForcefully(obj, settings); }
private void backupLogFile() { Debug.Assert(_logFileInfo != null, "_logFileInfo not initialised"); try { _logFileInfo.Backup(); } // not to handle any exception but just let it passes. catch (DirectoryNotFoundException) {} catch (IOException) {} }