Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix mutex cleanup crash on macOS/Linux - #15684

#15684
Merged
nohwnd merged 2 commits into
microsoft:mainmicrosoft/vstest:mainfrom
nohwnd:fix-mutex-cleanup-macosnohwnd/vstest:fix-mutex-cleanup-macosCopy head branch name to clipboard
Apr 16, 2026
Merged

Fix mutex cleanup crash on macOS/Linux#15684
nohwnd merged 2 commits into
microsoft:mainmicrosoft/vstest:mainfrom
nohwnd:fix-mutex-cleanup-macosnohwnd/vstest:fix-mutex-cleanup-macosCopy head branch name to clipboard

Conversation

@nohwnd

@nohwnd nohwnd commented Apr 16, 2026

Copy link
Copy Markdown
Member

AssemblyCleanup may run on a different thread than AssemblyInitialize. On macOS/Linux the .NET runtime throws InvalidOperationException (not ApplicationException) when ReleaseMutex() is called from a non-owning thread. This widens the catch to handle both platforms.

AssemblyCleanup may run on a different thread than AssemblyInitialize.
On macOS/Linux the runtime throws InvalidOperationException (not
ApplicationException) when ReleaseMutex is called from a non-owning
thread. Widen the catch to handle both platforms.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 16, 2026 11:50
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts integration test asset cleanup to avoid crashes when AssemblyCleanup runs on a different thread than AssemblyInitialize, which can cause Mutex.ReleaseMutex() to throw different exception types on macOS/Linux vs Windows.

Changes:

  • Adds explanatory comments about cross-thread ReleaseMutex() behavior across platforms.
  • Broadens the exception handling around ReleaseMutex() during cleanup.

Comment thread test/Microsoft.TestPlatform.TestUtilities/IntegrationTestBuild.cs
@nohwnd
nohwnd enabled auto-merge (squash) April 16, 2026 13:30
@nohwnd
nohwnd merged commit fb4c973 into microsoft:main Apr 16, 2026
6 checks passed
This was referenced Jul 14, 2026
This was referenced Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.