rafallopatka / ToastNotifications

Toast notifications for WPF allows you to create and display rich notifications in WPF applications. It's highly configurable with set of built-in options like positions, behaviours, themes and many others. It's extendable, it gives you possibility to create custom and interactive notifications in simply manner.
GNU Lesser General Public License v3.0
718 stars 171 forks source link

Toastnotifications are not displayed after reconnecting to Terminalserver (RDP) sessions #99

Open WaldemarCoding opened 5 years ago

WaldemarCoding commented 5 years ago

Connecting to a Terminalserver ToastNotifications are displayed. If the User sessions is disconnected (by Admin or after timeout for example) and the user reconnects, the session and software is still open but no Messages are displayed anymore.

Library version

ToastNotification.Messages 2.5.1

Expected behaviour

Messages should be displayed after reconnect.

Actual behaviour

Messages are not displayed/visible after reconnect.

Steps to reproduce behaviour

Run attached demo in Terminalserver sessions, disconnect user and reconnect again. ToastNotificationsError

Code to reproduce behaviour

ToastNotificationDemo.zip

Questions

WaldemarCoding commented 5 years ago

I installed VS on a the terminalserver and ran the BasicUsageExample from source in Debug with "JustMyCode" disabled. When I disconnnect the user while a notification is still visible it will continue to work after reconnect. Doing so after all notifications were closed it stops working. Both times there is a COMExecption thrown. Let me know if I can check/debug something else.

Exception thrown: 'System.Runtime.InteropServices.COMException' in PresentationCore.dll
System.Runtime.InteropServices.COMException
  HResult=0x8000FFFF
  Message=Schwerwiegender Fehler (Ausnahme von HRESULT: 0x8000FFFF (E_UNEXPECTED))
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

grafik

jidel commented 4 years ago

Tracked it down to collapsing the NotificationsWindow: https://github.com/rafallopatka/ToastNotifications/blob/95ab84fe76fdf1380c52cacdb861ee0aa0280d29/Src/ToastNotifications/Display/NotificationsWindow.xaml.cs#L64 When setting this.Visibility = Visibility.Hidden the issue does not seem to occur.

There seem to be some obscure RDP/WPF issues at play here.

Edit: This also occurs when using the "normal" remote desktop and not only when using TerminalServer

WaldemarCoding commented 4 years ago

Not sure what happend here but closing this was not on purpose. Actually I just wanted to merge the PR of @jidel in my Fork, not closing the original Issue.

cuiliang commented 4 years ago

There are chances toast will not show after computer wake up or after screen saver closed. Change this.Visibility = Visibility.Collapsed; to this.Visibility = Visibility.Hidden ; solves the problem.