Skip to content

Commit bd61b22

Browse files
committed
Replace Debug.Assert(false, with Debug.Fail(
1 parent d285c82 commit bd61b22

File tree

61 files changed

+156
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+156
-156
lines changed

src/coreclr/nativeaot/Common/src/Internal/Runtime/MethodTable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@ public uint GetFieldOffset(EETypeField eField)
13621362
return cbOffset;
13631363
}
13641364

1365-
Debug.Assert(false, "Unknown MethodTable field type");
1365+
Debug.Fail("Unknown MethodTable field type");
13661366
return 0;
13671367
}
13681368

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/ExceptionHandling.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ private static void OnUnhandledExceptionViaClassLib(object exception)
200200
// disallow all exceptions leaking out of callbacks
201201
}
202202
#else
203-
Debug.Assert(false, "Unhandled exceptions should be processed by the native runtime only");
203+
Debug.Fail("Unhandled exceptions should be processed by the native runtime only");
204204
#endif
205205
}
206206

@@ -429,7 +429,7 @@ public static Exception GetRuntimeException(ExceptionIDs id)
429429
return new InvalidCastException();
430430

431431
default:
432-
Debug.Assert(false, "unexpected ExceptionID");
432+
Debug.Fail("unexpected ExceptionID");
433433
FallbackFailFast(RhFailFastReason.InternalError, null);
434434
return null;
435435
}
@@ -696,7 +696,7 @@ public static void RhUnwindAndIntercept(ref ExInfo exInfo, UIntPtr interceptStac
696696
InternalCalls.ResumeAtInterceptionLocation(exInfo._frameIter.RegisterSet);
697697
}
698698

699-
Debug.Assert(false, "unreachable");
699+
Debug.Fail("unreachable");
700700
FallbackFailFast(RhFailFastReason.InternalError, null);
701701
}
702702
#endif // !NATIVEAOT
@@ -903,7 +903,7 @@ private static void DispatchEx(scoped ref StackFrameIterator frameIter, ref ExIn
903903
pReversePInvokePropagationContext, pReversePInvokePropagationCallback, frameIter.RegisterSet, ref exInfo, frameIter.PreviousTransitionFrame);
904904
// the helper should jump to propagation handler and not return
905905
#endif
906-
Debug.Assert(false, "unreachable");
906+
Debug.Fail("unreachable");
907907
FallbackFailFast(RhFailFastReason.InternalError, null);
908908
}
909909
#endif // FEATURE_OBJCMARSHAL
@@ -926,7 +926,7 @@ private static void DispatchEx(scoped ref StackFrameIterator frameIter, ref ExIn
926926
}
927927
#endif // NATIVEAOT
928928
// currently, RhpCallCatchFunclet will resume after the catch
929-
Debug.Assert(false, "unreachable");
929+
Debug.Fail("unreachable");
930930
FallbackFailFast(RhFailFastReason.InternalError, null);
931931
}
932932

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/RuntimeExports.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ internal static unsafe IntPtr RhGetRuntimeHelperForType(MethodTable* pEEType, Ru
388388
return (IntPtr)(delegate*<MethodTable*, int, object>)&InternalCalls.RhpNewArray;
389389

390390
default:
391-
Debug.Assert(false, "Unknown RuntimeHelperKind");
391+
Debug.Fail("Unknown RuntimeHelperKind");
392392
return IntPtr.Zero;
393393
}
394394
}

src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/TypeCast.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ internal static unsafe bool TypeParametersAreCompatible(int arity,
711711
break;
712712

713713
default:
714-
Debug.Assert(false, "unknown generic variance type");
714+
Debug.Fail("unknown generic variance type");
715715
break;
716716
}
717717
}

src/coreclr/nativeaot/System.Private.StackTraceMetadata/src/Internal/StackTraceMetadata/MethodNameFormatter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ private void EmitTypeName(Handle typeHandle, Flags flags)
263263
break;
264264

265265
default:
266-
Debug.Assert(false, $"Type handle {typeHandle.HandleType} was not handled");
266+
Debug.Fail($"Type handle {typeHandle.HandleType} was not handled");
267267
_outputBuilder.Append("???");
268268
break;
269269
}

src/coreclr/nativeaot/Test.CoreLib/src/System/RuntimeExceptionHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static Exception GetRuntimeException(ExceptionIDs id)
6969
return new PlatformNotSupportedException();
7070

7171
default:
72-
Debug.Assert(false, "unexpected ExceptionID");
72+
Debug.Fail("unexpected ExceptionID");
7373
RuntimeImports.RhpFallbackFailFast();
7474
return null;
7575
}

src/coreclr/tools/Common/JitInterface/SystemVStructClassificator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ private static bool ClassifyEightBytes(TypeDesc typeDesc,
260260
// The field can't span past the end of the struct.
261261
if ((normalizedFieldOffset + fieldSize) > helper.StructSize)
262262
{
263-
Debug.Assert(false, "Invalid struct size. The size of fields and overall size don't agree");
263+
Debug.Fail("Invalid struct size. The size of fields and overall size don't agree");
264264
return false;
265265
}
266266

src/coreclr/tools/Common/TypeSystem/Common/FieldLayoutIntervalCalculator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private int GetFieldSize(TypeDesc fieldType)
7373
}
7474
else
7575
{
76-
Debug.Assert(false, fieldType.ToString());
76+
Debug.Fail(fieldType.ToString());
7777
return fieldType.GetElementSize().AsInt;
7878
}
7979
}

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Dataflow/CompilerGeneratedState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ void MapGeneratedTypeTypeParameters(
378378
}
379379
else
380380
{
381-
Debug.Assert(false, "This should be impossible in valid code");
381+
Debug.Fail("This should be impossible in valid code");
382382
}
383383
}
384384
}

src/coreclr/tools/aot/ILCompiler.MetadataTransform/ILCompiler/Metadata/Transform.TypeForwarders.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private void HandleTypeForwarders(Cts.Ecma.EcmaModule module)
3939
}
4040
else
4141
{
42-
Debug.Assert(false, "Multi-module assemblies");
42+
Debug.Fail("Multi-module assemblies");
4343
}
4444
}
4545
}

0 commit comments

Comments
 (0)