Skip to content

Treat an inaccessible tray mutex as no tray - #794

Merged
SimonCropp merged 1 commit into
mainfrom
fix-mutex-probe-access-denied
Aug 22, 2026
Merged

Treat an inaccessible tray mutex as no tray#794
SimonCropp merged 1 commit into
mainfrom
fix-mutex-probe-access-denied

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

Both mutex probes caught only IOException, for the documented macOS case where
opening a mutex that does not exist throws. Mutex.TryOpenExisting also documents
UnauthorizedAccessException, for a mutex that does exist but is not accessible
to this caller - the tray running under one account and the tests under another
in the same session, which is ordinary on a shared or elevated desktop.

"Not accessible" is not the same as "not running", but from inside the probe
there is nothing to tell them apart with, and the answer that keeps a diff tool
launching is the one to take.

The consequence in DiffEngineTray is out of proportion to the cause: that probe
is in a static constructor, so the exception becomes a TypeInitializationException
and every later DiffRunner.Launch and AddDelete in the process throws it, for
the life of the process.

No test. The condition needs a mutex owned by another account, which cannot be
arranged from inside the suite.

Both mutex probes caught only IOException, for the documented macOS case where
opening a mutex that does not exist throws. Mutex.TryOpenExisting also documents
UnauthorizedAccessException, for a mutex that does exist but is not accessible
to this caller - the tray running under one account and the tests under another
in the same session, which is ordinary on a shared or elevated desktop.

"Not accessible" is not the same as "not running", but from inside the probe
there is nothing to tell them apart with, and the answer that keeps a diff tool
launching is the one to take.

The consequence in DiffEngineTray is out of proportion to the cause: that probe
is in a static constructor, so the exception becomes a TypeInitializationException
and every later DiffRunner.Launch and AddDelete in the process throws it, for
the life of the process.

No test. The condition needs a mutex owned by another account, which cannot be
arranged from inside the suite.
@SimonCropp
SimonCropp merged commit 283b710 into main Aug 22, 2026
9 checks passed
@SimonCropp
SimonCropp deleted the fix-mutex-probe-access-denied branch August 22, 2026 00:43
@SimonCropp SimonCropp added this to the 20.0.0 milestone Aug 22, 2026
This was referenced Aug 26, 2026
This was referenced Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant