microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.52k stars 6.56k forks source link

[Run] IOException: The process cannot access the file ... QueryHistory.json #32057

Open BananaManIT opened 8 months ago

BananaManIT commented 8 months ago

Microsoft PowerToys version

0.79.0.0

Installation method

PowerToys auto-update

Running as admin

Yes

Area(s) with issue?

General, Settings

Steps to reproduce

Restarting as Administrator

✔️ Expected Behavior

To see PowerToys settings showing running as admin

❌ Actual Behavior

OS Version: Microsoft Windows NT 10.0.19045.0
IntPtr Length: 8
x64: True
Date: 24/03/2024 13:24:36
Exception:
System.IO.IOException: The process cannot access the file 'C:\Users\derek\AppData\Local\Microsoft\PowerToys\PowerToys Run\Settings\QueryHistory.json' because it is being used by another process.
   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.StreamReader.ValidateArgsAndOpenPath(String path, Encoding encoding, Int32 bufferSize)
   at System.IO.File.ReadAllText(String path, Encoding encoding)
   at System.IO.Abstractions.FileWrapper.ReadAllText(String path)
   at Wox.Infrastructure.Storage.JsonStorage`1.Load()
   at PowerLauncher.ViewModel.MainViewModel..ctor(PowerToysRunSettings settings, CancellationToken nativeThreadCancelToken)
   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)

Other Software

2024-03-24.txt

github-actions[bot] commented 8 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

davidegiacometti commented 7 months ago

Saving issue has been fixed, but it still seems to affect reading.

https://github.com/microsoft/PowerToys/blob/a1aa4351325264ae228d893a396611b3e37dc013/src/modules/launcher/Wox.Infrastructure/Storage/JsonStorage%601.cs#L60-L82