Skip to content

Stop first Apex test from timing out - #7651

Merged
zivkan merged 7 commits into
devfrom
dev-zivkan-apex-tests
Aug 25, 2026
Merged

zivkan merged 7 commits into
devfrom
dev-zivkan-apex-tests

Conversation

@zivkan

@zivkan zivkan commented Aug 24, 2026

Copy link
Copy Markdown
Member

Bug

Fixes: Apex test reliability

Description

The Apex library does a scan of all the assemblies in VS on first host creation. Copilot says it's to get a catalog of assembly names to locations, I guess so it can load assemblies if test code needs to load VS assemblies outside the context of VS's normal assembly loading rules. On the VMs our tests run on, this takes between 6 to 7 minutes, so tests that timeout after 5 minutes don't give the framework enough time to warm up.

Therefore, the fix is to use an assembly initialize method that warms up the apex host without a timeout, and then when the first test actually runs, it only takes a few seconds.

I also modified the pipeline to make it easier to collect memory dumps when a test freezes. Unfortunately, the blame collector includes the initialize method in its timeout, so the timeout needs to be longer than 6 or 7 minutes, otherwise it'll fail every time and just collect a memory dump of the assembly scan. So, when it's enabled, mstest timeout is set to 10 minutes, instead of 5, so the blame collector can use a timeout of 9 minutes.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc. N/A

@zivkan
zivkan requested a review from a team as a code owner August 24, 2026 10:42
@zivkan
zivkan requested review from jebriede and martinrrm August 24, 2026 10:42
@zivkan zivkan changed the title Dev zivkan apex tests Stop first Apex test from timing out Aug 24, 2026
@zivkan
zivkan merged commit 6f72cac into dev Aug 25, 2026
17 of 18 checks passed
@zivkan
zivkan deleted the dev-zivkan-apex-tests branch August 25, 2026 21:29
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.

2 participants