-
-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
When building a WPF app with H.NotifyIcon.Wpf version 2.3.2 in Visual Studio 2026, using C# 10 and PublishSingleFile=true; SelfContained=true, the app crashes with the error shown below.
To reproduce the issue, I created a small example app, described here: https://github.com/MRoc/H.NotifyIcon-Crash
Steps to reproduce the bug
- Clone the example repo
https://github.com/MRoc/H.NotifyIcon-Crash - Open PowerShell
- Run
./Publish.ps1 - Run
./WpfApp1\publish\WpfApp1.exe
Expected behavior
The blank example window opens.
Actual behavior
A message box with the following error appears:
System.TypeInitializationException: The type initializer for 'H.NotifyIcon.TaskbarIcon' threw an exception.
---> System.IO.FileNotFoundException:
File name: 'System.Drawing.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at H.NotifyIcon.TaskbarIcon..cctor()
--- End of inner exception stack trace ---
at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle type)
at System.Windows.DependencyProperty.FromName(String name, Type ownerType)
at System.Windows.Baml2006.WpfXamlType.FindDependencyPropertyBackedProperty(String name, Boolean isAttachable, Boolean skipReadOnlyCheck)
at System.Windows.Baml2006.WpfXamlType.FindMember(String name, Boolean isAttached, Boolean skipReadOnlyCheck)
at System.Xaml.XamlType.GetMember(String name)
at System.Windows.Baml2006.Baml2006SchemaContext.GetProperty(Int16 propertyId, XamlType parentType)
at System.Windows.Baml2006.Baml2006Reader.Process_PropertyWithConverter()
at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()
at System.Windows.Baml2006.Baml2006Reader.ReadObject(KeyRecord record)
at System.Windows.ResourceDictionary.CreateObject(KeyRecord key)
at System.Windows.ResourceDictionary.OnGettingValue(Object key, Object& value, Boolean& canCache)
at System.Windows.ResourceDictionary.OnGettingValuePrivate(Object key, Object& value, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValueWithoutLock(Object key, Boolean& canCache)
at System.Windows.ResourceDictionary.GetValue(Object key, Boolean& canCache)
at System.Windows.Application.FindResource(Object resourceKey)
at WpfApp1.App.OnStartup(StartupEventArgs e) in C:\Projects\H.NotifyIcon-Crash\WpfApp1\App.xaml.cs:line 20
NuGet package version
H.NotifyIcon.Wpf 2.3.2
Platform
x64
IDE
Visual Studio Community 2026, November 2025 Feature Update, Version 18.0.2
Windows Version
Windows 11 Version 25H2 OS Build 26200.7171
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working