Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit acbe9f5

Browse files
jkotassafern
authored andcommitted
Search/replace Debug.Assert(false, => Debug.Fail(
Signed-off-by: dotnet-bot-corefx-mirror <dotnet-bot@microsoft.com>
1 parent 306e195 commit acbe9f5

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

src/Common/src/CoreLib/System/Convert.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2902,7 +2902,7 @@ private static unsafe Int32 FromBase64_Decode(Char* startInputPtr, Int32 inputLe
29022902
} // unchecked while
29032903

29042904
// 'd be nice to have an assert that we never get here, but CS0162: Unreachable code detected.
2905-
// Debug.Assert(false, "We only leave the above loop by jumping; should never get here.");
2905+
// Debug.Fail("We only leave the above loop by jumping; should never get here.");
29062906

29072907
// We jump here out of the loop if we hit an '=':
29082908
_EqualityCharEncountered:

src/Common/src/CoreLib/System/Diagnostics/Tracing/EventSource.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4025,7 +4025,7 @@ static private int GetHelperCallFirstArg(MethodInfo method)
40254025
goto default;
40264026
break;
40274027
default:
4028-
/* Debug.Assert(false, "Warning: User validation code sub-optimial: Unsuported opcode " + instrs[idx] +
4028+
/* Debug.Fail("Warning: User validation code sub-optimial: Unsuported opcode " + instrs[idx] +
40294029
" at " + idx + " in method " + method.Name); */
40304030
return -1;
40314031
}
@@ -4617,7 +4617,7 @@ private static void RemoveReferencesToListenerInEventSources(EventListener liste
46174617
EventDispatcher cur = prev.m_Next;
46184618
if (cur == null)
46194619
{
4620-
Debug.Assert(false, "EventSource did not have a registered EventListener!");
4620+
Debug.Fail("EventSource did not have a registered EventListener!");
46214621
break;
46224622
}
46234623
if (cur.m_Listener == listenerToRemove)

src/Common/src/CoreLib/System/Globalization/CalendarData.Unix.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ private static void EnumCalendarInfoCallback(string calendarString, IntPtr conte
325325
}
326326
catch (Exception e)
327327
{
328-
Debug.Assert(false, e.ToString());
328+
Debug.Fail(e.ToString());
329329
// we ignore the managed exceptions here because EnumCalendarInfoCallback will get called from the native code.
330330
// If we don't ignore the exception here that can cause the runtime to fail fast.
331331
}

src/Common/src/CoreLib/System/Globalization/CalendarData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ internal CalendarData(String localeName, CalendarId calendarId, bool bUseUserOve
105105

106106
if (!LoadCalendarDataFromSystem(localeName, calendarId))
107107
{
108-
Debug.Assert(false, "[CalendarData] LoadCalendarDataFromSystem call isn't expected to fail for calendar " + calendarId + " locale " + localeName);
108+
Debug.Fail("[CalendarData] LoadCalendarDataFromSystem call isn't expected to fail for calendar " + calendarId + " locale " + localeName);
109109

110110
// Something failed, try invariant for missing parts
111111
// This is really not good, but we don't want the callers to crash.

src/Common/src/CoreLib/System/Globalization/CalendricalCalculationsHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private static double EphemerisCorrection(double time)
215215
}
216216
}
217217

218-
Debug.Assert(false, "Not expected to come here");
218+
Debug.Fail("Not expected to come here");
219219
return DefaultEphemerisCorrection(year);
220220
}
221221

src/Common/src/CoreLib/System/Globalization/CultureData.Unix.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private string GetLocaleInfo(string localeName, LocaleStringData type)
148148
{
149149
// Failed, just use empty string
150150
StringBuilderCache.Release(sb);
151-
Debug.Assert(false, "[CultureData.GetLocaleInfo(LocaleStringData)] Failed");
151+
Debug.Fail("[CultureData.GetLocaleInfo(LocaleStringData)] Failed");
152152
return String.Empty;
153153
}
154154
return StringBuilderCache.GetStringAndRelease(sb);
@@ -173,7 +173,7 @@ private int GetLocaleInfo(LocaleNumberData type)
173173
if (!result)
174174
{
175175
// Failed, just use 0
176-
Debug.Assert(false, "[CultureData.GetLocaleInfo(LocaleNumberData)] failed");
176+
Debug.Fail("[CultureData.GetLocaleInfo(LocaleNumberData)] failed");
177177
}
178178

179179
return value;
@@ -188,7 +188,7 @@ private int[] GetLocaleInfo(LocaleGroupingData type)
188188
bool result = Interop.GlobalizationInterop.GetLocaleInfoGroupingSizes(_sWindowsName, (uint)type, ref primaryGroupingSize, ref secondaryGroupingSize);
189189
if (!result)
190190
{
191-
Debug.Assert(false, "[CultureData.GetLocaleInfo(LocaleGroupingData type)] failed");
191+
Debug.Fail("[CultureData.GetLocaleInfo(LocaleGroupingData type)] failed");
192192
}
193193

194194
if (secondaryGroupingSize == 0)
@@ -215,7 +215,7 @@ private string GetTimeFormatString(bool shortFormat)
215215
{
216216
// Failed, just use empty string
217217
StringBuilderCache.Release(sb);
218-
Debug.Assert(false, "[CultureData.GetTimeFormatString(bool shortFormat)] Failed");
218+
Debug.Fail("[CultureData.GetTimeFormatString(bool shortFormat)] Failed");
219219
return String.Empty;
220220
}
221221

src/Common/src/CoreLib/System/Globalization/DateTimeFormatInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2839,7 +2839,7 @@ private void InsertAtCurrentHashNode(TokenHashValue[] hashTable, String str, cha
28392839
}
28402840
previousNode = temp;
28412841
};
2842-
Debug.Assert(false, "The hashtable is full. This should not happen.");
2842+
Debug.Fail("The hashtable is full. This should not happen.");
28432843
}
28442844

