Add retry for StackTraceTests.ToString_ShowILOffset AMSI hang#125814
Merged
danmoseley merged 3 commits intodotnet:mainfrom Mar 20, 2026
Merged
Add retry for StackTraceTests.ToString_ShowILOffset AMSI hang#125814danmoseley merged 3 commits intodotnet:mainfrom
danmoseley merged 3 commits intodotnet:mainfrom
Conversation
The ToString_ShowILOffset test's Assembly.Load(byte[]) case triggers an AMSI (Antimalware Scan Interface) scan via Windows Defender RPC. On some CI machines, this RPC call hangs indefinitely on NtAlpcConnectPort, causing a 60-second RemoteExecutor timeout (see dotnet#125599, dotnet#122690). Split the byte[] case into its own test method (ToString_ShowILOffset_ByteArrayLoad) with a shorter 30s timeout and up to 3 retry attempts. This isolates the flaky AMSI-dependent case from the other two stable cases (LoadFrom and AssemblyBuilder), and retries with a fresh child process when the OS-level hang occurs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @steveisok, @dotnet/area-system-diagnostics |
jkotas
reviewed
Mar 20, 2026
src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull request overview
Reduces CI flakiness caused by occasional Windows Defender AMSI hangs during Assembly.Load(byte[]) in stack trace tests by isolating the scenario and retrying it under a shorter RemoteExecutor timeout.
Changes:
- Split the
Assembly.Load(byte[])scenario into its own test method. - Add retry (up to 3 attempts) with a 30s RemoteExecutor timeout for the AMSI-prone scenario.
- Keep existing stable cases (LoadFrom / AssemblyBuilder) in the original test.
src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.StackTrace/tests/StackTraceTests.cs
Outdated
Show resolved
Hide resolved
- Restrict retry to Windows only (AMSI is Windows-specific) per @jkotas - Only retry on timeout, not assertion failures (check message) - Use Assert.Throws for explicit throw assertion Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jkotas
approved these changes
Mar 20, 2026
This was referenced Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
ToString_ShowILOffsettest'sAssembly.Load(byte[])case triggers an AMSI (Antimalware Scan Interface) scan via Windows Defender RPC. On some Helix CI machines, this RPC call hangs indefinitely onNtAlpcConnectPort, causing the 60-second RemoteExecutor timeout.This is an external Windows OS/Defender issue, not a .NET bug (diagnosed in #122690 by @jkotas).
Changes
Assembly.Load(byte[])case into its own test method (ToString_ShowILOffset_ByteArrayLoad) so an AMSI hang no longer drags down the other two stable cases (LoadFrom and AssemblyBuilder).Fixes #125599