New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autosaving and upgraded to .NET 8 #582
base: master
Are you sure you want to change the base?
Conversation
src/PixiEditor/ViewModels/SubViewModels/Document/AutosaveDocumentViewModel.cs
Outdated
Show resolved
Hide resolved
src/PixiEditor/ViewModels/SubViewModels/Document/AutosaveDocumentViewModel.cs
Outdated
Show resolved
Hide resolved
Also I'm thinking, why save every x setting is a dropdown not number input? |
Also seems like autosave timer isn't working? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PixiEditor doesn't restore files that are manually saved after closing, while autosaved files are. I think this should work like VS Code, last session is restored no matter if it's unsaved by user or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Autosave worked for me once and then stopped, no matter if I restarted the app or paused and resumed via AutosaveControl. Timer seems to be frozen
|
…seems unnecessary as SendExceptionInfoToWebhook is already async, but imma assume it has a purpose)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found an infinite loop
triggered by transform selection, and close without applying
seems like it infinitely autosaves
and it also seems like Document.UpdateableChangeActive isn't set properly for transforming selection
Equbuxu — 今日 01:24
and now I can't repro it
also for some reason files that were saved right before closing are marked as unsaved after reopening
while Untitled files that were never saved are marked as saved
but only sometimes
also passthrough action and modified/deleted on disk labels are still todo
…r or important events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CrashHelper.SendExceptionInfoToWebhook
must not use Task.Run (or anything with a separate thread), supposedly the reason for adding it was this:
I remember it not sending the exception in certain scenerios cause it wasn't awaited
weird, it shouldn't matter whether you await it or not. I can only imagine it happening if the app shuts down before it has a chance to run
I think that was it
Also it seems like a good idea to go through the entire project and closely examite each Task.Run
, they are dangerous
#if DEBUG | ||
throw exception; | ||
#else | ||
exception.GenerateStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd crash here, as that's what WPF normally does when it detects a non-ui thread
"Cancel" | ||
}; | ||
|
||
dialog.ShowDialog(); | ||
} | ||
|
||
[Command.Debug("PixiEditor.Debug.BackupUserPreferences", @"%appdata%\PixiEditor\user_preferences.json", "BACKUP_USR_PREFS", "BACKUP_USR_PREFS")] | ||
[Command.Debug("PixiEditor.Debug.BackupEditorData", @"%localappdata%\PixiEditor\editor_data.json", "BACKUP_EDITOR_DATA", "BACKUP_EDITOR_DATA")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can break on ms store #495; use Environment.GetFolderPath(...
instead
} | ||
|
||
[Command.Debug("PixiEditor.Debug.LoadUserPreferencesBackup", @"%appdata%\PixiEditor\user_preferences.json", "LOAD_USR_PREFS_BACKUP", "LOAD_USR_PREFS_BACKUP")] | ||
[Command.Debug("PixiEditor.Debug.LoadEditorDataBackup", @"%localappdata%\PixiEditor\editor_data.json", "LOAD_EDITOR_DATA_BACKUP", "LOAD_EDITOR_DATA_BACKUP")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can break on ms store #495; use Environment.GetFolderPath(...
instead
@@ -39,6 +39,7 @@ public void AddFinishedActions(params IAction[] actions) | |||
queuedActions.AddRange(actions); | |||
queuedActions.Add(new ChangeBoundary_Action()); | |||
TryExecuteAccumulatedActions(); | |||
document.AutosaveViewModel.HintFinishedAction(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can still pass ChangeBoundary_Action
into AddActions manually, and it won't get picked up. Although it is a bit hard to account for
Actually, this also won't work because TryExecuteAccumulatedActions
doesn't guarantee the actions will be executed right away, so HintFinishedActions
can get called when in fact we are still mid-change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided that this doesn't really matter, saving during an updateable change shouldn't cause any issues apart from a potential lag spike, and this is fine for preventing the lag spike
Looks like |
Strange inconsistency:
I have also noticed pixieditor hanging and getting into an infinite autosaving loop during 2, but not sure if it's specific to 2 (probably not) or just something that can randomly happen. Ironically it happens inside "SafeAutosave". Might be caused by the -1 from AutosavePeriodMinutes ending up in the timer, with that timer then being enabled in |
Seems like autosave files never get deleted? I made some new documents, closed pixieditor, reopened it, then closed all documents without saving, closed pixieditor, and now I have zombie .pixi files laying in Temp\PixiEditor\Autosave |
|
Added periodic autosaving and upgraded to .NET 8
TODO