28452845
private void InsertHash(TokenHashValue[] hashTable, String str, TokenType tokenType, int tokenValue)
@@ -2927,7 +2927,7 @@ private void InsertHash(TokenHashValue[] hashTable, String str, TokenType tokenT
29272927
hashcode += hashProbe;
29282928
if (hashcode >= TOKEN_HASH_SIZE) hashcode -= TOKEN_HASH_SIZE;
29292929
} while (i < TOKEN_HASH_SIZE);
2930-
Debug.Assert(false, "The hashtable is full. This should not happen.");
2930+
Debug.Fail("The hashtable is full. This should not happen.");
29312931
}
29322932

29332933
private bool CompareStringIgnoreCaseOptimized(string string1, int offset1, int length1, string string2, int offset2, int length2)

src/Common/src/CoreLib/System/Globalization/DateTimeParse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4647,7 +4647,7 @@ private static Exception GetDateTimeParseException(ref DateTimeResult result)
46474647
case ParseFailureKind.FormatBadDateTimeCalendar:
46484648
return new FormatException(SR.Format(SR.GetResourceString(result.failureMessageID), result.calendar));
46494649
default:
4650-
Debug.Assert(false, "Unkown DateTimeParseFailure: " + result);
4650+
Debug.Fail("Unkown DateTimeParseFailure: " + result);
46514651
return null;
46524652
}
46534653
}

src/Common/src/CoreLib/System/Lazy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ internal LazyHelper(LazyThreadSafetyMode mode, Exception exception)
8484
break;
8585

8686
default:
87-
Debug.Assert(false, "internal constructor, this should never occur");
87+
Debug.Fail("internal constructor, this should never occur");
8888
break;
8989
}
9090

@@ -119,7 +119,7 @@ private LazyThreadSafetyMode GetMode()
119119
return LazyThreadSafetyMode.ExecutionAndPublication;
120120

121121
default:
122-
Debug.Assert(false, "Invalid logic; State should always have a valid value");
122+
Debug.Fail("Invalid logic; State should always have a valid value");
123123
return default(LazyThreadSafetyMode);
124124
}
125125
}

0 commit comments

Comments
 (0)