ToastNotifications
ToastNotifications copied to clipboard
Unhandled System.Threading.Tasks.TaskCanceledException when exiting application
Library version
2.5.1
Expected behaviour
Properly handle TaskCanceledExceptions.
Actual behaviour
Throws an unhandled exception when exiting application.

Steps to reproduce behaviour
- Open sample application using Visual Studio 2019 16.2.x
- Run application with debugging
- Close application
Unhandled exception does not occur every time, may need to repeat (perhaps as many as 12-15 times)
Code to reproduce behaviour
Sample application included.
Questions
This only seems to happen with Visual Studio 2019 16.2.0 or higher. I did not see this on earlier viersions of vs2019 or vs2017.

Exception details...
HResult=0x8013153B
Message=A task was canceled.
Source=mscorlib
StackTrace:
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Windows.Threading.DispatcherOperation.Wait(TimeSpan timeout)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherOperation operation, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke[TResult](Func`1 callback, DispatcherPriority priority, CancellationToken cancellationToken, TimeSpan timeout)
at System.Windows.Threading.Dispatcher.Invoke[TResult](Func`1 callback)
at Microsoft.VisualStudio.DesignTools.WpfTap.WpfVisualTreeService.Properties.PropertyService.GetPropertyValuesChainInternal(Int64 instanceHandle, Object targetObject)
at Microsoft.VisualStudio.DesignTools.WpfTap.WpfVisualTreeService.Properties.PropertyService.HandlePropertyChainRequest(PropertiesRequestInfo requestInfo)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.HandleMessage[TMessage,TReply](Func`2 callback, Message request)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.<>c__DisplayClass27_0`2.<RegisterMessageObserver>b__0(Message message)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.ProcessInboundMessage(Message message)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.<>c__DisplayClass40_0.<OnMessageReceived>b__0()
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.WaitableActionsList.<>c__DisplayClass8_0.<AddAndSignal>b__0(Boolean isCancelled)
at Microsoft.VisualStudio.DesignTools.WpfTap.Networking.ProtocolHandler.ActionThread(Object list)
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart(Object obj)
This appears to likely be a VS2019 16.2 issue.
https://developercommunity.visualstudio.com/content/problem/684087/systemthreadingtaskstaskcanceledexception-thrown-w.html