Synchronizes calls to Environment.FailFast. This helps resolve an issue #55939
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.
This helps resolve an issue where Windows Error Reporting (WER) fails to trigger (and therefore
fails to collect dumps) when there are multiple threads triggering Environment.FailFast at the same time.
To validate this locally, I set the WER registry keys to (with the appropriate DumpFolder for my machine).
Without this change, about 50% of the time WER failed to capture a dump. I hacked together this script for easier running - https://github.com/dibarbet/roslyn/blob/working_helix_dump_logging/run_tests_iter.ps1. I ran it about 3 times for 30 iterations total, getting dumps 4/10, 6/10 and 4/10 times.
After this change, all 30 iterations successfully collected dumps.
Part of #55639