microsoft / microsoft/msstore-cli

Concurrent msstore invocations crash with an unhandled IOException on telemetrySettings.json

Open
#176 0 comments 1 reaction 2 assignees View on GitHub

@isourabh is already working on this.

Since Sep 3, 2026.

  • #178 by @copilot-swe-agent — open
bug
Dominant language
C#
Stars
163
Forks
22
Avg merge
5d 6h
Merged PRs (30d)
10

Description

Summary

Running two msstore processes at the same time can crash one of them with an unhandled IOException while it loads or saves telemetrySettings.json.

Repro

Start two msstore invocations concurrently — anything is enough, since the telemetry configuration is loaded before the command line is even parsed:

Start-Job { msstore --help }
Start-Job { msstore --help }

Observed

One process terminates with an unhandled exception and exit code -532462766 (0xE0434352):

Unhandled exception. System.IO.IOException: The process cannot access the file
'C:\Users\<user>\AppData\Local\Microsoft\MSStore.CLI\telemetrySettings.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)

Expected

Concurrent invocations should not crash. Telemetry configuration is incidental bookkeeping, so contention on it should at worst be ignored, not terminate the process.

Notes

Program.Main calls telemetryConfigurationManager.LoadAsync(true, …) and then CreateTelemetryClientAsync, which writes the file back when TelemetryEnabled is unset or the GUID is older than 24 hours. ConfigurationManager.LoadAsync/SaveAsync (MSStore.CLI/Services/ConfigurationManager.cs) open the file with no sharing mode, retry, or exception handling for this case, and nothing higher up catches it.

This matters most in CI, where several pipeline steps may invoke the CLI in parallel, and the failure is confusing because it is unrelated to the command being run.

Found incidentally while working on #161 / #174 — two probe invocations happened to overlap. Not caused by that change; it reproduces on main.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.