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

MouseWithoutBorders multiple threads conflicting access to settings.json #26537

Open
dtaylor84 opened this issue May 31, 2023 · 7 comments
Open
Labels
Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams

Comments

@dtaylor84
Copy link

dtaylor84 commented May 31, 2023

Microsoft PowerToys version

0.70.0

Installation method

WinGet

Running as admin

Yes

Area(s) with issue?

Mouse Without Borders

Steps to reproduce

I'm not sure what is triggering the problem, but I have been configuring & using MouseWithoutBorders on three machines, and had the settings open when I noticed errors in Event Viewer, which are also reported in the MouseWithoutBorders log file.

✔️ Expected Behavior

No error messages.

❌ Actual Behavior

procmon for Image contains MouseWithoutBorders, Path ends with settings.json:

image

MouseWithoutBorders Log (from around the time of the procmon trace):

The process cannot access the file '...settings.json' because it is being used by another process, repeated many times.

[20:42:12.1904801] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.2441962] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.2910031] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.3331874] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.3341173] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.3867593] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.4344280] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.4788106] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.4794601] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.5320794] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.5329877] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.5776401] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.6682178] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.7419509] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.8057661] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.8098926] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.8716513] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.9188104] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.9910281] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:12.9915978] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.0556116] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.1359485] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.1391849] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.1914971] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.2463655] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.3037688] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.3542964] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.3900095] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.4353965] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.4371754] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.4637630] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.4644760] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.4658061] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)
[20:42:13.4664756] [Error] MouseWithoutBordersSettings::Save
Exception encountered while saving MouseWithoutBorders settings.
The process cannot access the file 'C:\Users\david\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\settings.json' because it is being used by another process.
Inner exception:

Stack trace:
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.File.WriteToFile(String path, FileMode mode, String contents, Encoding encoding)
at Microsoft.PowerToys.Settings.UI.Library.SettingsUtils.SaveSettings(String jsonSettings, String powertoy, String fileName)

Other Software

Windows 11 22H2 22621.1778 and 22621.1702 both show a large number of errors.

@dtaylor84 dtaylor84 added Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels May 31, 2023
@dtaylor84 dtaylor84 changed the title MouseWithoutBorders multiple threads writing settings.json MouseWithoutBorders multiple threads conflicting access to settings.json May 31, 2023
@HTPLN
Copy link

HTPLN commented Aug 5, 2023

I'm having the same issue as yourself. I have used MWB in the past a while ago before it came to powertoys and never had issues like this.

I think I have narrowed the problem down but haven't tested it to re-create the issue again yet.

I believe the issue is created by after first activating/initialising mwb for use, then sometime after that activating the "Use Service" switch (the one that requires administrator permission) which is just after the device layout section + then also activating the "Show the original Mouse Without Borders UI" under the "Troubleshooting" section right at the end.

If you look inside task manager in the details section and have a path or command line column you will see two instances of the PowerToys.MouseWithoutBorders.exe service with the only difference in the command line of each being "Winlogon" and "default" - I assume that's supposed to ascertain between a standard service and and one with administrator permission.

The .exe's are located below -

C:\Users\George\AppData\Local\PowerToys - contains PowerToys.MouseWithoutBorders.exe - PowerToys.MouseWithoutBordersHelper.exe - PowerToys.MouseWithoutBordersService.exe alongside most other power toys executables.

C:\Users\George\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders - contains settings.json and some logs

C:\Windows\System32\config\systemprofile\AppData\Local\Microsoft\PowerToys\MouseWithoutBorders\Logs\0.72.0.0 - contains logs but in quite more detail than the ones in my own appdata local folder - but also seems like it's possible that once i initialised the administrator service that the logs were then moved to this profile.

Anyway I hope this can help you gain some more understanding.

Cheers

@nmofonseca
Copy link

Hello,
I have the exact same issue, I also see two Process for PowerToys MouseWithoutBorders which I don't know why it's the case.

I am also running MWB as a service and PowerToys as administrator so I am wondering if that is at play. I haven't tried to unsintall and install PowerToys on both machines.

gps PowerToys*

 NPM(K)    PM(M)      WS(M)     CPU(s)      Id  SI ProcessName
 ------    -----      -----     ------      --  -- -----------
     32    10.27      46.20       0.17   35712   1 PowerToys
     12    18.14      29.07       0.06   47784   1 PowerToys.AlwaysOnTop
     43    11.91      44.61       0.08   17120   1 PowerToys.Awake
     76    71.77     135.54       0.16   48116   1 PowerToys.ColorPickerUI
     11    16.77      26.11       0.00   21280   1 PowerToys.CropAndLock
     20    81.92      65.93       0.09   43252   1 PowerToys.FancyZones
      9    14.93      22.26       0.03   28404   1 PowerToys.KeyboardManagerEngine
     59    18.81      70.79       0.22    2128   1 PowerToys.MouseWithoutBorders
     78    32.03      96.57       1.58   33128   1 PowerToys.MouseWithoutBorders
     52    19.35      64.41       0.55   40448   1 PowerToys.MouseWithoutBordersHelper
     89    97.83     180.89       0.55   47732   1 PowerToys.Peek.UI
     73    89.18     147.75      12.20   37964   1 PowerToys.PowerAccent
    122   201.92     287.00      20.44   16308   1 PowerToys.PowerLauncher
     43    13.07      49.08       0.05    8324   1 PowerToys.PowerOCR

@asheroto
Copy link

asheroto commented Dec 23, 2023

This is still an issue as of Dec 23, 2023.

image

@asheroto
Copy link

asheroto commented Feb 2, 2024

Ping. 😊 Still an issue on latest version. Sometimes floods the event logs....

image

No other process using it except MouseWithoutBorders...

image

@Michael-Kempe
Copy link

Hi, I also see an exception. I noticed it under DbgView.exe - see screenshot. The exception is thrown by the instance with PID 13188 (with parameter 'default').
image

image

@asheroto
Copy link

Perhaps MouseWithoutBorders isn't closing the file handle before another handle is opened?

@asheroto
Copy link

image

Looks like it's also getting debug info

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams
Projects
None yet
Development

No branches or pull requests

5 participants