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

"Win32Exception The operation completed successfully" on IconSourcePropertyChanged #52

Open
WoKavo opened this issue Mar 27, 2021 · 7 comments
Assignees

Comments

@WoKavo
Copy link

WoKavo commented Mar 27, 2021

I've been using NotifyIcon for a long time now for my application which was working fine on my test machines but I receive a lot of logs with the aforementioned unhandled exception and this stack trace:

System.ComponentModel.Win32Exception (0x80004005): The operation completed successfully.
   at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
   at Hardcodet.Wpf.TaskbarNotification.Util.ToIcon(ImageSource imageSource)
   at Hardcodet.Wpf.TaskbarNotification.TaskbarIcon.IconSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.DependencyObject.InvalidateProperty(DependencyProperty dp, Boolean preserveCurrentValue)
   at System.Windows.Data.MultiBindingExpression.TransferValue()
   at System.Windows.Data.BindingExpression.TransferValue(Object newValue, Boolean isASubPropertyChange)
   at MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32 k, ICollectionView collectionView, Object newValue, Boolean isASubPropertyChange)
   at MS.Internal.Data.PropertyPathWorker.RefreshValue()
   at MS.Internal.Data.ClrBindingWorker.ScheduleTransferOperation(Object arg)
   at MS.Internal.Data.DataBindOperation.Invoke()
   at MS.Internal.Data.DataBindEngine.ProcessCrossThreadRequests()
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

The NotifyIcon has several variants of icons that might change dynamically. All variants of the icons are 32x32 .ico files.
The app is for Windows 10 18362.0+ and exceptions occur on different versions of it and at a random execution time. The app is on .net core 3.1, I've tried changing the package to .net core fork but the exception was still there.

@Lakritzator
Copy link
Collaborator

Lakritzator commented Apr 22, 2021

Without going into the code I would assume there is an issue where some resources are not correctly disposed. Years ago, mid of 2016, I had a look at improving the icon code, but things were still unclear and never merged.

If I find some time, I will check this out. Maybe I will go through the PR's that are still pending on Bitbucket to see what hidden gems are still there.

@Lakritzator Lakritzator self-assigned this Apr 22, 2021
@Lakritzator
Copy link
Collaborator

I found this PR here: https://bitbucket.org/hardcodet/notifyicon-wpf/pull-requests/18
Where it feels like your issue is covered, so I will look at that.

@WoKavo
Copy link
Author

WoKavo commented May 1, 2021

I tried using the library with this commit. Unfortunately the problem wasn't fixed.

@punker76
Copy link
Collaborator

punker76 commented May 1, 2021

@WoKavo It would be nice if you can make a sample with these icons, so we can show what's going wrong here. Thx!

@WoKavo
Copy link
Author

WoKavo commented May 1, 2021

Made a sample. These icons have a dark variant as well and some additional logic to it's changing, but I don't think it's relevant to the problem.

@punker76
Copy link
Collaborator

punker76 commented May 1, 2021

@WoKavo Thx for your sample! I run it on my machine (TM) without this exception. The 0x80004005 means "Unspecified Error" - Not much help, yes.

Looking to the source it could be

Can you possibly find out on which machines these errors occurred?

@Lakritzator Should we adopt the changes from this PR? The PR looks ok to me.

@WoKavo
Copy link
Author

WoKavo commented May 2, 2021

@punker76 All I know is that it's Windows 10 18362.0+, mostly 64-bit and the number of CPU cores ranges from 2 to 12.
I could start gathering some additional data about the machines, could you suggest what exactly should I collect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants