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

DialogHost | Dialog no longer visible if disconnected-then-reconnect to VM running application #3069

Closed
tblong opened this issue Jan 30, 2023 · 3 comments · Fixed by #3092
Closed
Labels
bug evaluation required Items is pending review or evaluation by the team

Comments

@tblong
Copy link
Contributor

tblong commented Jan 30, 2023

Bug explanation

Steps to reproduce

Used a hyper-v VM running Win 10 21H2 build 19044.1466 + the MainDemo.Wpf app latest commit 607ee6a:

  1. Transfer the MainDemo.Wpf app to the VM
  2. Open the MainDemo.Wpf app and navigate to Dialogs
  3. Click "Run Code" under Sample 3
  4. While the dialog is visible, close the window which disconnects from the VM but leave the VM running
  5. Reconect to the VM and login.
  6. Notice that the dialog is no longer visible, the obscured background of the app is still greyed out and present, and nothing in the app being overlaid by the DialogHost responds to user input.

Screenshot for step 3 above:
image

Screenshot for step 6 above:
image

The short story of them problem seems to be: If the user gets disconnected from a remote session AND a dialog is visible when the disconnect occurs, then the user on reconnect will see a greyed out screen and no visible dialog on reconnect. Anyone ran into this and is there a known workaround?

Version

v4.7.1

@tblong tblong added bug evaluation required Items is pending review or evaluation by the team labels Jan 30, 2023
@tblong
Copy link
Contributor Author

tblong commented Feb 15, 2023

@Keboo I'm able to help out here and contribute to fixing this. Not much experience troubleshooting controls like this directly though. Is this a situation where I should install VS on the VM in question and run the app to see whether certain events are not getting fired or state not updating while trying to reproduce the issue? I'll likely need just a bit of guidance on where to look first.

@Keboo
Copy link
Member

Keboo commented Feb 15, 2023

@tblong that would be really helpful. Some suggestions.

First, take a look at this blog post on how the DialogHost works. Specifically, it appears that the bug above is the Popup control being hidden but the DialogHost not being notified of it.

I have a hunch that if you watch the Loaded/Unloaded events what you will see is when you disconnect your session the controls are unloaded. Likewise reconnecting likely triggers the Loaded event but the Popup control is not moved back into the correct state (this is just a guess). These would be the first two events I would look into.

Also keep an eye on the IsOpen property on the DialogHost as well as the IsOpen on the Popup control. A second theory I have is that because the Popup's IsOpen is set as part of the VisualStateManager it is possible that those are simply not re-triggering. It is possible that we might need to call VisualStateManager.GoToState during some event when the RDP session is reconnected.

You can certainly install VS on the VM if that makes running this easier. It might also make sense to modify the app to write a log file since I am not sure how the debugger will respond when you disconnect your RDP session.

Happy to provide guidance, on what you find.

@peijiehuang
Copy link

@tblong that would be really helpful. Some suggestions.

First, take a look at this blog post on how the DialogHost works. Specifically, it appears that the bug above is the Popup control being hidden but the DialogHost not being notified of it.

I have a hunch that if you watch the Loaded/Unloaded events what you will see is when you disconnect your session the controls are unloaded. Likewise reconnecting likely triggers the Loaded event but the Popup control is not moved back into the correct state (this is just a guess). These would be the first two events I would look into.

Also keep an eye on the IsOpen property on the DialogHost as well as the IsOpen on the Popup control. A second theory I have is that because the Popup's IsOpen is set as part of the VisualStateManager it is possible that those are simply not re-triggering. It is possible that we might need to call VisualStateManager.GoToState during some event when the RDP session is reconnected.

You can certainly install VS on the VM if that makes running this easier. It might also make sense to modify the app to write a log file since I am not sure how the debugger will respond when you disconnect your RDP session.

Happy to provide guidance, on what you find.

Thanks for sharing, great programmer

tblong added a commit to tblong/MaterialDesignInXamlToolkit that referenced this issue Feb 17, 2023
tblong added a commit to tblong/MaterialDesignInXamlToolkit that referenced this issue Feb 17, 2023
Keboo added a commit that referenced this issue Feb 20, 2023
* Fixes DialogHost visibility on VM disconnect (#3069)

* Adding UI test

Reverted change to make sure that we remove dead weak references.

---------

Co-authored-by: Kevin Bost <kitokeboo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug evaluation required Items is pending review or evaluation by the team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants