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
Clean up of status reporting of failed operations #8311
Clean up of status reporting of failed operations #8311
Conversation
Undo plumbing and infra introduced in 1572cbd. With that we have one less dependency on WPF stack. There are several scenarios that involve showing `FormStatus` or its descendants. 1. Show a progress as a modal dialog (this is standard way). 2. Do not show the progress dialog, and only show it if an operation that was running failed (e.g. staging files in `FormCommit`). The approach to showing results of failed operations appears to be unnecessay complex, that IIUC led to issues while attempting to show a dialog that was already considered opened but invisible. And the WPF's DispatcherFrameModalController was used to deal with this. This also necessitated defining delegates, and required more plumbing to pass those around, validation, etc. However it is much simpler *not* to show the dialog *until after* the operation has failed. The callsites are also much easier to read and understand.
Codecov Report
@@ Coverage Diff @@
## master #8311 +/- ##
==========================================
+ Coverage 52.68% 52.70% +0.02%
==========================================
Files 864 864
Lines 62509 62474 -35
Branches 11194 11187 -7
==========================================
- Hits 32933 32928 -5
+ Misses 26965 26929 -36
- Partials 2611 2617 +6
|
@msftbot merge in 2 days |
Hello @RussKie! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
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.
Makes sense to me. Have not tested. Just a few nits.
using (var form = new FormStatus(commands: null, new EditboxBasedConsoleOutputControl(), useDialogSettings: true)) | ||
{ |
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.
using (var form = new FormStatus(commands: null, new EditboxBasedConsoleOutputControl(), useDialogSettings: true)) | |
{ | |
using var form = new FormStatus(commands: null, new EditboxBasedConsoleOutputControl(), useDialogSettings: true); |
|
||
_errorOccurred = !isSuccess; | ||
|
||
if (isSuccess && !_showOnError && (_useDialogSettings && AppSettings.CloseProcessDialog)) | ||
if (isSuccess && (_useDialogSettings && AppSettings.CloseProcessDialog)) |
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.
if (isSuccess && (_useDialogSettings && AppSettings.CloseProcessDialog)) | |
if (isSuccess && _useDialogSettings && AppSettings.CloseProcessDialog) |
} | ||
|
||
internal void Start() | ||
private void Start() |
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.
private
methods are not sorted.
public Action<FormStatus> AbortCallback; | ||
private bool _errorOccurred; | ||
private bool _showOnError; | ||
private protected ConsoleOutputControl ConsoleOutput { get; } |
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.
Properties between methods?
Thank you. There's more clean up to do, I'll address the nits in the follow up PRs. |
Proposed changes
Undo plumbing and infra introduced in 1572cbd. With that we have one less dependency on WPF stack.
There are several scenarios that involve showing
FormStatus
or its descendants.FormCommit
).The approach to showing results of failed operations appears to be unnecessary complex, that IIUC led to issues while attempting to show a dialog that was already considered opened but invisible.
And the WPF's DispatcherFrameModalController was used to deal with this.
This also necessitated defining delegates, and required more plumbing to pass those around, validation, etc.
However it is much simpler not to show the dialog until after the operation has failed. The callsites are also much easier to read and understand.
Also some general code clean up.
Test methodology
Lots of manual tests
git fetch
andgit fetch -all
)crlf
tolf
in one of the existing files in a repo)