Skip to content
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

(#904) Wrap MessageBoxes with a hidden window #905

Merged
merged 1 commit into from
Jan 21, 2022

Conversation

corbob
Copy link
Member

@corbob corbob commented Jan 16, 2022

There appears to be a "feature" in WPF that prevents MessageBoxes from
displaying when there are no active windows. Many of our MessageBoxes
are to report errors, and many of them occur during startup. This
results in them not displaying as we haven't created any windows. This
works around that by creating a hidden window and closing it after the
MessageBox has been displayed.

Description Of Changes

Wrap message boxes with calls to display a hidden window.

Motivation and Context

There is apparently a "feature" of WPF that prevents message boxes from displaying unless there's a window being displayed.

Testing

Caveat: I have not verified that all 7 message boxes are displayed, merely the one that I was able to reliably reproduce. I also did not verify the overloads that don't have any references (yet). I merely added them so we have them if needed in the future.

  1. Purposed broke the user.config file by putting some bad xml elements in it.
  2. Confirmed that Chocolatey GUI displays the message box without immediately dismissing it.

Change Types Made

  • Bug fix (non-breaking change)
  • Feature / Enhancement (non-breaking change)
  • Breaking change (fix or feature that could cause existing functionality to change)
  • PowerShell code changes.

Related Issue

Fixes #904

Change Checklist

  • Requires a change to the documentation
  • Documentation has been updated
  • Tests to cover my changes, have been added
  • All new and existing tests passed.
  • PowerShell v2 compatibility checked.

@corbob corbob force-pushed the 904_fix_message_boxes branch from 8f04765 to cbee966 Compare January 16, 2022 01:08
@gep13 gep13 added this to the 0.20.0 milestone Jan 17, 2022
@gep13 gep13 added Bug Issues where something has happened which was not expected or intended and removed Bug Issues where something has happened which was not expected or intended labels Jan 17, 2022
@gep13 gep13 removed this from the 0.20.0 milestone Jan 17, 2022
@AdmiringWorm AdmiringWorm requested a review from gep13 January 20, 2022 17:19
@gep13
Copy link
Member

gep13 commented Jan 20, 2022

@corbob Is this something that you are in a position to get updated? This is slated to go out with 0.20.0. Thanks

@corbob corbob force-pushed the 904_fix_message_boxes branch from 07ee3d8 to 8bfd269 Compare January 20, 2022 21:13
@gep13 gep13 force-pushed the 904_fix_message_boxes branch from 8bfd269 to 31cf539 Compare January 21, 2022 07:30
There appears to be a "feature" in WPF that prevents MessageBoxes from
displaying when there are no active windows. Many of our MessageBoxes
are to report errors, and many of them occur during startup. This
results in them not displaying as we haven't created any windows. This
works around that by creating a hidden window and closing it after the
MessageBox has been displayed.
@gep13 gep13 force-pushed the 904_fix_message_boxes branch from 31cf539 to 4475b74 Compare January 21, 2022 07:32
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gep13 gep13 merged commit 418bb96 into chocolatey:develop Jan 21, 2022
@gep13
Copy link
Member

gep13 commented Jan 21, 2022

@corbob thanks for getting this added! This was a great find!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Message boxes used to report issues often don't stay open
2 participants