[PTRun] app.dark.png not found
Microsoft PowerToys version
0.61.1
Running as admin
- [ ] Yes
Area(s) with issue?
General
Steps to reproduce
I woke up my computer from suspend, logged in, and immediately saw the powertoys "something went wrong" popup.
Version: 0.61.1.0 OS Version: Microsoft Windows NT 10.0.22000.0 IntPtr Length: 8 x64: True Date: 8/11/2022 2:01:20 AM Exception: System.IO.FileNotFoundException: Could not find file 'C:\Program Files\PowerToys\modules\launcher\Images\app.dark.png'. File name: 'C:\Program Files\PowerToys\modules\launcher\Images\app.dark.png' at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, Int64 preallocationSize) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.Windows.Media.Imaging.BitmapDecoder.SetupDecoderFromUriOrStream(Uri uri, Stream stream, BitmapCacheOption cacheOption, Guid& clsId, Boolean& isOriginalWritable, Stream& uriStream, UnmanagedMemoryStream& unmanagedMemoryStream, SafeFileHandle& safeFilehandle) at System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy, Boolean insertInDecoderCache) at System.Windows.Media.Imaging.BitmapImage.FinalizeCreation() at System.Windows.Media.Imaging.BitmapImage.EndInit() at System.Windows.Media.Imaging.BitmapImage..ctor(Uri uriSource, RequestCachePolicy uriCachePolicy) at Wox.Infrastructure.Image.ImageLoader.Initialize(Theme theme) at PowerLauncher.App.<>c__DisplayClass14_0.<OnStartup>b__0() at Wox.Infrastructure.Stopwatch.Normal(String message, Action action) at PowerLauncher.App.OnStartup(Object sender, StartupEventArgs e) at System.Windows.Application.OnStartup(StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) 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)
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
Other Software
No response
/dup #9742
Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Would you mind: 1 - Uninstall PowerToys. 2 - See if the PowerToys install directory (default: C:\Program Files\PowerToys) is still there. If it is, delete it manually. 3 - Install PowerToys.
Please let us know if this works for you. /needinfo
Let's treat this issue as the new one for this. It looks like these files keep not being installed correctly for same cases up until 63.0.0 at least.
we took an approach with #21327. We can't repro this inhouse but we clearly see this failure and somehow that file is getting cleaned up and not reinstalled. so we're testing out a different way to load the file
Issue is still present in PowerToys v0.68.0. (Edit: it seems to be fixed for me in v.0.68.1.)
Copy of my comment from #24589 (duplicate of this issue):
I am getting the same exception on application start.
However, all the modules I am using seems to be working normally afterwards. I rarely use PowerLauncher / PowerToys Run. Some quick troubleshooting shows that manually selecting "Light" as app theme does not prevent the crash / exception. Disabling PowerToys Run removes the exception and error box on each login / app start.
Excerpt from log file:
[2023-03-06 11:08:59.9784] [INFO] [C:\a\_work\1\s\src\modules\launcher\PowerLauncher\App.xaml.cs::63] Starting PowerToys Run with PID=3804 [2023-03-06 11:09:00.2110] [INFO] [C:\a\_work\1\s\src\modules\launcher\PowerLauncher\App.xaml.cs::74] Runner pid=17336 [2023-03-06 11:09:04.8886] [INFO] [C:\a\_work\1\s\src\modules\launcher\PowerLauncher\App.xaml.cs::116] On Startup. [2023-03-06 11:09:06.4003] [FATAL] ## Exception System.IO.FileNotFoundException: Could not find file 'C:\Program Files\PowerToys\modules\launcher\Images\app.dark.png'. Source: System.Private.CoreLib TargetAssembly: System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e TargetModule: System.Private.CoreLib.dll TargetSite: Microsoft.Win32.SafeHandles.SafeFileHandle CreateFile(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, System.IO.FileOptions) at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at System.Windows.Media.Imaging.BitmapDecoder.SetupDecoderFromUriOrStream(Uri uri, Stream stream, BitmapCacheOption cacheOption, Guid& clsId, Boolean& isOriginalWritable, Stream& uriStream, UnmanagedMemoryStream& unmanagedMemoryStream, SafeFileHandle& safeFilehandle) at System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy, Boolean insertInDecoderCache) at System.Windows.Media.Imaging.BitmapImage.FinalizeCreation() at Wox.Infrastructure.Image.ImageLoader.Initialize(Theme theme) at PowerLauncher.App.<>c__DisplayClass19_0.<OnStartup>b__0() at Wox.Infrastructure.Stopwatch.Normal(String message, Action action) at PowerLauncher.App.OnStartup(Object sender, StartupEventArgs e) at System.Windows.Application.<.ctor>b__1_0(Object unused) 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) ## Environment * Command Line: "C:\Program Files\PowerToys\modules\launcher\PowerToys.PowerLauncher.dll" -powerToysPid 17336 --started-from-runner * Timestamp: 03/06/2023 11:09:06 * Wox version: 0.68.0.0 * OS Version: Microsoft Windows NT 10.0.22621.0 * IntPtr Length: 8 * x64: True * CLR Version: 7.0.3 * Installed .NET Framework: * v2.0.50727 2.0.50727.4927 SP2 * v3.0 3.0.30729.4926 SP2 * v3.5 3.5.30729.4926 SP1 * v4 Client 4.8.09032 * v4 Full 4.8.09032 * v4.0 Client 4.0.0.0
Still happening in 0.70.0. In case you find this problem, you can fix it with this workaround (faster than reinstalling):
- Download the file from the repo: https://github.com/microsoft/PowerToys/blob/main/src/modules/launcher/PowerLauncher/Images/app.dark.png
- Copy it to Program Files\PowerToys\modules\launcher\Images\
This has been a "🤦" one to hunt down.
In reality, we don't even use the launcher app "app.dark.png" file for anything I'd consider useful. All we do with it is load it at startup into the cache assuming it'll be used generally by the plugins as the default icon and free the handle. However, we've changed it so that each plugin uses its own default icon so it seems like this is no longer useful. We still use "app_error.dark.png" and its light equivalent as the default error icon when we can't find an image or thumbnail.
So what was causing the file to remain locked? I've used sysinternals Process Explorer to understand the usage of the file and verified that indeed the process has a handle for the app.dark.png file 🤔 But only that file in the Images folder. It turns out that MainWindow.xaml is using app.dark.png as the icon for the Window, which isn't even visible. I've never been able to replicate having that file locked past uninstall or closing the PowerLaunch app but it's possible that it might happen if there's some sort of debug tool listing windows and showing their icons? Hard to know at this point.
Anyway, the fix here seems to be to remove the window's icon, which isn't even visible, and just generally remove the files and their usage from the code, since it seems they're not used anymore. I'll do some more in depth tests to make sure and open a PR afterwards.
This has been fixed with 0.71