We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
TaskbarIcon.Dispose
The Dispose method of TaskbarIcon is not thread-safe, it can only be called from the WPF application's main thread.
Dispose
TaskbarIcon
This should either be documented, or the implementation should be made safe e.g. by making use of the Application instance's Dispatcher.
Application
Dispatcher
Version: 1.1.0
Steps to reproduce:
Clicked
var taskbarIcon = new TaskbarIcon(); var t = new Thread(() => { taskbarIcon.Dispose(); }); t.Start();
Result
System.InvalidOperationException: "The calling thread cannot access this object because a different thread owns it."
System.InvalidOperationException
Callstack:
WindowsBase.dll!System.Windows.Threading.Dispatcher.VerifyAccess() Unknown WindowsBase.dll!System.Windows.Threading.DispatcherObject.VerifyAccess() Unknown PresentationFramework.dll!System.Windows.Application.Exit.remove(System.Windows.ExitEventHandler value) Unknown Hardcodet.NotifyIcon.Wpf.dll!Hardcodet.Wpf.TaskbarNotification.TaskbarIcon.Dispose(bool disposing) Unknown Hardcodet.NotifyIcon.Wpf.dll!Hardcodet.Wpf.TaskbarNotification.TaskbarIcon.Dispose() Unknown > TrayIconThreadsafety.dll!TrayIconThreadsafety.MainWindow.Button_Click.AnonymousMethod__0() Line 36 C# System.Private.CoreLib.dll!System.Threading.Thread.StartHelper.Callback(object state) Unknown System.Private.CoreLib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown System.Private.CoreLib.dll!System.Threading.Thread.StartCallback() Unknown
The text was updated successfully, but these errors were encountered:
hardcodet#92: Dispatch event access to correct thread
9344d1b
Successfully merging a pull request may close this issue.
The
Dispose
method ofTaskbarIcon
is not thread-safe, it can only be called from the WPF application's main thread.This should either be documented, or the implementation should be made safe e.g. by making use of the
Application
instance'sDispatcher
.Version: 1.1.0
Steps to reproduce:
Clicked
handler to the main window.Result
System.InvalidOperationException
: "The calling thread cannot access this object because a different thread owns it."Callstack:
The text was updated successfully, but these errors were encountered: