You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attaching a project that succinctly shows the bug, but here's the idea:
Create a WPF app with a main window.
Click a button that does two things:
2a. Immediately shows another window as a dialog (using ShowDialog())
2b. After a short delay, shows a third window as a dialog whose owner is the second window (the first dialog)
In the first dialog's Loaded handler, the dialog closes itself after a short delay.
What should happen:
Both dialogs close and both dialogs' ShowDialog() methods return.
What actually happens:
Both dialogs close but neither dialog's ShowDialog() method returns.
In the attached sample, a counter is used to keep track of how many dialogs are currently being shown, based on the number of ShowDialog() calls. Clicking the button multiple times keeps increasing the number of dialogs open (ShowDialog() calls). Commenting out the indicated line in MainWindow.xaml.cs works around the bug.
Motivating example:
In my app the first thing the user does is create a "workspace". Creating a workspace involves a number of steps and we show a progress dialog while those steps are being performed. That progress dialog is dialog #1 from the sample. Meanwhile, the app also checks for updates in the background during startup. If an update is found, a separate dialog is shown telling the user about the update. That is dialog #2. If the user happens to tell the app to create a workspace and, while creating the workspace, an update is found, this bug is hit.
I'm attaching a project that succinctly shows the bug, but here's the idea:
2a. Immediately shows another window as a dialog (using ShowDialog())
2b. After a short delay, shows a third window as a dialog whose owner is the second window (the first dialog)
What should happen:
Both dialogs close and both dialogs' ShowDialog() methods return.
What actually happens:
Both dialogs close but neither dialog's ShowDialog() method returns.
In the attached sample, a counter is used to keep track of how many dialogs are currently being shown, based on the number of ShowDialog() calls. Clicking the button multiple times keeps increasing the number of dialogs open (ShowDialog() calls). Commenting out the indicated line in MainWindow.xaml.cs works around the bug.
Motivating example:
In my app the first thing the user does is create a "workspace". Creating a workspace involves a number of steps and we show a progress dialog while those steps are being performed. That progress dialog is dialog #1 from the sample. Meanwhile, the app also checks for updates in the background during startup. If an update is found, a separate dialog is shown telling the user about the update. That is dialog #2. If the user happens to tell the app to create a workspace and, while creating the workspace, an update is found, this bug is hit.
This issue has been moved from https://developercommunity.visualstudio.com/content/problem/51151/wpf-showdialog-never-returns-when-a-dialogs-owner.html
VSTS ticketId: 428554
These are the original issue comments:
Henning Dampel on 5/24/2018, 02:15 AM (239 days ago):
ShowDialog() also never returns if the dialog's owner is a normal window that closes.
These are the original issue solutions:
(no solutions)
The text was updated successfully, but these errors were encountered: