Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronizes calls to Environment.FailFast. This helps resolve an issue #55939

Merged
merged 3 commits into from
Aug 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Compilers/Core/Portable/InternalUtilities/FailFast.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis
Expand All @@ -13,6 +14,9 @@ internal static class FailFast
{
[DebuggerHidden]
[DoesNotReturn]
#if !NETSTANDARD1_3
dibarbet marked this conversation as resolved.
Show resolved Hide resolved
[MethodImpl(MethodImplOptions.Synchronized)]
#endif
internal static void OnFatalException(Exception exception)
{
// EDMAURER Now using the managed API to fail fast so as to default
Expand All @@ -39,6 +43,9 @@ internal static void OnFatalException(Exception exception)

[DebuggerHidden]
[DoesNotReturn]
#if !NETSTANDARD1_3
[MethodImpl(MethodImplOptions.Synchronized)]
#endif
internal static void Fail(string message)
{
DumpStackTrace(message: message);
Expand Down Expand Up @@ -100,8 +107,7 @@ internal static void Assert([DoesNotReturnIf(false)] bool condition, string? mes
Debugger.Break();
}

DumpStackTrace(message: message);
sharwell marked this conversation as resolved.
Show resolved Hide resolved
Environment.FailFast("ASSERT FAILED" + Environment.NewLine + message);
Fail("ASSERT FAILED" + Environment.NewLine + message);
}
}
}