MS\Internal\TextFormatting\Bidi.cs (30)
693Debug.Assert(CharProperty[1, (int) startClass]==1 || (startClass == DirectionClass.ArabicLetter),
696Debug.Assert(CharProperty[1, (int) endClass]==1, ("Cannot use non strong type to resolve neutrals"));
719Debug.Assert(CharProperty[2, (int) characterClass[counter + classIndex]]==0,
744Debug.Assert(CharProperty[2, (int) characterClass[counter + classIndex]]==0, "Changing class of a fixed class");
855Debug.Assert(startOfNeutrals == PositionInvalid,
900Debug.Assert(startOfDelayed != PositionInvalid,
945Debug.Assert(startOfNeutrals == PositionInvalid,
950Debug.Assert(startOfDelayed != PositionInvalid,
1050Debug.Assert(startOfNeutrals != PositionInvalid,
1089Debug.Assert(startOfNeutrals != PositionInvalid,
1122Debug.Assert(startOfNeutrals == PositionInvalid,
1140Debug.Assert(startOfNeutrals == PositionInvalid,
1153Debug.Assert(startOfDelayed != PositionInvalid,
1167Debug.Assert(startOfNeutrals == PositionInvalid,
1172Debug.Assert(startOfDelayed != PositionInvalid,
1183Debug.Assert(startOfNeutrals != PositionInvalid,
1192Debug.Assert(startOfNeutrals == PositionInvalid,
1210Debug.Assert(startOfDelayed != PositionInvalid,
1214Debug.Assert(lastClass == DirectionClass.EuropeanTerminator,
1221Debug.Assert(startOfNeutrals == PositionInvalid,
1226Debug.Assert(startOfDelayed != PositionInvalid,
1275Debug.Assert(startOfNeutrals != PositionInvalid,
1289Debug.Assert(startOfNeutrals == PositionInvalid,
1294Debug.Assert(startOfDelayed != PositionInvalid,
1326Debug.Assert(startOfNeutrals == PositionInvalid,
1353Debug.Assert(startOfNeutrals == PositionInvalid,
1398Debug.Assert(startOfNeutrals == PositionInvalid,
1434Debug.Assert(startOfDelayed != PositionInvalid,
1576Debug.Assert(startOfNeutrals == PositionInvalid,
2467Debug.Assert(runLengthResolved == runLength,
System\Windows\Input\Stylus\Wisp\PenThreadWorker.cs (11)
164Debug.WriteLine("WorkerOperationGetTabletsInfo.OnDoWork failed due to: {0}{1}", Environment.NewLine, e.ToString());
220Debug.WriteLine("WorkerOperationCreateContext.OnDoWork failed due to a {0}{1}", Environment.NewLine, e.ToString());
327Debug.WriteLine("WorkerOperationRefreshCursorInfo.OnDoWork failed due to a {0}{1}", Environment.NewLine, e.ToString());
369Debug.WriteLine("WorkerOperationGetTabletInfo.OnDoWork failed due to {0}{1}", Environment.NewLine, e.ToString());
409Debug.WriteLine("WorkerOperationWorkerGetUpdatedSizes.OnDoWork failed due to a {0}{1}", Environment.NewLine, e.ToString());
525Debug.Assert(penContext != null);
552Debug.Assert(penContext != null);
942Debug.Assert(properties[StylusPointDescription.RequiredXIndex /*0*/].Id == StylusPointPropertyIds.X, "X isn't where we expect it! Fix PenImc to ask for X at index 0");
943Debug.Assert(properties[StylusPointDescription.RequiredYIndex /*1*/].Id == StylusPointPropertyIds.Y, "Y isn't where we expect it! Fix PenImc to ask for Y at index 1");
1045Debug.Assert(pc != null && pc.CommHandle != IntPtr.Zero);
1099Debug.Assert(pc != null && pc.CommHandle != IntPtr.Zero);
System\Windows\Media\Animation\AnimationStorage.cs (41)
50Debug.Assert( _animationClocks == null
53Debug.Assert( _propertyTriggerLayers == null
82Debug.Assert(animationClock != null);
83Debug.Assert(_dependencyObject.Target != null);
84Debug.Assert(_currentTimeInvalidatedHandler != null);
110Debug.Assert(animationClock != null);
111Debug.Assert(_currentTimeInvalidatedHandler != null);
123Debug.Assert(_dependencyObject == null);
124Debug.Assert(_dependencyProperty == null);
148Debug.Assert(_propertyTriggerLayers != null);
149Debug.Assert(_propertyTriggerLayers.ContainsValue(layer));
153Debug.Assert(index >= 0);
251Debug.Assert(animatedPropertyMap.Count > 0);
252Debug.Assert(animatedPropertyMap[_dependencyProperty.GlobalIndex] != DependencyProperty.UnsetValue);
509Debug.Assert( _animationClocks != null
517Debug.Assert(index > -1,
546Debug.Assert(_hasStickySnapshotValue,
558Debug.Assert(_animationClocks.Count > 0);
597Debug.Assert(animationClocks != null,
599Debug.Assert(animationClocks.Count > 0,
601Debug.Assert(!animationClocks.Contains(null),
603Debug.Assert(HandoffBehaviorEnum.IsDefined(handoffBehavior),
658Debug.Assert(animationClocks[i] != null);
666Debug.Assert(handoffBehavior == HandoffBehavior.Compose);
667Debug.Assert(storage != null);
668Debug.Assert(storage._animationClocks != null);
713Debug.Assert(animationClocks != null);
714Debug.Assert(!animationClocks.Contains(null));
716Debug.Assert(HandoffBehaviorEnum.IsDefined(handoffBehavior),
786Debug.Assert(animation == null || IsAnimationValid(dp, animation));
787Debug.Assert(IsPropertyAnimatable(d, dp));
789Debug.Assert(HandoffBehaviorEnum.IsDefined(handoffBehavior),
858Debug.Assert(storage._animationClocks != null && storage._animationClocks.Count > 0,
905Debug.Assert(storage != null,
926Debug.Assert(storage._snapshotValue != DependencyProperty.UnsetValue);
938Debug.Assert(currentPropertyValue != DependencyProperty.UnsetValue);
948Debug.Assert(count > 0);
980Debug.Assert(clocksCount > 0);
981Debug.Assert(defaultDestinationValue != DependencyProperty.UnsetValue);
1094Debug.Assert( AnimatedPropertyMapField.GetValue(d)[dp.GlobalIndex] == DependencyProperty.UnsetValue
1156Debug.Assert(type == typeof(Vector3D), "Application is trying to create independent animation storage for an unsupported type.");
System\Windows\Media\Animation\Clock.cs (145)
65Debug.Assert(timeline != null);
175Debug.Assert(!IsTimeManager);
204Debug.Assert(!IsTimeManager);
222Debug.Assert(!IsTimeManager);
244Debug.Assert(!IsTimeManager);
282Debug.Assert(!IsTimeManager);
295Debug.Assert(!IsTimeManager);
313Debug.Assert(!IsTimeManager);
340Debug.Assert(!IsTimeManager);
368Debug.Assert(!IsTimeManager);
500Debug.Assert(!IsTimeManager);
586Debug.Assert(!clock.IsTimeManager);
636Debug.Assert(!current.IsTimeManager); // We should not yet be connected to the TimeManager
714Debug.Assert(!IsTimeManager);
789Debug.Assert(!IsTimeManager);
796Debug.Assert(!(IsInteractivelyPaused && PendingInteractivePause));
797Debug.Assert(!(!IsInteractivelyPaused && PendingInteractiveResume));
834Debug.Assert(!IsTimeManager);
841Debug.Assert( !(IsInteractivelyPaused && PendingInteractivePause));
842Debug.Assert( !(!IsInteractivelyPaused && PendingInteractiveResume));
869Debug.Assert(IsRoot);
891Debug.Assert(IsRoot);
962Debug.Assert(IsRoot);
973Debug.Assert(IsRoot);
1004Debug.Assert(IsRoot);
1085Debug.Assert(!IsTimeManager);
1121Debug.Assert(!IsTimeManager);
1143Debug.Assert(!IsTimeManager);
1162Debug.Assert(!IsTimeManager);
1241Debug.Assert(!IsTimeManager);
1389Debug.Assert(!IsTimeManager);
1409Debug.Assert(_resolvedDuration != Duration.Automatic, "_resolvedDuration should never be set to Automatic.");
1426Debug.Assert(!IsTimeManager);
1427Debug.Assert(_parent != null && !_parent.IsTimeManager);
1799Debug.Assert(IsRoot); // root clocks only; non-roots have constant begin time
1800Debug.Assert(_rootData != null);
1805Debug.Assert(!RootBeginPending); // we can have either a begin or a seek, not both
1876Debug.Assert(_beginTime.HasValue);
1927Debug.Assert(IsRoot);
1933Debug.Assert(_rootData.DesiredFrameRate > 0);
1953Debug.Assert(!IsTimeManager);
1954Debug.Assert(!IsInteractivelyStopped);
1955Debug.Assert(_parent._currentClockState != ClockState.Stopped);
1956Debug.Assert(_currentClockState != ClockState.Stopped);
1957Debug.Assert(_currentDuration != Duration.Automatic, "_currentDuration should never be Automatic.");
1958Debug.Assert(_beginTime.HasValue);
1960Debug.Assert(parentTime >= _beginTime.Value); // We are active or in postfill
1976Debug.Assert(_currentClockState != ClockState.Active);
2184Debug.Assert(_currentDuration == Duration.Forever, "_currentDuration has an invalid enum value.");
2185Debug.Assert(_currentClockState == ClockState.Active
2203Debug.Assert(this is ClockGroup, "ComputeCurrentIterationWithGrow should only run on ClockGroups.");
2204Debug.Assert(CanGrow, "ComputeCurrentIterationWithGrow should only run on clocks with CanGrow.");
2205Debug.Assert(_currentIterationBeginTime.HasValue, "ComputeCurrentIterationWithGrow should only be called when _currentIterationBeginTime has a value.");
2206Debug.Assert(_resolvedDuration.HasTimeSpan, "ComputeCurrentIterationWithGrow should only be called when _resolvedDuration has a value."); // We must have a computed duration
2207Debug.Assert(_currentDuration.HasTimeSpan, "ComputeCurrentIterationWithGrow should only be called when _currentDuration has a value.");
2268Debug.Assert(!IsTimeManager);
2269Debug.Assert(!IsInteractivelyStopped);
2270Debug.Assert(_parent._currentClockState != ClockState.Stopped);
2271Debug.Assert(_beginTime.HasValue);
2320Debug.Assert(!IsTimeManager);
2321Debug.Assert(!IsInteractivelyStopped);
2322Debug.Assert(_parent._currentClockState != ClockState.Stopped);
2323Debug.Assert(_currentClockState == ClockState.Active); // Must be active at this point
2350Debug.Assert(!IsTimeManager);
2351Debug.Assert(!IsInteractivelyStopped);
2352Debug.Assert(_parent._currentClockState != ClockState.Stopped);
2353Debug.Assert(_currentClockState != ClockState.Stopped);
2354Debug.Assert(_currentDuration != Duration.Automatic, "_currentDuration should never be Automatic.");
2358Debug.Assert(_currentDuration.TimeSpan > TimeSpan.Zero, "ComputeCurrentTime was entered with _currentDuration <= 0");
2365Debug.Assert(transitionTime <= 1, "The values of the accel and decel attributes incorrectly add to more than 1.0");
2366Debug.Assert(transitionTime >= 0, "The values of the accel and decel attributes incorrectly add to less than 0.0");
2429Debug.Assert(_currentDuration == Duration.Forever, "_currentDuration has an invalid enum value.");
2443Debug.Assert(!IsTimeManager);
2457Debug.Assert(_resolvedDuration == Duration.Forever, "_resolvedDuration should be Forever when NaturalDuration is Automatic.");
2485Debug.Assert(!IsTimeManager);
2486Debug.Assert(!IsInteractivelyStopped || IsRoot);
2490Debug.Assert(_resolvedDuration != Duration.Automatic, "_resolvedDuration should never be Automatic.");
2491Debug.Assert(_currentDuration != Duration.Automatic, "_currentDuration should never be Automatic.");
2513Debug.Assert(_currentDuration.HasTimeSpan, "_currentDuration is invalid, neither Forever nor a TimeSpan.");
2514Debug.Assert(_currentDuration == _resolvedDuration, "For clocks which cannot grow, _currentDuration must equal _resolvedDuration.");
2526Debug.Assert(_resolvedDuration.HasTimeSpan, "_resolvedDuration is invalid, neither Forever nor a TimeSpan.");
2527Debug.Assert(_currentDuration.HasTimeSpan, "_currentDuration is invalid, neither Forever nor a TimeSpan.");
2536Debug.Assert(_beginTime.HasValue); // _currentIterationBeginTime.HasValue implies _beginTime.HasValue
2565Debug.Assert(repeatBehavior == RepeatBehavior.Forever); // Only other valid enum value
2659Debug.Assert(!IsTimeManager);
2660Debug.Assert(!IsInteractivelyStopped || IsRoot);
2667Debug.Assert(!_currentIterationBeginTime.HasValue, "_currentIterationBeginTime should not have a value when _beginTime has no value.");
2672Debug.Assert(_beginTime.HasValue);
2701Debug.Assert(IsRoot);
2744Debug.Assert(_beginTime == null);
2745Debug.Assert(_currentClockState == ClockState.Stopped);
2769Debug.Assert(!IsInteractivelyPaused); // Enforce invariant: cannot be pausePending when already paused
2770Debug.Assert(!PendingInteractiveResume); // Enforce invariant: cannot be both pause and resumePending
2787Debug.Assert(IsInteractivelyPaused);
2788Debug.Assert(!PendingInteractivePause);
2816Debug.Assert(endOfActivePeriod.HasValue);
2894Debug.Assert(!IsTimeManager);
2919Debug.Assert(parentTime.HasValue); // If parent isn't stopped, it must have valid time and speed
2920Debug.Assert(parentSpeed.HasValue);
2946Debug.Assert(parentTime.HasValue); // Cannot be true unless parent is stopped
2967Debug.Assert(_beginTime.HasValue);
2968Debug.Assert(parentTime.HasValue);
3013Debug.Assert(!IsTimeManager);
3014Debug.Assert(!IsInteractivelyStopped);
3015Debug.Assert(_parent._currentClockState != ClockState.Stopped);
3016Debug.Assert(_beginTime.HasValue);
3088Debug.Assert(!IsTimeManager);
3089Debug.Assert(!IsInteractivelyStopped || IsRoot);
3093Debug.Assert(_rootData != null, "A root Clock must have the _rootData structure initialized.");
3171Debug.Assert(!IsTimeManager);
3172Debug.Assert(_parent != null);
3173Debug.Assert(_parent.CurrentState != ClockState.Stopped);
3176Debug.Assert(HasSeekOccuredAfterLastTick ||
3180Debug.Assert(_syncData.SyncClock == this || _syncData.SyncClock._parent == this);
3181Debug.Assert(CanSlip || _timeline is ParallelTimeline && ((ParallelTimeline)_timeline).SlipBehavior == SlipBehavior.Slip);
3183Debug.Assert(_syncData != null);
3184Debug.Assert(!_syncData.IsInSyncPeriod);
3187Debug.Assert(_timeline.AutoReverse == false);
3188Debug.Assert(_timeline.AccelerationRatio == 0);
3189Debug.Assert(_timeline.DecelerationRatio == 0);
3236Debug.Assert(syncClockDuration == Duration.Automatic);
3304Debug.Assert(!IsTimeManager);
3305Debug.Assert(_parent != null);
3306Debug.Assert(_syncData != null);
3307Debug.Assert(_syncData.IsInSyncPeriod);
3310Debug.Assert(_syncData.SyncClock == this || _syncData.SyncClock._parent == this);
3314Debug.Assert(!parentIntervalCollection.IsEmpty); // The parent isn't Stopped, so it must have a TIC
3318Debug.Assert(parentIntervalCollection.IsEmptyOfRealPoints || parentIntervalCollection.FirstNodeTime <= currentParentTimePT);
3319Debug.Assert(currentParentSpeed >= 0);
3407Debug.Assert(!current.IsRoot, "Root nodes never should reset their Slip amounts with ResetSlipOnSubtree(), even when seeking.");
3449Debug.Assert(!IsTimeManager);
3530Debug.Assert(_rootData.DesiredFrameRate > 0);
3558Debug.Assert(!IsTimeManager);
3581Debug.Assert(!IsTimeManager);
3582Debug.Assert(_parent == null);
3583Debug.Assert(_timeManager == null);
3674Debug.Assert(factor != 0); // Divide by zero
3761Debug.Assert(IsRoot); // This should only be called on root-child clocks
3797Debug.Assert(!IsTimeManager);
3879Debug.Assert(!IsTimeManager);
3999Debug.Assert(syncClock != null);
4000Debug.Assert(syncClock.GetCanSlip());
4001Debug.Assert(syncClock.IsRoot || syncClock._timeline.BeginTime.HasValue); // Only roots may later validate their _beginTime
4090Debug.Assert(_syncClockBeginTime.HasValue); // This should never be queried on a root without beginTime
4192Debug.Assert(Math.Abs(optimizedInputTime - inputTime) <= error,
System\Windows\Media\MediaContext.cs (34)
211Debug.Assert(dispatcher.Reserved0 == null);
367Debug.Assert(CheckAccess());
629Debug.Assert(InterlockIsEnabled,
726Debug.Assert(_interlockState == InterlockState.WaitingForResponse,
803Debug.Assert(!InterlockIsWaiting,
868Debug.Assert(InterlockIsWaiting,
1103Debug.Assert(IsClockSupported, "MediaContext.CurrentTime called when QueryPerformaceCounter is not supported");
1362Debug.Assert(_interlockState == InterlockState.Disabled,
1371Debug.Assert(Channel != null);
1392Debug.Assert(dispatcher != null, "Dispatcher required");
1397Debug.Assert(dispatcher.Reserved0 == cm);
1420Debug.Assert(CheckAccess());
1429Debug.Assert(CheckAccess());
1460Debug.Assert(_timeManager != null);
1489Debug.Assert(dispatcher != null);
1490Debug.Assert(iv != null);
1502Debug.Assert(!_isDisposed);
1503Debug.Assert(iv != null);
1530Debug.Assert(dispatcher != null);
1531Debug.Assert(iv != null);
1542Debug.Assert(iv != null);
1592Debug.Assert(callback != null);
1597Debug.Assert(arg != null);
1638Debug.Assert(op != null);
1676Debug.Assert(CheckAccess());
1800Debug.Assert(CheckAccess());
1801Debug.Assert(
2042Debug.Assert(CheckAccess());
2044Debug.Assert(!_isDisposed);
2045Debug.Assert(_registeredICompositionTargets != null);
2151Debug.Assert(_needToCommitChannel, "CommitChannel called with nothing on the channel");
2155Debug.Assert(!InterlockIsWaiting,
2221Debug.Assert(InterlockIsEnabled,
2553Debug.Assert(_interlockState == InterlockState.WaitingForNextFrame
System\Windows\Media\Visual.cs (30)
174Debug.Assert(false, "TYPE_VISUAL or TYPE_VIEWPORT3DVISUAL expected.");
580Debug.Assert(BitmapEffectStateField.GetValue(this) != null);
658Debug.Assert(IsOnChannel(channel));
659Debug.Assert(!CheckFlagsAnd(channel, VisualProxyFlags.IsContentNodeConnected));
860Debug.Assert(channelsToCyclicBrushMap[channel] > 0);
886Debug.Assert(cyclicBrushToChannelsMap[cyclicBrush] > 0);
911Debug.Assert(cyclicBrushToChannelsMap != null);
912Debug.Assert(cyclicBrushToChannelsMap.ContainsKey(cyclicBrush));
913Debug.Assert(cyclicBrushToChannelsMap[cyclicBrush] > 0);
934Debug.Assert(channelsToCyclicBrushMap != null);
935Debug.Assert(channelsToCyclicBrushMap.ContainsKey(channel));
936Debug.Assert(channelsToCyclicBrushMap[channel] > 0);
1312Debug.Assert(CheckFlagsAnd(VisualFlags.ReentrancyFlag)); // Exit must be matched with Enter. See Enter comments.
1965Debug.Assert(Point.Equals(pointParams.HitPoint, backupHitPoint),
1996Debug.Assert(Matrix.Equals(geometryParams.InternalHitGeometry.Transform.Value, originalMatrix),
2091Debug.Assert(BitmapEffectStateField.GetValue(this) != null);
2222Debug.Assert(bitmapEffectState != null);
2261Debug.Assert(intersectionDetail != IntersectionDetail.NotCalculated);
2319Debug.Assert(intersectionDetail != IntersectionDetail.NotCalculated);
2383Debug.Assert(resultCallback != null);
2444Debug.Assert(intersectionDetail != IntersectionDetail.NotCalculated);
3058Debug.Assert(bed != null, "Must be non-null because otherwise the code would have earlied out where new value is compared against old value.");
3220Debug.Assert(currentBitmapEffect.IsFrozen == emulatingEffect.IsFrozen);
3289Debug.Assert(bitmapEffectState != null);
3303Debug.Assert(EffectField.GetValue(this) == null, "Not expecting both BitmapEffect and Effect to be set on the same node");
3978Debug.Assert(_parent != null, "If oldParent is null, current parent should != null.");
4490Debug.Assert(ancestor != null);
4607Debug.Assert((group == null) || (group.Children.Count > 0));
4685Debug.Assert(ancestor != null);
5247Debug.Assert(cyclicBrushToChannelsMap != null, "Visual brush roots need to have the visual brush to channels map!");
System\Windows\Media3D\Visual3D.cs (23)
246Debug.Assert(child != null);
247Debug.Assert(child.InternalVisualParent == null);
294Debug.Assert(child != null);
295Debug.Assert(child.InternalVisualParent == this);
467Debug.Assert(VisualTreeHelper.GetParent(this) != null, "If oldParent is null, current parent should != null.");
960Debug.Assert(InternalVisualParent == newParent);
968Debug.Assert(InternalVisualParent == newParent);
1068Debug.Assert(boundsAreEqual, errorString);
1090Debug.Assert(model != null);
1222Debug.Assert((flags & VisualProxyFlags.IsContentNodeConnected) == 0,
1270Debug.Assert(!CheckFlagsAnd(channel, VisualProxyFlags.IsContentConnected));
1271Debug.Assert(IsOnChannel(channel));
1462Debug.Assert(IsOnChannel(channel));
1463Debug.Assert(!CheckFlagsAnd(channel, VisualProxyFlags.IsContentNodeConnected));
1593Debug.Assert(child.InheritanceContext == this,
1660Debug.Assert(ancestor != null);
1808Debug.Assert(ancestor != null);
1845Debug.Assert(_2DParent.GetValue(this) == null,
1853Debug.Assert(parent2D == null || parent2D is Viewport3DVisual,
2059Debug.Assert(!e.CheckFlagsOr(VisualFlags.ShouldPostRender),
2061Debug.Assert(!e.CheckFlagsOr(VisualFlags.NodeIsCyclicBrushRoot),
2073Debug.Assert((viewport == null) == (e.InternalVisualParent == null),
2111Debug.Assert(_inheritanceContext.GetValue(this) == UseParentAsContext,
MS\Internal\Annotations\Anchoring\LocatorManager.cs (13)
330Debug.Assert(attachedAnchor != null, "AttachedAnchor cannot be null if attachmentLevel is not Unresolved.");
380Debug.Assert(processor != null, "SubtreeProcessor can not be null");
658Debug.Assert(startNode != null, "startNode can not be null");
770Debug.Assert(node != null, "node can not be null");
837Debug.Assert(data != null, "dataBlob is either null or not of ProcessingTreeState type");
842Debug.Assert(processor != null, "SubtreeProcessor can not be null"); // There is always a default processor
864Debug.Assert(data != null, "dataBlob is either null or not of ProcessingTreeState type");
868Debug.Assert(processor != null, "SubtreeProcessor can not be null");
903Debug.Assert(locator != null, "locator can not be null");
904Debug.Assert(startNode != null, "startNode can not be null");
940Debug.Assert(offset >= 0 && offset < realLocator.Parts.Count, "offset out of range");
1111Debug.Assert(locator != null, "locator can not be null");
1112Debug.Assert(data.LocatorPartIndex >= 0 && data.LocatorPartIndex < locator.Parts.Count,
MS\Internal\Annotations\Component\AnnotationHighlightLayer.cs (21)
80Debug.Assert(start != null, "start pointer is null");
81Debug.Assert(end != null, "end pointer is null");
82Debug.Assert(start.CompareTo(end) <= 0, "end pointer before start");
118Debug.Assert(highlightRange != null, "null range data");
348Debug.Assert(highlightRange != null, " null highlight range");
350Debug.Assert((rangeSegments != null) && (rangeSegments.Count > 0), "invalid rangeSegments");
361Debug.Assert(highlightSegment != null, "null highlight segment");
385Debug.Assert(rangeEnumerator.Current.IsNull || !next ||
520Debug.Assert(false, "Mismatched segment data");
643Debug.Assert(start != null, "start pointer is null");
644Debug.Assert(end != null, "end pointer is null");
645Debug.Assert(owners != null, "null owners list");
646Debug.Assert(owners.Count > 0, "empty owners list");
648Debug.Assert(owners[i] != null, "null owner");
799Debug.Assert((ps1 != null) && (ps2 != null) && (ps1.CompareTo(ps2) <= 0), "invalid splitting points");
873Debug.Assert(res.Count == 2, "unexpected resulting segment count after split");
929Debug.Assert(textViews != null, "geometry text view not found");
948Debug.Assert((view != null) && (parentView != null), "null text view");
990Debug.Assert(!_segment.IsNull, "null TextSegment");
1109Debug.Assert(TopOwner != null, "invalid TopOwner");
1111Debug.Assert(parentView != null, "geometry parent text view not found");
MS\Internal\Annotations\Component\MarkedHighlightComponent.cs (26)
370Debug.Assert(anchor != null, "undefined anchor");
371Debug.Assert(marker.Data != null || marker.Data == Geometry.Empty, "undefined geometry");
375Debug.Assert(geometry != null, "unexpected geometry type");
376Debug.Assert(geometry.Children.Count == 3, "unexpected geometry children count");
443Debug.Assert(_uiParent != null, "No selection container");
485Debug.Assert(textContainer != null, "TextAnchor does not belong to a TextContainer");
633Debug.Assert(componentsRegister != null, "The selection is not registered");
659Debug.Assert(anchor != null, "wrong attachedAnchor");
892Debug.Assert(selection != null, "Unexpected sender of Changed event");
902Debug.Assert(components != null, "No SN registered for this selection");
910Debug.Assert(components[i].HighlightAnchor != null, "Missing highlight anchor component");
931Debug.Assert(sender != null, "undefined sender");
958Debug.Assert(pos != null, "null text pointer");
972Debug.Assert((components != null) && (components.Count > 0), "invalid component registry");
999Debug.Assert(selectionHandler != null, "SelectionHandler handler can not be null");
1000Debug.Assert(mouseMoveHandler != null, "MouseMoveHandler handler can not be null");
1013Debug.Assert(component != null, "component is null");
1014Debug.Assert(_components != null, "_components are null");
1048Debug.Assert(component != null, "component is null");
1049Debug.Assert(_components != null, "_components are null");
1104Debug.Assert(first != null, "first component is null");
1105Debug.Assert((first.AttachedAnnotations != null) && (first.AttachedAnnotations.Count > 0), "first AttachedAnchor is null");
1106Debug.Assert(second != null, "second component is null");
1107Debug.Assert((second.AttachedAnnotations != null) && (second.AttachedAnnotations.Count > 0), "second AttachedAnchor is null");
1112Debug.Assert(firstAnchor != null, " first TextAnchor is null");
1113Debug.Assert(secondAnchor != null, " second TextAnchor is null");
MS\Internal\Ink\EditingCoordinator.cs (22)
88Debug.Assert(ActiveEditingBehavior == SelectionEditor,
181Debug.Assert(currentBehavior is StylusEditingBehavior,
203Debug.Assert(currentBehavior is StylusEditingBehavior,
259Debug.Assert(behavior != null);
317Debug.Assert(_activationStack.Count == 1, "The behavior stack has to contain one behavior.");
363Debug.Assert(behavior == ActiveEditingBehavior);
373Debug.Assert(behavior == LassoSelectionBehavior || behavior == SelectionEditingBehavior,
384Debug.Assert(behavior != LassoSelectionBehavior && behavior != SelectionEditingBehavior,
453Debug.Assert((_capturedStylus != null && _capturedMouse == null)
611Debug.Assert(newEditingBehavior != null);
787Debug.Assert(stylusEditingBehavior != null || ActiveEditingBehavior == null,
870Debug.Assert(ActiveEditingBehavior == null || ActiveEditingBehavior is IStylusEditing,
942Debug.Assert(inputDevice != null, "A null device is passed in.");
943Debug.Assert(stylusEditingBehavior != null, "stylusEditingBehavior cannot be null.");
944Debug.Assert(!IsInMidStroke, "The previous device hasn't been released yet.");
992Debug.Assert(!resetDynamicRenderer, "The dynamic renderer shouldn't be reset for Mouse");
1028Debug.Assert(IsInMidStroke || !releaseDevice, "The captured device has been release unexpectly.");
1070Debug.Assert(_capturedStylus == null || _capturedMouse == null, "InkCanvas cannot capture both stylus and mouse at the same time.");
1203Debug.Assert(false, "Unknown behavior");
1240Debug.Assert(false, "Unknown behavior");
1248Debug.Assert(!IsInMidStroke, "ChangeEditingBehavior cannot be called in a mid-stroke");
1249Debug.Assert(_activationStack.Count <= 1, "The behavior stack has to contain at most one behavior when user is not editing.");
MS\Internal\PtsHost\PtsHost.cs (24)
398Debug.Assert(cnms == 1); // Only one section is supported right now.
584Debug.Assert(false, "PTS.GetSegmentDefinedColumnSpanAreaInfo is not implemented.");
596Debug.Assert(false, "PTS.GetHeightDefinedColumnSpanAreaInfo is not implemented.");
884Debug.Assert(false, "PTS.GetNumberEndnoteColumns is not implemented.");
896Debug.Assert(false, "PTS.GetEndnoteColumnInfo is not implemented.");
907Debug.Assert(false, "PTS.GetFootnoteSeparators is not implemented.");
916Debug.Assert(false, "PTS.FFootnoteBeneathText is not implemented.");
925Debug.Assert(false, "PTS.GetNumberFootnoteColumns is not implemented.");
937Debug.Assert(false, "PTS.GetFootnoteColumnInfo is not implemented.");
946Debug.Assert(false, "PTS.GetFootnoteSegment is not implemented.");
960Debug.Assert(false, "PTS.GetFootnotePresentationAndRejectionOrder is not implemented.");
969Debug.Assert(false, "PTS.FAllowFootnoteSeparation is not implemented.");
1267Debug.Assert(false, "PTS.GetFootnotes is not implemented.");
1286Debug.Assert(false, "PTS.FormatDropCap is not implemented.");
1304Debug.Assert(false, "PTS.GetDropCapPolygons is not implemented.");
1312Debug.Assert(false, "PTS.DestroyDropCap is not implemented.");
1724Debug.Assert(false, "PTS.SnapGridVertical is not implemented.");
1825Debug.Assert(false, "PTS.UpdGetDropCapChange is not implemented.");
1926Debug.Assert(false, "PTS.GetOptimalLineDcpCache is not implemented.");
2571Debug.Assert(false);
2956Debug.Assert(false, "PTS.ObjGetFootnoteInfo is not implemented.");
2966Debug.Assert(false);
3186Debug.Assert(false);
3265Debug.Assert(false);
MS\Internal\PtsHost\TextParaClient.cs (42)
137Debug.Assert(textDetails.fsktd == PTS.FSKTEXTDETAILS.fsktdCached);
138Debug.Assert(false, "Should not get here. ParaCache is not currently used.");
164Debug.Assert(!((TextParagraph) Paragraph).HasFiguresFloatersOrInlineObjects());
235Debug.Assert(textDetails.fsktd == PTS.FSKTEXTDETAILS.fsktdCached);
236Debug.Assert(false, "Should not get here. ParaCache is not currently used.");
257Debug.Assert(Paragraph.Element as ContentElement != e);
324Debug.Assert(textDetails.fsktd == PTS.FSKTEXTDETAILS.fsktdCached);
325Debug.Assert(false, "Should not get here. ParaCache is not currently used.");
377Debug.Assert(textDetails.fsktd == PTS.FSKTEXTDETAILS.fsktdCached);
378Debug.Assert(false, "Should not get here. ParaCache is not currently used.");
719Debug.Assert(textDetails.fsktd == PTS.FSKTEXTDETAILS.fsktdCached);
720Debug.Assert(false, "Should not get here. ParaCache is not currently used.");
800Debug.Assert(textDetails.fsktd == PTS.FSKTEXTDETAILS.fsktdCached);
801Debug.Assert(false, "Should not get here. ParaCache is not currently used.");
832Debug.Assert(position is TextPointer);
863Debug.Assert(textDetails.fsktd == PTS.FSKTEXTDETAILS.fsktdCached);
864Debug.Assert(false, "Should not get here. ParaCache is not currently used.");
882Debug.Assert(position is TextPointer);
913Debug.Assert(textDetails.fsktd == PTS.FSKTEXTDETAILS.fsktdCached);
914Debug.Assert(false, "Should not get here. ParaCache is not currently used.");
1070Debug.Assert(textDetails.fsktd == PTS.FSKTEXTDETAILS.fsktdCached);
1071Debug.Assert(false, "Should not get here. ParaCache is not currently used.");
1372Debug.Assert(textDetails.fsktd == PTS.FSKTEXTDETAILS.fsktdCached);
1373Debug.Assert(false, "Should not get here. ParaCache is not currently used.");
1392Debug.Assert(!PTS.ToBoolean(textDetails.fLinesComposite));
1472Debug.Assert(insertionIndex >= 0 && insertionIndex <= lineVisuals.Count);
2624Debug.Assert(index > 0);
2754Debug.Assert(index == 0);
2755Debug.Assert(elIndex == 0);
2769Debug.Assert(index > 0);
2793Debug.Assert(elIndex == arrayLineElement.Length - 1);
2794Debug.Assert(index == arrayLineDesc.Length - 1);
2914Debug.Assert(index > 0);
2962Debug.Assert(backspaceCaretPosition != null);
3011Debug.Assert(index == 0);
3012Debug.Assert(elIndex == 0);
3026Debug.Assert(index > 0);
3373Debug.Assert(!PTS.ToBoolean(textDetails.fLinesComposite));
3491Debug.Assert(_lineIndexFirstVisual == lineIndexFirstVisible);
3520Debug.Assert(visualChildren.Count == (lineIndexFirstInvisible - lineIndexFirstVisible));
3930Debug.Assert(localEnd > localStart);
4130Debug.Assert(localEnd > localStart);
MS\Internal\Text\ComplexLine.cs (12)
69Debug.Assert(run != null, "TextRun has not been created.");
70Debug.Assert(run.Length > 0, "TextRun has to have positive length.");
85Debug.Assert(dcp >= 0);
160Debug.Assert(runs != null, "Cannot retrieve runs collection.");
183Debug.Assert(DoubleUtil.GreaterThanOrClose(rect.Width, 0), "Negative inline object's width.");
235Debug.Assert(runs != null, "Cannot retrieve runs collection.");
339Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.Text, "TextPointer does not point to characters.");
386Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementStart, "TextPointer does not point to element start edge.");
391Debug.Assert(element != null, "Cannot use ITextContainer that does not provide TextElement instances.");
477Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.ElementEnd, "TextPointer does not point to element end edge.");
482Debug.Assert(element != null, "Element should be here.");
527Debug.Assert(position.GetPointerContext(LogicalDirection.Forward) == TextPointerContext.EmbeddedElement, "TextPointer does not point to embedded object.");
System\Windows\Controls\DataGrid.cs (17)
1649Debug.Assert(info != null, "info is null.");
1650Debug.Assert(column != null, "column is null.");
1759Debug.Assert(_isDraggingSelection, "DoAutoScroll should only be called when dragging selection.");
3569Debug.Assert(CanUserAddRows, "AddNewItem called when the end-user cannot add new rows.");
3570Debug.Assert(!IsAddingNewItem, "AddNewItem called when a pending add is taking place.");
5283Debug.Assert(!IsUpdatingSelectedCells);
5289Debug.Assert(IsUpdatingSelectedCells);
5370Debug.Fail("Unknown SelectionUnit encountered.");
6417Debug.Assert(RelativeMousePosition != RelativeMousePositions.Over, "The mouse is not supposed to be over the DataGrid.");
7136Debug.Assert(sortColumn != null, "column should not be null");
7294Debug.Assert(e.NewItems.Count == 1, "SortDescriptionCollection should handle one element at a time");
7305Debug.Assert(e.OldItems.Count == 1, "SortDescriptionCollection should handle one element at a time");
7325Debug.Assert(e.OldItems.Count == 1 && e.NewItems.Count == 1, "SortDescriptionCollection should handle one element at a time");
7439Debug.Assert(e.NewItems.Count == 1, "GroupDescriptionCollection should handle one element at a time");
7447Debug.Assert(e.OldItems.Count == 1, "GroupDescriptionCollection should handle one element at a time");
7458Debug.Assert(e.OldItems.Count == 1 && e.NewItems.Count == 1, "GroupDescriptionCollection should handle one element at a time");
7881Debug.Assert(dataGrid != null || columnCollection != null, "Both dataGrid and columnCollection cannot not be null at the same time");
System\Windows\Controls\DataGridAutoGeneratingColumnEventArgs.cs (1)
110Debug.Assert(
System\Windows\Controls\DataGridCellsPanel.cs (18)
172Debug.Assert(blockList != null, "RealizedColumnsBlockList shouldn't be null at this point.");
639Debug.Assert(!children.Contains(child), "we incorrectly identified a recycled container");
654Debug.Assert(child == InternalChildren[childIndex], "Wrong child was generated");
684Debug.Assert(container != null, "Null container was generated");
720Debug.Assert(children[visualTreeIndex] != null, "MoveVisualChild interprets a null destination as 'move to end'");
781Debug.Assert(false, "We should have found a child");
1076Debug.Assert(columnIndex < columnCount, "columnIndex should be less than column count");
1151Debug.Assert(startIndex >= 0);
1152Debug.Assert(children == _realizedChildren, "the given child list must be the _realizedChildren list when recycling");
1343Debug.Assert(
1349Debug.Assert(
1426Debug.Assert(i >= arrangeState.FrozenColumnCount, "Frozen cells should have been realized or not visible");
1460Debug.Assert(child != null, "child cannot be null.");
1475Debug.Assert(cell.Column != null, "column cannot be null.");
1580Debug.Assert(children.Count > blockElementCount, "Element count from blocks can't be less than total children count");
1621Debug.Assert(columnIndex <= block.EndIndex, "Missing children for index in block list");
1983Debug.Assert(ParentDataGrid != null, "ParentDataGrid should not be null");
2101Debug.Assert((itemCount == itemUICount) || (itemUICount == 0), "Both ItemUICount and ItemCount should be equal or ItemUICount should be 0.");
System\Windows\Controls\DataGridColumnCollection.cs (18)
25Debug.Assert(dataGridOwner != null, "We should have a valid DataGrid");
232Debug.Assert(displayIndex >= 0 && displayIndex < DisplayIndexMap.Count, "displayIndex should have already been validated");
330Debug.Assert(newDisplayIndex >= 0 && newDisplayIndex < Count, "The new DisplayIndex should have already been validated");
363Debug.Assert(oldDisplayIndex != newDisplayIndex, "A column's display index must have changed for us to call OnColumnDisplayIndexChanged");
364Debug.Assert(oldDisplayIndex >= 0 && oldDisplayIndex < Count, "The old DisplayIndex should be valid");
415Debug.Assert(
418Debug.Assert(IsUpdatingDisplayIndex == false, "We don't add new columns as part of a display index update operation");
475Debug.Assert(DisplayIndexMap.Count == 0, "DisplayIndexMap should be empty until first measure call.");
548Debug.Assert(assignedDisplayIndexMap.ContainsKey(displayIndex));
559Debug.Assert(
562Debug.Assert(IsUpdatingDisplayIndex == false, "We don't remove columns as part of a display index update operation");
567Debug.Assert(DisplayIndexMap.Count > Count, "Columns were just removed: the display index map shouldn't have yet been updated");
603Debug.Assert(oldColumns.Count == 1 && newColumns.Count == 1, "Multi replace isn't possible with ObservableCollection");
692Debug.Assert(removedDisplayIndex >= 0);
731Debug.Assert(Count == DisplayIndexMap.Count, "Display Index map is of the wrong size");
734Debug.Assert(DisplayIndexMap[i] >= 0 && DisplayIndexMap[i] < Count, "DisplayIndex map entry doesn't point to a valid column");
735Debug.Assert(ColumnFromDisplayIndex(i).DisplayIndex == i, "DisplayIndex map doesn't match column indices");
902Debug.Assert(
System\Windows\Controls\GridViewColumnCollectionChangedEventArgs.cs (12)
48Debug.Assert(action == NotifyCollectionChangedAction.Add || action == NotifyCollectionChangedAction.Remove,
50Debug.Assert(changedItem != null, "changedItem can't be null");
51Debug.Assert(index >= 0, "index must >= 0");
52Debug.Assert(actualIndex >= 0, "actualIndex must >= 0");
63Debug.Assert(newItem != null, "newItem can't be null");
64Debug.Assert(oldItem != null, "oldItem can't be null");
65Debug.Assert(index >= 0, "index must >= 0");
66Debug.Assert(actualIndex >= 0, "actualIndex must >= 0");
77Debug.Assert(changedItem != null, "changedItem can't be null");
78Debug.Assert(index >= 0, "index must >= 0");
79Debug.Assert(oldIndex >= 0, "oldIndex must >= 0");
80Debug.Assert(actualIndex >= 0, "actualIndex must >= 0");
System\Windows\Controls\GridViewHeaderRowPresenter.cs (16)
304Debug.Assert(_paddingHeader != null, "padding header is null");
314Debug.Assert(_indicator != null, "_indicator is null");
315Debug.Assert(_floatingHeader != null, "_floatingHeader is null");
388Debug.Assert(_paddingHeader != null, "padding header is null");
457Debug.Assert(_draggingSrcHeader != null, "_draggingSrcHeader is null");
640Debug.Assert(column != null);
858Debug.Assert(index >= 0 && index < InternalChildren.Count, "Error index when GetVisualIndex");
941Debug.Assert(false, "Head is container for itself, but parent is neither GridViewHeaderRowPresenter nor null.");
991Debug.Assert(header != null || index != -1);
1074Debug.Assert(header != null);
1083Debug.Assert(header != null);
1192Debug.Assert(header != null, "Cannot instantiate GridViewColumnHeader in AddFloatingHeader");
1205Debug.Assert(srcHeader != null, "srcHeader is null");
1206Debug.Assert(_floatingHeader != null, "floating header is null");
1372Debug.Assert(index >= 0 && index < HeadersPositionList.Count, "wrong index");
1565Debug.Assert(Columns != null, "Columns is null in OnHeaderDragCompleted");
System\Windows\Controls\InkCanvas.cs (18)
578Debug.Assert(e.Property == InkCanvas.RightProperty || e.Property == InkCanvas.BottomProperty,
1042Debug.Assert(e != null, "EventArg can not be null");
1261Debug.Assert(e != null, "EventArg can not be null");
1318Debug.Assert(e != null, "EventArg can not be null");
1372Debug.Assert(e != null, "EventArg can not be null");
1406Debug.Assert(e != null, "EventArg can not be null");
1437Debug.Assert(e != null, "EventArg can not be null");
1473Debug.Assert(e != null, "EventArg can not be null");
1549Debug.Assert(e != null, "EventArg can not be null");
1579Debug.Assert(e != null, "EventArg can not be null");
1613Debug.Assert(e != null, "EventArg can not be null");
1643Debug.Assert(e != null, "EventArg can not be null");
2265System.Diagnostics.Debug.Assert(_dynamicallySelectedStrokes.Contains(s));
2336Debug.Assert(strokes != null
2563System.Diagnostics.Debug.Assert(object.ReferenceEquals(sender, DefaultDrawingAttributes));
2663Debug.Assert(removeSelectedStrokes || removeSelectedElements, "At least either Strokes or Elements should be removed!");
2702Debug.Assert(inkCanvas != null);
2775Debug.Assert(inkCanvas != null);
System\Windows\Controls\ItemContainerGenerator.cs (9)
286Debug.Assert(false, "Unexpected reentrant call to ICG.Remove");
332Debug.Assert(!_recyclableContainers.Contains(container), "trying to add a container to the collection twice");
937Debug.Assert(item == null || ItemsControl.EqualsEx(item, target),
2217Debug.Assert(ItemsControl.EqualsEx(rib.ItemAt(rib.ContainerCount - 1),
2283Debug.Assert(!container.HasExpression(entryIndex, dp), "DataContext set by expression (unexpectedly)");
2348Debug.Assert(!container.HasExpression(entryIndex, dp), "DataContext set by expression (unexpectedly)");
2381Debug.Assert(ItemsControl.EqualsEx(item, ItemsInternal[index]), "Event contains the wrong index");
2456Debug.Assert(false, "unexpected reentrant call to OnItemAdded");
2644Debug.Assert(false, "unexpected reentrant call to OnItemMoved");
System\Windows\Controls\Primitives\DataGridCellsPresenter.cs (1)
354Debug.Assert(
System\Windows\Controls\Primitives\DataGridColumnHeadersPresenter.cs (11)
232Debug.Assert(column != null, "We shouldn't have generated this column header if we don't have a column.");
268Debug.Assert(HeaderCollection != null, "This is a helper method for preparing and clearing a container; if it's called we must have a valid ItemSource");
710Debug.Assert(ParentDataGrid != null, "ParentDataGrid is null");
757Debug.Assert(_draggingSrcColumnHeader != null, "Dragging header is null");
769Debug.Assert(_columnHeaderDragIndicator != null, "Drag indicator is null");
770Debug.Assert(_draggingSrcColumnHeader != null, "Dragging header is null");
788Debug.Assert(_draggingSrcColumnHeader != null, "Dragging header is null");
800Debug.Assert(_columnHeaderDropLocationIndicator != null, "Drag indicator is null");
801Debug.Assert(_draggingSrcColumnHeader != null, "Dragging header is null");
818Debug.Assert(ParentDataGrid != null, "ParentDataGrid is null");
934Debug.Assert(ParentDataGrid != null, "ParentDataGrid is null");
System\Windows\Controls\Primitives\Popup.cs (12)
188Debug.Assert(popup != null, "Popup must be non-null");
189Debug.Assert(placementTarget != null, "Placement target must be non-null.");
219Debug.Assert(popup != null, "Popup must be non-null");
220Debug.Assert(placementTarget != null, "Placement target must be non-null.");
896Debug.Assert(!bindTreatMousePlacementAsBottomProperty || child is ToolTip, "child must be a Tooltip to bind TreatMousePlacementAsBottomProperty");
1102Debug.Assert( Mouse.Captured == _popupRoot.Value, "_cacheValid[(int)CacheBits.CaptureEngaged] == true but Mouse.Captured != _popupRoot");
1395Debug.Assert(popup != null, "popup should be non-null.");
1396Debug.Assert(child != null, "child should be non-null.");
1419Debug.Assert(child != null, "child should be non-null");
1933Debug.Assert(CheckAccess(), "AsyncReposition not called on the dispatcher thread.");
2498Debug.Assert(i >= 0 && i < GetNumberOfCombinations(placement));
3308Debug.Assert(!IsChildPopup || (IsChildPopup && !transparent), "Child popups cannot be transparent");
System\Windows\Controls\Primitives\Selector.cs (22)
593Debug.Assert(String.IsNullOrEmpty(path) || path == "/InnerText");
1047Debug.Assert(CanSelectMultiple, "CanSelectMultiple should be true when calling SelectAllImpl");
1435Debug.Assert(!SelectionChange.IsActive, "SelectionChange is already active -- use SelectionChange.Select or Unselect");
1509Debug.Assert(!((SelectedIndex >= 0) && (_selectedItems.Count == 0)), "SelectedIndex >= 0 implies _selectedItems nonempty");
1536Debug.Assert(IsSynchronizedWithCurrentItemPrivate);
1564Debug.Assert(IsSynchronizedWithCurrentItemPrivate);
1607Debug.Assert(SelectionChange.IsActive, "SelectionChange.IsActive should be true");
1689Debug.Assert(SelectionChange.IsActive, "SelectionChange.IsActive should be true");
2051Debug.Assert(SelectionChange.IsActive, "SelectionChange.IsActive should be true");
2183Debug.Assert(String.IsNullOrEmpty(path) || path == "/InnerText");
2282Debug.Assert(_owner.CheckAccess());
2283Debug.Assert(!_active, SR.SelectionChangeActive);
2295Debug.Assert(_owner.CheckAccess());
2296Debug.Assert(_active, "There must be a selection change active when you call SelectionChange.End()");
2330Debug.Assert(_toSelect.Count <= 1, "_toSelect.Count was > 1");
2505Debug.Assert(_owner.CheckAccess());
2506Debug.Assert(_active, SR.SelectionChangeNotActive);
2507Debug.Assert(info != null, "parameter info should not be null");
2562Debug.Assert(_owner.CheckAccess());
2563Debug.Assert(_active, SR.SelectionChangeNotActive);
2564Debug.Assert(info != null, "info should not be null");
2600Debug.Assert(_owner.CheckAccess());
System\Windows\Controls\VirtualizedCellInfoCollection.cs (30)
28Debug.Assert(owner != null, "owner must not be null.");
41Debug.Assert(owner != null, "owner must not be null.");
91Debug.Assert(IsValidCell(cell), "The cell should be valid.");
92Debug.Assert(!Contains(cell), "VirtualizedCellInfoCollection does not support duplicate items.");
475Debug.Assert(left >= 0, "left must be positive.");
476Debug.Assert(top >= 0, "top must be positive.");
477Debug.Assert(width >= 0, "width must be positive.");
478Debug.Assert(height >= 0, "height must be positive.");
495Debug.Assert(value >= 0, "Value must be positive.");
509Debug.Assert(value >= 0, "Value must be positive.");
523Debug.Assert(value >= _left, "Right must be greater than or equal to Left.");
537Debug.Assert(value >= _top, "Bottom must be greater than or equal to Top.");
551Debug.Assert(value >= 0, "Value must be positive.");
565Debug.Assert(value >= 0, "Value must be positive.");
791Debug.Assert(!IsEmpty, "Don't call GetBoundingRegion when IsEmpty is true.");
823Debug.Assert(left <= right, "left should be less than or equal to right.");
824Debug.Assert(top <= bottom, "top should be less than or equal to bottom.");
834Debug.Assert(rowCount > 0, "rowCount should be greater than 0.");
835Debug.Assert(columnCount > 0, "columnCount should be greater than 0.");
979Debug.Assert(rowIndex >= 0);
1007Debug.Assert(rowIndex >= 0);
1046Debug.Assert(rowIndex >= 0);
1062Debug.Assert(oldIndex >= 0);
1063Debug.Assert(newIndex >= 0);
1152Debug.Assert(columnIndex >= 0);
1195Debug.Assert(columnIndex >= 0);
1234Debug.Assert(columnIndex >= 0);
1253Debug.Assert(oldIndex >= 0);
1254Debug.Assert(newIndex >= 0);
1638Debug.Assert(list != null, "list should not be null.");
System\Windows\Controls\VirtualizingStackPanel.cs (78)
407Debug.Assert(!IsPixelBased && IsScrolling &&
484Debug.Assert(IsScrolling, "setting offset on non-scrolling panel");
612Debug.Assert(IsScrolling, "setting offset on non-scrolling panel");
803Debug.Assert(AnchorOperationField.GetValue(this) == null, "There is already a pending AnchorOperation.");
835Debug.Assert(_scrollData._firstContainerInViewport != null, "Must have an anchor element");
861Debug.Assert(AnchorOperationField.GetValue(this) != null, "anchor state is inconsistent");
892Debug.Assert(currFirstContainerInViewport != null, "Cannot find container in viewport");
1147Debug.Assert(!IsPixelBased || !findTopContainer, "find 'top' container only makes sense when item-scrolling");
1714Debug.Assert(IsVirtualizing && InRecyclingMode, "We should only modify the visual order when in recycling mode");
2405Debug.Assert(!adjustToChangeInFirstItem || foundFirstItemInViewport, "This loop should only happen twice at most");
3715Debug.Assert(args.Action == NotifyCollectionChangedAction.Reset && args.ItemCount == 1);
3869Debug.Assert(info != null, "Expected state from previous measure not found");
3977Debug.Assert(IsScrolling && IsVirtualizing, "Only check viewport on scrolling panel when virtualizing");
4378Debug.Assert(retryCount >=0, "retry MeasureCaches too often");
4538Debug.Assert(effectiveOffsetInfo.ScrollGeneration <= scrollGeneration,
4737Debug.Assert(cacheUnit != VirtualizationCacheLengthUnit.Page, "Page cacheUnit is not expected here.");
4993Debug.Assert(IsScrolling, "The scrolling panel is the only one that should extend the viewport");
5051Debug.Assert(virtualizationInfoProvider != null, "This method should only be invoked for a virtualizing owner");
5052Debug.Assert(cacheUnit != VirtualizationCacheLengthUnit.Page, "Page after cache size is not expected here.");
5680Debug.Assert(itemIndex < items.Count, "index out of range");
5780Debug.Assert(IsVirtualizing, "We should only need to extend the viewport beyond the generated items when virtualizing");
6114Debug.Assert(!containerSize.IsEmpty, "We can't estimate an empty size");
6130Debug.Assert(!IsVSP45Compat, "this method should not be called in VSP45Compat mode");
6198Debug.Assert(!containerSize.IsEmpty, "We can't estimate an empty size");
6410Debug.Assert(parentItemStorageProvider != null || container != null,
6453Debug.Assert(!IsVSP45Compat, "SetItemsHostInset should not be called in VSP45-compat mode");
6489Debug.Assert(false, "SetInset should only be called for a container");
6593Debug.Fail($"Unexpected container type: {((container == null) ? "null" : container.GetType().Name)}");
6634Debug.Assert(cacheUnit != VirtualizationCacheLengthUnit.Page, "Page cacheUnit is not expected here.");
6842Debug.Assert(virtualizingChild != null, "This method should only be invoked for a virtualizing child");
7280Debug.Assert(DoubleUtil.AreClose(pixelSizeInViewport + pixelSizeBeforeViewport + pixelSizeAfterViewport, childPixelSize.Width), "The computed sizes within and outside the viewport should add up to the childPixelSize.");
7372Debug.Assert(DoubleUtil.AreClose(pixelSizeInViewport + pixelSizeBeforeViewport + pixelSizeAfterViewport, childPixelSize.Height), "The computed sizes within and outside the viewport should add up to the childPixelSize.");
7467Debug.Assert(IsVSP45Compat, "this method should only be called in VSP45Compat mode");
7473Debug.Assert(evaluateAreContainersUniformlySized || !computedAreContainersUniformlySized, "AreContainersUniformlySized starts off true and can only be flipped to false.");
7619Debug.Assert(!IsVSP45Compat, "this method should not be called in VSP45Compat mode");
7625Debug.Assert(evaluateAreContainersUniformlySized || !computedAreContainersUniformlySized, "AreContainersUniformlySized starts off true and can only be flipped to false.");
7908Debug.Assert(itemStorageProvider != null || item == this, "An item storage provider must be available.");
7909Debug.Assert(item != null, "An item must be available.");
7933Debug.Assert(itemStorageProvider != null || item == this, "An item storage provider must be available.");
7934Debug.Assert(item != null, "An item must be available.");
7977Debug.Assert(itemStorageProvider != null || item == this, "An item storage provider must be available.");
7978Debug.Assert(item != null, "An item must be available.");
8035Debug.Assert(itemStorageProvider != null || item == this, "An item storage provider must be available.");
8036Debug.Assert(item != null, "An item must be available.");
8758Debug.Assert(container != null, "Null container was generated");
8803Debug.Assert(children[visualTreeIndex] != null, "MoveVisualChild interprets a null destination as 'move to end'");
8928Debug.Assert(!children.Contains(child), "we incorrectly identified a recycled container");
8949Debug.Assert(child == InternalChildren[childIndex], "Wrong child was generated");
8971Debug.Assert(args.ItemUICount == args.ItemCount, "Both ItemUICount and ItemCount should be equal or ItemUICount should be 0.");
8981Debug.Assert(child != null, "Null child was generated");
8982Debug.Assert(!newlyRealized, "newlyRealized should be false after Replace");
9011Debug.Assert((itemCount == itemUICount) || (itemUICount == 0), "Both ItemUICount and ItemCount should be equal or ItemUICount should be 0.");
9052Debug.Assert(IsVirtualizing, "Can't clean up containers if not virtualizing");
9053Debug.Assert(itemsControl != null, "We can't cleanup if we aren't the itemshost");
9198Debug.Assert(InRecyclingMode, "This method only applies to recycling mode");
9217Debug.Assert(IsVirtualizing && InRecyclingMode, "Realized children only exist when recycling");
9218Debug.Assert(_realizedChildren != null, "Realized children must exist to verify it");
9231Debug.Assert(!_realizedChildren.Contains(child), "_realizedChildren should not contain recycled containers");
9237Debug.Assert(_realizedChildren[position.Index] == child, "_realizedChildren is corrupt!");
9249Debug.Assert(_realizedChildren.Count == children.Count, "Realized and visual children must match");
9253Debug.Assert(_realizedChildren[i] == children[i], "Realized and visual children must match");
9283Debug.Assert(false, "We should have found a child");
9354Debug.Assert(_cleanupDelay != null);
9375Debug.Assert(_cleanupOperation != null);
9399Debug.Assert(!InRecyclingMode, "This method only applies to standard virtualization");
9464Debug.Assert(startIndex >= 0 && count > 0);
9465Debug.Assert(children == _realizedChildren, "the given child list must be the _realizedChildren list when recycling");
9611Debug.Assert(IsScrolling, "ScrollData must only be set on a scrolling panel.");
9738Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9739Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
9743Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
9744Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10465Debug.Assert(IsScrolling, "ScrollData must only be set on a scrolling panel.");
10590Debug.Assert(DoubleUtil.AreClose(viewportSize.Width - Math.Floor(viewportSize.Width), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10591Debug.Assert(DoubleUtil.AreClose(extentSize.Width - Math.Floor(extentSize.Width), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
10595Debug.Assert(DoubleUtil.AreClose(viewportSize.Height - Math.Floor(viewportSize.Height), 0.0), "The viewport size must not contain fractional values when in item scrolling mode.");
10596Debug.Assert(DoubleUtil.AreClose(extentSize.Height - Math.Floor(extentSize.Height), 0.0), "The extent size must not contain fractional values when in item scrolling mode.");
12239Debug.Assert(tracer != null, "Trace called when not tracing");
System\Windows\Input\KeyboardNavigation.cs (20)
505Debug.Assert(adornedElement != null, "adornedElement should not be null");
506Debug.Assert(focusVisualStyle != null, "focusVisual should not be null");
520Debug.Assert(adornedElement != null, "adornedElement should not be null");
521Debug.Assert(adornedElementParent != null, "adornedElementParent should not be null");
522Debug.Assert(contentHostParent != null, "contentHostParent should not be null");
523Debug.Assert(contentHostParent is Visual, "contentHostParent should be Visual");
524Debug.Assert(focusVisualStyle != null, "focusVisual should not be null");
988Debug.Assert(currentElement != null, "currentElement should not be null");
1349Debug.Assert(container != null, "container cannot be null");
1800Debug.Assert(e != null, "e should not be null");
1801Debug.Assert(container != null, "container should not be null");
1879Debug.Assert(e != null, "e cannot be null");
2093Debug.Assert(container != null, "container should not be null");
2129Debug.Assert(IsTabStopOrGroup(nextTabElement), "nextTabElement should be IsTabStop or group");
2268Debug.Assert(e != null || container != null, "e or container should not be null");
2647Debug.Assert(sourceElement != null, "sourceElement must not be null");
2901Debug.Assert(!(sourceElement == null && container == null), "Both sourceElement and container cannot be null");
2906Debug.Assert(container != null, "container cannot be null");
3118Debug.Assert(DoubleUtil.GreaterThanOrClose(rangeEnd1, rangeStart1));
3119Debug.Assert(DoubleUtil.GreaterThanOrClose(rangeEnd2, rangeStart2));
System\Windows\Interop\ActiveXHost.cs (26)
232Debug.Assert(args.Key.Length > 0, "got an empty access key");
424Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Loaded, "Failed transition");
429Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Running, "Failed transition");
434Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.InPlaceActive, "Failed transition");
439Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.UIActive, "Failed transition");
443Debug.Fail("bad state");
475Debug.Fail("how did we ever get into the open state?");
480Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.InPlaceActive, "Failed transition");
485Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Running, "Failed transition");
490Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Loaded, "Failed transition");
495Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Passive, "Failed transition");
499Debug.Fail("bad state");
523Debug.Assert(hr == NativeMethods.S_OK, $"DoVerb call failed for verb 0x{verb:X}");
566Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Passive, "Wrong start state to transition from");
571Debug.Assert(_axInstance == null, "_axInstance must be null");
574Debug.Assert(_axInstance != null, "w/o an exception being thrown we must have an object...");
589Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Loaded, "Wrong start state to transition from");
623Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Loaded, "Wrong start state to transition from");
648Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Running, "Wrong start state to transition from");
665Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.Running, "Wrong start state to transition from");
692Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.InPlaceActive, "Wrong start state to transition from");
707Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.InPlaceActive, "Wrong start state to transition from");
720Debug.Assert(this.ActiveXState == ActiveXHelper.ActiveXState.UIActive, "Wrong start state to transition from");
724Debug.Assert(NativeMethods.Succeeded(hr), "Failed in IOleInPlaceObject.UiDeactivate");
956Debug.Assert(_axInstance != null, "The native control is null");
1001Debug.Fail(e.ToString());
System\Windows\Markup\BamlRecordReader.cs (46)
107Debug.Assert(null != bamlStream);
108Debug.Assert(null != parserContext && null != parserContext.XamlTypeMapper);
133Debug.Assert(null != parserContext && null != parserContext.XamlTypeMapper);
242Debug.Assert(false == XamlReaderStream.IsWriteComplete,
342Debug.Assert(bamlRecord.RecordType == BamlRecordType.LinePosition);
528Debug.Assert( stackDepth == ReaderContextStack.Count );
544Debug.Assert(bamlConnectionIdRecord.ConnectionId > 0);
556Debug.Assert(0 == ReaderContextStack.Count); // if not zero we missed an EndElement
640Debug.Assert(false);
729Debug.Assert(ReaderFlags.DependencyObject == CurrentContext.ContextType);
811Debug.Assert(ReaderFlags.DependencyObject == CurrentContext.ContextType ||
1016Debug.Assert(_rootElement != null);
1066Debug.Assert(null == ParentContext);
1219Debug.Assert(!CurrentContext.CheckFlag(ReaderFlags.NeedToAddToTree), "Failed to add Element to tree before popping stack");
1233Debug.Assert( CurrentContext.ContextType != ReaderFlags.PropertyComplexClr );
1234Debug.Assert( CurrentContext.ContextType != ReaderFlags.PropertyComplexDP );
1286Debug.Assert(CurrentContext.ContextType == ReaderFlags.ConstructorParams);
1316Debug.Assert(parent is DependencyObject);
1435Debug.Assert(param is String);
1478Debug.Assert(paramString != null);
1516Debug.Assert(param != null && paramList == null, "Must have a single param");
1530Debug.Assert(param == null && paramList != null, "Must have a paramList");
1904Debug.Assert(staticResourceValues != null, "Must have a list of StaticResourceValues for lookup");
1977Debug.Assert(staticResourceValues != null, "Must have a list of StaticResourceValues for lookup");
2114Debug.Assert(serializerTypeId == (short)KnownElements.DependencyPropertyConverter);
2245Debug.Assert(element is DependencyObject, "Guaranteed by PropertyDefinition constructor");
2539Debug.Assert(o is DependencyObject);
2713Debug.Assert( attributeUsage == BamlAttributeUsage.XmlSpace,
2755Debug.Assert(element is DependencyObject);
2994Debug.Assert(!holder.ReadOnly); // this is being checked in XamlReaderHelper, just assert
3019Debug.Assert(arrayExt != null);
3138Debug.Assert (holder.Collection == null);
3458Debug.Assert( CurrentContext.ObjectData == null && CurrentContext.ExpectedType != null,
3643Debug.Assert(null != CurrentContext &&
3703Debug.Assert(false);
3712Debug.Assert(currentTarget is DependencyObject);
3726Debug.Assert(false); // We do not expect to be here after all checks done in propertyType identification above
3788Debug.Assert(genericType != null);
3832Debug.Assert(memberInfo is MethodInfo);
3848Debug.Assert(null != CurrentContext &&
3897Debug.Assert(null != CurrentContext &&
4250Debug.Assert(!context.CreateUsingTypeConverter,
4903Debug.Assert(contentProperty != null);
5008Debug.Assert(false, "The only remaining option is attached property, which is not allowed in xaml for content properties");
5754Debug.Assert(_attributeInfo != null);
5849Debug.Assert(this.AttachedPropertyGetter != null);
System\Windows\Markup\BamlRecords.cs (29)
700Debug.Assert(false,"Assembly, Type and Attribute records are not cached, so don't ask for one.");
725Debug.Assert(false,"Unknown RecordType");
778Debug.Assert(null == _writeCache[(int)record.RecordType]);
868set { Debug.Assert (value == -1, "Setting fixed record to an invalid size"); }
877Debug.Assert(false, "Must override RecordType");
915Debug.Assert( value <= 3 && value >= 0 );
1103Debug.Assert(RecordSize < 0);
1513Debug.Assert(_valuePositionPosition != -1,
1696Debug.Assert(_valuePositionPosition != -1,
2061set { Debug.Assert (value == -1, "Wrong size set for complex prop record"); }
2131set { Debug.Assert (value == -1, "Wrong size set for complex prop record"); }
2192set { Debug.Assert (value == -1, "Wrong size set for complex prop record"); }
2399Debug.Assert(value <= ExtensionIdMask);
2419set { Debug.Assert(value == -1, "Wrong size set for complex prop record"); }
2729Debug.Assert(!ValueObjectSet);
2808Debug.Assert (false, "Unknown custom serializer");
2996set { Debug.Assert (value == -1, "Wrong size set for complex prop record"); }
3210set { Debug.Assert(value == -1, "Wrong size set for element record"); }
3297set { Debug.Assert(value == -1, "Wrong size set for element record"); }
3446Debug.Assert(_contentSizePosition != -1,
3491set { Debug.Assert(value == -1, "Wrong size set for element record"); }
3651set { Debug.Assert(value == -1, "Wrong size set for complex prop record"); }
3749set { Debug.Assert(value == -1, "Wrong size set for complex prop record"); }
3827set { Debug.Assert(value == -1, "Wrong size set for complex prop record"); }
4012Debug.Assert(FilePos != -1,"UpdateWrite called but Write Never was");
4555Debug.Assert( SerializerTypeId != 0 );
4708Debug.Assert((propertyMember is MethodInfo) || (propertyMember is PropertyInfo)
4728Debug.Assert(arr.Length == 3 && arr[0] != null && arr[1] != null);
4771Debug.Assert(arr.Length == 3 && arr[0] != null && arr[1] != null);
System\Windows\Markup\BamlRecordWriter.cs (22)
119Debug.Assert(null != DocumentStartRecord);
137Debug.Assert(null != DocumentStartRecord);
408Debug.Assert(_deferElementDepth == 0);
409Debug.Assert(_deferComplexPropertyDepth == 0);
410Debug.Assert(_staticResourceElementDepth == 0);
411Debug.Assert(_dynamicResourceElementDepth == 0);
412Debug.Assert(_staticResourceRecordList == null);
430Debug.Assert(_staticResourceElementDepth == 0);
467Debug.Assert(!InStaticResourceSection, "We do not support x:Key within a StaticResource Section");
567Debug.Assert(!InStaticResourceSection, "We do not support x:Key within a StaticResource Section");
604Debug.Assert(!InStaticResourceSection, "We do not support x:Shared within a StaticResource Section");
788Debug.Assert(!InStaticResourceSection, "We do not support x:Key within a StaticResource Section");
844Debug.Assert(keyRecord.RecordList.Count == 0, "Should have empty record list");
870Debug.Assert(!InStaticResourceSection, "We do not support x:Key within a StaticResource Section");
881Debug.Assert(_deferElementDepth == 2);
1070Debug.Assert(extensionTypeId != (short)KnownElements.TypeExtension);
1087Debug.Assert(typeValue != null);
1632Debug.Assert(keyRecord != null, "Unknown key record type in defer load dictionary");
1643Debug.Assert(keyIndex == _deferKeys.Count,
1666Debug.Assert(_deferElementDepth > 0 && CollectingValues,
1674Debug.Assert(valueDeferRecord.Record != null &&
1686Debug.Assert(valueDeferRecord.Record != null && valueDeferRecord.Record.RecordType == BamlRecordType.ElementEnd,
System\Windows\Markup\XamlStream.cs (14)
84Debug.Assert(!WriteComplete,"Write called after close");
86Debug.Assert(null != buffer,"Null buffer past to the Writer");
98Debug.Assert(null != writeBuffer,"Null writeBuffer returned");
118Debug.Assert(0 < bufferWriteCount,"Not writing any bytes to the buffer");
123Debug.Assert(bufferOffset < BufferSize,"Trying to Read past bufer");
189Debug.Assert(!WriteComplete,"UpdateReaderLength called after close");
234Debug.Assert(bufferOffset < BufferSize,"Calculated bufferOffset is greater than buffer");
254Debug.Assert(0 < bufferReadCount,"Not reading any bytes to the buffer");
259Debug.Assert(bufferOffset < BufferSize,"Trying ot read past buffer");
382Debug.Assert(bufferOffset < BufferSize,"Calculated bufferOffset is greater than buffer");
387Debug.Assert(bufferArray.Count == bufferIndex,"Need to allocate more than one buffer");
388Debug.Assert(false == reader,"Allocating a buffer on Read");
793Debug.Assert(false,"Close called on ReaderStream");
801Debug.Assert(false,"Flush called on ReaderStream");
System\Windows\Markup\XamlTypeMapper.cs (33)
562Debug.WriteLine($"Reflected for type converter on {propType.Name}.{propName}");
835Debug.Assert(null != attribInfo, "null attribInfo");
836Debug.Assert(null != currentParentType, "null currentParentType");
875Debug.Assert(propertyOwnerType != null);
904Debug.Assert(attachedPropertyInfo.IsPublic ||
954Debug.Assert(null != localName, "null localName");
955Debug.Assert(null != xmlNamespace, "null xmlNamespace");
1602Debug.Assert(null != eventName, "null eventName");
1603Debug.Assert(null != owner, "null owner");
1647Debug.Assert(null != localName, "null localName");
1648Debug.Assert(null != xmlNamespace, "null xmlNamespace");
1685Debug.Assert(null != baseType, "baseType not set");
1778Debug.Assert(null != localName, "null localName");
1779Debug.Assert(null != xmlNamespace, "null xmlNamespace");
1921Debug.Assert(typeInfo != null, "Must have cached type info at this point");
2138Debug.Assert( propertyMember is DependencyProperty);
2319Debug.Assert(memberName != null);
2322Debug.Assert(memberInfo != null);
2337Debug.Assert(targetType != null);
2413Debug.Assert(null != xmlNamespace,"null value passed for xmlNamespace");
2414Debug.Assert(null != localName,"null value passed for localName");
2452Debug.Assert(null != xmlNamespace,"null value passed for xmlNamespace");
2453Debug.Assert(null != localName,"null value passed for localName");
2603Debug.Assert(namespaceMap.ClrNamespace != null,"Null CLR Namespace");
2604Debug.Assert(localName != null,"Null localName");
3451Debug.Assert(null != type, "Null passed for type to GetTypeConverterType");
3482Debug.Assert(null != type, "Null passed for type to GetTypeConverter");
3526Debug.Assert(null != propType, "Null passed for propType to GetPropertyConverterType");
3570Debug.Assert(null != propType, "Null passed for propType to GetPropertyConverter");
3689Debug.Assert(_constructors != null, "This operation is legal only after the constructors have been fetched");
3755Debug.Assert(null != type, "null value for type passed to GetWhitespace");
3767Debug.Assert(1 == trimAttribute.Length,"More than one TrimWhitespace Attribute");
4021Debug.Assert(_dpLookupHashtable != null,
System\Windows\Navigation\NavigationService.cs (46)
95Debug.Assert(_navigateQueueItem == null || _navigateQueueItem.IsPosted == false);
104Debug.Assert(e != null, "Hyperlink fired Navigate event with null NavigateEventArgs");
117Debug.Assert(dobj != null, "RequestNavigateEventArgs.OriginalSource should be DependencyObject");
254Debug.Assert(_bp != null, "NavigationService should not handle a nav from a hyperlink thats not in its hosted tree");
260Debug.Assert(IsConsistent(navInfo));
292Debug.Assert(navMode != NavigationMode.Refresh); // because of !IsSameUri() above
313Debug.Assert(_navStatus == NavigationStatus.Navigating);
461Debug.Assert(!(_bp is Visual));
600Debug.Assert(_parentNavigationService == newParent);
640Debug.Assert(ChildNavigationServices.Contains(ncChild), "Child NavigationService must already exist");
703Debug.Assert(fe != null, "INavigatorHost needs to be FrameworkElement");
879Debug.Assert(_navigateQueueItem == null && _navStatus == NavigationStatus.Navigated);
903Debug.Assert(finishingChildPageFunction == null ||
922Debug.Assert(finishingChildPageFunction._Return == null);
956Debug.Assert(pfReturnInfo == null);
962Debug.Assert(pf.ParentPageFunctionId != Guid.Empty);
1001Debug.Assert(IsConsistent(navInfo));
1026Debug.Assert(!JournalScope.Journal.HasUncommittedNavigation);
1030Debug.Assert(_navigateQueueItem == null);
1145Debug.Assert(bpu == null ||
1175Debug.Assert(navMode == NavigationMode.Refresh,
1193Debug.Assert(!JournalScope.Journal.HasUncommittedNavigation);
1210Debug.Assert(navMode == NavigationMode.Back || navMode == NavigationMode.Forward);
1213Debug.Assert(_contentId != 0);
1217Debug.Assert(_journalEntryGroupState == null ||
1951Debug.Assert(PendingNavigationList.Count == 0,
2061Debug.Assert(this.Application != null &&
2115Debug.Assert(navigateInfo.IsConsistent);
2116Debug.Assert(source == null ||
2166Debug.Assert(PendingNavigationList.Count == 0,
2176Debug.Assert(_navigateQueueItem == null, "Previous nav queue item should be cleared by now.");
2262Debug.Assert(_navStatus == NavigationStatus.Navigated);
2603Debug.Assert(sender == _bp);
3086Debug.Assert(IsConsistent(navigateInfo));
3113Debug.Assert(navigationMode == NavigationMode.New ||
3118Debug.Assert(destinationJournalEntry == null
3197Debug.Assert(_contentId != 0 &&
3703Debug.Assert(ps._Resume); // should've been set by JournalEntryPFxx.ResumePageFunction()
3732Debug.Assert(_navigateQueueItem == null,
3807Debug.Assert(parentPF._Return == null);
3909Debug.Assert(parentEntryIndex < journal.CurrentIndex);
3914Debug.Fail("Could not find the finishing PageFunction in the journal.");
3971Debug.Fail($"Unhandled scenario: PageFunction returning to {parentEntry.GetType().Name}");
4414Debug.Assert(_postedOp == null);
4505Debug.Assert(child != null);
4531Debug.Assert(node != null, "Trying to dispose a null Logical Tree Node");
System\Windows\StyleHelper.cs (99)
67Debug.Assert(fe != null || fce != null);
106Debug.Assert(fe != null || fce != null);
172Debug.Assert((fe != null && fce == null)|| (fe == null && fce != null));
360Debug.Assert(frameworkTemplate != null );
380Debug.Assert( !frameworkTemplate.HasXamlNodeContent );
384Debug.Assert(frameworkTemplate != null);
425Debug.Assert( frameworkTemplate != null );
723Debug.Assert(freezable.IsFrozen, "Freezable within a Style or Template should have been frozen by now");
779Debug.Assert(childIndex >= 0);
1133Debug.Assert(action.IsSealed, "TriggerAction should have already been sealed by this point.");
1287Debug.Assert( childIndex != 0 ); // This should go to the other AddDelegateToFireTrigger overload
1345Debug.Assert((fe != null && fce == null) || (fe == null && fce != null));
1377Debug.Assert((fe != null && fce == null) || (fe == null && fce != null));
1378Debug.Assert((fe != null && fe == container) || (fce != null && fce == container));
1379Debug.Assert(newStyle != null || newFrameworkTemplate != null );
1441Debug.Assert((fe != null && fce == null) || (fe == null && fce != null));
1442Debug.Assert((fe != null && fe == container) || (fce != null && fce == container));
1443Debug.Assert(oldStyle != null || oldFrameworkTemplate != null );
1502Debug.Assert((container is FrameworkElement) || (container is FrameworkContentElement), "Caller has queried with non-framework element. Bad caller, bad!");
1503Debug.Assert(dataType < InstanceStyleData.ArraySize, "Caller has queried using a value outside the range of the Enum. Bad caller, bad!");
1606Debug.Assert(!freezable.CanFreeze, "If a freezable could have been frozen it would have been done by now.");
1633Debug.Assert(instanceValues != null, "InstanceValues hashtable should have been created at initialization time.");
1677Debug.Assert(oldStyle != null || oldFrameworkTemplate != null );
1695Debug.Assert(dataField == ThemeStyleDataField);
1777Debug.Assert(frameworkTemplate != null );
1818Debug.Assert(treeRoot is FrameworkElement || treeRoot is FrameworkContentElement,
1866Debug.Assert(treeRoot == null || treeRoot is FrameworkElement || treeRoot is FrameworkContentElement,
1894Debug.Assert( feContainer._buildVisualTreeVerification == VerificationState.WaitingForBuildVisualTree,
1902Debug.Assert(frameworkTemplate != null, "Only FrameworkTemplate has the ability to build a VisualTree by this means");
1914Debug.Assert( feContainer._buildVisualTreeVerification == VerificationState.WaitingForBuildVisualTreeCompletion,
1919Debug.Assert( feContainer._buildVisualTreeVerification == VerificationState.WaitingForAddCustomTemplateRoot,
1954Debug.Assert( container._buildVisualTreeVerification != VerificationState.WaitingForBuildVisualTreeCompletion,
1956Debug.Assert( container._buildVisualTreeVerification == VerificationState.WaitingForAddCustomTemplateRoot,
1977Debug.Assert( null == VisualTreeHelper.GetParent(child),
2051Debug.Assert(frameworkTemplate != null );
2065Debug.Assert( feWalkNode != null || fceWalkNode != null,
2138Debug.Assert(feContainer != null || fceContainer != null,
2157Debug.Assert(templatedChildren.Count > 0,
2189Debug.Assert(feContainer != null || fceContainer != null);
2224Debug.Assert(oldFrameworkTemplate != null );
2273Debug.Assert( oldFrameworkTemplate != null );
2401Debug.Assert(sender is FrameworkElement || sender is FrameworkContentElement,
2456Debug.Assert(sender is FrameworkElement || sender is FrameworkContentElement,
2487Debug.Assert( feTemplatedParent != null );
2490Debug.Assert(templatedParentTemplate != null, "Must have a VisualTree owner");
2511Debug.Assert(ownerStyle != null || frameworkTemplate != null );
2523Debug.Assert( frameworkTemplate != null );
2535Debug.Assert(action.ContainingTrigger is EventTrigger,
2626Debug.Assert(child.IsValid, "child should either be an FE or an FCE");
2892Debug.Assert(dataField == ThemeStyleDataField);
2978Debug.Assert(value != NotYetApplied, "attempt to retrieve instance value that was never set");
3034Debug.Assert(frameworkTemplate != null );
3048Debug.Assert(frameworkTemplate != null );
3083Debug.Assert(!StyleHelper.IsSetOnContainer(conditions[j].Property, ref containerDependents, true),
3159Debug.Assert(fe != null || fce != null);
3241Debug.Assert(fe != null || fce != null);
3313Debug.Assert(feContainer != null);
3322Debug.Assert(feContainer != null);
3362Debug.Assert(feContainer != null);
3385Debug.Assert(feContainer != null);
3413Debug.Assert(feContainer != null);
3457Debug.Assert(fe != null || fce != null);
3458Debug.Assert(container == fe || container == fce);
3498Debug.Assert(fe != null || fce != null);
3499Debug.Assert(container == fe || container == fce);
3500Debug.Assert( oldTemplate == null || oldTemplate is FrameworkTemplate,
3502Debug.Assert( newTemplate == null || newTemplate is FrameworkTemplate,
3504Debug.Assert( (oldTemplate == null || newTemplate == null ) ||
3908Debug.Assert(sourceType == ValueLookupType.Simple ||
3938Debug.Assert(sourceType == ValueLookupType.Trigger ||
3992Debug.Assert(sourceType == ValueLookupType.Simple ||
4092Debug.Assert(styledChildren != null, "Should reach here only if the template tree has already been created");
4202Debug.Assert(child.FE != null || child.FCE != null);
4221Debug.Assert(dp != null, "dp must not be null");
4311Debug.Assert(ownerStyle != null || frameworkTemplate != null );
4353Debug.Assert(candidateTrigger is List<TriggerBase>,
4382Debug.Assert(ownerStyle != null || frameworkTemplate != null );
4453Debug.Assert( triggerBase is MultiDataTrigger,
4489Debug.Assert( triggerBase is MultiTrigger,
4553Debug.Assert( ft != null );
4832Debug.Assert(!(action.ContainingTrigger is EventTrigger),
4848Debug.Assert( trigger.Property == changedProperty,
4855Debug.Assert( frameworkTemplate != null,
4863Debug.Assert( conditions != null && conditions.Length == 1,
4893Debug.Assert( conditions != null && conditions.Length == 1,
4926Debug.Assert( frameworkTemplate != null,
4937Debug.Assert(evaluationNode != null,
4999Debug.Assert( evaluationBinding != null,
5064Debug.Assert( existing is List<TriggerBase>,
5110Debug.Assert( existing is List<TriggerBase>,
5283Debug.Assert(candidateTrigger is List<TriggerBase>,
5315Debug.Assert(frameworkTemplate != null );
5322Debug.Assert(frameworkTemplate != null);
5346Debug.Assert(frameworkTemplate != null);
5391Debug.Assert(frameworkTemplate != null );
5396Debug.Assert(frameworkTemplate != null);
5449Debug.Assert(
5559Debug.Assert(routedEvent != null);
5815Debug.Assert(false, "GetHashCode for value types will use reflection to generate the hashcode. Write a better hash code generation algorithm if this struct is to be used in a hashtable, or remove this assert if it's decided that reflection is OK.");
System\Windows\TreeWalkHelper.cs (14)
44Debug.Assert(fe != null || fce != null, "Node with the tree change notification must be an FE or an FCE.");
45Debug.Assert(parent != null, "Must have a parent that the current node is connected to or disconnected from.");
246Debug.Assert(fe != null || fce != null, "Must have non-null current node");
269Debug.Assert(inheritableProperty.IsPotentiallyInherited, "if we got here, it means that this property is inheritable by someone");
286Debug.Assert(!currentInheritableProperties.Contains(inheritableProperty), "InheritableProperties list should not have duplicates");
321Debug.Assert(d != null, "Must have non-null current node");
324Debug.Assert(fMetadata.IsInherited == true, "This must be an inherited dependency property");
327Debug.Assert(!wasSelfInheritanceParent || isSelfInheritanceParent, "IsSelfInheritanceParent changed from true to false");
458Debug.Assert(fe != null || fce != null, "Node with the resources change notification must be an FE or an FCE.");
516Debug.Assert(d != null, "Must have non-null current node");
681Debug.Assert(d != null, "Must have non-null current node");
744Debug.Assert(d != null, "Must have non-null current node");
906Debug.Assert(fo.IsValid, "Node with the resources change notification must be an FE or an FCE.");
938Debug.Assert(d != null, "Must have non-null current node");
System\Windows\Window.cs (57)
353Debug.Assert(_threadWindowHandles == null, "_threadWindowHandles must be null before enumerating the thread windows");
670Debug.Assert(false);
1321Debug.Assert( IsSourceWindowNull == false , "IsSourceWindowNull cannot be true when _showingAsDialog is true");
2235Debug.Assert( _swh != null );
2244Debug.Assert( _swh != null );
2929Debug.Assert( IsSourceWindowNull == false , "IsSourceWindowNull cannot be true when calling this function");
3156Debug.Assert(Manager != null, "HwndStyleManager must have a valid value here");
3477Debug.Assert(w != null, "Target must be of type Window.");
3500Debug.Assert(_threadWindowHandles != null, "_threadWindowHandles must not be null at this point");
3523Debug.Assert(_threadWindowHandles != null, "_threadWindowHandles must not be null at this point");
3676Debug.Assert(IsSourceWindowNull == false, "_swh should not be null here");
3793Debug.Assert(hMonitor != IntPtr.Zero);
3826Debug.Assert(workAreaWidthDeviceUnits >= 0, string.Create(CultureInfo.InvariantCulture, $"workAreaWidth ({hMonitor})for monitor ({workAreaWidthDeviceUnits}) is negative"));
3827Debug.Assert(workAreaHeightDeviceUnits >= 0, string.Create(CultureInfo.InvariantCulture, $"workAreaHeight ({hMonitor}) for monitor ({workAreaHeightDeviceUnits}) is negative"));
3837Debug.Assert(IsSourceWindowNull == false, "_swh should not be null here");
3964Debug.Assert(false, "Invalid value for ResizeMode");
4342Debug.Assert(_showingAsDialog == true, "_showingAsDialog must be true when DoDialogHide is called");
4383Debug.Assert(_threadWindowHandles != null, "_threadWindowHandles must not be null at this point");
4424Debug.Assert(ownedWindows.Count == 0, "All owned windows should now be gone");
4985Debug.Assert(w != null, "DependencyObject must be of type Window.");
5011Debug.Assert(w != null, "DependencyObject must be of type Window.");
5030Debug.Assert(w != null, "DependencyObject must be of type Window.");
5090Debug.Assert(w != null, "DependencyObject must be of type Window.");
5217Debug.Assert(w != null, "DependencyObject must be of type Window.");
5237Debug.Assert(w != null, "DependencyObject must be of type Window.");
5498Debug.Assert(_dispatcherFrame == null, "_dispatcherFrame must be null here");
5557Debug.Assert(w != null, "DependencyObject must be of type Window.");
5568Debug.Assert(w != null, "DependencyObject must be of type Window.");
5628Debug.Assert(w != null, "d must be typeof Window");
5651Debug.Assert(w != null, "d must be typeof Window");
5690Debug.Assert(w != null, "d must be typeof Window");
5728Debug.Assert(w != null, "d must be typeof Window");
5749Debug.Assert(w != null, "d must be typeof Window");
5790Debug.Assert(w != null, "d must be typeof Window");
5882Debug.Assert(false, $"specifiedRestoreBounds can't be {specifiedRestoreBounds}");
6016Debug.Assert( w != null, "DependencyObject must be of type Window." );
6091Debug.Assert( w != null, "DependencyObject must be of type Window." );
6148Debug.Assert( IsSourceWindowNull == false , "IsSourceWindowNull cannot be true when calling this function");
6170Debug.Assert( w != null, "DependencyObject must be of type Window." );
6202Debug.Assert(w != null, "DependencyObject must be of type Window.");
6389Debug.Assert(0 != (int)_overlaySize.Width);
6390Debug.Assert(0 != (int)_overlaySize.Height);
6433Debug.Assert(null != _taskbarList);
6459Debug.Assert(false);
6478Debug.Assert(null != _taskbarList);
6492Debug.Assert(0 <= taskbarInfo.ProgressValue && taskbarInfo.ProgressValue <= 1);
6500Debug.Assert(null != _taskbarList);
6525Debug.Assert(null != _taskbarList);
6596Debug.Assert(null != _taskbarList);
6624Debug.Assert(null != _taskbarList);
7070Debug.Assert( _swh != null );
7281Debug.Assert( sourceWindow != null );
7362Debug.Assert(IsSourceWindowNull != true, "IsSourceWindowNull cannot be true here");
7453Debug.Assert( IsSourceWindowNull == false , "Should only be invoked when we know Handle is non-null" );
7463Debug.Assert( IsSourceWindowNull == false , "Should only be invoked when we know Handle is non-null" );
7488Debug.Assert( IsSourceWindowNull == false , "IsSourceWindowNull can't be true here");
7507Debug.Assert( IsSourceWindowNull == false , "IsSourceWindowNull can't be true here");
System\Linq\Parallel\Channels\AsynchronousChannel.cs (21)
118Debug.Assert(chunkSize > 0, "chunk size must be greater than 0");
119Debug.Assert(capacity > 1, "this impl doesn't support capacity of 1 or 0");
258Debug.Assert(_producerChunk != null);
289Debug.Assert(chunk != null);
290Debug.Assert(!_done, "can't continue producing after the production is over");
294Debug.Assert(!IsFull, "expected a non-full buffer");
315Debug.Assert(_consumerEvent != null);
327Debug.Assert(_producerEvent != null);
383Debug.Assert(1 <= _producerChunkIndex && _producerChunkIndex <= _chunkSize);
410Debug.Assert(_consumerChunk == null);
418Debug.Assert(_consumerChunk != null, "consumer chunk is null");
419Debug.Assert(0 <= _consumerChunkIndex && _consumerChunkIndex < _consumerChunk.Length, "chunk index out of bounds");
488Debug.Assert(_consumerChunk == null);
496Debug.Assert(_consumerChunk != null, "consumer chunk is null");
497Debug.Assert(0 <= _consumerChunkIndex && _consumerChunkIndex < _consumerChunk.Length, "chunk index out of bounds");
587Debug.Assert(!IsChunkBufferEmpty, "single-consumer should never witness an empty queue here");
606Debug.Assert(!IsChunkBufferEmpty);
630Debug.Assert(_producerEvent != null);
663Debug.Assert(_done, "Expected channel to be done before disposing");
664Debug.Assert(_producerEvent != null);
665Debug.Assert(_consumerEvent != null);
System\Linq\Parallel\Partitioning\PartitionedDataSource.cs (41)
74Debug.Assert(source != null);
75Debug.Assert(partitionCount > 0);
81Debug.Assert(source != null);
138Debug.Assert(partitions.Length == partitionCount);
161Debug.Assert(source != null);
162Debug.Assert(partitionCount > 0);
238Debug.Assert(data != null, "data mustn't be null");
239Debug.Assert(partitionCount > 0, "partitionCount must be positive");
240Debug.Assert(partitionIndex >= 0, "partitionIndex can't be negative");
241Debug.Assert(partitionIndex < partitionCount, "partitionIndex must be less than partitionCount");
242Debug.Assert(maxChunkSize > 0, "maxChunkSize must be positive or -1");
251Debug.Assert(sectionSize > 0);
277Debug.Assert(mutables != null);
278Debug.Assert(mutables._currentPositionInChunk >= mutables._currentChunkSize);
340Debug.Assert(data != null, "data must not be null");
341Debug.Assert(partitionCount > 0, "partitionCount must be positive");
342Debug.Assert(partitionIndex >= 0, "partitionIndex can't be negative");
343Debug.Assert(partitionIndex < partitionCount, "partitionIndex must be less than partitionCount");
360Debug.Assert(_currentIndex == null, "Expected deferred allocation to ensure it happens on correct thread");
409Debug.Assert(data != null, "data must not be null");
410Debug.Assert(partitionCount > 0, "partitionCount must be positive");
411Debug.Assert(partitionIndex >= 0, "partitionIndex can't be negative");
412Debug.Assert(partitionIndex < partitionCount, "partitionIndex must be less than partitionCount");
413Debug.Assert(maxChunkSize > 0, "maxChunkSize must be positive or -1");
422Debug.Assert(sectionSize > 0);
448Debug.Assert(mutables != null);
449Debug.Assert(mutables._currentPositionInChunk >= mutables._currentChunkSize);
511Debug.Assert(data != null, "data must not be null");
512Debug.Assert(partitionCount > 0, "partitionCount must be positive");
513Debug.Assert(partitionIndex >= 0, "partitionIndex can't be negative");
514Debug.Assert(partitionIndex < partitionCount, "partitionIndex must be less than partitionCount");
531Debug.Assert(_currentIndex == null, "Expected deferred allocation to ensure it happens on correct thread");
595Debug.Assert(source != null);
596Debug.Assert(sourceSyncLock != null);
597Debug.Assert(currentIndex != null);
614Debug.Assert(mutables._chunkBuffer != null);
624Debug.Assert(_source != null);
625Debug.Assert(chunkBuffer != null);
626Debug.Assert(mutables._currentChunkSize > 0);
627Debug.Assert(0 <= currentChunkIndex && currentChunkIndex < chunkBuffer.Length);
641Debug.Assert(0 <= mutables._nextChunkMaxSize && mutables._nextChunkMaxSize <= chunkBuffer.Length);
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (40)
38Debug.Assert(initialBufferSize >= 0);
70Debug.Assert(byteCount >= 0);
71Debug.Assert(byteCount <= ActiveMemory.Length, $"MultiArrayBuffer.Discard: Expected byteCount={byteCount} <= {ActiveMemory.Length}");
112Debug.Assert(toReturn is not null);
120Debug.Assert(byteCount >= 0);
121Debug.Assert(byteCount <= AvailableMemory.Length, $"MultiArrayBuffer.Commit: Expected byteCount={byteCount} <= {AvailableMemory.Length}");
130Debug.Assert(byteCount >= 0);
131Debug.Assert(limit >= 0);
147Debug.Assert(byteCount >= 0);
157Debug.Assert(byteCount > AvailableMemory.Length);
169Debug.Assert(_allocatedEnd == 0);
170Debug.Assert(_activeStart == 0);
171Debug.Assert(_availableStart == 0);
183Debug.Assert(_allocatedEnd % BlockSize == 0);
184Debug.Assert(_allocatedEnd <= _blocks.Length * BlockSize);
220Debug.Assert(_activeStart / BlockSize == 0, $"Start is not in first block after move or resize?? _activeStart={_activeStart}");
225Debug.Assert(_allocatedEnd % BlockSize == 0);
227Debug.Assert(allocatedBlockCount == 0 || _blocks[allocatedBlockCount - 1] is not null);
230Debug.Assert(_blocks[allocatedBlockCount] is null);
237Debug.Assert(byteCount <= AvailableMemory.Length);
247Debug.Assert(_activeStart == 0);
248Debug.Assert(_availableStart == 0);
249Debug.Assert(_allocatedEnd == 0);
253Debug.Assert(_activeStart <= _availableStart);
254Debug.Assert(_availableStart <= _allocatedEnd);
255Debug.Assert(_allocatedEnd <= _blocks.Length * BlockSize);
257Debug.Assert(_allocatedEnd % BlockSize == 0, $"_allocatedEnd={_allocatedEnd} not at block boundary?");
264Debug.Assert(_blocks[i] is null);
269Debug.Assert(_blocks[i] is not null);
274Debug.Assert(_blocks[i] is null);
279Debug.Assert(_activeStart == 0, $"No active bytes but _activeStart={_activeStart}");
307Debug.Assert(blocks is not null);
308Debug.Assert(start <= int.MaxValue);
309Debug.Assert(length <= int.MaxValue);
310Debug.Assert(start + length <= blocks.Length * BlockSize);
349Debug.Assert(_length > 0, "Length should never be 0 here because BlockCount would be 0");
350Debug.Assert(_blocks is not null);
355Debug.Assert(0 <= startInBlock, $"Invalid startInBlock={startInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
356Debug.Assert(startInBlock < endInBlock, $"Invalid startInBlock={startInBlock}, endInBlock={endInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
357Debug.Assert(endInBlock <= BlockSize, $"Invalid endInBlock={endInBlock}. blockIndex={blockIndex}, _blocks.Length={_blocks.Length}, _start={_start}, _length={_length}");
System\Net\Http\Headers\HttpHeaders.cs (66)
68Debug.Assert((allowedHeaderTypes & treatAsCustomHeaderTypes) == 0);
92Debug.Assert(!Contains(descriptor));
124Debug.Assert(!Contains(descriptor));
154Debug.Assert(currentValue is string);
179Debug.Assert(storeValueRef is not null);
184Debug.Assert(value is string);
251Debug.Assert(singleValue is not null ^ multiValue is not null);
263Debug.Assert(multiValue is not null && multiValue.Length > 0);
283Debug.Assert(singleValue is not null ^ multiValue is not null);
307Debug.Assert(_count != 0 && entries is not null, "Caller should have validated the collection is not empty");
327Debug.Assert(Contains(entry.Key));
352Debug.Assert(value != null);
353Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available.");
359Debug.Assert(descriptor.Parser.SupportsMultipleValues, $"Header '{descriptor.Name}' doesn't support multiple values");
366Debug.Assert(value != null);
367Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available.");
395Debug.Assert(value != null);
401Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available.");
402Debug.Assert(descriptor.Parser.SupportsMultipleValues,
420Debug.Assert(parsedValue.GetType() == value.GetType(),
436Debug.Assert(item.GetType() == value.GetType(),
462Debug.Assert(headerRemoved, $"Existing header '{descriptor.Name}' couldn't be removed.");
473Debug.Assert(value != null);
479Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available.");
480Debug.Assert(descriptor.Parser.SupportsMultipleValues,
498Debug.Assert(parsedValue.GetType() == value.GetType(),
510Debug.Assert(item.GetType() == value.GetType(),
529Debug.Assert(sourceHeaders != null);
530Debug.Assert(GetType() == sourceHeaders.GetType(), "Can only copy headers from an instance of the same type.");
569Debug.Assert(sourceValue is string);
621Debug.Assert(source is not InvalidValue);
667Debug.Assert(!Contains(descriptor));
673Debug.Assert((descriptor.HeaderType & _treatAsCustomHeaderTypes) == 0);
707Debug.Assert(value is string);
725Debug.Assert(!info.IsEmpty);
738Debug.Assert(rawValue is not null);
743Debug.Assert(info.ParsedAndInvalidValues is not null);
751Debug.Assert(Monitor.IsEntered(info));
790Debug.Assert(!Contains(descriptor));
800Debug.Assert(info != null);
801Debug.Assert(descriptor.Parser != null);
833Debug.Assert(index < value.Length, "Parser must return an index value within the string length.");
876Debug.Assert(value != null);
886Debug.Assert(!(value is List<object>),
919Debug.Assert(currentStoreValue is T);
923Debug.Assert(value is T);
967Debug.Assert(info != null);
1001Debug.Assert(index < value.Length, "Parser must return an index value within the string length.");
1091Debug.Assert(singleValue is not null ^ multiValue is not null);
1100Debug.Assert(sourceValues is string);
1119Debug.Assert(length > 1, "The header should have been removed when it became empty");
1127Debug.Assert(currentIndex == length);
1138Debug.Assert(sourceValues is string);
1152Debug.Assert(length > 0);
1162Debug.Assert(currentIndex == length);
1170Debug.Assert(info != null);
1171Debug.Assert(Monitor.IsEntered(info));
1196Debug.Assert(item != null);
1206Debug.Assert(value != null);
1223Debug.Assert(value is not null);
1239Debug.Assert(parser != null, "There should be no reason to call CanAddValue if there is no parser for the current header.");
1262Debug.Assert(item is not InvalidValue);
1267Debug.Assert(ParsedAndInvalidValues is not InvalidValue);
1311Debug.Assert(count == 1, "Only a single parsed value should be stored for this parser");
1452Debug.Assert(dictionary.Count == _count - 1);
1470Debug.Assert(!Contains(entry.Key));
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (71)
80Debug.Assert(pool != null);
81Debug.Assert(stream != null);
158Debug.Assert(_readAheadTaskStatus == ReadAheadTask_NotStarted);
206Debug.Assert(_readAheadTask == default);
217Debug.Assert(_readAheadTask == default);
218Debug.Assert(_readBuffer.ActiveLength == 0);
269Debug.Assert(bytesToConsume <= _readBuffer.ActiveLength);
275Debug.Assert(request.RequestUri is not null);
296Debug.Assert(request.RequestUri.Scheme == Uri.UriSchemeHttp);
305Debug.Assert(request.Version.Major >= 0 && request.Version.Minor >= 0); // guaranteed by Version class
315Debug.Assert(Kind != HttpConnectionKind.Proxy);
320Debug.Assert(Kind == HttpConnectionKind.Proxy);
375Debug.Assert(success);
383Debug.Assert(_currentRequest is not null);
401Debug.Assert(headerValuesCount > 0, "No values for header??");
455Debug.Assert(Ascii.IsValid(s));
460Debug.Assert(status == OperationStatus.Done);
461Debug.Assert(bytesWritten == s.Length);
480Debug.Assert(status == OperationStatus.Done);
481Debug.Assert(bytesWritten == s.Length);
498Debug.Assert(_currentRequest == null, $"Expected null {nameof(_currentRequest)}.");
499Debug.Assert(_readBuffer.ActiveLength == 0, "Unexpected data in read buffer");
500Debug.Assert(_readAheadTaskStatus != ReadAheadTask_Started);
563Debug.Assert(_readBuffer.ActiveLength == 0);
572Debug.Assert(_readAheadTask != default);
573Debug.Assert(_readAheadTaskStatus == ReadAheadTask_CompletionReserved);
818Debug.Assert(_readAheadTaskStatus == ReadAheadTask_CompletionReserved);
906Debug.Assert(request.Content is not null);
932Debug.Assert(stream.BytesWritten == 0);
1105Debug.Assert(_allowedReadLineBytes >= 0);
1282Debug.Assert(added);
1336Debug.Assert(source.Length <= _writeBuffer.AvailableLength);
1494Debug.Assert(formatted);
1500Debug.Assert(_writeBuffer.Capacity >= 8);
1586Debug.Assert(!ReadAheadTaskHasStarted);
1587Debug.Assert(_readBuffer.AvailableLength == _readBuffer.Capacity);
1588Debug.Assert(_readBuffer.AvailableLength >= InitialReadBufferSize);
1602Debug.Assert(_readAheadTask == default);
1642Debug.Assert(_readBuffer.ActiveStartOffset == 0);
1643Debug.Assert(_readBuffer.ActiveLength > searchOffset);
1656Debug.Assert(searchOffset == readLength - 1 && _readBuffer.ActiveReadOnlySpan[searchOffset] == '\n');
1673Debug.Assert(buffer.Length > 0);
1729Debug.Assert(_readAheadTask == default, "Read ahead task should have been consumed as part of the headers.");
1747Debug.Assert(_readAheadTask == default, "Read ahead task should have been consumed as part of the headers.");
1768Debug.Assert(_readAheadTask == default, "Read ahead task should have been consumed as part of the headers.");
1775Debug.Assert(_readBuffer.AvailableLength == _readBuffer.Capacity);
1806Debug.Assert(_readAheadTask == default, "Read ahead task should have been consumed as part of the headers.");
1808Debug.Assert(_readBuffer.AvailableLength == _readBuffer.Capacity);
1821Debug.Assert(count <= _readBuffer.ActiveLength);
1841Debug.Assert(destination != null);
1860Debug.Assert(remaining > 0);
1877Debug.Assert(destination != null);
1878Debug.Assert(length > 0);
1896Debug.Assert(_readBuffer.ActiveLength == 0, "HttpConnection's buffer should have been empty.");
1946Debug.Assert(origReadBuffer.Length > 0);
1967Debug.Assert(_currentRequest == null);
1968Debug.Assert(!_inUse);
1975Debug.Assert(_inUse);
1993Debug.Assert(_inUse);
2000Debug.Assert(_currentRequest != null, "Expected the connection to be associated with a request.");
2001Debug.Assert(_writeBuffer.ActiveLength == 0, "Everything in write buffer should have been flushed.");
2031Debug.Assert(_inUse);
2038Debug.Assert(response.Content != null);
2042Debug.Assert(responseStream != null || stream is EmptyReadStream);
2046Debug.Assert(response.RequestMessage == _currentRequest);
2055Debug.Assert(_currentRequest == null);
2062Debug.Assert(_currentRequest == null, "Connection should no longer be associated with a request.");
2063Debug.Assert(_readAheadTask == default, "Expected a previous initial read to already be consumed.");
2064Debug.Assert(_readAheadTaskStatus == ReadAheadTask_NotStarted, "Expected SendAsync to reset the read-ahead task status.");
2065Debug.Assert(_readBuffer.ActiveLength == 0, "Unexpected data in connection read buffer.");
2082Debug.Assert(!_detachedFromPool, "Should not be detached from pool unless _connectionClose is true");
src\coreclr\nativeaot\Runtime.Base\src\System\Runtime\ExceptionHandling.cs (14)
203Debug.Assert(false, "Unhandled exceptions should be processed by the native runtime only");
655Debug.Assert(isValid, "Unwind and intercept failed unexpectedly");
673Debug.Assert(false);
699Debug.Assert(false, "unreachable");
727Debug.Assert(exInfo._passNumber == 1, "expected asm throw routine to set the pass");
751Debug.Assert(isValid, "RhThrowEx called with an unexpected context");
838Debug.Assert(pCatchHandler != null || pReversePInvokePropagationCallback != IntPtr.Zero || unwoundReversePInvoke || isExceptionIntercepted, "We should have a handler if we're starting the second pass");
839Debug.Assert(!isExceptionIntercepted || (pCatchHandler == null), "No catch handler should be returned for intercepted exceptions in the first pass");
863Debug.Assert(isValid, "second-pass EH unwind failed unexpectedly");
878Debug.Assert(frameIter.SP == handlingFrameSP, "Encountered a different reverse P/Invoke frame in the second pass.");
931Debug.Assert(false, "unreachable");
938Debug.Assert(ip != null, "IP address must not be null");
944Debug.Assert(handlingFrameSP != MaxSP, "Handling frame must have an SP value");
945Debug.Assert(((UIntPtr*)handlingFrameSP) > &handlingFrameSP,
src\libraries\Common\src\System\Collections\Concurrent\SingleProducerSingleConsumerQueue.cs (13)
67Debug.Assert(InitialSegmentSize > 0, "Initial segment size must be > 0.");
68Debug.Assert((InitialSegmentSize & (InitialSegmentSize - 1)) == 0, "Initial segment size must be a power of 2");
69Debug.Assert(InitialSegmentSize <= MaxSegmentSize, "Initial segment size should be <= maximum.");
70Debug.Assert(MaxSegmentSize < int.MaxValue / 2, "Max segment size * 2 must be < int.MaxValue, or else overflow could occur.");
102Debug.Assert(segment != null, "Expected a non-null segment.");
112Debug.Assert(newSegmentSize > 0, "The max size should always be small enough that we don't overflow.");
179Debug.Assert(segment != null, "Expected a non-null segment.");
180Debug.Assert(array != null, "Expected a non-null item array.");
253Debug.Assert(segment != null, "Expected a non-null segment.");
254Debug.Assert(array != null, "Expected a non-null item array.");
368Debug.Assert(syncObj != null, "The syncObj parameter is null.");
390Debug.Assert((size & (size - 1)) == 0, "Size must be a power of 2");
429Debug.Assert(queue != null, "Expected a non-null queue.");
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Dictionary.cs (34)
129Debug.Assert(source._entries is not null);
130Debug.Assert(_entries is not null);
131Debug.Assert(_entries.Length >= source.Count);
132Debug.Assert(_count == 0);
199Debug.Assert(_comparer is not null, "The comparer should never be null for a reference type.");
244Debug.Assert(modified);
251Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown.
285Debug.Assert(_buckets != null, "_buckets should be non-null");
286Debug.Assert(_entries != null, "_entries should be non-null");
407Debug.Assert(_entries != null, "expected entries to be != null");
444Debug.Assert(comparer is not null);
519Debug.Assert(_buckets != null);
522Debug.Assert(entries != null, "expected entries to be non-null");
525Debug.Assert(comparer is not null || typeof(TKey).IsValueType);
567Debug.Assert(comparer is not null);
602Debug.Assert((StartOfFreeList - entries[_freeList].next) >= -1, "shouldn't overflow because `next` cannot underflow");
660Debug.Assert(dictionary._buckets != null);
663Debug.Assert(entries != null, "expected entries to be non-null");
666Debug.Assert(comparer is not null || typeof(TKey).IsValueType);
699Debug.Assert(comparer is not null);
725Debug.Assert((StartOfFreeList - entries[dictionary._freeList].next) >= -1, "shouldn't overflow because `next` cannot underflow");
764Debug.Assert(!Unsafe.IsNullRef(ref value), "the lookup result cannot be a null ref here");
826Debug.Assert(!forceNewHashCodes || !typeof(TKey).IsValueType);
827Debug.Assert(_entries != null, "_entries should be non-null");
828Debug.Assert(newSize >= _entries.Length);
837Debug.Assert(_comparer is NonRandomizedStringEqualityComparer);
880Debug.Assert(_entries != null, "entries should be non-null");
884Debug.Assert(typeof(TKey).IsValueType || comparer is not null);
907Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
953Debug.Assert(_entries != null, "entries should be non-null");
957Debug.Assert(typeof(TKey).IsValueType || comparer is not null);
982Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
1178Debug.Assert(oldEntries is not null);
1185Debug.Assert(_entries is not null);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\HashSet.cs (20)
184Debug.Assert(Count == source.Count);
199Debug.Assert(_buckets != null, "_buckets should be non-null");
200Debug.Assert(_entries != null, "_entries should be non-null");
222Debug.Assert(entries != null, "Expected _entries to be initialized");
252Debug.Assert(comparer is not null);
294Debug.Assert(entries != null, "entries should be non-null");
300Debug.Assert(typeof(T).IsValueType || comparer is not null);
324Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
927Debug.Assert(_comparer is not null, "The comparer should never be null for a reference type.");
966Debug.Assert(!forceNewHashCodes || !typeof(T).IsValueType);
967Debug.Assert(_entries != null, "_entries should be non-null");
968Debug.Assert(newSize >= _entries.Length);
977Debug.Assert(_comparer is NonRandomizedStringEqualityComparer);
1094Debug.Assert(_buckets != null);
1097Debug.Assert(entries != null, "expected entries to be non-null");
1133Debug.Assert(comparer is not null);
1161Debug.Assert((StartOfFreeList - entries![_freeList].Next) >= -1, "shouldn't overflow because `next` cannot underflow");
1194Debug.Assert(location >= 0);
1252Debug.Assert(_buckets != null, "_buckets shouldn't be null; callers should check first");
1410Debug.Assert((_buckets != null) && (_count > 0), "_buckets was null but count greater than 0");
src\libraries\System.Private.CoreLib\src\System\Globalization\CharUnicodeInfo.cs (10)
56Debug.Assert(s != null, "s != null");
57Debug.Assert(index >= 0 && index < s.Length, "index < s.Length");
89Debug.Assert(bidiCategory == StrongBidiCategory.Other || bidiCategory == StrongBidiCategory.StrongLeftToRight || bidiCategory == StrongBidiCategory.StrongRightToLeft, "Unknown StrongBidiCategory value.");
365Debug.Assert(value != null, "value can not be null");
366Debug.Assert(index < value.Length, "index < value.Length");
377Debug.Assert(str != null, "str can not be null");
378Debug.Assert(str.Length > 0, "str.Length > 0");
379Debug.Assert(index >= 0 && index < str.Length, "index >= 0 && index < str.Length");
411Debug.Assert(s != null, "s != null");
412Debug.Assert((uint)index < (uint)s.Length, "index < s.Length");
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.cs (20)
917Debug.Assert(_sRealName != null, "[CultureData.CultureName] Expected _sRealName to be populated by already");
1104Debug.Assert(_sSpecificCulture != null, "[CultureData.SpecificCultureName] Expected this.sSpecificCulture to be populated by culture data initialization already");
1683Debug.Assert(_sWindowsName != null, "[CultureData.CalendarIds] Expected _sWindowsName to be populated by already");
1751Debug.Assert(calendarId > 0 && calendarId <= CalendarId.LAST_CALENDAR,
1767Debug.Assert(_sWindowsName != null, "[CultureData.GetCalendar] Expected _sWindowsName to be populated by already");
1796Debug.Assert(_sRealName != null, "[CultureData.IsRightToLeft] Expected _sRealName to be populated by already");
1820Debug.Assert(_sRealName != null, "[CultureData.TextInfoName] Expected _sRealName to be populated by already");
1832Debug.Assert(_sRealName != null, "[CultureData.SortName] Expected _sRealName to be populated by already");
1905Debug.Assert(_sRealName != null, "[CultureData.LCID] Expected this.sRealName to be populated already");
1948Debug.Assert(calendarId > 0, "[CultureData.saEraNames] Expected Calendar.ID > 0");
1954Debug.Assert(calendarId > 0, "[CultureData.saAbbrevEraNames] Expected Calendar.ID > 0");
1960Debug.Assert(calendarId > 0, "[CultureData.saAbbrevEraNames] Expected Calendar.ID > 0");
2042Debug.Assert(str != null);
2043Debug.Assert(start >= 0);
2044Debug.Assert(end >= 0);
2129Debug.Assert(startIndex >= 0, "startIndex cannot be negative");
2130Debug.Assert(!timeParts.AsSpan().ContainsAny('\'', '\\'), "timeParts cannot include quote characters");
2224Debug.Assert(index >= 10, $"Couldn't read native digits for '{_sWindowsName}' successfully.");
2250Debug.Assert(_sWindowsName != null, "[CultureData.GetNFIValues] Expected _sWindowsName to be populated by already");
2270Debug.Assert(_sRealName != null);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormatInfo.cs (51)
172Debug.Assert(abbreviatedDayNames.Length == 7, "[DateTimeFormatInfo.GetAbbreviatedDayOfWeekNames] Expected 7 day names in a week");
186Debug.Assert(m_superShortDayNames.Length == 7, "[DateTimeFormatInfo.InternalGetSuperShortDayNames] Expected 7 day names in a week");
200Debug.Assert(dayNames.Length == 7, "[DateTimeFormatInfo.GetDayOfWeekNames] Expected 7 day names in a week");
214Debug.Assert(abbreviatedMonthNames.Length == 12 || abbreviatedMonthNames.Length == 13,
229Debug.Assert(monthNames.Length == 12 || monthNames.Length == 13,
243Debug.Assert(cultureData != null);
244Debug.Assert(cal != null);
254Debug.Assert(cultureData != null);
255Debug.Assert(calendarId != CalendarId.UNINITIALIZED_VALUE, "[DateTimeFormatInfo.Populate] Expected initialized calendarId");
272Debug.Assert(allLongTimePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some long time patterns");
275Debug.Assert(allShortTimePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some short time patterns");
278Debug.Assert(allLongDatePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some long date patterns");
281Debug.Assert(allShortDatePatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some short date patterns");
284Debug.Assert(allYearMonthPatterns.Length > 0, "[DateTimeFormatInfo.Populate] Expected some year month patterns");
340Debug.Assert(amDesignator != null, "DateTimeFormatInfo.AMDesignator, amDesignator != null");
359Debug.Assert(typeof(TChar) == typeof(char) || typeof(TChar) == typeof(byte));
369Debug.Assert(calendar != null, "DateTimeFormatInfo.Calendar: calendar != null");
573Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.AbbreviatedEnglishEraNames] Expected Calendar.ID > 0");
589Debug.Assert(dateSeparator != null, "DateTimeFormatInfo.DateSeparator, dateSeparator != null");
608Debug.Assert(typeof(TChar) == typeof(char) || typeof(TChar) == typeof(byte));
622Debug.Assert(firstDayOfWeek != -1, "DateTimeFormatInfo.FirstDayOfWeek, firstDayOfWeek != -1");
654Debug.Assert(calendarWeekRule != -1, "DateTimeFormatInfo.CalendarWeekRule, calendarWeekRule != -1");
768Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.MonthDayPattern] Expected calID > 0");
772Debug.Assert(monthDayPattern != null, "DateTimeFormatInfo.MonthDayPattern, monthDayPattern != null");
792Debug.Assert(pmDesignator != null, "DateTimeFormatInfo.PMDesignator, pmDesignator != null");
811Debug.Assert(typeof(TChar) == typeof(char) || typeof(TChar) == typeof(byte));
974Debug.Assert(timeSeparator != null, "DateTimeFormatInfo.TimeSeparator, timeSeparator != null");
993Debug.Assert(typeof(TChar) == typeof(char) || typeof(TChar) == typeof(byte));
1037Debug.Assert(values != null, "value != null");
1038Debug.Assert(values.Length >= length);
1196Debug.Assert(m_genitiveAbbreviatedMonthNames.Length == 13,
1206Debug.Assert(genitiveMonthNames.Length == 13,
1222Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.InternalGetLeapYearMonthNames] Expected Calendar.ID > 0");
1224Debug.Assert(leapYearMonthNames.Length == 13,
1263Debug.Assert(patterns1 != null);
1264Debug.Assert(patterns2 != null);
1405Debug.Assert(patterns != null && patterns.Length > 0,
1407Debug.Assert(defaultPattern != null,
1483Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.UnclonedYearMonthPatterns] Expected Calendar.ID > 0");
1485Debug.Assert(allYearMonthPatterns.Length > 0,
1504Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.UnclonedShortDatePatterns] Expected Calendar.ID > 0");
1506Debug.Assert(allShortDatePatterns.Length > 0,
1525Debug.Assert(Calendar.ID > 0, "[DateTimeFormatInfo.UnclonedLongDatePatterns] Expected Calendar.ID > 0");
1527Debug.Assert(allLongDatePatterns.Length > 0,
1547Debug.Assert(allShortTimePatterns.Length > 0,
1567Debug.Assert(allLongTimePatterns.Length > 0,
1732Debug.Assert(typeof(TChar) == typeof(char) || typeof(TChar) == typeof(byte));
2296Debug.Assert(state == HebrewNumberParsingState.ContinueParsing || state == HebrewNumberParsingState.FoundEndOfHebrewNumber,
2345Debug.Assert(str.Index < str.Value.Length, "DateTimeFormatInfo.Tokenize(): start < value.Length");
2463Debug.Fail("The hashtable is full. This should not happen.");
2547Debug.Fail("The hashtable is full. This should not happen.");
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (23)
97Debug.Assert(dtfi != null, "dtfi == null");
190Debug.Assert(dtfi != null, "dtfi == null");
553Debug.Assert(hourOffset >= 0 && hourOffset <= 99, "hourOffset >= 0 && hourOffset <= 99");
554Debug.Assert(minuteOffset >= 0 && minuteOffset <= 99, "minuteOffset >= 0 && minuteOffset <= 99");
1054Debug.Fail("Should never be reached");
1076Debug.Fail("Should never be reached");
2069Debug.Assert(raw.numCount >= 2, "raw.numCount >= 2");
2091Debug.Assert(raw.numCount >= 3, "raw.numCount >= 3");
2513Debug.Assert(dtfi != null, "dtfi == null");
2809Debug.Assert(result.parsedDate.Kind == DateTimeKind.Unspecified, "result.parsedDate.Kind == DateTimeKind.Unspecified");
3145Debug.Assert(minDigitLen > 0, "minDigitLen > 0");
3146Debug.Assert(maxDigitLen < 9, "maxDigitLen < 9");
3147Debug.Assert(minDigitLen <= maxDigitLen, "minDigitLen <= maxDigitLen");
3182Debug.Assert(maxDigitLen <= DateTimeFormat.MaxSecondsFractionDigits);
5211Debug.Fail("Unknown DateTimeParseFailure: " + result.failure.ToString());
5390Debug.Assert(dtfi != null, "Expected non-null DateTimeFormatInfo");
5429Debug.Assert(Index + count <= Length, "__DTString::Advance: Index + count <= len");
5756Debug.Assert(Index >= 0 && Index < Length, "Index >= 0 && Index < len");
5765Debug.Assert(Index >= 0 && Index < Length, "Index >= 0 && Index < len");
5766Debug.Assert(char.IsAsciiDigit(Value[Index]), "IsDigit(Value[Index])");
5918Debug.Assert(number >= 0 && number <= 9, "number >= 0 && number <= 9");
5940Debug.Assert(sub.index == Index, "sub.index == Index");
5941Debug.Assert(sub.index + sub.length <= Length, "sub.index + sub.length <= len");
src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.cs (13)
157Debug.Assert(inputLength > 0);
201Debug.Assert(count >= 1, "[IdnMapping.GetAscii] Expected 0 length strings to fail before now.");
372Debug.Assert(!char.IsLowSurrogate(unicode, basicCount), "[IdnMapping.punycode_encode]Unexpected low surrogate");
449Debug.Assert(delta > 0, "[IdnMapping.cs]1 punycode_encode - delta overflowed int");
463Debug.Assert(delta > 0, "[IdnMapping.cs]2 punycode_encode - delta overflowed int");
474Debug.Assert(c_punycodeBase != t, "[IdnMapping.punycode_encode]Expected c_punycodeBase (36) to be != t");
493Debug.Assert(delta > 0, "[IdnMapping.cs]3 punycode_encode - delta overflowed int");
693Debug.Assert(w > 0, "[IdnMapping.punycode_decode]Expected w > 0");
701Debug.Assert(c_punycodeBase != t, "[IdnMapping.punycode_decode]Expected t != c_punycodeBase (36)");
711Debug.Assert((output.Length - iOutputAfterLastDot - numSurrogatePairs) + 1 > 0,
835Debug.Assert(numpoints != 0, "[IdnMapping.adapt]Expected non-zero numpoints.");
843Debug.Assert(delta + c_skew != 0, "[IdnMapping.adapt]Expected non-zero delta+skew.");
868Debug.Assert(d >= 0 && d < c_punycodeBase, "[IdnMapping.encode_digit]Expected 0 <= d < punycodeBase");
src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanFormat.cs (27)
53Debug.Assert(typeof(TChar) == typeof(char) || typeof(TChar) == typeof(byte));
111Debug.Assert(format == StandardFormat.C || format == StandardFormat.G || format == StandardFormat.g);
127Debug.Assert(ticks == long.MinValue /* -9223372036854775808 */);
144Debug.Assert(fraction < 10_000_000);
152Debug.Assert(decimalSeparator.IsEmpty);
167Debug.Assert(format == StandardFormat.g);
182Debug.Assert(seconds < 60);
190Debug.Assert(minutes < 60);
194Debug.Assert(totalHoursRemaining <= uint.MaxValue);
201Debug.Assert(hours < 24);
216Debug.Assert(dayDigits <= 8);
251Debug.Assert(hourDigits == 1 || hourDigits == 2);
289Debug.Assert(p - dest == requiredOutputLength);
299Debug.Assert(dtfi != null);
522Debug.Assert(field >= 0 && field <= 5);
539Debug.Fail("Unexpected special token '%', Bug in DateTimeFormatInfo.FullTimeSpan[Positive|Negative]Pattern");
551Debug.Assert((field == 0 && sb.Length == 0) || field == 1, "field == 0 || field == 1, Bug in DateTimeFormatInfo.FullTimeSpan[Positive|Negative]Pattern");
559Debug.Assert((field == 1 && sb.Length == 0) || field == 2, "field == 1 || field == 2, Bug in DateTimeFormatInfo.FullTimeSpan[Positive|Negative]Pattern");
567Debug.Assert((field == 2 && sb.Length == 0) || field == 3, "field == 2 || field == 3, Bug in DateTimeFormatInfo.FullTimeSpan[Positive|Negative]Pattern");
575Debug.Assert((field == 3 && sb.Length == 0) || field == 4, "field == 3 || field == 4, Bug in DateTimeFormatInfo.FullTimeSpan[Positive|Negative]Pattern");
584Debug.Assert((field == 4 && sb.Length == 0) || field == 5, "field == 4 || field == 5, Bug in DateTimeFormatInfo.FullTimeSpan[Positive|Negative]Pattern");
597Debug.Assert(field == 5);
600Debug.Assert(0 < dd && dd < 3, "0 < dd && dd < 3, Bug in System.Globalization.DateTimeFormatInfo.FullTimeSpan[Positive|Negative]Pattern");
601Debug.Assert(0 < hh && hh < 3, "0 < hh && hh < 3, Bug in System.Globalization.DateTimeFormatInfo.FullTimeSpan[Positive|Negative]Pattern");
602Debug.Assert(0 < mm && mm < 3, "0 < mm && mm < 3, Bug in System.Globalization.DateTimeFormatInfo.FullTimeSpan[Positive|Negative]Pattern");
603Debug.Assert(0 < ss && ss < 3, "0 < ss && ss < 3, Bug in System.Globalization.DateTimeFormatInfo.FullTimeSpan[Positive|Negative]Pattern");
604Debug.Assert(0 < ff && ff < 8, "0 < ff && ff < 8, Bug in System.Globalization.DateTimeFormatInfo.FullTimeSpan[Positive|Negative]Pattern");
src\libraries\System.Private.CoreLib\src\System\IO\BufferedStream.cs (83)
92Debug.Assert(_stream != null);
100Debug.Assert(_stream != null);
108Debug.Assert(_stream != null);
116Debug.Assert(_buffer != null);
117Debug.Assert(_bufferSize > 0);
132Debug.Assert(_bufferSize > 0);
199Debug.Assert(!(_writePos > 0 && _readPos != _readLen), "Read and Write buffers cannot both have data in them at the same time.");
270Debug.Assert(_writePos == 0 && _readPos == 0 && _readLen == 0);
292Debug.Assert(_writePos == 0 && (!_stream.CanSeek || (_readPos == 0 && _readLen == 0)));
315Debug.Assert(_stream != null);
323Debug.Assert(_writePos == 0 && _readPos == 0 && _readLen == 0);
344Debug.Assert(_writePos == 0 && (!_stream.CanSeek || (_readPos == 0 && _readLen == 0)));
353Debug.Assert(_writePos == 0 && _readPos == _readLen);
367Debug.Assert(_stream != null);
368Debug.Assert(_writePos == 0, "BufferedStream: Write buffer must be empty in FlushRead!");
382Debug.Assert(_stream != null);
383Debug.Assert(_readPos <= _readLen, $"_readPos <= _readLen [{_readPos} <= {_readLen}]");
393Debug.Assert(_readPos < _readLen);
406Debug.Assert(_stream != null);
407Debug.Assert(_readPos == 0 && _readLen == 0,
409Debug.Assert(_buffer != null && _bufferSize >= _writePos,
419Debug.Assert(_stream != null);
420Debug.Assert(_readPos == 0 && _readLen == 0,
422Debug.Assert(_buffer != null && _bufferSize >= _writePos,
433Debug.Assert(readbytes >= 0);
449Debug.Assert(readbytes >= 0);
477Debug.Assert(_stream != null);
499Debug.Assert(_readLen == _readPos, "The read buffer must now be empty");
532Debug.Assert(_stream != null);
549Debug.Assert(_readLen == _readPos, "The read buffer must now be empty");
675Debug.Assert(_stream != null);
676Debug.Assert(_stream.CanRead);
677Debug.Assert(_bufferSize > 0);
678Debug.Assert(_asyncActiveSemaphore != null);
679Debug.Assert(semaphoreLockTask != null);
699Debug.Assert(_readLen == _readPos);
742Debug.Assert(_readPos == _readLen);
751Debug.Assert(_stream != null);
798Debug.Assert(_stream != null);
863Debug.Assert(_writePos < _bufferSize);
880Debug.Assert(count == 0);
884Debug.Assert(count >= 0);
885Debug.Assert(_writePos == _bufferSize);
886Debug.Assert(_buffer != null);
893Debug.Assert(count == 0);
894Debug.Assert(_writePos < _bufferSize);
901Debug.Assert(_buffer != null);
902Debug.Assert(totalUserbytes >= _bufferSize);
927Debug.Assert(_stream != null);
933Debug.Assert(_writePos < _bufferSize, $"Expected {_writePos} < {_bufferSize}");
952Debug.Assert(bytesWritten == buffer.Length);
957Debug.Assert(_writePos == _bufferSize);
958Debug.Assert(_buffer != null);
966Debug.Assert(bytesWritten == buffer.Length);
968Debug.Assert(_writePos < _bufferSize);
975Debug.Assert(_buffer != null);
976Debug.Assert(totalUserbytes >= _bufferSize);
1028Debug.Assert(_writePos < _bufferSize);
1035Debug.Assert(bytesWritten == buffer.Length);
1058Debug.Assert(_stream != null);
1059Debug.Assert(_stream.CanWrite);
1060Debug.Assert(_bufferSize > 0);
1061Debug.Assert(_asyncActiveSemaphore != null);
1062Debug.Assert(semaphoreLockTask != null);
1090Debug.Assert(buffer.Length == 0);
1094Debug.Assert(buffer.Length >= 0);
1095Debug.Assert(_writePos == _bufferSize);
1096Debug.Assert(_buffer != null);
1102Debug.Assert(bytesWritten == buffer.Length);
1104Debug.Assert(_writePos < _bufferSize);
1112Debug.Assert(_buffer != null);
1113Debug.Assert(totalUserBytes >= _bufferSize);
1175Debug.Assert(_writePos < _bufferSize);
1182Debug.Assert(_stream != null);
1203Debug.Assert(oldPos == _stream.Position + (_readPos - _readLen));
1225Debug.Assert(newPos == Position, $"newPos (={newPos}) == Position (={Position})");
1237Debug.Assert(_stream != null);
1248Debug.Assert(_stream != null);
1251Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}");
1256Debug.Assert(_writePos == 0, "Write buffer must be empty if there's data in the read buffer");
1283Debug.Assert(_stream != null);
1290Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}");
1295Debug.Assert(_writePos == 0, "Write buffer must be empty if there's data in the read buffer");
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (40)
28Debug.Assert(bufferSize > 1, "Buffering must not be enabled for smaller buffer sizes");
62Debug.Assert(!(_writePos > 0 && _readPos != _readLen), "Read and Write buffers cannot both have data in them at the same time.");
162Debug.Assert((_readPos == 0 && _readLen == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLen),
233Debug.Assert(_readPos == _readLen, "Read buffer should be empty!");
254Debug.Assert(_readPos == _readLen);
301Debug.Assert(!_strategy.IsClosed, "FileStream ensures that strategy is not closed");
302Debug.Assert((_readPos == 0 && _readLen == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLen),
352Debug.Assert(!_strategy.CanSeek);
380Debug.Assert(_writePos == 0, "Win32FileStream must not have buffered write data here! Pipes should be unidirectional.");
393Debug.Assert(_asyncActiveSemaphore != null);
394Debug.Assert(_strategy.CanSeek);
427Debug.Assert(_readLen == _readPos, "The read buffer must now be empty");
518Debug.Assert(_writePos == 0, "FlushWrite must set _writePos to 0");
524Debug.Assert(_writePos == 0, "FileStream cannot have buffered data to write here! Your stream will be corrupted.");
575Debug.Assert(_writePos <= _bufferSize);
598Debug.Assert(!_strategy.IsClosed, "FileStream ensures that strategy is not closed");
599Debug.Assert((_readPos == 0 && _readLen == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLen),
601Debug.Assert(_strategy.CanSeek || (_readPos == 0 && _readLen == 0),
660Debug.Assert(!_strategy.CanSeek);
676Debug.Assert(_asyncActiveSemaphore != null);
677Debug.Assert(_strategy.CanSeek);
721Debug.Assert(_writePos == 0, "FileStream cannot have buffered data to write here! Your stream will be corrupted.");
758Debug.Assert(!_strategy.IsClosed, "FileStream responsibility");
759Debug.Assert((_readPos == 0 && _readLen == 0 && _writePos >= 0) || (_writePos == 0 && _readPos <= _readLen),
780Debug.Assert(_writePos == 0 && (!_strategy.CanSeek || (_readPos == 0 && _readLen == 0)));
804Debug.Assert(_writePos == 0 && _readPos == 0 && _readLen == 0);
819Debug.Assert(_writePos == 0 && (!_strategy.CanSeek || (_readPos == 0 && _readLen == 0)));
824Debug.Assert(_writePos == 0 && _readPos == _readLen);
849Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}");
854Debug.Assert(_writePos == 0, "Write buffer must be empty if there's data in the read buffer");
880Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}");
885Debug.Assert(_writePos == 0, "Write buffer must be empty if there's data in the read buffer");
917Debug.Assert(oldPos == _strategy.Position + (_readPos - _readLen));
939Debug.Assert(newPos == Position, $"newPos (={newPos}) == Position (={Position})");
952Debug.Assert(_writePos == 0, "Write buffer must be empty in FlushRead!");
965Debug.Assert(_readPos == 0 && _readLen == 0, "Read buffer must be empty in FlushWrite!");
966Debug.Assert(_buffer != null && _bufferSize >= _writePos, "Write buffer must be allocated and write position must be in the bounds of the buffer in FlushWrite!");
977Debug.Assert(_readPos <= _readLen, $"_readPos <= _readLen [{_readPos} <= {_readLen}]");
987Debug.Assert(_readPos < _readLen);
1044Debug.Assert(!_strategy.IsClosed, "FileStream ensures that strategy is not closed");
src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (34)
99Debug.Assert(this is NullStreamReader);
463Debug.Assert(_byteLen >= n, "CompressBuffer was called with a number of bytes greater than the current buffer length. Are two threads using this StreamReader at the same time?");
472Debug.Assert(_byteLen >= 2, "Caller should've validated that at least 2 bytes were available.");
550Debug.Assert(_checkPreamble);
553Debug.Assert(_bytePos < preamble.Length, "_compressPreamble was called with the current bytePos greater than the preamble buffer length. Are two threads using this StreamReader at the same time?");
567Debug.Assert(_bytePos <= preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
598Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
600Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
612Debug.Assert(_bytePos == 0, "bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
614Debug.Assert(_byteLen >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
643Debug.Assert(_charPos == 0 && _charLen == 0, "We shouldn't be trying to decode more data if we made progress in an earlier iteration.");
653Debug.Assert(_charPos == 0 && _charLen == 0, "We shouldn't be looking for EOF unless we have an empty char buffer.");
698Debug.Assert(charsRead == 0);
702Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
704Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
716Debug.Assert(_bytePos == 0, "bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
718Debug.Assert(_byteLen >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
750Debug.Assert(charsRead == 0 && _charPos == 0 && _charLen == 0, "We shouldn't be trying to decode more data if we made progress in an earlier iteration.");
768Debug.Assert(charsRead == 0 && _charPos == 0 && _charLen == 0, "We shouldn't be looking for EOF unless we have an empty char buffer.");
813Debug.Assert(!charBufferSpan.IsEmpty, "ReadBuffer returned > 0 but didn't bump _charLen?");
924Debug.Assert(charPos < charLen, "ReadBuffer returned > 0 but didn't bump _charLen?");
1136Debug.Assert(n == 0);
1140Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
1143Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
1164Debug.Assert(n == 0);
1176Debug.Assert(_bytePos == 0, "_bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
1180Debug.Assert(_byteLen >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
1212Debug.Assert(n == 0);
1335Debug.Assert(_bytePos <= _encoding.Preamble.Length, "possible bug in _compressPreamble. Are two threads using this StreamReader at the same time?");
1338Debug.Assert(len >= 0, "Stream.Read returned a negative number! This is a bug in your stream class.");
1350Debug.Assert(_bytePos == 0, "_bytePos can be non zero only when we are trying to _checkPreamble. Are two threads using this StreamReader at the same time?");
1352Debug.Assert(_byteLen >= 0, "Stream.Read returned a negative number! Bug in stream class.");
1381Debug.Assert(_charPos == 0 && _charLen == 0, "We shouldn't be trying to decode more data if we made progress in an earlier iteration.");
1391Debug.Assert(_charPos == 0 && _charLen == 0, "We shouldn't be looking for EOF unless we have an empty char buffer.");
src\libraries\System.Private.CoreLib\src\System\Resources\ManifestBasedResourceGroveler.cs (24)
31Debug.Assert(mediator != null, "mediator shouldn't be null; check caller");
37Debug.Assert(culture != null, "culture shouldn't be null; check caller");
38Debug.Assert(localResourceSets != null, "localResourceSets shouldn't be null; check caller");
90Debug.Assert(satellite != null, "satellite should not be null when stream is set");
112Debug.Assert(_mediator.NeutralResourcesCulture != null);
128Debug.Assert(a != null, "assembly != null");
154Debug.Fail(CoreLib.Name + "'s NeutralResourcesLanguageAttribute is a malformed culture name! name: \"" + attr.CultureName + "\" Exception: " + e);
168Debug.Assert(store != null, "I need a Stream!");
208Debug.Assert(_mediator.MainAssembly != null);
225Debug.Assert(readerTypeName != null, "Reader Type name should be set");
226Debug.Assert(resSetTypeName != null, "ResourceSet Type name should be set");
305Debug.Assert(resSetTypeName != null, "We should have a ResourceSet type name from the custom resource file here.");
320Debug.Assert(satellite != null, "satellite shouldn't be null; check caller");
321Debug.Assert(fileName != null, "fileName shouldn't be null; check caller");
333Debug.Assert(satellite != null, "satellite shouldn't be null; check caller");
334Debug.Assert(name != null, "name shouldn't be null; check caller");
362Debug.Assert(_mediator.MainAssembly != null);
397Debug.Assert(readerTypeName != null, "readerTypeName shouldn't be null; check caller");
398Debug.Assert(resSetTypeName != null, "resSetTypeName shouldn't be null; check caller");
424Debug.Assert(_mediator.MainAssembly != null);
432Debug.Assert(_mediator.NeutralResourcesCulture != null);
467Debug.Assert(_mediator.BaseName != null);
472Debug.Fail("Couldn't get " + CoreLib.Name + ResourceManager.ResFileExtension + " from " + CoreLib.Name + "'s assembly" + Environment.NewLineConst + Environment.NewLineConst + "Are you building the runtime on your machine? Chances are the BCL directory didn't build correctly. Type 'build -c' in the BCL directory. If you get build errors, look at buildd.log. If you then can't figure out what's wrong (and you aren't changing the assembly-related metadata code), ask a BCL dev.\n\nIf you did NOT build the runtime, you shouldn't be seeing this and you've found a bug.");
478Debug.Assert(_mediator.MainAssembly != null);
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (32)
46Debug.Assert(value >= 0, "negative ResourceTypeCode. What?");
197Debug.Assert(index >= 0 && index < _numResources, $"Bad index into hash array. index: {index}");
201Debug.Assert(_nameHashes != null && _nameHashesPtr == null, "Internal state mangled.");
206Debug.Assert(_nameHashes == null && _nameHashesPtr != null, "Internal state mangled.");
213Debug.Assert(index >= 0 && index < _numResources, $"Bad index into name position array. index: {index}");
217Debug.Assert(_namePositions != null && _namePositionsPtr == null, "Internal state mangled.");
222Debug.Assert(_namePositions == null && _namePositionsPtr != null, "Internal state mangled.");
258Debug.Assert(_store != null, "ResourceReader is closed!");
339Debug.Assert(_store != null, "ResourceReader is closed!");
340Debug.Assert(Monitor.IsEntered(this)); // uses _store
382Debug.Assert(_store != null, "ResourceReader is closed!");
453Debug.Assert(_store != null, "ResourceReader is closed!");
477Debug.Assert(_store != null, "ResourceReader is closed!");
539Debug.Assert(_store != null, "ResourceReader is closed!");
540Debug.Assert(_version == 1, ".resources file was not a V1 .resources file!");
541Debug.Assert(Monitor.IsEntered(this)); // uses _store
561Debug.Assert(Monitor.IsEntered(this)); // uses _store
621Debug.Assert(_store != null, "ResourceReader is closed!");
622Debug.Assert(_version >= 2, ".resources file was not a V2 (or higher) .resources file!");
623Debug.Assert(Monitor.IsEntered(this)); // uses _store
643Debug.Assert(Monitor.IsEntered(this)); // uses _store
729Debug.Assert(r == len, "ResourceReader needs to use a blocking read here. (Call _store.ReadBytes(len)?)");
781Debug.Assert(!Monitor.IsEntered(this)); // only called during init
782Debug.Assert(_store != null, "ResourceReader is closed!");
804Debug.Assert(!Monitor.IsEntered(this)); // only called during init
993Debug.Assert(Monitor.IsEntered(this)); // uses _store
1001Debug.Assert(_typeTable[typeIndex] != null, "Should have found a type!");
1032Debug.Assert(typeCode >= 0, "can't be negative");
1033Debug.Assert(Monitor.IsEntered(this)); // uses _store
1037Debug.Assert(!string.Equals(typeCode.ToString(), "LastPrimitive"), "Change ResourceTypeCode metadata order so LastPrimitive isn't what Enum.ToString prefers.");
1043Debug.Assert(typeIndex >= 0 && typeIndex < _typeTable.Length, "TypeCode is broken or corrupted!");
1117Debug.Assert(!Monitor.IsEntered(_reader));
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\TaskAwaiter.cs (16)
32Debug.Assert(task != null, "Constructing an awaiter requires a task to await.");
107Debug.Assert(taskCompleted, "With an infinite timeout, the task should have always completed.");
129Debug.Assert(task.IsCompleted, "Task must have been completed by now.");
130Debug.Assert(task.Status != TaskStatus.RanToCompletion, "Task should not be completed successfully.");
144Debug.Fail("Throw() should have thrown");
155Debug.Fail("Throw() should have thrown");
160Debug.Fail("There should be exceptions if we're Faulted.");
195Debug.Assert(stateMachineBox != null);
217Debug.Assert(task != null, "Need a task to wait on");
218Debug.Assert(continuation != null, "Need a continuation to invoke when the wait completes");
298Debug.Assert(task != null, "Constructing an awaiter requires a task to await.");
366Debug.Assert(task != null, "Constructing an awaitable requires a task to await.");
394Debug.Assert(task != null, "Constructing an awaiter requires a task to await.");
395Debug.Assert((options & ~(ConfigureAwaitOptions.ContinueOnCapturedContext | ConfigureAwaitOptions.SuppressThrowing | ConfigureAwaitOptions.ForceYielding)) == 0);
476Debug.Assert(task != null, "Constructing an awaiter requires a task to await.");
477Debug.Assert((options & ~(ConfigureAwaitOptions.ContinueOnCapturedContext | ConfigureAwaitOptions.ForceYielding)) == 0);
src\libraries\System.Private.CoreLib\src\System\Runtime\Serialization\SerializationInfo.cs (14)
105Debug.Assert(_names.Length == _count, "[SerializationInfo.ExpandArrays]_names.Length == _count");
267Debug.Assert(null != name, "[SerializationInfo.UpdateValue]name!=null");
268Debug.Assert(null != value, "[SerializationInfo.UpdateValue]value!=null");
269Debug.Assert(type is not null, "[SerializationInfo.UpdateValue]type!=null");
310Debug.Assert(index < _values.Length, "[SerializationInfo.GetElement]index<_values.Length");
311Debug.Assert(index < _types.Length, "[SerializationInfo.GetElement]index<_types.Length");
314Debug.Assert(foundType is not null, "[SerializationInfo.GetElement]foundType!=null");
327Debug.Assert(index < _values.Length, "[SerializationInfo.GetElement]index<_values.Length");
328Debug.Assert(index < _types.Length, "[SerializationInfo.GetElement]index<_types.Length");
331Debug.Assert(foundType is not null, "[SerializationInfo.GetElement]foundType!=null");
349Debug.Assert(_converter != null, "[SerializationInfo.GetValue]_converter!=null");
355Debug.Assert(type is not null, "[SerializationInfo.GetValue]type ==null");
356Debug.Assert(type is RuntimeType, "[SerializationInfo.GetValue]type is not a runtime type");
367Debug.Assert(_converter != null, "[SerializationInfo.GetValue]_converter!=null");
src\libraries\System.Private.CoreLib\src\System\SearchValues\IndexOfAnyAsciiSearcher.cs (15)
70Debug.Assert(typeof(T) == typeof(byte) || typeof(T) == typeof(char));
139Debug.Assert(searchSpaceLength >= Vector128<short>.Count);
166Debug.Assert(searchSpaceLength >= Vector128<short>.Count);
270Debug.Assert(searchSpaceLength >= Vector256<short>.Count, "We expect that the input is long enough for us to load a whole vector.");
323Debug.Assert(searchSpaceLength >= Vector128<short>.Count, "We expect that the input is long enough for us to load a whole vector.");
401Debug.Assert(searchSpaceLength >= Vector256<short>.Count, "We expect that the input is long enough for us to load a whole vector.");
452Debug.Assert(searchSpaceLength >= Vector128<short>.Count, "We expect that the input is long enough for us to load a whole vector.");
548Debug.Assert(searchSpaceLength >= Vector128<byte>.Count, "We expect that the input is long enough for us to load a Vector128.");
597Debug.Assert(searchSpaceLength >= sizeof(ulong), "We expect that the input is long enough for us to load a ulong.");
672Debug.Assert(searchSpaceLength >= Vector128<byte>.Count, "We expect that the input is long enough for us to load a Vector128.");
721Debug.Assert(searchSpaceLength >= sizeof(ulong), "We expect that the input is long enough for us to load a ulong.");
819Debug.Assert(searchSpaceLength >= Vector128<byte>.Count, "We expect that the input is long enough for us to load a Vector128.");
871Debug.Assert(searchSpaceLength >= sizeof(ulong), "We expect that the input is long enough for us to load a ulong.");
947Debug.Assert(searchSpaceLength >= Vector128<byte>.Count, "We expect that the input is long enough for us to load a Vector128.");
999Debug.Assert(searchSpaceLength >= sizeof(ulong), "We expect that the input is long enough for us to load a ulong.");
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.T.cs (63)
72Debug.Fail("Vector<T> isn't 128 or 256 bits in size?");
84Debug.Fail("Vector<T> isn't 256 bits in size?");
90Debug.Fail("Vector<T> is greater than 256 bits in size?");
193Debug.Assert(searchSpaceLength >= 0);
194Debug.Assert(valueLength >= 0);
206Debug.Assert(0 <= index && index <= searchSpaceLength); // Ensures no deceptive underflows in the computation of "remainingSearchSpaceLength".
229Debug.Assert(length >= 0);
235Debug.Assert(value is not null);
301Debug.Assert(length >= 0);
306Debug.Assert(value is not null);
390Debug.Assert(length >= 0);
396Debug.Assert(value0 is not null && value1 is not null);
496Debug.Assert(length >= 0);
502Debug.Assert(value0 is not null && value1 is not null && value2 is not null);
601Debug.Assert(searchSpaceLength >= 0);
602Debug.Assert(valueLength >= 0);
672Debug.Assert(searchSpaceLength >= 0);
673Debug.Assert(valueLength >= 0);
691Debug.Assert(0 <= index && index <= searchSpaceLength); // Ensures no deceptive underflows in the computation of "remainingSearchSpaceLength".
712Debug.Assert(length >= 0);
716Debug.Assert(value is not null);
795Debug.Assert(length >= 0);
800Debug.Assert(value0 is not null && value1 is not null);
900Debug.Assert(length >= 0);
905Debug.Assert(value0 is not null && value1 is not null && value2 is not null);
1005Debug.Assert(searchSpaceLength >= 0);
1006Debug.Assert(valueLength >= 0);
1061Debug.Assert(length >= 0, "Expected non-negative length");
1076Debug.Assert(length >= 0, "Expected non-negative length");
1091Debug.Assert(length >= 0, "Expected non-negative length");
1107Debug.Assert(length >= 0, "Expected non-negative length");
1123Debug.Assert(length >= 0, "Expected non-negative length");
1141Debug.Assert(length >= 0, "Expected non-negative length");
1159Debug.Assert(length >= 0, "Expected non-negative length");
1178Debug.Assert(length >= 0, "Expected non-negative length");
1197Debug.Assert(length >= 0);
1289Debug.Assert(firstLength >= 0);
1290Debug.Assert(secondLength >= 0);
1318Debug.Assert(length >= 0, "Expected non-negative length");
1319Debug.Assert(value is byte or short or int or long, "Expected caller to normalize to one of these types");
1498Debug.Assert(length >= 0, "Expected non-negative length");
1499Debug.Assert(value is byte or short or int or long, "Expected caller to normalize to one of these types");
1704Debug.Assert(length >= 0, "Expected non-negative length");
1705Debug.Assert(value0 is byte or short or int or long, "Expected caller to normalize to one of these types");
1911Debug.Assert(length >= 0, "Expected non-negative length");
1912Debug.Assert(value0 is byte or short or int or long, "Expected caller to normalize to one of these types");
2103Debug.Assert(length >= 0, "Expected non-negative length");
2104Debug.Assert(value0 is byte or short or int or long, "Expected caller to normalize to one of these types");
2265Debug.Assert(length >= 0, "Expected non-negative length");
2266Debug.Assert(value0 is byte or short or int or long, "Expected caller to normalize to one of these types");
2431Debug.Assert(length >= 0, "Expected non-negative length");
2432Debug.Assert(value is byte or short or int or long, "Expected caller to normalize to one of these types");
2551Debug.Assert(length >= 0, "Expected non-negative length");
2552Debug.Assert(value0 is byte or short or int or long, "Expected caller to normalize to one of these types");
2736Debug.Assert(length >= 0, "Expected non-negative length");
2737Debug.Assert(value0 is byte or short or int or long, "Expected caller to normalize to one of these types");
2922Debug.Assert(length >= 0, "Expected non-negative length");
2923Debug.Assert(value0 is byte or short or int or long, "Expected caller to normalize to one of these types");
3064Debug.Assert(oldValue is not null);
3094Debug.Assert(Vector128.IsHardwareAccelerated && Vector128<T>.IsSupported, "Vector128 is not HW-accelerated or not supported");
3151Debug.Assert(Vector512.IsHardwareAccelerated && Vector512<T>.IsSupported, "Vector512 is not HW-accelerated or not supported");
3189Debug.Assert(length >= 0, "Expected non-negative length");
3190Debug.Assert(value0 is byte or short or int or long, "Expected caller to normalize to one of these types");
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Utility.cs (87)
48Debug.Assert(typeof(T) == typeof(byte) || typeof(T) == typeof(ushort));
74Debug.Assert((mask != 0) ? index < 16 : index >= 16);
143Debug.Assert(0 < numBytesRead && numBytesRead <= Vector512.Size, "We should've made forward progress of at least one byte.");
144Debug.Assert((nuint)numBytesRead <= bufferLength, "We shouldn't have read past the end of the input buffer.");
147Debug.Assert(pBuffer <= pFinalVectorReadPos, "Should be able to read at least one vector.");
151Debug.Assert((nuint)pBuffer % Vector512.Size == 0, "Vector read should be aligned.");
179Debug.Assert(0 < numBytesRead && numBytesRead <= Vector256.Size, "We should've made forward progress of at least one byte.");
180Debug.Assert((nuint)numBytesRead <= bufferLength, "We shouldn't have read past the end of the input buffer.");
183Debug.Assert(pBuffer <= pFinalVectorReadPos, "Should be able to read at least one vector.");
187Debug.Assert((nuint)pBuffer % Vector256.Size == 0, "Vector read should be aligned.");
215Debug.Assert(0 < numBytesRead && numBytesRead <= Vector128.Size, "We should've made forward progress of at least one byte.");
216Debug.Assert((nuint)numBytesRead <= bufferLength, "We shouldn't have read past the end of the input buffer.");
219Debug.Assert(pBuffer <= pFinalVectorReadPos, "Should be able to read at least one vector.");
223Debug.Assert((nuint)pBuffer % Vector128.Size == 0, "Vector read should be aligned.");
323Debug.Assert(!AllBytesInUInt32AreAscii(currentUInt32), "Shouldn't have reached this point if we have an all-ASCII input.");
337Debug.Assert(sseMask != uint.MaxValue);
338Debug.Assert(Sse2.IsSupported);
345Debug.Assert(advSimdIndex != uint.MaxValue);
346Debug.Assert(AdvSimd.IsSupported);
357Debug.Assert(Sse2.IsSupported || AdvSimd.Arm64.IsSupported, "Sse2 or AdvSimd64 required.");
358Debug.Assert(BitConverter.IsLittleEndian, "This SSE2/Arm64 implementation assumes little-endian.");
415Debug.Assert(0 < numBytesRead && numBytesRead <= SizeOfVector128, "We should've made forward progress of at least one byte.");
416Debug.Assert((nuint)numBytesRead <= bufferLength, "We shouldn't have read past the end of the input buffer.");
582Debug.Assert(ContainsNonAsciiByte_Sse2(currentSseMask), "Shouldn't be here unless we see non-ASCII data.");
587Debug.Assert(ContainsNonAsciiByte_AdvSimd(currentAdvSimdIndex), "Shouldn't be here unless we see non-ASCII data.");
600Debug.Assert(!AllBytesInUInt32AreAscii(currentDWord), "Shouldn't be here unless we see non-ASCII data.");
611Debug.Assert(bufferLength < SizeOfVector128);
739Debug.Assert(bufferLength <= nuint.MaxValue / sizeof(char));
759Debug.Assert(0 < numCharsRead && numCharsRead <= SizeOfVector512InChars, "We should've made forward progress of at least one char.");
760Debug.Assert((nuint)numCharsRead <= bufferLength, "We shouldn't have read past the end of the input buffer.");
763Debug.Assert(pBuffer <= pFinalVectorReadPos, "Should be able to read at least one vector.");
767Debug.Assert((nuint)pBuffer % Vector512.Size == 0, "Vector read should be aligned.");
795Debug.Assert(0 < numCharsRead && numCharsRead <= SizeOfVector256InChars, "We should've made forward progress of at least one char.");
796Debug.Assert((nuint)numCharsRead <= bufferLength, "We shouldn't have read past the end of the input buffer.");
799Debug.Assert(pBuffer <= pFinalVectorReadPos, "Should be able to read at least one vector.");
803Debug.Assert((nuint)pBuffer % Vector256.Size == 0, "Vector read should be aligned.");
830Debug.Assert(0 < numCharsRead && numCharsRead <= SizeOfVector128InChars, "We should've made forward progress of at least one char.");
831Debug.Assert((nuint)numCharsRead <= bufferLength, "We shouldn't have read past the end of the input buffer.");
834Debug.Assert(pBuffer <= pFinalVectorReadPos, "Should be able to read at least one vector.");
838Debug.Assert((nuint)pBuffer % Vector128.Size == 0, "Vector read should be aligned.");
917Debug.Assert(totalNumBytesRead % sizeof(char) == 0, "Total number of bytes read should be even since we're working with chars.");
922Debug.Assert(!AllCharsInUInt32AreAscii(currentUInt32), "Shouldn't have reached this point if we have an all-ASCII input.");
950Debug.Assert(Sse2.IsSupported || AdvSimd.Arm64.IsSupported, "Should've been checked by caller.");
951Debug.Assert(BitConverter.IsLittleEndian, "This SSE2/Arm64 assumes little-endian.");
967Debug.Assert(bufferLength <= nuint.MaxValue / sizeof(char));
997Debug.Assert(0 < numCharsRead && numCharsRead <= SizeOfVector128InChars, "We should've made forward progress of at least one char.");
998Debug.Assert((nuint)numCharsRead <= bufferLength, "We shouldn't have read past the end of the input buffer.");
1076Debug.Assert(((nuint)pBuffer - (nuint)pOriginalBuffer) % 2 == 0, "Shouldn't have incremented any pointer by an odd byte count.");
1119Debug.Assert(currentMask != 0, "Shouldn't be here unless we see non-ASCII data.");
1144Debug.Assert(!AllCharsInUInt32AreAscii(currentDWord), "Shouldn't be here unless we see non-ASCII data.");
1162Debug.Assert(bufferLength < SizeOfVector128InChars);
1246Debug.Assert(AllCharsInUInt64AreAscii(value));
1300Debug.Assert(AllCharsInUInt32AreAscii(value));
1364Debug.Assert(currentOffset <= elementCount);
1480Debug.Assert(!AllCharsInUInt32AreAscii(utf16Data32BitsHigh), "Shouldn't have reached this point if we have an all-ASCII input.");
1586Debug.Assert(typeof(T) == typeof(byte) || typeof(T) == typeof(ushort));
1597Debug.Assert(typeof(T) == typeof(byte) || typeof(T) == typeof(ushort));
1621Debug.Assert(typeof(T) == typeof(byte) || typeof(T) == typeof(ushort));
1641Debug.Assert(typeof(T) == typeof(byte) || typeof(T) == typeof(ushort));
1689Debug.Assert(Vector128.IsHardwareAccelerated, "Vector128 is required.");
1690Debug.Assert(BitConverter.IsLittleEndian, "This implementation assumes little-endian.");
1691Debug.Assert(elementCount >= 2 * SizeOfVector128);
1742Debug.Assert(0 < currentOffsetInElements && currentOffsetInElements <= SizeOfVector128, "We wrote at least 1 byte but no more than a whole vector.");
1743Debug.Assert(currentOffsetInElements <= elementCount, "Shouldn't have overrun the destination buffer.");
1744Debug.Assert(elementCount - currentOffsetInElements >= SizeOfVector128, "We should be able to run at least one whole vector.");
1762Debug.Assert(((nuint)pAsciiBuffer + currentOffsetInElements) % SizeOfVector128 == 0, "Write should be aligned.");
1785Debug.Assert(((nuint)pAsciiBuffer + currentOffsetInElements) % sizeof(ulong) == 0, "Destination should be ulong-aligned.");
1807Debug.Assert(Vector256.IsHardwareAccelerated, "Vector256 is required.");
1808Debug.Assert(BitConverter.IsLittleEndian, "This implementation assumes little-endian.");
1809Debug.Assert(elementCount >= 2 * Vector256.Size);
1859Debug.Assert(0 < currentOffsetInElements && currentOffsetInElements <= Vector256.Size, "We wrote at least 1 byte but no more than a whole vector.");
1860Debug.Assert(currentOffsetInElements <= elementCount, "Shouldn't have overrun the destination buffer.");
1861Debug.Assert(elementCount - currentOffsetInElements >= Vector256.Size, "We should be able to run at least one whole vector.");
1879Debug.Assert(((nuint)pAsciiBuffer + currentOffsetInElements) % Vector256.Size == 0, "Write should be aligned.");
1902Debug.Assert(((nuint)pAsciiBuffer + currentOffsetInElements) % Vector128.Size == 0, "Destination should be 128-bit-aligned.");
1924Debug.Assert(Vector512.IsHardwareAccelerated, "Vector512 is required.");
1925Debug.Assert(BitConverter.IsLittleEndian, "This implementation assumes little-endian.");
1926Debug.Assert(elementCount >= 2 * Vector512.Size);
1977Debug.Assert(0 < currentOffsetInElements && currentOffsetInElements <= Vector512.Size, "We wrote at least 1 byte but no more than a whole vector.");
1978Debug.Assert(currentOffsetInElements <= elementCount, "Shouldn't have overrun the destination buffer.");
1979Debug.Assert(elementCount - currentOffsetInElements >= Vector512.Size, "We should be able to run at least one whole vector.");
1997Debug.Assert(((nuint)pAsciiBuffer + currentOffsetInElements) % Vector512.Size == 0, "Write should be aligned.");
2020Debug.Assert(((nuint)pAsciiBuffer + currentOffsetInElements) % Vector256.Size == 0, "Destination should be 256-bit-aligned.");
2055Debug.Assert(currentOffset <= elementCount);
2127Debug.Assert(!AllBytesInUInt32AreAscii(asciiData), "Shouldn't have reached this point if we have an all-ASCII input.");
2225Debug.Assert(typeof(TVectorByte) == typeof(Vector128<byte>));
2239Debug.Assert(AllBytesInUInt32AreAscii(value));
src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (14)
156Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
157Debug.Assert(pChars is not null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
349Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
350Debug.Assert(pChars is not null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
351Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
352Debug.Assert(pBytes is not null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
408Debug.Assert(idx <= numElementsToConvert, "Somehow went beyond bounds of source or destination buffer?");
498Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
499Debug.Assert(pBytes is not null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
640Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
641Debug.Assert(pBytes is not null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
642Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
643Debug.Assert(pChars is not null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
696Debug.Assert(idx <= numElementsToConvert, "Somehow went beyond bounds of source or destination buffer?");
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.Internal.cs (73)
75Debug.Fail("This should be overridden by a subclassed type.");
81Debug.Fail("This should be overridden by a subclassed type.");
113Debug.Fail("This should be overridden by a subclassed type.");
123Debug.Assert(encoder != null, "This code path should only be called from EncoderNLS.");
124Debug.Assert(charCount >= 0, "Caller should've checked this condition.");
125Debug.Assert(pChars != null || charCount == 0, "Cannot provide a null pointer and a non-zero count.");
206Debug.Fail("This should be overridden by a subclassed type.");
231Debug.Assert(0 <= charsConsumedSoFar && charsConsumedSoFar < originalCharCount, "Invalid arguments provided to method.");
257Debug.Assert(encoder != null, "This code path should only be called from EncoderNLS.");
258Debug.Assert(0 <= charsConsumedSoFar && charsConsumedSoFar <= originalCharCount, "Caller should've checked this condition.");
312Debug.Assert(!chars.IsEmpty, "Caller shouldn't invoke this method with an empty input buffer.");
313Debug.Assert(originalCharsLength >= 0, "Caller provided invalid parameter.");
347Debug.Assert(byteCountThisIteration >= 0, "Fallback shouldn't have returned a negative value.");
348Debug.Assert(charsConsumedThisIteration >= 0, "Fallback shouldn't have returned a negative value.");
370Debug.Assert(byteCountThisIteration >= 0, "Workhorse shouldn't have returned a negative value.");
371Debug.Assert(charsConsumedThisIteration >= 0, "Workhorse shouldn't have returned a negative value.");
385Debug.Assert(fallbackBuffer.Remaining == 0, "There should be no data in the fallback buffer after GetByteCount.");
400Debug.Assert(encoder != null, "This code path should only be called from EncoderNLS.");
401Debug.Assert(charCount >= 0, "Caller should've checked this condition.");
402Debug.Assert(pChars != null || charCount == 0, "Cannot provide a null pointer and a non-zero count.");
403Debug.Assert(byteCount >= 0, "Caller should've checked this condition.");
404Debug.Assert(pBytes != null || byteCount == 0, "Cannot provide a null pointer and a non-zero count.");
469Debug.Fail("This should be overridden by a subclassed type.");
494Debug.Assert(0 <= charsConsumedSoFar && charsConsumedSoFar < originalCharCount, "Invalid arguments provided to method.");
495Debug.Assert(0 <= bytesWrittenSoFar && bytesWrittenSoFar <= originalByteCount, "Invalid arguments provided to method.");
524Debug.Assert(encoder != null, "This code path should only be called from EncoderNLS.");
525Debug.Assert(0 <= charsConsumedSoFar && charsConsumedSoFar <= originalCharCount, "Caller should've checked this condition.");
526Debug.Assert(0 <= bytesWrittenSoFar && bytesWrittenSoFar <= originalByteCount, "Caller should've checked this condition.");
588Debug.Assert(!chars.IsEmpty, "Caller shouldn't invoke this method with an empty input buffer.");
589Debug.Assert(originalCharsLength >= 0, "Caller provided invalid parameter.");
590Debug.Assert(originalBytesLength >= 0, "Caller provided invalid parameter.");
608Debug.Assert(charsConsumedThisIteration == chars.Length, "If returning NeedMoreData, should out the entire buffer length as chars consumed.");
658Debug.Assert(bytesWrittenThisIteration >= 0, "Workhorse shouldn't have returned a negative value.");
659Debug.Assert(charsConsumedThisIteration >= 0, "Workhorse shouldn't have returned a negative value.");
688Debug.Assert(encoder is null);
697Debug.Assert(originalCharsLength >= chars.Length, "About to report a negative number of chars used?");
701Debug.Assert(fallbackBuffer.Remaining == 0 || encoder != null, "Shouldn't have any leftover data in fallback buffer unless an EncoderNLS is in use.");
716Debug.Assert(decoder != null, "This code path should only be called from DecoderNLS.");
717Debug.Assert(byteCount >= 0, "Caller should've checked this condition.");
718Debug.Assert(pBytes != null || byteCount == 0, "Cannot provide a null pointer and a non-zero count.");
725Debug.Assert(!decoder.InternalHasFallbackBuffer || decoder.FallbackBuffer.Remaining == 0, "Fallback buffer can't hold data between GetChars invocations.");
800Debug.Fail("This should be overridden by a subclassed type.");
825Debug.Assert(0 <= bytesConsumedSoFar && bytesConsumedSoFar < originalByteCount, "Invalid arguments provided to method.");
851Debug.Assert(decoder != null, "This code path should only be called from DecoderNLS.");
852Debug.Assert(0 <= bytesConsumedSoFar && bytesConsumedSoFar <= originalByteCount, "Caller should've checked this condition.");
912Debug.Assert(!bytes.IsEmpty, "Caller shouldn't invoke this method with an empty input buffer.");
913Debug.Assert(originalBytesLength >= 0, "Caller provided invalid parameter.");
944Debug.Assert(charCountThisIteration >= 0, "Fallback shouldn't have returned a negative value.");
966Debug.Assert(charCountThisIteration >= 0, "Workhorse shouldn't have returned a negative value.");
967Debug.Assert(bytesConsumedThisIteration >= 0, "Workhorse shouldn't have returned a negative value.");
981Debug.Assert(fallbackBuffer.Remaining == 0, "There should be no data in the fallback buffer after GetCharCount.");
996Debug.Assert(decoder != null, "This code path should only be called from DecoderNLS.");
997Debug.Assert(byteCount >= 0, "Caller should've checked this condition.");
998Debug.Assert(pBytes != null || byteCount == 0, "Cannot provide a null pointer and a non-zero count.");
999Debug.Assert(charCount >= 0, "Caller should've checked this condition.");
1000Debug.Assert(pChars != null || charCount == 0, "Cannot provide a null pointer and a non-zero count.");
1065Debug.Fail("This should be overridden by a subclassed type.");
1090Debug.Assert(0 <= bytesConsumedSoFar && bytesConsumedSoFar < originalByteCount, "Invalid arguments provided to method.");
1091Debug.Assert(0 <= charsWrittenSoFar && charsWrittenSoFar <= originalCharCount, "Invalid arguments provided to method.");
1120Debug.Assert(decoder != null, "This code path should only be called from DecoderNLS.");
1121Debug.Assert(0 <= bytesConsumedSoFar && bytesConsumedSoFar <= originalByteCount, "Caller should've checked this condition.");
1122Debug.Assert(0 <= charsWrittenSoFar && charsWrittenSoFar <= originalCharCount, "Caller should've checked this condition.");
1146Debug.Assert(!decoder.InternalHasFallbackBuffer || decoder.FallbackBuffer.Remaining == 0, "Should be no remaining fallback data at this point.");
1189Debug.Assert(!bytes.IsEmpty, "Caller shouldn't invoke this method with an empty input buffer.");
1190Debug.Assert(originalBytesLength >= 0, "Caller provided invalid parameter.");
1191Debug.Assert(originalCharsLength >= 0, "Caller provided invalid parameter.");
1210Debug.Assert(bytesConsumedThisIteration == bytes.Length, "If returning NeedMoreData, should out the entire buffer length as bytes consumed.");
1227Debug.Assert(charsWrittenThisIteration >= 0, "Fallback shouldn't have returned a negative value.");
1258Debug.Assert(charsWrittenThisIteration >= 0, "Workhorse shouldn't have returned a negative value.");
1259Debug.Assert(bytesConsumedThisIteration >= 0, "Workhorse shouldn't have returned a negative value.");
1272Debug.Assert(fallbackBuffer.Remaining == 0);
1285Debug.Assert(decoder is null);
1294Debug.Assert(originalBytesLength >= bytes.Length, "About to report a negative number of bytes used?");
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (10)
108Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
109Debug.Assert(pChars is not null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
295Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
296Debug.Assert(pChars is not null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
297Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
298Debug.Assert(pBytes is not null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
601Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
602Debug.Assert(pBytes is not null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
603Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
604Debug.Assert(pChars is not null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Utility.cs (33)
40Debug.Assert(bufferLength <= nuint.MaxValue / sizeof(char));
63Debug.Assert(0 < numCharsRead && numCharsRead <= SizeOfVectorInChars, "We should've made forward progress of at least one char.");
64Debug.Assert((nuint)numCharsRead <= bufferLength, "We shouldn't have read past the end of the input buffer.");
67Debug.Assert(pBuffer <= pFinalVectorReadPos, "Should be able to read at least one vector.");
71Debug.Assert((nuint)pBuffer % SizeOfVectorInChars == 0, "Vector read should be aligned.");
149Debug.Assert(totalNumBytesRead % sizeof(char) == 0, "Total number of bytes read should be even since we're working with chars.");
154Debug.Assert(!AllCharsInUInt32AreLatin1(currentUInt32), "Shouldn't have reached this point if we have an all-Latin-1 input.");
184Debug.Assert(Sse2.IsSupported, "Should've been checked by caller.");
185Debug.Assert(BitConverter.IsLittleEndian, "SSE2 assumes little-endian.");
204Debug.Assert(bufferLength <= nuint.MaxValue / sizeof(char));
240Debug.Assert(0 < numCharsRead && numCharsRead <= SizeOfVector128InChars, "We should've made forward progress of at least one char.");
241Debug.Assert((nuint)numCharsRead <= bufferLength, "We shouldn't have read past the end of the input buffer.");
370Debug.Assert(((nuint)pBuffer - (nuint)pOriginalBuffer) % 2 == 0, "Shouldn't have incremented any pointer by an odd byte count.");
425Debug.Assert(currentMask != 0, "Shouldn't be here unless we see non-Latin-1 data.");
433Debug.Assert(!AllCharsInUInt32AreLatin1(currentDWord), "Shouldn't be here unless we see non-Latin-1 data.");
451Debug.Assert(bufferLength < SizeOfVector128InChars);
550Debug.Assert(BitConverter.IsLittleEndian, "Assume little endian if SSE2 is supported.");
630Debug.Assert(currentOffset <= elementCount);
746Debug.Assert(!AllCharsInUInt32AreLatin1(utf16Data32BitsHigh), "Shouldn't have reached this point if we have an all-Latin-1 input.");
779Debug.Assert(Sse2.IsSupported);
780Debug.Assert(BitConverter.IsLittleEndian);
781Debug.Assert(elementCount >= 2 * SizeOfVector128);
862Debug.Assert(0 < currentOffsetInElements && currentOffsetInElements <= SizeOfVector128, "We wrote at least 1 byte but no more than a whole vector.");
864Debug.Assert(currentOffsetInElements <= elementCount, "Shouldn't have overrun the destination buffer.");
865Debug.Assert(elementCount - currentOffsetInElements >= SizeOfVector128, "We should be able to run at least one whole vector.");
898Debug.Assert(((nuint)pLatin1Buffer + currentOffsetInElements) % SizeOfVector128 == 0, "Write should be aligned.");
933Debug.Assert(((nuint)pLatin1Buffer + currentOffsetInElements) % sizeof(ulong) == 0, "Destination should be ulong-aligned.");
971Debug.Assert(Sse2.IsSupported);
972Debug.Assert(BitConverter.IsLittleEndian);
997Debug.Assert(0 < currentOffset && currentOffset <= SizeOfVector128 / sizeof(char));
1027Debug.Assert(elementCount - currentOffset < SizeOfVector128, "Case where 2 vectors remained should've been in the hot loop.");
1071Debug.Assert(!Sse2.IsSupported);
1098Debug.Assert(elementCount - currentOffset < SizeOfVector, "Vectorized logic should result in less than a vector's length of data remaining.");
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (63)
238Debug.Assert(m_ChunkOffset + m_ChunkChars.Length >= m_ChunkOffset, "The length of the string is greater than int.MaxValue.");
245Debug.Assert(currentBlock.m_MaxCapacity == maxCapacity);
246Debug.Assert(currentBlock.m_ChunkChars != null);
248Debug.Assert(currentBlock.m_ChunkLength <= currentBlock.m_ChunkChars.Length);
249Debug.Assert(currentBlock.m_ChunkLength >= 0);
250Debug.Assert(currentBlock.m_ChunkOffset >= 0);
255Debug.Assert(currentBlock.m_ChunkOffset == 0);
259Debug.Assert(currentBlock.m_ChunkOffset == prevBlock.m_ChunkOffset + prevBlock.m_ChunkLength);
431Debug.Assert(newLen == chunk.m_ChunkChars.Length, "The new chunk should be larger or equal to the one it is replacing.");
441Debug.Assert(Length == value, "Something went wrong setting Length.");
559Debug.Assert(next.m_ChunkPrevious != null);
585Debug.Assert(stringBuilder != null);
638Debug.Assert(stringBuilder != null);
684Debug.Assert(repeatCount > 0, "Invalid length; should have been validated by caller.");
706Debug.Assert(m_ChunkLength == 0, "A new block was not created.");
904Debug.Assert(chunk != null);
956Debug.Assert(insertingChars + this.Length < int.MaxValue);
1024Debug.Assert(m_ChunkLength == 0, "A new block was not created.");
1057Debug.Assert(typeof(T).Assembly.Equals(typeof(object).Assembly), "Implementation trusts the results of TryFormat because T is expected to be something known");
1070Debug.Assert(typeof(T).Assembly.Equals(typeof(object).Assembly), "Implementation trusts the results of TryFormat because T is expected to be something known");
1236Debug.Assert(values != null);
1237Debug.Assert(!Unsafe.IsNullRef(ref separator));
1238Debug.Assert(separatorLength >= 0);
1413Debug.Assert(typeof(T).Assembly.Equals(typeof(object).Assembly), "Implementation trusts the results of TryFormat because T is expected to be something known");
1589Debug.Assert(format[pos - 1] == '{');
1590Debug.Assert(ch != '{');
1693Debug.Assert(format[pos] == '}');
1921Debug.Assert(index > 2);
2010Debug.Assert(thisChunk != null && sbChunk != null);
2047Debug.Assert(offset == Length);
2102Debug.Assert(chunk != null, "chunk was null in replace");
2126Debug.Assert(count >= 0, "count should never go negative");
2144Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk),
2164Debug.Assert(indexInChunk >= chunk.m_ChunkLength || count == 0,
2182Debug.Assert(chunk != null || count == 0, "Chunks ended prematurely!");
2242Debug.Assert(chunk.m_ChunkPrevious != null);
2268Debug.Assert(valueCount >= 0, "Invalid length; should have been validated by caller.");
2320Debug.Assert(m_ChunkLength == 0, "A new block was not created.");
2337Debug.Assert((uint)index <= (uint)Length, "Callers should check that index is a legal value.");
2358Debug.Assert(!replacements.IsEmpty);
2391Debug.Assert(gapStart < sourceChunk.m_ChunkChars.Length, "gap starts at end of buffer. Should not happen");
2392Debug.Assert(gapStart <= gapEnd, "negative gap size");
2393Debug.Assert(gapEnd <= sourceChunk.m_ChunkLength, "gap too big");
2402Debug.Assert(targetIndexInChunk <= targetChunk.m_ChunkLength, "gap not in chunk");
2471Debug.Assert(chunk != null, "chunk should not be null at this point");
2473Debug.Assert(lengthInChunk >= 0, "Index isn't in the chunk.");
2505Debug.Assert(0 <= index && index <= Length);
2510Debug.Assert(result.m_ChunkPrevious != null);
2514Debug.Assert(result != null);
2547Debug.Assert(Capacity == Length, nameof(ExpandByABlock) + " should only be called when there is no space left.");
2548Debug.Assert(minBlockCharCount > 0);
2638Debug.Assert(count > 0);
2639Debug.Assert(index >= 0);
2650Debug.Assert(chunk.m_ChunkPrevious != null);
2707Debug.Assert(size > 0);
2708Debug.Assert(maxCapacity > 0);
2733Debug.Assert(startIndex >= 0 && startIndex < Length);
2761Debug.Assert(chunk.m_ChunkPrevious != null);
2764Debug.Assert(chunk != null, "We fell off the beginning of the string!");
2796Debug.Assert(chunk != null, "We fell off the beginning of the string!");
3134Debug.Assert(_hasCustomFormatter);
3135Debug.Assert(_provider != null);
3138Debug.Assert(formatter != null, "An incorrectly written provider said it implemented ICustomFormatter, and then didn't");
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Transcoding.cs (18)
22Debug.Assert(inputLength >= 0, "Input length must not be negative.");
23Debug.Assert(pInputBuffer != null || inputLength == 0, "Input length must be zero if input buffer pointer is null.");
25Debug.Assert(outputCharsRemaining >= 0, "Destination length must not be negative.");
26Debug.Assert(pOutputBuffer != null || outputCharsRemaining == 0, "Destination length must be zero if destination buffer pointer is null.");
62Debug.Assert(pInputBuffer <= pFinalPosWhereCanReadDWordFromInputBuffer);
72Debug.Assert(pLastBufferPosProcessed < pInputBuffer, "Algorithm should've made forward progress since last read.");
132Debug.Assert(!Ascii.AllBytesInUInt32AreAscii(secondDWord));
150Debug.Assert(!Ascii.AllBytesInUInt32AreAscii(thisDWord)); // this should have been handled earlier
222Debug.Assert(outputCharsRemaining == 1);
842Debug.Assert(inputLength >= 0, "Input length must not be negative.");
843Debug.Assert(pInputBuffer != null || inputLength == 0, "Input length must be zero if input buffer pointer is null.");
845Debug.Assert(outputBytesRemaining >= 0, "Destination length must not be negative.");
846Debug.Assert(pOutputBuffer != null || outputBytesRemaining == 0, "Destination length must be zero if destination buffer pointer is null.");
896Debug.Assert(pInputBuffer <= pFinalPosWhereCanReadDWordFromInputBuffer);
906Debug.Assert(pLastBufferPosProcessed < pInputBuffer, "Algorithm should've made forward progress since last read.");
1053Debug.Assert(!Utf16Utility.AllCharsInUInt64AreAscii(possibleNonAsciiQWord)); // this condition should've been checked earlier
1120Debug.Assert(!Utf16Utility.AllCharsInUInt32AreAscii(thisDWord)); // this should have been handled earlier
1397Debug.Assert(inputLength < CharsPerDWord);
src\libraries\System.Private.CoreLib\src\System\Text\UnicodeEncoding.cs (32)
338Debug.Assert(chars is not null, "[UnicodeEncoding.GetByteCount]chars!=null");
339Debug.Assert(count >= 0, "[UnicodeEncoding.GetByteCount]count >=0");
482Debug.Assert(chars > charStart,
550Debug.Assert(chars > charStart,
617Debug.Assert(fallbackBuffer is null || fallbackBuffer.Remaining == 0,
627Debug.Assert(chars is not null, "[UnicodeEncoding.GetBytes]chars!=null");
628Debug.Assert(byteCount >= 0, "[UnicodeEncoding.GetBytes]byteCount >=0");
629Debug.Assert(charCount >= 0, "[UnicodeEncoding.GetBytes]charCount >=0");
630Debug.Assert(bytes is not null, "[UnicodeEncoding.GetBytes]bytes!=null");
767Debug.Assert(chars > charStart,
835Debug.Assert(chars > charStart + 1 || bytes == byteStart,
864Debug.Assert(chars > charStart,
899Debug.Assert(chars > charStart,
966Debug.Assert((encoder is not null && !encoder.MustFlush) || charLeftOver == (char)0,
969Debug.Assert(fallbackBuffer is null || fallbackBuffer.Remaining == 0 ||
978Debug.Assert(bytes is not null, "[UnicodeEncoding.GetCharCount]bytes!=null");
979Debug.Assert(count >= 0, "[UnicodeEncoding.GetCharCount]count >=0");
1013Debug.Assert(!decoder.InternalHasFallbackBuffer || decoder.FallbackBuffer.Remaining == 0,
1292Debug.Assert(fallbackBuffer is null || fallbackBuffer.Remaining == 0,
1301Debug.Assert(chars is not null, "[UnicodeEncoding.GetChars]chars!=null");
1302Debug.Assert(byteCount >= 0, "[UnicodeEncoding.GetChars]byteCount >=0");
1303Debug.Assert(charCount >= 0, "[UnicodeEncoding.GetChars]charCount >=0");
1304Debug.Assert(bytes is not null, "[UnicodeEncoding.GetChars]bytes!=null");
1320Debug.Assert(!decoder.InternalHasFallbackBuffer || decoder.FallbackBuffer.Remaining == 0,
1474Debug.Assert(bytes >= byteStart + 2 || chars == charStart,
1525Debug.Assert(bytes >= byteStart + 2 || chars == charStart,
1542Debug.Assert(bytes >= byteStart + 2 || chars == charStart,
1586Debug.Assert(bytes >= byteStart + 2 || chars == charStart,
1603Debug.Assert(bytes >= byteStart + 2 || chars == charStart,
1650Debug.Assert(bytes >= byteStart + 2 || chars == charStart,
1706Debug.Assert(!decoder.MustFlush || ((lastChar == (char)0) && (lastByte == -1)),
1716Debug.Assert(fallbackBuffer is null || fallbackBuffer.Remaining == 0,
src\libraries\System.Private.CoreLib\src\System\Text\UTF32Encoding.cs (26)
346Debug.Assert(chars is not null, "[UTF32Encoding.GetByteCount]chars!=null");
347Debug.Assert(count >= 0, "[UTF32Encoding.GetByteCount]count >=0");
410Debug.Assert(chars > charStart,
468Debug.Assert(fallbackBuffer.Remaining == 0,
478Debug.Assert(chars is not null, "[UTF32Encoding.GetBytes]chars!=null");
479Debug.Assert(bytes is not null, "[UTF32Encoding.GetBytes]bytes!=null");
480Debug.Assert(byteCount >= 0, "[UTF32Encoding.GetBytes]byteCount >=0");
481Debug.Assert(charCount >= 0, "[UTF32Encoding.GetBytes]charCount >=0");
551Debug.Assert(chars > charStart + 1 || bytes == byteStart,
579Debug.Assert(chars > charStart,
624Debug.Assert(chars > charStart,
661Debug.Assert(highSurrogate == 0 || (encoder is not null && !encoder.MustFlush),
679Debug.Assert(bytes is not null, "[UTF32Encoding.GetCharCount]bytes!=null");
680Debug.Assert(count >= 0, "[UTF32Encoding.GetCharCount]count >=0");
705Debug.Assert(fallbackBuffer.Remaining == 0,
812Debug.Assert(fallbackBuffer.Remaining == 0,
822Debug.Assert(chars is not null, "[UTF32Encoding.GetChars]chars!=null");
823Debug.Assert(bytes is not null, "[UTF32Encoding.GetChars]bytes!=null");
824Debug.Assert(byteCount >= 0, "[UTF32Encoding.GetChars]byteCount >=0");
825Debug.Assert(charCount >= 0, "[UTF32Encoding.GetChars]charCount >=0");
849Debug.Assert(baseDecoder is not null);
854Debug.Assert(fallbackBuffer.Remaining == 0,
919Debug.Assert(bytes >= byteStart + 4 || chars == charStart,
942Debug.Assert(bytes >= byteStart + 4 || chars == charStart,
959Debug.Assert(bytes >= byteStart + 4 || chars == charStart,
1027Debug.Assert(fallbackBuffer.Remaining == 0,
src\libraries\System.Private.CoreLib\src\System\Text\UTF7Encoding.cs (15)
62Debug.Assert(_base64Bytes.Length == 64);
382Debug.Assert(chars is not null, "[UTF7Encoding.GetByteCount]chars!=null");
383Debug.Assert(count >= 0, "[UTF7Encoding.GetByteCount]count >=0");
392Debug.Assert(byteCount >= 0, "[UTF7Encoding.GetBytes]byteCount >=0");
393Debug.Assert(chars is not null, "[UTF7Encoding.GetBytes]chars!=null");
394Debug.Assert(charCount >= 0, "[UTF7Encoding.GetBytes]charCount >=0");
531Debug.Assert(count >= 0, "[UTF7Encoding.GetCharCount]count >=0");
532Debug.Assert(bytes is not null, "[UTF7Encoding.GetCharCount]bytes!=null");
541Debug.Assert(byteCount >= 0, "[UTF7Encoding.GetChars]byteCount >=0");
542Debug.Assert(bytes is not null, "[UTF7Encoding.GetChars]bytes!=null");
543Debug.Assert(charCount >= 0, "[UTF7Encoding.GetChars]charCount >=0");
562Debug.Assert(!firstByte || decoder.bitCount <= 0,
840Debug.Assert(iCount < 0, "[DecoderUTF7FallbackBuffer.Fallback] Can't have recursive fallbacks");
841Debug.Assert(bytesUnknown.Length == 1, "[DecoderUTF7FallbackBuffer.Fallback] Only possible fallback case should be 1 unknown byte");
893Debug.Assert(iCount < 0, "[DecoderUTF7FallbackBuffer.InternalFallback] Can't have recursive fallbacks");
src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.cs (12)
206Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
207Debug.Assert(pChars is not null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
396Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
397Debug.Assert(pChars is not null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
398Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
399Debug.Assert(pBytes is not null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
598Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
599Debug.Assert(pBytes is not null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
600Debug.Assert(charCount >= 0, "Caller shouldn't specify negative length buffer.");
601Debug.Assert(pChars is not null || charCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
716Debug.Assert(byteCount >= 0, "Caller shouldn't specify negative length buffer.");
717Debug.Assert(pBytes is not null || byteCount == 0, "Input pointer shouldn't be null if non-zero length specified.");
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (22)
323Debug.Assert(IsCancellationRequested);
342Debug.Assert(IsCancellationCompleted, "Expected cancellation to have finished");
585Debug.Assert(this != s_neverCanceledSource, "This source should never be exposed via a CancellationToken.");
586Debug.Assert(callback is Action<object?> || callback is Action<object?, CancellationToken>);
621Debug.Assert(node.Prev == null, "Nodes in the free list should all have a null Prev");
679Debug.Assert(id != 0, "IDs should never be the reserved value 0.");
697Debug.Assert(IsCancellationCompleted, "Expected cancellation to have finished");
733Debug.Assert(IsCancellationRequested, "ExecuteCallbackHandlers should only be called after setting IsCancellationRequested->true");
770Debug.Assert(node.Registrations.Source == this);
771Debug.Assert(node.Prev == null);
834Debug.Assert(exceptionList.Count > 0, $"Expected {exceptionList.Count} > 0");
943Debug.Assert(s is CancellationTokenSource, $"Expected {typeof(CancellationTokenSource)}, got {s}");
987Debug.Assert(d is Action<object?> || d is Action<object?, CancellationToken>);
1033Debug.Assert(_lock == 1);
1055Debug.Assert(node != null, "Expected non-null node");
1056Debug.Assert(node.Registrations == this, "Expected node to come from this registrations instance");
1084Debug.Assert(node.Prev == null);
1089Debug.Assert(node.Prev != null);
1183Debug.Assert(_lock == 1);
1203Debug.Assert(registrations != null, "Expected non-null parent registrations");
1212Debug.Assert(Callback != null);
1220Debug.Assert(node.Callback != null);
src\libraries\System.Private.CoreLib\src\System\Threading\ExecutionContext.cs (23)
84Debug.Assert(isFlowSuppressed != m_isFlowSuppressed);
250Debug.Assert(threadPoolThread == Thread.CurrentThread);
298Debug.Assert(executionContext != null && !executionContext.m_isDefault, "ExecutionContext argument is Default.");
314Debug.Assert(currentThread == Thread.CurrentThread);
315Debug.Assert(contextToRestore != currentContext);
350Debug.Assert(!Thread.IsThreadStartSupported || Thread.CurrentThread.IsThreadPoolThread); // there are no dedicated threadpool threads on runtimes where we can't start threads
351Debug.Assert(Thread.CurrentThread._executionContext == null, "ThreadPool thread not on Default ExecutionContext.");
352Debug.Assert(Thread.CurrentThread._synchronizationContext == null, "ThreadPool thread not on Default SynchronizationContext.");
357Debug.Assert(previousExecutionCtx != nextExecutionCtx);
364Debug.Assert(previousChangeNotifications != null || nextChangeNotifications != null);
372Debug.Assert(previousExecutionCtx!.m_localValues != null);
373Debug.Assert(nextExecutionCtx!.m_localValues != null);
407Debug.Assert(previousExecutionCtx!.m_localValues != null);
421Debug.Assert(nextExecutionCtx!.m_localValues != null);
456Debug.Assert(!current.IsDefault);
457Debug.Assert(current.m_localValues != null, "Only the default context should have null, and we shouldn't be here on the default context");
470Debug.Assert(!current.IsDefault);
471Debug.Assert(current.m_localValues != null, "Only the default context should have null, and we shouldn't be here on the default context");
493Debug.Assert(!current.IsDefault);
494Debug.Assert(current.m_localValues != null, "Only the default context should have null, and we shouldn't be here on the default context");
513Debug.Assert(newChangeNotifications != null);
514Debug.Assert(Array.IndexOf(newChangeNotifications, local) >= 0);
556Debug.Assert(currentThread == Thread.CurrentThread);
src\libraries\System.Private.CoreLib\src\System\Threading\SemaphoreSlim.cs (14)
352Debug.Assert(m_asyncTail is not null, "tail should not be null if head isn't");
384Debug.Assert(!waitSuccessful || m_currentCount > 0,
631Debug.Assert(m_currentCount == 0, "m_currentCount should never be negative");
644Debug.Assert(Monitor.IsEntered(m_lockObjAndDisposed), "Requires the lock be held");
652Debug.Assert(m_asyncTail is null, "If head is null, so too should be tail");
658Debug.Assert(m_asyncTail is not null, "If head is not null, neither should be tail");
673Debug.Assert(task is not null, "Expected non-null task");
674Debug.Assert(Monitor.IsEntered(m_lockObjAndDisposed), "Requires the lock be held");
684Debug.Assert((m_asyncHead is null) == (m_asyncTail is null), "Head is null iff tail is null");
700Debug.Assert(asyncWaiter is not null, "Waiter should have been constructed");
701Debug.Assert(Monitor.IsEntered(m_lockObjAndDisposed), "Requires the lock be held");
790Debug.Assert(m_countOfWaitersPulsedToWake <= waitCount);
818Debug.Assert(m_asyncTail is not null, "tail should not be null if head isn't null");
892Debug.Assert(obj is SemaphoreSlim, "Expected a SemaphoreSlim");
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\ConcurrentExclusiveSchedulerPair.cs (26)
200Debug.Assert(ReadyToComplete, "The block must be ready to complete to be here.");
211Debug.Assert(state is ConcurrentExclusiveSchedulerPair);
213Debug.Assert(!localThis.m_completionState!.IsCompleted, "Completion should only happen once.");
219Debug.Assert(success, "Expected to complete completion task.");
230Debug.Assert(faultedTask != null && faultedTask.IsFaulted && faultedTask.Exception!.InnerExceptionCount > 0,
340else Debug.Assert(m_processingCount == EXCLUSIVE_PROCESSING_SENTINEL, "The processing count must be the sentinel if it's not >= 0.");
364Debug.Assert(m_processingCount == EXCLUSIVE_PROCESSING_SENTINEL, "Processing exclusive tasks requires being in exclusive mode.");
365Debug.Assert(!m_exclusiveTaskScheduler.m_tasks.IsEmpty, "Processing exclusive tasks requires tasks to be processed.");
370Debug.Assert(m_threadProcessingMode.Value == ProcessingMode.NotCurrentlyProcessing,
388Debug.Assert(m_threadProcessingMode.Value == ProcessingMode.ProcessingExclusiveTask,
399Debug.Assert(m_processingCount == EXCLUSIVE_PROCESSING_SENTINEL, "The processing mode should not have deviated from exclusive.");
412Debug.Assert(m_processingCount > 0, "Processing concurrent tasks requires us to be in concurrent mode.");
417Debug.Assert(m_threadProcessingMode.Value == ProcessingMode.NotCurrentlyProcessing,
446Debug.Assert(m_threadProcessingMode.Value == ProcessingMode.ProcessingConcurrentTasks,
457Debug.Assert(m_processingCount > 0, "The procesing mode should not have deviated from concurrent.");
524Debug.Assert(pair != null, "Scheduler must be associated with a valid pair.");
525Debug.Assert(processingMode == ProcessingMode.ProcessingConcurrentTasks || processingMode == ProcessingMode.ProcessingExclusiveTask,
527Debug.Assert(
547Debug.Assert(task != null, "Infrastructure should have provided a non-null task.");
563Debug.Assert(task != null, "Infrastructure should have provided a non-null task.");
573Debug.Assert(task != null, "Infrastructure should have provided a non-null task.");
647Debug.Assert(t.IsFaulted, "Task should be faulted due to the scheduler faulting it and throwing the exception.");
671Debug.Assert(scheduler != null, "Need a scheduler with which to construct the debug view.");
694Debug.Assert(pair != null, "Need a pair with which to construct the debug view.");
734Debug.Assert(syncObj != null, "The monitor object to check must be provided.");
735Debug.Assert(Monitor.IsEntered(syncObj) == held, "The locking scheme was not correctly followed.");
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\FutureFactory.cs (31)
497Debug.Assert((endFunction != null) != (endAction != null), "Expected exactly one of endFunction/endAction to be non-null");
641Debug.Assert((endFunction != null) != (endAction != null), "Both endFunction and endAction were non-null");
761Debug.Assert((endFunction != null) != (endAction != null), "Both endFunction and endAction were non-null");
783Debug.Assert(asyncResult.IsCompleted, "If the operation completed synchronously, it must be completed.");
878Debug.Assert((endFunction != null) != (endAction != null), "Both endFunction and endAction were non-null");
900Debug.Assert(asyncResult.IsCompleted, "If the operation completed synchronously, it must be completed.");
1003Debug.Assert((endFunction != null) != (endAction != null), "Both endFunction and endAction were non-null");
1025Debug.Assert(asyncResult.IsCompleted, "If the operation completed synchronously, it must be completed.");
1136Debug.Assert((endFunction != null) != (endAction != null), "Both endFunction and endAction were non-null");
1158Debug.Assert(asyncResult.IsCompleted, "If the operation completed synchronously, it must be completed.");
1197Debug.Assert(thisRef != null, "Expected a non-null thisRef");
1198Debug.Assert(beginMethod != null, "Expected a non-null beginMethod");
1199Debug.Assert(endMethod != null, "Expected a non-null endMethod");
1212Debug.Assert(asyncResult.IsCompleted, "If the operation completed synchronously, it must be completed.");
1240Debug.Assert(thisRef != null, "Expected a non-null thisRef");
1241Debug.Assert(endMethod != null, "Expected a non-null endMethod");
1270Debug.Assert(thisRef != null);
1287Debug.Assert(!IsCompleted, "The task should not have been completed yet.");
1316Debug.Assert(successfullySet, "Expected the task to not yet be completed");
1608Debug.Assert((continuationFunction != null) != (continuationAction != null), "Expected exactly one of endFunction/endAction to be non-null");
1634Debug.Assert(continuationAction != null);
1655Debug.Assert((continuationFunction != null) != (continuationAction != null), "Expected exactly one of endFunction/endAction to be non-null");
1679Debug.Assert(state is Func<Task[], TResult>);
1686Debug.Assert(continuationAction != null);
1691Debug.Assert(state is Action<Task[]>);
1979Debug.Assert((continuationFunction != null) != (continuationAction != null), "Expected exactly one of endFunction/endAction to be non-null");
1999Debug.Assert(state is Func<Task, TResult>);
2006Debug.Assert(continuationAction != null);
2010Debug.Assert(state is Action<Task>);
2029Debug.Assert((continuationFunction != null) != (continuationAction != null), "Expected exactly one of endFunction/endAction to be non-null");
2052Debug.Assert(continuationAction != null);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (124)
187Debug.Assert(task != null, "Null Task objects can't be added to the ActiveTasks collection");
328Debug.Assert(promiseStyle, "Promise CTOR: promiseStyle was false");
521Debug.Assert(m_contingentProperties == null || m_contingentProperties.m_capturedContext == null,
565Debug.Assert(illegalInternalOptions == 0, "TaskConstructorCore: Illegal internal options");
569Debug.Assert(m_stateFlags == 0, "TaskConstructorCore: non-zero m_stateFlags");
570Debug.Assert((((int)creationOptions) | (int)TaskStateFlags.OptionsMask) == (int)TaskStateFlags.OptionsMask, "TaskConstructorCore: options take too many bits");
597Debug.Assert((internalOptions & InternalTaskOptions.ContinuationTask) == 0, "TaskConstructorCore: Did not expect to see cancelable token for continuation task.");
639Debug.Assert(continuation != null);
685Debug.Assert(((int)TaskStateFlags.OptionsMask & 1) == 1, "OptionsMask needs a shift in Options.get");
740Debug.Assert((Options & (TaskCreationOptions)InternalTaskOptions.PromiseTask) != 0,
748Debug.Assert(success, "Tried to set enabled on completed Task");
778Debug.Assert(tasks != null, "Expected non-null array of tasks");
815Debug.Assert(isWaitNotificationEnabled, "Should only be called if the wait completion bit is set.");
833Debug.Assert(IsWaitNotificationEnabled, "Should only be called if the wait completion bit is set.");
874Debug.Assert(InternalCurrent == this, "Task.AddNewChild(): Called from an external context");
895Debug.Assert(InternalCurrent == this, "Task.DisregardChild(): Called from an external context");
898Debug.Assert(props.m_completionCountdown >= 2, "Task.DisregardChild(): Expected parent count to be >= 2");
1043Debug.Assert(scheduler != null, "Task.InternalRunSynchronously(): null TaskScheduler");
1113Debug.Assert(
1130Debug.Assert((m_stateFlags & (int)TaskStateFlags.Canceled) != 0, "Task.RunSynchronously: expected TaskStateFlags.Canceled to be set");
1260Debug.Assert((e == null) || IsFaulted, "Task.Exception_get(): returning non-null value when not Faulted");
1660Debug.Assert(m_taskScheduler != null, "expected a task scheduler to have been selected");
1661Debug.Assert((m_stateFlags & (int)TaskStateFlags.Started) == 0, "task has already started");
1683Debug.Assert(m_action != null, "Must have a delegate to be in ScheduleAndStart");
1708Debug.Assert(
1728Debug.Assert(exceptionObject != null, "Task.AddException: Expected a non-null exception object");
1739Debug.Assert(exceptionObject != null, "Task.AddException: Expected a non-null exception object");
1747Debug.Assert(
1753Debug.Assert(
1845Debug.Assert(m_contingentProperties != null && m_contingentProperties.m_exceptionsHolder != null, "ExceptionRecorded should imply this");
1863Debug.Assert(IsFaulted && ExceptionRecorded, "Must only be used when the task has faulted with exceptions.");
1871Debug.Assert(IsCanceled, "Must only be used when the task has canceled.");
1886Debug.Assert(IsCompleted, "ThrowIfExceptional(): Expected IsCompleted == true");
1991Debug.Assert(userDelegateExecute || m_contingentProperties != null);
2153Debug.Assert(childTask != null);
2154Debug.Assert(childTask.IsCompleted, "ProcessChildCompletion was called for an uncompleted task");
2156Debug.Assert(childTask.m_contingentProperties?.m_parent == this, "ProcessChildCompletion should only be called for a child of this task");
2198Debug.Assert(props != null);
2216Debug.Assert(task.IsCompleted, "Expected all tasks in list to be completed");
2220Debug.Assert(exceptionHolder != null);
2382Debug.Assert(obj is Task);
2393Debug.Assert(m_action != null, "Null action in InnerInvoke()");
2405Debug.Fail("Invalid m_action in Task");
2415Debug.Assert(unhandledException != null);
2485Debug.Assert(continuationAction != null);
2530Debug.Assert(!flowExecutionContext, "We already determined we're not required to flow context.");
2556Debug.Assert(stateMachineBox != null);
2629Debug.Assert(waitResult, "expected wait to succeed");
2785Debug.Assert((m_stateFlags & (int)TaskStateFlags.Faulted) == 0, "Task.Wait() completing when in Faulted state.");
2862Debug.Assert(source != null);
2863Debug.Assert(millisecondsDelay != 0);
2917Debug.Assert(completingTask.IsCompleted);
3007Debug.Assert(IsCompleted || millisecondsTimeout != Timeout.Infinite);
3147Debug.Assert((Options & (TaskCreationOptions)InternalTaskOptions.PromiseTask) == 0, "Task.InternalCancel() did not expect promise-style task");
3219Debug.Assert((m_stateFlags & IllegalFlags) == 0, "The continuation was in an invalid state.");
3220Debug.Assert((m_stateFlags & (int)TaskStateFlags.WaitingForActivation) != 0, "Expected continuation to be waiting for activation");
3221Debug.Assert(m_contingentProperties is null || m_contingentProperties.m_cancellationToken == default);
3239Debug.Assert((Options & (TaskCreationOptions)InternalTaskOptions.PromiseTask) != 0, "Task.RecordInternalCancellationRequest(CancellationToken) only valid for promise-style task");
3242Debug.Assert(m_contingentProperties!.m_cancellationToken == default);
3259Debug.Assert(edi != null, "Expected either an OCE or an EDI");
3261Debug.Assert(oce != null, "Expected EDI to contain an OCE");
3263Debug.Assert(oce.CancellationToken == tokenToRecord,
3274Debug.Assert((m_stateFlags & ((int)TaskStateFlags.Canceled | (int)TaskStateFlags.CompletionReserved)) != 0, "Task.CancellationCleanupLogic(): Task not canceled or reserved.");
3306Debug.Assert(this == InternalCurrent, "SetCancellationAcknowledged() should only be called while this is still the current task");
3307Debug.Assert(IsCancellationRequested, "SetCancellationAcknowledged() should not be called if the task's CT wasn't signaled");
3344Debug.Assert(exceptionObject != null, "Expected non-null exceptionObject argument");
3347Debug.Assert(
3389Debug.Assert(
3435Debug.Assert(continuationObject != null);
3537Debug.Assert(currentContinuation is TaskContinuation);
3574Debug.Assert(currentContinuation is ITaskCompletionAction);
4433Debug.Assert(continuationTask != null, "Task.ContinueWithCore(): null continuationTask");
4434Debug.Assert(scheduler != null, "Task.ContinueWithCore(): null scheduler");
4435Debug.Assert(!continuationTask.IsCompleted, "Did not expect continuationTask to be completed");
4517Debug.Assert(tc != null, "Expected non-null tc object in AddTaskContinuationComplex");
4520Debug.Assert(oldValue is not null, "Expected non-null m_continuationObject object");
4556Debug.Assert(oldValue == s_taskCompletionSentinel, "Expected m_continuationObject to be list or sentinel");
4594Debug.Assert(tc != null);
4690Debug.Assert(waitResult, "expected wait to succeed");
4710Debug.Assert(waitResult, "expected wait to succeed");
5014Debug.Assert(exceptions != null, "Should have seen at least one exception");
5040Debug.Assert(tasks != null, "Expected a non-null list of tasks");
5041Debug.Assert(tasks.Count > 0, "Expected at least one task");
5087Debug.Assert(count > 0, "Expected count > 0");
5094Debug.Assert(_count >= 0, "Count should never go below 0");
5137Debug.Assert(tasks.Length == 0 || waitResult != -1, "expected wait to succeed");
5312Debug.Assert(firstCompleted.Status == TaskStatus.RanToCompletion);
5314Debug.Assert(signaledTaskIndex >= 0);
5401Debug.Assert(succeeded, "This should always succeed on a new task.");
5415Debug.Assert(succeeded, "This should always succeed on a new task.");
5445Debug.Assert(exception != null);
5449Debug.Assert(succeeded, "This should always succeed on a new task.");
5459Debug.Assert(exception != null);
5463Debug.Assert(succeeded, "This should always succeed on a new task.");
5752Debug.Assert(millisecondsDelay != 0);
5811Debug.Assert(token.CanBeCanceled);
5987Debug.Assert(tasks.Length != 0, "Expected a non-zero length task array");
5988Debug.Assert(m_stateObject is null, "Expected to be able to use the state object field for faulted/canceled tasks.");
6063Debug.Assert(failedOrCanceled is Task, $"Expected Task, got {failedOrCanceled}");
6072Debug.Assert(failedOrCanceled is List<Task>);
6095Debug.Assert(completed);
6127Debug.Assert(failedOrCanceled is Task);
6133Debug.Assert(observedExceptions.Count > 0, "Expected at least one exception");
6145Debug.Assert(IsCompleted);
6148Debug.Assert(_remainingToComplete >= 0, "Count should never go below 0");
6339Debug.Assert(tasks != null, "Expected a non-null task array");
6340Debug.Assert(tasks.Length > 0, "Expected a non-zero length task array");
6378Debug.Assert(task != null, "Constituent task in WhenAll should never be null");
6391Debug.Assert(task.Status == TaskStatus.RanToCompletion);
6403Debug.Assert(observedExceptions.Count > 0, "Expected at least one exception");
6424Debug.Assert(m_count >= 0, "Count should never go below 0");
6565Debug.Assert(task1 != null && task2 != null);
6601Debug.Assert(task1 != null && task2 != null);
6602Debug.Assert(task1.IsCompleted || task2.IsCompleted);
6625Debug.Assert(success, "Only one task should have gotten to this point, and thus this must be successful.");
6860Debug.Assert(_waitForNextCompletedTask.GetStatus(_waitForNextCompletedTask.Version) == ValueTaskSourceStatus.Pending);
6981Debug.Assert(outerTask != null);
7324Debug.Assert(outerTask != null, "Expected non-null outerTask");
7378Debug.Assert(result, "Expected TrySetFromTask from inner task to succeed");
7381Debug.Fail("UnwrapPromise in illegal state");
7405Debug.Assert(task != null && task.IsCompleted, "Expected non-null, completed outer task");
7406Debug.Assert(_state == STATE_WAITING_ON_OUTER_TASK, "We're in the wrong state!");
7418Debug.Assert(result, "Expected TrySetFromTask from outer task to succeed");
7435Debug.Assert(task != null && task.IsCompleted, "TrySetFromTask: Expected task to have completed.");
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskContinuation.cs (34)
18Debug.Assert(action is Action<Task> || action is Action<Task, object?>,
31Debug.Assert(antecedent != null,
39Debug.Assert(m_action != null);
51Debug.Fail("Invalid m_action in ContinuationTaskFromTask");
64Debug.Assert(function is Func<Task, TResult> || function is Func<Task, object?, TResult>,
77Debug.Assert(antecedent != null,
85Debug.Assert(m_action != null);
97Debug.Fail("Invalid m_action in ContinuationResultTaskFromTask");
110Debug.Assert(action is Action<Task<TAntecedentResult>> || action is Action<Task<TAntecedentResult>, object?>,
123Debug.Assert(antecedent != null,
131Debug.Assert(m_action != null);
143Debug.Fail("Invalid m_action in ContinuationTaskFromResultTask");
156Debug.Assert(function is Func<Task<TAntecedentResult>, TResult> || function is Func<Task<TAntecedentResult>, object?, TResult>,
169Debug.Assert(antecedent != null,
177Debug.Assert(m_action != null);
189Debug.Fail("Invalid m_action in ContinuationResultTaskFromResultTask");
216Debug.Assert(task != null);
217Debug.Assert(task.m_taskScheduler != null);
274Debug.Assert(task != null, "TaskContinuation ctor: task is null");
275Debug.Assert(scheduler != null, "TaskContinuation ctor: scheduler is null");
291Debug.Assert(completedTask != null);
292Debug.Assert(completedTask.IsCompleted, "ContinuationTask.Run(): completedTask not completed");
295Debug.Assert(continuationTask != null);
369Debug.Assert(state is Action);
385Debug.Assert(context != null);
418Debug.Assert(state is SynchronizationContextAwaitTaskContinuation);
466Debug.Assert(scheduler != null);
534Debug.Assert(action != null);
549Debug.Assert(action != null);
550Debug.Assert(scheduler != null);
669Debug.Assert(state is Action);
683Debug.Assert(callback != null);
684Debug.Assert(currentTask == Task.t_currentTask);
826Debug.Assert(m_action != null);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\TaskExceptionHolder.cs (17)
47Debug.Assert(task != null, "Expected a non-null task.");
92Debug.Assert(exceptionObject != null, "TaskExceptionHolder.Add(): Expected a non-null exceptionObject");
93Debug.Assert(
109Debug.Assert(exceptionObject != null, "Expected exceptionObject to be non-null.");
111Debug.Assert(m_cancellationException == null,
116Debug.Assert(m_faultExceptions == null,
129Debug.Assert(edi != null && edi.SourceException is OperationCanceledException,
145Debug.Assert(exceptionObject != null, "AddFaultException(): Expected a non-null exceptionObject");
173Debug.Assert(exc != null, "No exceptions should be null");
179Debug.Assert(numExceptions > 0, "Collection should contain at least one exception.");
189Debug.Assert(exceptions.Count > 0, "There should be at least one dispatch info.");
192Debug.Assert(tmp != null, "No dispatch infos should be null");
255Debug.Assert(exceptions != null, "Expected an initialized list.");
256Debug.Assert(exceptions.Count > 0, "Expected at least one exception.");
284Debug.Assert(exceptions != null, "Expected an initialized list.");
285Debug.Assert(exceptions.Count > 0, "Expected at least one exception.");
300Debug.Assert(edi == null || edi.SourceException is OperationCanceledException,
System\Xml\BinaryXml\SqlUtils.cs (17)
85Debug.Assert(rgulU.Length == s_cNumeMax);
92Debug.Assert(iulD != 0, "iulD != 0", "Divided by zero!");
93Debug.Assert(iulD > 0, "iulD > 0", "Invalid data: less than zero");
94Debug.Assert(ciulU > 0, "ciulU > 0", "No data in the array");
130Debug.Assert(bPrec <= s_maxPrecision && bPrec > 0, "bPrec <= MaxPrecision && bPrec > 0", "Invalid numeric precision");
136Debug.Assert(uiDigit < 10);
250Debug.Assert(m_bScale <= s_NUMERIC_MAX_PRECISION, "m_bScale <= NUMERIC_MAX_PRECISION", "In AssertValid");
251Debug.Assert(m_bScale <= m_bPrec, "m_bScale <= m_bPrec", "In AssertValid");
252Debug.Assert(m_bScale >= 0, "m_bScale >= 0", "In AssertValid");
253Debug.Assert(m_bPrec > 0, "m_bPrec > 0", "In AssertValid");
254Debug.Assert(CLenFromPrec(m_bPrec) >= m_bLen, "CLenFromPrec(m_bPrec) >= m_bLen", "In AssertValid");
255Debug.Assert(m_bLen <= s_cNumeMax, "m_bLen <= x_cNumeMax", "In AssertValid");
262Debug.Assert(m_bLen == 1, "m_bLen == 1", "In AssertValid");
267Debug.Assert(rglData[iulData] == 0, "rglData[iulData] == 0", "In AssertValid");
323Debug.Assert(val >= 0 && val < 100);
329Debug.Assert(val > -10000 && val < 10000);
341Debug.Assert(val >= 0 && val < 1000);
System\Xml\Cache\XPathNode.cs (14)
154Debug.Assert(HasCollapsedText, "Do not call CollapsedLinePosition unless HasCollapsedText is true.");
173Debug.Assert(pageNode != null);
211Debug.Assert(localName == null || (object?)Document.NameTable.Get(localName) == (object)localName, "localName must be atomized.");
223Debug.Assert(localName == null || (object?)Document.NameTable.Get(localName) == (object)localName, "localName must be atomized.");
361Debug.Assert(info != null && idxParent <= ushort.MaxValue);
372Debug.Assert(lineNumOffset >= 0 && lineNumOffset <= MaxLineNumberOffset, $"Line number offset too large or small: {lineNumOffset}");
373Debug.Assert(linePosOffset >= 0 && linePosOffset <= MaxLinePositionOffset, $"Line position offset too large or small: {linePosOffset}");
383Debug.Assert(posOffset >= 0 && posOffset <= MaxCollapsedPositionOffset, $"Collapsed text line position offset too large or small: {posOffset}");
400Debug.Assert(NodeType == XPathNodeType.Element);
411Debug.Assert(NodeType == XPathNodeType.Element);
439Debug.Assert(pageSibling != null && idxSibling != 0 && idxSibling <= ushort.MaxValue, "Bad argument");
440Debug.Assert(_idxSibling == 0, "SetSibling should not be called more than once.");
458Debug.Assert(pageSimilar != null && idxSimilar != 0 && idxSimilar <= ushort.MaxValue, "Bad argument");
459Debug.Assert(_idxSimilar == 0, "SetSimilarElement should not be called more than once.");
System\Xml\Cache\XPathNodeHelper.cs (34)
26Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element);
70Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
75Debug.Assert(pageNode[idxNode].NodeType == XPathNodeType.Attribute);
89Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
109Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
119Debug.Assert(idx != 0);
120Debug.Assert(page != null);
138Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
161Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
179Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
180Debug.Assert(idxNode <= ushort.MaxValue);
181Debug.Assert(pageNode[0].PageInfo!.PageNumber <= short.MaxValue);
194Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
200Debug.Assert(idx != 0);
228Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
261Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
299Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
312Debug.Assert(typ != XPathNodeType.Attribute && typ != XPathNodeType.Namespace);
331Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
332Debug.Assert(pageNode[idxNode].NodeType != XPathNodeType.Attribute);
348Debug.Assert(pagePrec != null);
369Debug.Assert(idxAnc != 0 && pageAnc != null);
394Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
428Debug.Assert(pageCurrent != null && idxCurrent != 0, "Cannot pass null argument(s)");
454Debug.Assert(page != null);
527Debug.Assert(pageCurrent != null && idxCurrent != 0, "Cannot pass null argument(s)");
528Debug.Assert(typ != XPathNodeType.Text, "Text should be handled by GetTextFollowing in order to take into account collapsed text.");
529Debug.Assert(page[idx].NodeType != XPathNodeType.Attribute, "Current node should never be an attribute or namespace--caller should handle this case.");
566Debug.Assert(!page[idx].IsAttrNmsp, "GetContentFollowing should never return attributes or namespaces.");
585Debug.Assert(pageCurrent != null && idxCurrent != 0, "Cannot pass null argument(s)");
586Debug.Assert(!page[idx].IsAttrNmsp, "Current node should never be an attribute or namespace--caller should handle this case.");
662Debug.Assert(pageNode[idxNode].HasAttribute || pageNode[idxNode].HasContentChild, "Caller must check HasAttribute/HasContentChild on parent before calling GetChild.");
663Debug.Assert(pageNode[idxNode].HasAttribute || !pageNode[idxNode].HasCollapsedText, "Text child is virtualized and therefore is not present in the physical node page.");
669Debug.Assert(pageNode != null);
System\Xml\Core\XmlTextReaderImpl.cs (294)
317Debug.Assert(nt != null);
330Debug.Assert(_index == 0);
371Debug.Assert(_nameTableFromSettings == false);
393Debug.Assert(_index == 0);
442Debug.Fail($"Unexpected conformance level {settings.ConformanceLevel}");
601Debug.Assert(baseUri == null);
629Debug.Assert(_laterInitParam != null);
630Debug.Assert(_laterInitParam.inputUriResolver != null);
631Debug.Assert(_laterInitParam.inputbaseUri != null);
632Debug.Assert(_reportedBaseUri != null);
699Debug.Assert(baseUri == null);
730Debug.Assert(_laterInitParam != null);
731Debug.Assert(_laterInitParam.inputStream != null);
732Debug.Assert(_reportedBaseUri != null);
763Debug.Assert(baseUriStr == string.Empty, "BaseURI can come either from XmlParserContext or from the constructor argument, not from both");
789Debug.Assert(_laterInitParam != null);
790Debug.Assert(_laterInitParam.inputTextReader != null);
791Debug.Assert(_reportedBaseUri != null);
812Debug.Assert(xmlFragment != null);
838default: Debug.Fail($"Unexpected fragment type {_fragmentType}"); goto case XmlNodeType.None;
1195Debug.Assert(_laterInitParam != null);
1210Debug.Fail("Invalid InitInputType");
1234Debug.Assert(_nextParsingFunction == ParsingFunction.DocumentContent);
1237Debug.Assert(!_ps.appendMode);
1265Debug.Assert(_parsingFunction == ParsingFunction.ElementContent ||
1270Debug.Assert(_curNode.type == XmlNodeType.Element);
1334Debug.Fail($"Unexpected parsing function {_parsingFunction}");
1362Debug.Fail($"Unexpected parsing function {_parsingFunction}");
1394Debug.Assert(_curNode.type == XmlNodeType.EndElement);
1395Debug.Assert(_parsingFunction != ParsingFunction.Eof);
1415Debug.Assert(_namespaceManager != null);
1498Debug.Assert(_parsingMode == ParsingMode.Full);
1517Debug.Fail("Unexpected entity type");
1543Debug.Fail("Unexpected entity type");
1559Debug.Assert(value is XmlTextReader);
1578Debug.Assert(_outerReader is XmlTextReaderImpl);
1867Debug.Assert(_ps.chars != null);
1891Debug.Assert(_ps.chars != null);
1944Debug.Assert(_namespaceManager != null);
1952Debug.Assert(_namespaceManager != null);
1988Debug.Assert(_namespaceManager != null);
2008Debug.Assert(_v1Compat, "XmlTextReaderImpl.Normalization property cannot be accessed on reader created via XmlReader.Create.");
2013Debug.Assert(_v1Compat, "XmlTextReaderImpl.Normalization property cannot be changed on reader created via XmlReader.Create.");
2041Debug.Assert(_v1Compat, "XmlTextReaderImpl.WhitespaceHandling property cannot be accessed on reader created via XmlReader.Create.");
2046Debug.Assert(_v1Compat, "XmlTextReaderImpl.WhitespaceHandling property cannot be changed on reader created via XmlReader.Create.");
2066Debug.Assert(_v1Compat, "XmlTextReaderImpl.DtdProcessing property cannot be accessed on reader created via XmlReader.Create.");
2071Debug.Assert(_v1Compat, "XmlTextReaderImpl.DtdProcessing property cannot be changed on reader created via XmlReader.Create.");
2123Debug.Assert(_v1Compat, "XmlTextReaderImpl.ResetState cannot be called on reader created via XmlReader.Create.");
2137Debug.Assert(_namespaceManager != null);
2165Debug.Assert(_v1Compat, "XmlTextReaderImpl.GetRemainder cannot be called on reader created via XmlReader.Create.");
2166Debug.Assert(_stringBuilder.Length == 0);
2206Debug.Assert(_v1Compat, "XmlTextReaderImpl.ReadChars cannot be called on reader created via XmlReader.Create.");
2207Debug.Assert(_outerReader is XmlTextReader);
2242Debug.Assert(_v1Compat, "XmlTextReaderImpl.ReadBase64 cannot be called on reader created via XmlReader.Create.");
2243Debug.Assert(_outerReader is XmlTextReader);
2276Debug.Assert(_v1Compat, "XmlTextReaderImpl.ReadBinHex cannot be called on reader created via XmlReader.Create.");
2277Debug.Assert(_outerReader is XmlTextReader);
2404Debug.Assert(value >= 0 && value <= _ps.charsUsed);
2490Debug.Assert(_parsingMode == ParsingMode.Full);
2578Debug.Assert(_parsingStatesStackTop == -1);
2579Debug.Assert((systemId != null && systemId.Length > 0) || (publicId != null && publicId.Length > 0));
2586Debug.Assert(_xmlResolver != null);
2598Debug.Assert(_ps.appendMode);
2614Debug.Assert(_parsingStatesStackTop == -1);
2615Debug.Assert(internalDtd != null);
2788Debug.Assert(InAttributeValueIterator);
2825Debug.Assert(baseUriStr != null);
2831Debug.Assert(baseUri != null);
2842Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.textReader == null);
2843Debug.Assert(baseUriStr != null);
2844Debug.Assert(baseUri == null || (baseUri.ToString().Equals(baseUriStr)));
2917Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.stream == null);
2918Debug.Assert(baseUriStr != null);
2946Debug.Assert(_ps.stream == null && _ps.textReader == null);
2947Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0);
2948Debug.Assert(baseUriStr != null);
2949Debug.Assert(str != null);
3004Debug.Assert(_parsingFunction == ParsingFunction.SwitchToInteractiveXmlDecl);
3008Debug.Assert(_parsingFunction == ParsingFunction.SwitchToInteractiveXmlDecl);
3009Debug.Assert(_nextParsingFunction == ParsingFunction.DocumentContent);
3034Debug.Assert(context != null && context.HasDtdInfo);
3048Debug.Fail("Unhandled DtdProcessing enumeration value.");
3056Debug.Assert(_url != null && _url.Length > 0);
3081Debug.Assert(_ps.stream != null);
3089Debug.Assert(_ps.bytes != null);
3090Debug.Assert(_ps.bytePos == 0);
3176Debug.Assert(_ps.charPos == 0);
3194Debug.Assert(_ps.encoding != null);
3195Debug.Assert(_ps.bytes != null);
3206Debug.Assert(_ps.encoding != null);
3209Debug.Assert(_ps.stream != null);
3221Debug.Assert(_ps.encoding != null);
3270Debug.Assert(newEncoding != null);
3271Debug.Assert(newEncoding.EncodingName != "UTF-8");
3285Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null);
3286Debug.Assert(_ps.appendMode, "UnDecodeChars cannot be called after ps.appendMode has been changed to false");
3288Debug.Assert(_ps.charsUsed >= _ps.charPos, "The current position must be in the valid character range.");
3296Debug.Assert(_charactersInDocument >= _ps.charsUsed - _ps.charPos,
3305Debug.Assert(_charactersFromEntities >= _ps.charsUsed - _ps.charPos,
3314Debug.Assert(_ps.encoding != null);
3315Debug.Assert(_ps.chars != null);
3341Debug.Assert(_ps.chars != null);
3364Debug.Assert(_ps.bytes != null);
3423Debug.Assert(_ps.bytes != null);
3438Debug.Assert(_ps.bytes != null);
3477Debug.Assert(_ps.charsUsed < _ps.chars.Length);
3488Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null);
3489Debug.Assert(_ps.chars != null);
3490Debug.Assert(maxCharsCount <= _ps.chars.Length - _ps.charsUsed - 1);
3514Debug.Assert(maxCharsCount >= charsCount);
3529Debug.Assert(_ps.decoder != null);
3530Debug.Assert(_ps.bytes != null);
3531Debug.Assert(_ps.chars != null);
3537Debug.Fail("We should get an exception again.");
3579Debug.Assert(_ps.chars != null);
3609Debug.Assert(_stringBuilder.Length == 0 || isTextDecl);
3653Debug.Assert(_ps.encoding != null);
3730Debug.Assert(attr != null);
3762Debug.Assert(attr != null);
3788Debug.Assert(attr != null);
3804Debug.Assert(attr != null);
3819Debug.Assert(!isTextDecl);
3825Debug.Assert(attr != null);
3831Debug.Fail($"Unexpected xmlDeclState {xmlDeclState}");
3871Debug.Assert(_ps.encoding != null);
3895Debug.Assert(_ps.chars != null);
4077Debug.Assert(pos == _ps.charsUsed && !_ps.isEof);
4097Debug.Assert(_index == 0);
4120Debug.Assert(_ps.chars != null);
4294Debug.Assert(_ps.chars != null);
4360Debug.Assert(_namespaceManager != null);
4452Debug.Assert(_curNode.type == XmlNodeType.Element);
4453Debug.Assert(_dtdInfo != null);
4545Debug.Assert(_ps.chars != null);
4625Debug.Fail("We should never get to this point.");
4634Debug.Assert(_index > 0);
4639Debug.Assert(_curNode == startTagNode);
4656Debug.Assert(_ps.chars != null);
4666Debug.Assert(startTag.type == XmlNodeType.EntityReference);
4675Debug.Assert(_ps.chars != null);
4679Debug.Assert(_attrCount == 0);
4728Debug.Assert(_curNode.type == XmlNodeType.Element);
4736Debug.Assert(_curNode.type == XmlNodeType.Element);
4840Debug.Assert(attrNameLineNo == _ps.LineNo);
4887Debug.Assert(val == XmlComplianceUtil.CDataNormalize(val), "The attribute value is not CDATA normalized!");
4962Debug.Assert(_curNode.type == XmlNodeType.Element);
5096Debug.Assert(_ps.chars != null);
5103Debug.Assert(_stringBuilder.Length == 0);
5258Debug.Assert(_ps.entity != null);
5312Debug.Fail("We should never get to this point.");
5315Debug.Assert(_ps.isEof);
5333Debug.Fail("no EndEntity reporting while parsing attributes");
5373Debug.Assert(attr.nextAttrValueChunk == null);
5402Debug.Assert(_stringBuilder.Length == 0);
5418Debug.Assert(endPos - startPos > 0);
5419Debug.Assert(_ps.chars != null);
5442Debug.Assert(_stringBuilder.Length > 0);
5463Debug.Assert(endPos - startPos > 0);
5464Debug.Assert(_ps.chars != null);
5539Debug.Assert(_ps.chars != null);
5729Debug.Assert(_ps.isEof);
5771Debug.Assert(_stringBuilder.Length == 0);
5772Debug.Assert(_parsingFunction == ParsingFunction.PartialTextValue ||
5786Debug.Assert(_stringBuilder.Length > 0);
5840Debug.Assert(_parsingFunction == ParsingFunction.PartialTextValue || _parsingFunction == ParsingFunction.InReadValueChunk ||
5850Debug.Assert(_parsingFunction == ParsingFunction.InReadValueChunk);
5855Debug.Assert((_index > 0) ? _nextParsingFunction == ParsingFunction.ElementContent : _nextParsingFunction == ParsingFunction.DocumentContent);
5867Debug.Assert(_parsingFunction == ParsingFunction.InReadContentAsBinary || _parsingFunction == ParsingFunction.InReadElementContentAsBinary);
5872Debug.Assert((_index > 0) ? _nextParsingFunction == ParsingFunction.ElementContent : _nextParsingFunction == ParsingFunction.DocumentContent);
5900Debug.Assert(_stringBuilder.Length == 0);
5904Debug.Assert(_ps.chars != null);
5942Debug.Assert(_ps.chars != null);
5943Debug.Assert(_ps.chars[_ps.charPos] == '&');
5952Debug.Assert(_ps.chars != null);
5953Debug.Assert(_ps.chars[_ps.charPos] == '&');
5968Debug.Assert(entityType == EntityType.CharacterDec || entityType == EntityType.CharacterHex);
6046Debug.Assert(entity != null);
6122Debug.Fail($"Unexpected parsing states stack top {_parsingStatesStackTop}");
6163Debug.Assert(_lastEntity != null);
6169Debug.Assert(_curNode.depth == _index);
6182Debug.Assert(_curNode.type == XmlNodeType.EntityReference);
6183Debug.Assert(_lastEntity != null);
6184Debug.Assert(Ref.Equal(_lastEntity.Name, _curNode.localName));
6203Debug.Assert(_stringBuilder.Length == 0);
6207Debug.Assert(_ps.chars != null);
6230Debug.Assert(_ps.charPos < _ps.charsUsed);
6274Debug.Assert(_stringBuilder.Length == 0);
6308Debug.Assert(_ps.chars != null);
6330Debug.Assert(!_ps.eolNormalized);
6477Debug.Assert(_stringBuilder.Length == 0);
6480Debug.Assert(_ps.chars != null);
6513Debug.Assert(_ps.chars != null);
6537Debug.Assert(!_ps.eolNormalized);
6686Debug.Assert(_ps.chars != null);
6719Debug.Assert(_dtdProcessing == DtdProcessing.Ignore);
6751Debug.Assert(_ps.chars != null);
6848Debug.Assert(_ps.chars != null);
6867Debug.Assert(_ps.chars != null);
7045Debug.Fail("We should never get to this point.");
7048Debug.Assert(_ps.isEof);
7064Debug.Assert(_ps.chars != null);
7146Debug.Fail("We should never get to this point.");
7149Debug.Assert(_ps.isEof);
7158Debug.Assert(_ps.chars != null);
7159Debug.Assert(_ps.chars[startPos] == '&');
7192Debug.Assert(_ps.chars != null);
7193Debug.Assert(_ps.chars[_ps.charPos] == '&');
7213Debug.Assert(_ps.chars != null);
7214Debug.Assert(_ps.chars[startPos] == '&' && _ps.chars[startPos + 1] == '#');
7269Debug.Assert(badDigitExceptionString != null);
7321Debug.Assert(pos > 0);
7355Debug.Assert(_ps.chars != null);
7356Debug.Assert(_ps.chars[_ps.charPos] == '&');
7376Debug.Assert(startPos < _ps.charsUsed);
7377Debug.Assert(_ps.chars != null);
7378Debug.Assert(_ps.chars[startPos] == '&');
7379Debug.Assert(_ps.chars[startPos + 1] != '#');
7487Debug.Assert(pos > 0);
7512Debug.Assert(_ps.chars != null);
7575Debug.Assert(_ps.chars != null);
7608Debug.Assert(_ps.chars != null);
7623Debug.Assert(nodeIndex < _nodes.Length);
7624Debug.Assert(_nodes[_nodes.Length - 1] == null);
7637Debug.Assert(nodeIndex < _nodes.Length);
7644Debug.Assert(nodeIndex < _nodes.Length);
7661Debug.Assert(_ps.chars != null);
7714Debug.Assert(attr.type == XmlNodeType.Attribute);
7730Debug.Assert(_namespaceManager != null);
7749Debug.Assert(_ps.isEof);
7762Debug.Assert(_namespaceManager != null);
7800Debug.Assert(_namespaceManager != null);
7813Debug.Assert(_xmlContext.defaultNamespace == uri);
7850Debug.Assert(_curNode.xmlContextPushed);
7892Debug.Assert(_xmlResolver != null);
7950Debug.Assert(_xmlResolver != null);
7967Debug.Assert(_xmlResolver.SupportsType(uri, typeof(Stream)), "Stream must always be a supported type in XmlResolver");
7987Debug.Assert(entity.IsExternal);
7991Debug.Assert(_xmlResolver != null);
8002Debug.Assert(_ps.appendMode);
8033Debug.Assert(!entity.IsExternal);
8099Debug.Assert(_parsingStatesStackTop == -1);
8115Debug.Assert(_parsingStatesStackTop >= 0);
8116Debug.Assert(_parsingStatesStack != null);
8163Debug.Assert(_incReadDecoder != null);
8173Debug.Assert(_incReadDecoder != null);
8174Debug.Assert(_ps.chars != null);
8223Debug.Assert(_ps.chars.AsSpan(_ps.charPos - 2).StartsWith("?>"));
8231Debug.Assert(_ps.chars.AsSpan(_ps.charPos - 3).StartsWith("-->"));
8239Debug.Assert(_ps.chars.AsSpan(_ps.charPos - 3).StartsWith("]]>"));
8261Debug.Fail($"Unexpected read state {_incReadState}");
8264Debug.Assert(_incReadState == IncrementalReadState.Text ||
8373Debug.Assert(_ps.charPos - pos == 0);
8374Debug.Assert(_ps.charPos - startPos == 0);
8413Debug.Assert(_ps.charPos - pos == 0);
8414Debug.Assert(_ps.charPos - startPos == 0);
8511Debug.Assert(count == charsParsed || _incReadDecoder.IsFull, "Check if decoded consumed all characters unless it's full.");
8528Debug.Assert(IncrementalRead() == 0, "Previous call of IncrementalRead should eat up all characters!");
8534Debug.Assert(_fragmentType == XmlNodeType.Attribute);
8551Debug.Assert(_parsingFunction == ParsingFunction.InReadAttributeValue);
8564Debug.Assert(_ps.chars != null);
8579Debug.Assert(_stringBuilder.Length == 0);
8590Debug.Assert(_ps.eolNormalized, "Entity replacement text for attribute values should be EOL-normalized!");
8645Debug.Fail("We should never get to this point.");
8703Debug.Fail("We should never get to this point.");
8783Debug.Assert(_ps.chars != null);
8796Debug.Assert(_ps.charPos < _ps.charsUsed);
8861Debug.Assert(_ps.chars != null);
8874Debug.Assert(_dtdInfo == null && _fragmentParserContext != null && _fragmentParserContext.HasDtdInfo);
8890Debug.Assert(_parsingFunction != ParsingFunction.InReadContentAsBinary);
8917Debug.Assert(_parsingFunction != ParsingFunction.InReadElementContentAsBinary);
8918Debug.Assert(_curNode.type == XmlNodeType.Element);
9001Debug.Assert(context != null);
9022Debug.Assert(nt != null);
9023Debug.Assert(context.NameTable == null || context.NameTable == nt, "This check should have been done in XmlParserContext constructor.");
9039Debug.Assert(_nameTableFromSettings == false);
9064Debug.Assert(_dtdInfo == null);
9122Debug.Assert(_curNode.type == XmlNodeType.Whitespace && newNodeType == XmlNodeType.SignificantWhitespace, "Incorrect node type change!");
9224Debug.Assert(attr != null);
9245Debug.Assert(_namespaceManager != null);
9248Debug.Assert(prefix != null);
9266Debug.Assert(attr != null);
9298Debug.Assert(_nodes[_index].type == XmlNodeType.Element);
9316Debug.Assert(_nodes[_index].type == XmlNodeType.Element);
9317Debug.Assert(_namespaceManager != null);
9351Debug.Assert(_incReadDecoder != null);
9385Debug.Assert(_ps.chars != null);
9464Debug.Assert(_parsingFunction != ParsingFunction.InReadElementContentAsBinary);
9520Debug.Assert(characters >= 0);
9562Debug.Assert(startPos >= 0);
9563Debug.Assert(endPos < chars.Length);
9564Debug.Assert(startPos <= endPos);
9571Debug.Assert(startPos >= 0);
9572Debug.Assert(endPos < str.Length);
9573Debug.Assert(startPos <= endPos);
System\Xml\Schema\XmlValueConverter.cs (9)
235Debug.Assert(schemaType != null && datatype != null, "schemaType or schemaType.Datatype may not be null");
242Debug.Assert(schemaType.Datatype!.Variety != XmlSchemaDatatypeVariety.List, "schemaType must be list's item type, not list itself");
270Debug.Fail($"Type code {typeCode} is not supported.");
282Debug.Assert(_clrTypeDefault!.IsArray);
435Debug.Assert(_typeCode == XmlTypeCode.Item, "If SchemaType is null, then TypeCode may only be Item, Node, or AnyAtomicType");
2919Debug.Assert(!(atomicConverter is XmlListConverter) || ((XmlListConverter)atomicConverter).atomicConverter == null,
3051Debug.Assert(enumSrc != null, "Value passed to ToArray must implement IEnumerable");
3079Debug.Assert(enumSrc != null, "Value passed to ToArray must implement IEnumerable");
3146Debug.Assert(schemaType.DerivedBy == XmlSchemaDerivationMethod.Union);
System\Xml\Xsl\IlGen\XmlILConstructAnalyzer.cs (30)
130Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
143Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
156Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
169Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
182Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
195Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
196Debug.Assert(value);
219Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
220Debug.Assert(value);
243Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
244Debug.Assert(value);
268Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
297Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
311Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
325Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
339Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
353Debug.Assert(!_isReadOnly, "This XmlILConstructInfo instance is read-only.");
442Debug.Assert(ndContent != null);
491case QilNodeType.NamespaceDecl: Debug.Assert(ndContent == null); break;
492case QilNodeType.TextCtor: Debug.Assert(ndContent == null); break;
493case QilNodeType.RawTextCtor: Debug.Assert(ndContent == null); break;
497case QilNodeType.XsltCopyOf: Debug.Assert(ndContent == null); break;
501default: Debug.Fail($"{ndConstr.NodeType} is not handled by XmlILStateAnalyzer."); break;
715Debug.Assert(!typ.IsSingleton);
751Debug.Assert(!typ.IsSingleton);
801Debug.Assert(ndElem!.NodeType == QilNodeType.ElementCtor);
839Debug.Assert(binaryNode != null);
858Debug.Assert(ndName != null);
1059Debug.Assert(nd.NodeType == QilNodeType.NamespaceDecl);
1095Debug.Assert(nd.NodeType != QilNodeType.NamespaceDecl || !_nsmgr.HasNamespace(prefix) || _nsmgr.LookupNamespace(prefix) == ns,
System\Xml\Xsl\IlGen\XmlIlVisitor.cs (90)
76Debug.Assert(_iterCurr.Storage.Location == ItemLocation.None, "Root expression should have been pushed to the writer.");
93Debug.Assert(iter.NodeType == QilNodeType.Let || iter.NodeType == QilNodeType.Parameter);
97Debug.Assert(methGlobal != null, "Metadata for global value should have already been computed");
149Debug.Assert(iter.XmlType == TypeFactory.ItemS, "IlGen currently only supports parameters of type item*.");
193Debug.Assert(iter.NodeType == QilNodeType.Parameter, "Only parameters may not have a default value");
223Debug.Assert(iter.NodeType == QilNodeType.Parameter);
253Debug.Assert(iter.XmlType == TypeFactory.ItemS, "IlGen currently only supports default values in parameters of type item*.");
318Debug.Assert(nd.XmlType!.IsSingleton || CachesResult(nd) || _iterCurr.HasLabelNext,
336Debug.Fail($"Visit{parent.NodeType} should never be called");
758Debug.Assert(_iterCurr.CurrentBranchingContext == BranchingContext.None);
843Debug.Assert(_iterCurr.CurrentBranchingContext == BranchingContext.None);
909Debug.Assert(info.ConstructMethod == XmlILConstructMethod.Iterator);
912Debug.Assert(ndCond.Left.XmlType!.TypeCode == XmlTypeCode.Boolean);
949Debug.Assert(!ndCond.Center.XmlType!.IsSingleton || !ndCond.Right.XmlType!.IsSingleton);
981Debug.Assert(ndBranch.XmlType!.IsSingleton, "Conditional must produce a singleton");
986Debug.Assert(itemStorageType == typeof(bool));
1012Debug.Assert(XmlILConstructInfo.Read(ndChoice).PushToWriterFirst);
1144Debug.Assert(XmlILConstructInfo.Read(nd).PullFromIteratorFirst, "VisitEmpty should only be called if items are iterated");
1165Debug.Assert(XmlILConstructInfo.Read(ndSeq).ConstructMethod == XmlILConstructMethod.Iterator, "This method should only be called if items in list are pulled from a code iterator.");
1509Debug.Assert(!ndStrConcat.Values.XmlType!.IsSingleton, "Optimizer should have folded StrConcat of a singleton value");
1630Debug.Assert(ndParsedTagName.Right.XmlType.IsSingleton);
1713Debug.Assert(ndComp.Left.XmlType!.IsAtomicValue && ndComp.Right.XmlType!.IsAtomicValue, "Operands to compare must be atomic values.");
1714Debug.Assert(ndComp.Left.XmlType.IsSingleton && ndComp.Right.XmlType.IsSingleton, "Operands to compare must be cardinality one.");
1715Debug.Assert(ndComp.Left.XmlType == ndComp.Right.XmlType, "Operands to compare may not be heterogenous.");
1753Debug.Assert(code != XmlTypeCode.QName, $"QName values do not support the {relOp} operation");
1772Debug.Fail($"Comparisons for datatype {code} are invalid.");
2030Debug.Fail($"Pattern {step.NodeType} should have been handled.");
2110Debug.Assert(ndIter != null);
2123Debug.Assert(ndIter.NodeType == QilNodeType.Let || ndIter.NodeType == QilNodeType.Parameter);
2124Debug.Assert(!patt.MatchesPattern(OptimizerPatternName.IsPositional));
2141Debug.Assert(ndFor.XmlType!.IsSingleton);
2203Debug.Assert(!ndLet.XmlType!.IsSingleton);
2234Debug.Assert(ndIter != null);
2248Debug.Assert(ndIter.NodeType == QilNodeType.For);
2251Debug.Assert(locPos != null);
2265Debug.Assert(ndSort.Variable.NodeType == QilNodeType.For);
2286Debug.Assert(!_iterNested!.Storage.IsCached);
2330Debug.Assert(ndKey.Key.XmlType!.IsAtomicValue, "Sort key must be an atomic value.");
2437Debug.Assert(pattStep.MatchesPattern(OptimizerPatternName.Axis), "Dod patterns should only match if step is FilterElements or FilterKindTest or Axis");
2474Debug.Fail($"Pattern {step.NodeType} should have been handled.");
2500Debug.Fail($"Pattern {step.NodeType} should have been handled.");
2523Debug.Assert(_iterCurr.Storage.IsCached, "DodMerge pattern should only be matched when cached sequences are returned from loop");
2552Debug.Assert(!XmlILConstructInfo.Read(ndInvoke).PushToWriterFirst || useWriter);
2600Debug.Assert(ndName != null, "Attribute node must have a literal QName as its second argument");
2780Debug.Assert(XmlILConstructInfo.Read(ndElem).PushToWriterFirst, "Element construction should always be pushed to writer.");
2830Debug.Assert(XmlILConstructInfo.Read(ndAttr).PushToWriterFirst, "Attribute construction should always be pushed to writer.");
2864Debug.Assert(XmlILConstructInfo.Read(ndComment).PushToWriterFirst, "Comment construction should always be pushed to writer.");
2884Debug.Assert(XmlILConstructInfo.Read(ndPI).PushToWriterFirst, "PI construction should always be pushed to writer.");
2924Debug.Assert(info.PushToWriterFirst, "Text construction should always be pushed to writer.");
2984Debug.Assert(XmlILConstructInfo.Read(ndDoc).PushToWriterFirst, "Document root construction should always be pushed to writer.");
3007Debug.Assert(info.PushToWriterFirst, "Namespace construction should always be pushed to writer.");
3137Debug.Fail($"Unexpected node type {ndProp.NodeType}");
3181Debug.Assert(!typDerived!.NeverSubtypeOf(typBase), "Normalizer should have eliminated IsType where source can never be a subtype of destination type.");
3187Debug.Assert(_iterCurr.Storage.ItemStorageType == typeof(XPathItem), "If !IsNode, then storage type should be Item");
3263Debug.Assert((typDerived.NodeKinds & kinds) != XmlNodeKindFlags.None, "Normalizer should have taken care of case where node kinds are disjoint.");
3375Debug.Assert(_iterCurr.CurrentBranchingContext == BranchingContext.None);
3439Debug.Assert(ndVal.Child.XmlType!.IsNode, "XPathNodeValue node may only be applied to a sequence of Nodes.");
3562Debug.Assert(XmlILConstructInfo.Read(ndInvoke).ConstructMethod != XmlILConstructMethod.Writer);
3649Debug.Assert(ndActualArg.XmlType!.IsSubtypeOf(xmlTypeFormalArg), "Xml type of actual arg must be a subtype of the Xml type of the formal arg");
3681Debug.Fail($"Internal Xslt library may not use parameters of type {clrTypeFormalArg}");
3745Debug.Assert(XmlILConstructInfo.Read(ndCopy).PushToWriterFirst);
3751Debug.Assert(ndCopy.Left.XmlType!.IsNode);
3763Debug.Assert(ndCopy.Left.XmlType.IsNode);
3779Debug.Assert(XmlILConstructInfo.Read(ndCopyOf).PushToWriterFirst, "XsltCopyOf should always be pushed to writer.");
3811Debug.Fail($"Conversion from {ndConv.Source.XmlType} to {ndConv.TargetType} is not supported.");
3988Debug.Assert(ndDod.NodeType == QilNodeType.DocOrderDistinct && ndLoop != null);
4105Debug.Assert(ndName.XmlType!.TypeCode == XmlTypeCode.QName, "Element or attribute name must have QName type.");
4124Debug.Assert(ValidateNames.ValidateName(prefix, localName, ns, nodeType, ValidateNames.Flags.AllExceptPrefixMapping));
4201Debug.Assert(relOp == QilNodeType.Eq || relOp == QilNodeType.Ne);
4240Debug.Assert(relOp == QilNodeType.Eq || relOp == QilNodeType.Ne);
4267Debug.Assert(ndSecond.NodeType == QilNodeType.NameOf);
4309default: Debug.Fail($"Unexpected rel op {relOp}"); opcode = OpCodes.Nop; break;
4322default: Debug.Fail($"Unexpected rel op {relOp}"); opcode = OpCodes.Nop; break;
4338default: Debug.Fail($"Unexpected rel op {relOp}"); opcode = OpCodes.Nop; break;
4345Debug.Assert(_iterCurr.CurrentBranchingContext == BranchingContext.None);
4357default: Debug.Fail($"Unexpected rel op {relOp}"); opcode = OpCodes.Nop; break;
4378Debug.Assert(relOp == QilNodeType.Eq || relOp == QilNodeType.Ne);
4398Debug.Assert(_iterCurr.CurrentBranchingContext == BranchingContext.None);
4583Debug.Assert(xmlTypes == XmlNodeKindFlags.PI);
4604Debug.Fail($"Cannot map QilNodeType {typ} to an XPathNodeType");
4616Debug.Assert(xmlTypes == XmlNodeKindFlags.Element);
4623Debug.Assert(!isXmlTypeUnion || (xmlTypes & XmlNodeKindFlags.Content) == XmlNodeKindFlags.Content);
4694Debug.Assert(_iterCurr.Storage.Location == ItemLocation.None ||
4772Debug.Assert(!XmlILConstructInfo.Read(nd).PushToWriterLast);
4786Debug.Assert(!XmlILConstructInfo.Read(nd).PushToWriterLast);
4805Debug.Assert(!XmlILConstructInfo.Read(nd).PushToWriterLast);
4815Debug.Assert(!XmlILConstructInfo.Read(nd).PushToWriterLast);
4825Debug.Assert(nd.XmlType!.IsSingleton && !XmlILConstructInfo.Read(nd).PushToWriterLast);
4839Debug.Assert(!XmlILConstructInfo.Read(nd).PushToWriterLast);
4853Debug.Assert(_iterCurr.Storage.IsCached, "Expression result should be cached. CachesResult() might have a bug in it.");
System\Xml\Xsl\Runtime\XmlQueryOutput.cs (47)
162Debug.Assert(prefix != null && !string.IsNullOrEmpty(localName) && ns != null, "Invalid argument");
163Debug.Assert(ValidateNames.ValidateName(prefix, localName, ns, XPathNodeType.Element, ValidateNames.Flags.All), "Name validation failed");
221Debug.Assert(prefix != null && localName != null && ns != null, "Invalid argument");
231Debug.Assert(ValidateNames.ValidateName(prefix, localName, ns, XPathNodeType.Attribute, ValidateNames.Flags.All));
419Debug.Assert(_xstate == XmlState.WithinSequence, $"StartTree cannot be called in the {_xstate} state.");
430Debug.Assert(_xstate == XmlState.EnumAttrs || _xstate == XmlState.WithinContent, $"EndTree cannot be called in the {_xstate} state.");
446Debug.Assert(_xstate == XmlState.WithinContent, $"WriteStartElement cannot be called in the {_xstate} state.");
469Debug.Assert(_xstate == XmlState.EnumAttrs, $"StartElementContent cannot be called in the {_xstate} state.");
484Debug.Assert(_xstate == XmlState.EnumAttrs || _xstate == XmlState.WithinContent, $"WriteEndElement cannot be called in the {_xstate} state.");
504Debug.Assert(_xstate == XmlState.EnumAttrs, $"WriteStartAttribute cannot be called in the {_xstate} state.");
523Debug.Assert(_xstate == XmlState.WithinAttr, $"WriteEndAttribute cannot be called in the {_xstate} state.");
538Debug.Assert(prefix != null && ns != null);
539Debug.Assert(_xstate == XmlState.EnumAttrs, $"WriteNamespaceDeclaration cannot be called in the {_xstate} state.");
542Debug.Assert(prefix.Length == 0 || ns.Length != 0);
572Debug.Assert(_xstate != XmlState.WithinSequence && _xstate != XmlState.EnumAttrs, $"WriteTextBlock cannot be called in the {_xstate} state.");
581Debug.Assert(_xstate != XmlState.WithinSequence && _xstate != XmlState.EnumAttrs, $"WriteTextBlockNoEntities cannot be called in the {_xstate} state.");
595Debug.Assert(_depth == 0, "Root node can only be constructed at top-level.");
608Debug.Assert(_depth == 1, "Root node can only be constructed at top-level.");
699Debug.Assert(prefix != null && ns != null);
746Debug.Assert(prefix != null, "Invalid argument");
762Debug.Assert(_xstate == XmlState.WithinNmsp, $"WriteNamespaceString cannot be called in the {_xstate} state.");
771Debug.Assert(_xstate == XmlState.WithinNmsp, $"WriteEndNamespace cannot be called in the {_xstate} state.");
801Debug.Assert(_xstate == XmlState.WithinComment, $"WriteCommentString cannot be called in the {_xstate} state.");
810Debug.Assert(_xstate == XmlState.WithinComment, $"WriteEndComment cannot be called in the {_xstate} state.");
844Debug.Assert(_xstate == XmlState.WithinPI, $"WriteProcessingInstructionString cannot be called in the {_xstate} state.");
853Debug.Assert(_xstate == XmlState.WithinPI, $"WriteEndProcessingInstruction cannot be called in the {_xstate} state.");
884Debug.Assert(_xstate == XmlState.WithinSequence, "Values can only be written at the top-level.");
938Debug.Assert(navigator.NodeType == XPathNodeType.Element, "StartCopy should return true only for Element nodes.");
957Debug.Assert(navigator.NodeType == XPathNodeType.Root, "EndCopy should only be called for Element and Document nodes.");
980Debug.Assert(text != null, "Invalid argument");
1021Debug.Fail($"Text cannot be output in the {_xstate} state.");
1037Debug.Assert(navigator != null);
1044Debug.Assert(nodeType == XPathNodeType.Element, "StartCopy should return true only for Element nodes.");
1175Debug.Assert(_xstate != XmlState.WithinSequence, "StartCopy should not called if state is WithinSequence");
1192Debug.Fail($"Unexpected node type {navigator.NodeType}");
1205Debug.Assert(navigator.NodeType == XPathNodeType.Element);
1206Debug.Assert(_xstate == XmlState.WithinContent, $"EndCopy cannot be called in the {_xstate} state.");
1219Debug.Assert(navigator.NodeType == XPathNodeType.Element, "Only elements have namespaces to copy");
1224Debug.Assert(navigator.LocalName.Length != 0, "xmlns:foo='' isn't allowed");
1257Debug.Assert(rootType == XPathNodeType.Element || rootType == XPathNodeType.Comment || rootType == XPathNodeType.ProcessingInstruction);
1288Debug.Assert(rootType == XPathNodeType.Attribute || rootType == XPathNodeType.Namespace);
1319Debug.Assert(_nsmgr != null);
1340Debug.Fail($"{xstate} is not a valid XmlState.");
1351Debug.Assert(prefix.Length != 0 && ns.Length != 0);
1399Debug.Assert(prefix != null && !string.IsNullOrEmpty(ns));
1505Debug.Assert(ValidateNames.ParseNCName(name.Name, 0) == name.Name.Length);
1554Debug.Assert(_stkNames != null);
System\Xml\Xsl\Runtime\XmlQueryRuntime.cs (22)
72Debug.Assert(data != null);
174Debug.Assert(IsGlobalComputed(idx), "Cannot get the value of a global value until it has been computed.");
175Debug.Assert(_globalValues![idx] is IList<XPathItem>, "Only debugger should call this method, and all global values should have type item* in debugging scenarios.");
191Debug.Assert(IsGlobalComputed(idx), "Cannot get the value of a global value until it has been computed.");
192Debug.Assert(_globalValues![idx] is IList<XPathItem>, "Only debugger should call this method, and all global values should have type item* in debugging scenarios.");
250Debug.Assert(_earlyObjects != null && index < _earlyObjects.Length, "Early bound object does not exist");
300Debug.Assert(IsGlobalComputed(index), "Cannot get the value of a global value until it has been computed.");
310Debug.Assert(!IsGlobalComputed(index), "Global value should only be set once.");
332Debug.Assert(_atomizedNames != null);
341Debug.Assert(_filters != null);
395Debug.Assert(_prefixMappingsList != null);
462Debug.Assert(_types != null);
480Debug.Assert(XmlILTypeHelper.GetStorageType(xmlType).IsAssignableFrom(value.GetType()),
483Debug.Assert(destinationType == typeof(object) || !destinationType.IsAssignableFrom(value.GetType()),
499Debug.Assert(xmlType != XmlQueryTypeFactory.Node && xmlType != XmlQueryTypeFactory.NodeS,
558Debug.Assert(destinationType.IsAssignableFrom(value.GetType()), $"ChangeType from type {value.GetType().Name} to type {destinationType.Name} failed");
680Debug.Assert(XmlILTypeHelper.GetStorageType(xmlType).IsAssignableFrom(value.GetType()), $"Xml type {xmlType} is not represented in ILGen as {value.GetType().Name}");
778Debug.Fail($"XmlTypeCode {code} was not fully handled.");
829Debug.Assert(_collations != null);
890Debug.Assert(context != null);
927Debug.Assert(context != null);
1078Debug.Assert(node.NodeType == XPathNodeType.Namespace);
System\Xml\Xsl\XmlQueryType.cs (11)
487Debug.Assert(Count == 1 && IsSingleton, "This method should only be called for item types.");
488Debug.Assert(baseType.Count == 1 && baseType.IsSingleton, "This method should only be called for item types.");
489Debug.Assert(!IsDod && !baseType.IsDod, "Singleton types may not have DocOrderDistinct property");
509Debug.Assert(IsAtomicValue && baseType.IsAtomicValue);
528Debug.Assert(this.Count == 1 && this.IsSingleton, "this should be an item");
529Debug.Assert(other.Count == 1 && other.IsSingleton, "other should be an item");
562Debug.Assert(Count == 1, "Do not pass a Union type to this method.");
563Debug.Assert(IsSingleton, "Do not pass a Sequence type to this method.");
885Debug.Assert(count < 64, "BitMatrix currently only handles up to 64x64 matrix.");
903Debug.Assert(index1 < _bits.Length && index2 < _bits.Length, "Index out of range.");
908Debug.Assert(index1 < _bits.Length && index2 < _bits.Length, "Index out of range.");
System\Xml\Xsl\XmlQueryTypeFactory.cs (15)
63Debug.Assert(schemaType.DerivedBy == XmlSchemaDerivationMethod.Union);
265Debug.Assert(itemType.IsSingleton, "All types should be prime.");
351Debug.Assert(arrEnum[arrEnum.Length - 1] == XmlTypeCode.DayTimeDuration,
437Debug.Assert(schemaType.Datatype!.Variety == XmlSchemaDatatypeVariety.Atomic, "List or Union Xsd types should have been handled by caller.");
470Debug.Assert(!isNillable);
504Debug.Assert(nameTest != null, "nameTest cannot be null");
505Debug.Assert(schemaType != null, "schemaType cannot be null");
513Debug.Assert(!IsAtomicValue || schemaType.Datatype!.Variety == XmlSchemaDatatypeVariety.Atomic);
554Debug.Assert((object)this == (object)Create(_code, _isStrict), "Unknown type");
741Debug.Assert(members != null && members.Count != 1, "ChoiceType must contain a list with 0 or >1 types.");
749Debug.Assert(t.Cardinality == XmlQueryCardinality.One, "ChoiceType member types must be prime types.");
972Debug.Assert(prime != null, "SequenceType can only modify the cardinality of a non-null XmlQueryType.");
973Debug.Assert(prime.IsSingleton, "Prime type must have cardinality one.");
1182Debug.Fail($"Don't know how to serialize {type.GetType()}");
1201Debug.Fail("Unexpected XmlQueryType's subtype id");
System\Xml\Xsl\XPath\XPathBuilder.cs (32)
46Debug.Fail("Must not be called");
67Debug.Assert(!_inTheBuild, "XPathBuilder is busy!");
80Debug.Assert(_inTheBuild, "StartBuild() wasn't called");
92Debug.Assert(numFixupCurrent >= 0, "Context fixup error");
93Debug.Assert(numFixupPosition >= 0, "Context fixup error");
94Debug.Assert(numFixupLast >= 0, "Context fixup error");
115Debug.Assert(op != XPathOperator.Unknown);
118Debug.Assert((opGroup != XPathOperatorGroup.Negate && right != null) || (opGroup == XPathOperatorGroup.Negate && right == null));
129Debug.Fail($"{op} is not a valid XPathOperator");
136Debug.Assert(op == XPathOperator.Or || op == XPathOperator.And);
147Debug.Assert(compType == XmlTypeCode.Boolean || compType == XmlTypeCode.Double || compType == XmlTypeCode.String);
148Debug.Assert(compType == XmlTypeCode.Boolean || left.XmlType!.IsSingleton && right.XmlType!.IsSingleton, "Both comparison operands must be singletons");
161Debug.Fail("Wrong operator type");
169Debug.Assert(val.XmlType!.IsSingleton);
170Debug.Assert(compType == XmlTypeCode.Boolean || compType == XmlTypeCode.Double || compType == XmlTypeCode.String, "I don't know what to do with RTF here");
214Debug.Assert(op == XPathOperator.Eq || op == XPathOperator.Ne);
247Debug.Assert(op == XPathOperator.Lt || op == XPathOperator.Le || op == XPathOperator.Gt || op == XPathOperator.Ge);
278Debug.Assert(op == XPathOperator.UnaryMinus);
294Debug.Fail("Wrong operator type");
301Debug.Assert(op == XPathOperator.Union);
414Debug.Fail("Invalid EnumValue 'XPathAxis'");
457Debug.Assert(nodeset.NodeType == QilNodeType.DocOrderDistinct,
561Debug.Assert(!args.IsReadOnly, "Writable collection expected");
602Debug.Fail($"{func.id} is present in the function table, but absent from the switch");
853Debug.Assert(current != null);
866Debug.Assert(environment != null);
890Debug.Assert(unknown.NodeType == QilNodeType.Unknown);
933Debug.Assert(_last != null);
938Debug.Assert(unknown != null);
988Debug.Assert(maxArgs == 0 || maxArgs == Infinity || argTypes != null && argTypes.Length == maxArgs);
1024Debug.Assert(numArgs > maxArgs);
1046Debug.Assert(args.Count == 0 || argTypes != null);
System\Xml\Xsl\Xslt\InvokeGenerator.cs (8)
60Debug.Assert(formalArg.Name.LocalName == "namespaces", "Cur,Pos,Last don't have default values and should be always added to by caller in AddImplicitArgs()");
61Debug.Assert(formalArg.DefaultValue != null, "PrecompileProtoTemplatesHeaders() set it");
71Debug.Assert(formalArg.Name!.NamespaceUri != XmlReservedNs.NsXslDebug, "Cur,Pos,Last don't have default values and should be always added to by caller in AddImplicitArgs(). We don't have $namespaces in !debug.");
86Debug.Assert(invokeType == T.ItemS, "Actual argument type is not a subtype of formal argument type");
104Debug.Assert(argName != null);
132Debug.Assert(_formalArgs![prevArg] != null, "formalArg must be in the list");
133Debug.Assert(_invokeArgs![prevArg] != null, "This arg should be compiled already");
151Debug.Assert(_invokeArgs[prevArg] is QilIterator);
System\Xml\Xsl\Xslt\QilGenerator.cs (56)
136Debug.Assert(compiler != null);
227Debug.Assert(IsDebug && _curLoop.IsFocusSet);
234Debug.Assert(!_curLoop.IsFocusSet && !_funcFocus.IsFocusSet, "Must be compiled using singleton focus");
432Debug.Assert(IsDebug, "This is debug only logic");
436Debug.Assert(var.XmlType!.IsSubtypeOf(T.NamespaceS));
437Debug.Assert(var.Binding is QilList);
446Debug.Assert(nsList[i].NodeType == QilNodeType.NamespaceDecl);
447Debug.Assert(varList[i].NodeType == QilNodeType.NamespaceDecl);
478Debug.Assert(tmpl != null && tmpl.Function == null);
479Debug.Assert(tmpl.NodeType == XslNodeType.AttributeSet || tmpl.NodeType == XslNodeType.Template);
508Debug.Assert(tmpl.NodeType == XslNodeType.Template);
602Debug.Assert((template != null) == (tmpl.SourceLine != null), "Templates must have line information, and attribute sets must not");
610Debug.Assert(!IsDebug, "In debug mode we don't generate parumWithCalls functions. Otherwise focus flags should be adjusted");
643Debug.Assert(tmpl != null && tmpl.Function != null && tmpl.Function.Definition.NodeType == QilNodeType.Unknown);
653Debug.Assert(tmpl is Template, "Only templates can have explicit arguments");
656Debug.Assert(arg.DefaultValue == null, "Argument must not be compiled yet");
700Debug.Assert(instructions != null);
743default: Debug.Fail($"Unexpected type of AST node: {nodeType}"); result = null; break;
747Debug.Assert(result != null, "Result of compilation should not be null");
983Debug.Assert(pos < source.Length);
1019Debug.Assert(i == source.Length || source[i] == '{');
1073Debug.Assert(avt != null);
1125Debug.Assert(_curLoop.IsFocusSet);
1179Debug.Assert(withParam.NodeType == XslNodeType.WithParam);
1215Debug.Assert(node.NodeType == XslNodeType.ApplyImports);
1216Debug.Assert(!_curLoop.IsFocusSet, "xsl:apply-imports cannot be inside of xsl:for-each");
1246Debug.Assert(tmpl.Function != null, "All templates should be already compiled");
1281Debug.Assert(attSet.Function != null, "All templates should be already compiled");
1417Debug.Assert(when.NodeType == XslNodeType.If || when.NodeType == XslNodeType.Otherwise);
1421Debug.Assert(result == null, "xsl:otherwise must be the last child of xsl:choose");
1460Debug.Assert(node.NodeType == XslNodeType.Variable);
1470Debug.Assert(node.NodeType == XslNodeType.Variable || node.NodeType == XslNodeType.Param || node.NodeType == XslNodeType.WithParam);
1502Debug.Assert(varValue.SourceLine == null);
1508Debug.Assert(withParam.NodeType == XslNodeType.WithParam);
1718Debug.Assert(result.XmlType == T.StringX);
1726Debug.Assert(sort.NodeType == XslNodeType.Sort);
1818Debug.Assert(0 < list.Count, "Pattern should have at least one filter");
1873Debug.Fail($"Unexpected NodeKind: {nodeKinds}");
2119Debug.Assert(num.Level == NumberLevel.Any);
2139Debug.Assert(sheet.TemplateMatches.Count == 0);
2223Debug.Assert(varPar.NodeType == XslNodeType.Variable || varPar.NodeType == XslNodeType.Param);
2259Debug.Assert(varPar.NodeType == XslNodeType.Variable || varPar.NodeType == XslNodeType.Param);
2346Debug.Assert(expr != null);
2375Debug.Assert(pttrn != null);
2401Debug.Assert(pttrn != null);
2515Debug.Assert(
2581Debug.Assert(actualArgs[actArg].NodeType == XslNodeType.WithParam, "All Sorts was removed in CompileSorts()");
2662Debug.Assert(actualArgs[i].NodeType == XslNodeType.WithParam, "All Sorts was removed in CompileSorts()");
2689Debug.Assert(actualArgs[0].Name == _nameCurrent, "Caller should always pass $current as a first argument to apply-* calls.");
2753Debug.Assert(
2794Debug.Assert(!IsDebug, "Attempt to override SourceLineInfo in debug mode");
2800Debug.Assert(n.SourceLine == null);
2824Debug.Assert(nsVar.XmlType!.IsSubtypeOf(T.NamespaceS));
2869Debug.Assert(let.NodeType == QilNodeType.Let);
2875Debug.Assert(0 <= varScope && varScope <= _vars.Count);
2886Debug.Assert(_vars.Count == 0, "Accumulated variables left unclaimed");
System\Xml\Xsl\Xslt\XPathPatternBuilder.cs (36)
28Debug.Assert(environment != null);
44Debug.Assert(!_inTheBuild, "XPathBuilder is busy!");
52Debug.Assert(filter.NodeType == QilNodeType.Filter, "XPathPatternBuilder expected to generate list of Filters on top level");
53Debug.Assert(filter.Variable.XmlType!.IsSubtypeOf(T.NodeNotRtf));
54Debug.Assert(filter.Variable.Binding!.NodeType == QilNodeType.Unknown); // fixupNode
55Debug.Assert(filter.Body.XmlType!.IsSubtypeOf(T.Boolean));
67Debug.Assert(_inTheBuild, "StartBuild() wasn't called");
71Debug.Assert(_predicateEnvironment.numFixupCurrent >= 0, "Context fixup error");
72Debug.Assert(_predicateEnvironment.numFixupPosition >= 0, "Context fixup error");
73Debug.Assert(_predicateEnvironment.numFixupLast >= 0, "Context fixup error");
80Debug.Assert(op == XPathOperator.Union);
81Debug.Assert(left != null);
82Debug.Assert(right != null);
84Debug.Assert(right.NodeType == QilNodeType.Filter, "LocationPathPattern must be compiled into a filter");
92Debug.Assert(left.NodeType == QilNodeType.Filter, "LocationPathPattern must be compiled into a filter");
122Debug.Assert(
133Debug.Assert(nodeType == XPathNodeType.All && prefix == null && name == null, " // is the only d-o-s axes that we can have in pattern");
190Debug.Assert(left != null);
191Debug.Assert(right != null);
195Debug.Assert(nop.Child == _fixupNode);
199Debug.Assert(GetLastParent(left) == left, "Left is always single axis and never the step");
200Debug.Assert(left.NodeType == QilNodeType.Filter);
209Debug.Assert(nop.Child != null);
213Debug.Assert(right.NodeType == QilNodeType.Filter);
215Debug.Assert(lastParent != null);
226Debug.Fail("Should not call to this function.");
291Debug.Assert(prefix.Length == 0);
297Debug.Assert(
305Debug.Assert(name == "key", "Unexpected function");
306Debug.Assert(
355Debug.Assert(parent.NodeType == QilNodeType.Filter);
376Debug.Assert(context != null, "Predicate always has step so it can't have context == null");
377Debug.Assert(context.Variable.NodeType == QilNodeType.For, "It shouldn't be Let, becaus predicates in PatternBuilder don't produce cached tuples.");
430Debug.Assert(current != null);
444Debug.Fail("GetPosition() must not be called");
450Debug.Fail("GetLast() must not be called");
System\Xml\Xsl\Xslt\XsltInput.cs (37)
43Debug.Assert(reader != null);
44Debug.Assert(atoms != null);
77Debug.Assert(tr.Settings == null, "XmlReader created with XmlReader.Create should always expand entities.");
201Debug.Assert(
244Debug.Assert(_reader.NodeType == XmlNodeType.EntityReference);
246Debug.Assert(local[0] == '#' || local == "lt" || local == "gt" || local == "quot" || local == "apos");
258Debug.Assert(_reader.NodeType == XmlNodeType.Text || _reader.NodeType == XmlNodeType.Whitespace || _reader.NodeType == XmlNodeType.SignificantWhitespace);
261Debug.Assert(_reader.NodeType == XmlNodeType.EndEntity);
273Debug.Assert(_reader.NodeType == XmlNodeType.Attribute, "reader.NodeType == XmlNodeType.Attribute");
323Debug.Assert(_reader.NodeType == XmlNodeType.Text, "Unexpected node type inside attribute value");
332Debug.Assert(_reader.NodeType != XmlNodeType.EntityReference);
348Debug.Assert(_nodeType == XmlNodeType.Element, "To call MoveToFirstChild() XsltInut should be positioned on an Element.");
358Debug.Assert(_nodeType != XmlNodeType.Element || IsEmptyElement, "On non-empty elements we should call MoveToFirstChild()");
441Debug.Assert(_nodeType == XmlNodeType.Text || _nodeType == XmlNodeType.Whitespace || _nodeType == XmlNodeType.SignificantWhitespace);
488Debug.Assert(_reader.NodeType == XmlNodeType.Element);
518Debug.Assert(_nodeType == XmlNodeType.Element, "For MoveToElement() we should be positioned on Element or Attribute");
524Debug.Assert(_nodeType == XmlNodeType.Element, "For MoveToLiteralAttribute() we should be positioned on Element or Attribute");
539Debug.Assert(_nodeType == XmlNodeType.Element, "For MoveToLiteralAttribute() we should be positioned on Element or Attribute");
554Debug.Assert(_attributes != null && _attributes[attNum].name == attName, "Attribute numbering error.");
566Debug.Assert(_attributes != null && _attributes[attNum].name == attName, "Attribute numbering error.");
589Debug.Assert(_nodeType == XmlNodeType.Element || _nodeType == XmlNodeType.EndElement, "Input is positioned on element or attribute");
620Debug.Assert(_nodeType != XmlNodeType.Element || _attributesRead, "Should first read attributes");
628Debug.Assert(_nodeType != XmlNodeType.Element || _attributesRead, "Should first read attributes");
637Debug.Assert(_nodeType != XmlNodeType.Element || _attributesRead, "Should first read attributes");
650Debug.Assert(IsKeyword(_atoms.Version));
714Debug.Assert(NodeType == XmlNodeType.Element);
715Debug.Assert(attributes.Length <= _xsltAttributeNumber.Length);
750Debug.Assert(SS, "First we parse xsl:stylesheet element");
843Debug.Assert(NodeType == XmlNodeType.Element);
921Debug.Assert(NodeType == XmlNodeType.Element && IsXsltNamespace());
948Debug.Assert(extensions ? IsKeyword(_atoms.ExtensionElementPrefixes) : IsKeyword(_atoms.ExcludeResultPrefixes));
1001Debug.Assert(IsKeyword(_atoms.XPathDefaultNamespace));
1013Debug.Assert(IsKeyword(_atoms.DefaultCollation));
1095Debug.Assert(prefix != null);
1099Debug.Assert(Ref.Equal(_atoms.NameTable.Get(nsUri), nsUri), "Namespaces must be atomized");
1179Debug.Assert(input.NodeType == XmlNodeType.EndElement);
1184Debug.Assert(input.NodeType == XmlNodeType.Element || input.NodeType == XmlNodeType.Attribute);
System\Xml\Xsl\Xslt\XsltLoader.cs (42)
43Debug.Assert(compiler != null);
98Debug.Fail("Should never get here");
102Debug.Assert(compiler.Root != null);
177Debug.Assert(_compiler.Version != 0, "Version should be already decided at this point");
236Debug.Assert(!_documentUriInUse.Contains(baseUri), "Circular references must be checked while processing xsl:include and xsl:import");
298Debug.Assert(_input.NodeType == XmlNodeType.Element);
323Debug.Assert(!_input.IsXsltNamespace());
324Debug.Assert(_curTemplate == null);
341Debug.Fail("AddTemplate() returned false for simplified stylesheet");
355Debug.Assert(_input.IsXsltNamespace() && (_input.IsKeyword(_atoms.Stylesheet) || _input.IsKeyword(_atoms.Transform)));
468Debug.Assert(_input.NodeType == XmlNodeType.Text);
825Debug.Assert(attSet != null);
836Debug.Assert(attSet.CycleCheck == CycleCheck.Processing);
837Debug.Assert(attSet.Content[0].SourceLine != null);
957Debug.Assert(NumCharAttrs == DefaultValues.Length);
973Debug.Assert(dummy, "One of the attrs should have lineInfo. If both are default they can't conflict.");
993Debug.Assert(name.Equals(format.Name));
1067Debug.Assert(setName != null, "Required attribute always != null");
1112Debug.Assert(_input.NodeType == XmlNodeType.Text);
1123Debug.Assert(_curTemplate == null);
1124Debug.Assert(_input.CanHaveApplyImports == false);
1141Debug.Assert(_curTemplate == null);
1455Debug.Assert(_input.NodeType == XmlNodeType.Text);
1503Debug.Assert(_input.NodeType == XmlNodeType.Text);
1716Debug.Assert(_input.NodeType == XmlNodeType.Text);
1921Debug.Assert(nodeType != XslNodeType.Unknown);
2034Debug.Assert(_input.NodeType == XmlNodeType.Element);
2480Debug.Assert(_input.NodeType == XmlNodeType.Element);
2523Debug.Assert(content != null && withParam != null);
2524Debug.Assert(withParam.NodeType == XslNodeType.WithParam);
2537Debug.Assert(content != null);
2546Debug.Assert(content != null);
2800Debug.Assert(_input.IsRequiredAttribute(attNum), "It happened that @name as NCName is always required attribute");
2890Debug.Assert(_input.LocalName == "use-attribute-sets", "we are positioned on this attribute");
2891Debug.Assert(list != null && list.Count == 0, "It happened that we always add use-attribute-sets first. Otherwise we can't call list.Clear()");
2954Debug.Assert(!_input.IsRequiredAttribute(attNum), "All Yes/No attributes are optional.");
2974Debug.Assert(!_input.IsRequiredAttribute(attNum), "All 'type' attributes are optional.");
2983Debug.Assert(!_input.IsRequiredAttribute(attNum), "All 'validation' attributes are optional.");
3009Debug.Assert(!_input.IsRequiredAttribute(attNum), "All 'input-type-validation' attributes are optional.");
3073Debug.Assert(node != null);
3080Debug.Assert(node != null);
3090Debug.Assert(to != null);
System\Xml\Xsl\XsltOld\Processor.cs (45)
128Debug.Assert(_execResult == ExecResult.Continue);
142Debug.Assert(_resolver != null, "Constructor should create it if null passed");
151Debug.Assert(_sortArray != null, "InitSortArray() wasn't called");
202Debug.Assert(_sortArray != null, "InitSortArray() wasn't called");
280Debug.Assert(!_stringBuilderLocked);
437Debug.Assert(_actionStack != null);
445Debug.Assert(_builder != null);
477Debug.Assert(frame != null);
506Debug.Assert(_templateLookup != null);
513Debug.Assert(key != Compiler.InvalidQueryKey);
519Debug.Assert(key != Compiler.InvalidQueryKey);
534Debug.Assert(key != Compiler.InvalidQueryKey);
603Debug.Assert(nav.NodeType == XPathNodeType.Element);
722Debug.Assert(_builder != null);
732Debug.Assert(_xsm != null);
746Debug.Assert(StateMachine.StateOnly(stateOutlook) == _xsm.State);
747Debug.Assert(ExecutionResult == ExecResult.Continue);
751Debug.Assert(StateMachine.StateOnly(stateOutlook) == _xsm.State);
763Debug.Fail("Unexpected result of RecordBuilder.BeginEvent()");
775Debug.Assert(_xsm != null);
788Debug.Assert(StateMachine.StateOnly(stateOutlook) == _xsm.State);
789Debug.Assert(ExecutionResult == ExecResult.Continue);
793Debug.Assert(StateMachine.StateOnly(stateOutlook) == _xsm.State);
803Debug.Fail("Unexpected result of RecordBuilder.TextEvent()");
810Debug.Assert(_xsm != null);
824Debug.Assert(StateMachine.StateOnly(stateOutlook) == _xsm.State);
828Debug.Assert(StateMachine.StateOnly(stateOutlook) == _xsm.State,
838Debug.Fail("Unexpected result of RecordBuilder.TextEvent()");
866Debug.Fail("Invalid XPathNodeType in CopyBeginEvent");
895Debug.Fail("Invalid XPathNodeType in CopyTextEvent");
925Debug.Fail("Invalid XPathNodeType in CopyEndEvent");
934Debug.Assert(navigator != null);
957Debug.Assert(output != null);
968Debug.Assert(_builder != null);
1017Debug.Assert(saveStackSize == _actionStack.Length);
1019Debug.Assert(result != null, "Variable was just calculated and result can't be null");
1030Debug.Assert(1 < _actionStack.Length);
1043Debug.Assert(2 < _actionStack.Length);
1058Debug.Assert(this.Debugger != null, "We don't generate calls this function if ! debugger");
1070Debug.Assert(this.Debugger != null, "We don't generate calls this function if ! debugger");
1076Debug.Assert(this.Debugger != null, "We don't generate calls this function if ! debugger");
1078Debug.Assert(dbgFrame != null, "PushDebuggerStack() wasn't ever called");
1085Debug.Assert(this.Debugger != null, "We don't generate calls this function if ! debugger");
1086Debug.Assert(2 <= _debuggerStack!.Length);
1092Debug.Assert(this.Debugger != null, "We don't generate calls this function if ! debugger");
System\Reflection\Metadata\PortablePdb\ImportDefinition.cs (1)
24Debug.Assert(
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EcDsa.ImportExport.cs (1)
147Debug.Assert(
System\Security\Cryptography\X509Certificates\UnixChainVerifier.cs (1)
38Debug.Assert(
System\Text\Json\BitStack.cs (13)
67Debug.Assert(index >= 0, $"Set - Negative - index: {index}, arrayLength: {_array.Length}");
70Debug.Assert(_array.Length <= int.MaxValue / 32 + 1, $"index: {index}, arrayLength: {_array.Length}");
79Debug.Assert(index >= 0 && index > (int)((uint)_array.Length * 32 - 1), $"Only grow when necessary - index: {index}, arrayLength: {_array.Length}");
83Debug.Assert(elementIndex < _array.Length, $"Set - index: {index}, elementIndex: {elementIndex}, arrayLength: {_array.Length}, extraBits: {extraBits}");
122Debug.Assert(_array != null);
123Debug.Assert(index >= 0, $"Get - Negative - index: {index}, arrayLength: {_array.Length}");
127Debug.Assert(elementIndex < _array.Length, $"Get - index: {index}, elementIndex: {elementIndex}, arrayLength: {_array.Length}, extraBits: {extraBits}");
134Debug.Assert(_array != null);
135Debug.Assert(_array.Length < int.MaxValue / 2, $"Array too large - arrayLength: {_array.Length}");
136Debug.Assert(minSize >= 0 && minSize >= _array.Length);
139Debug.Assert(nextDouble > minSize);
146Debug.Assert(_currentDepth == 0, "Only call SetFirstBit when depth is 0");
153Debug.Assert(_currentDepth == 0, "Only call ResetFirstBit when depth is 0");
System\Text\Json\Serialization\Metadata\JsonPropertyInfo.cs (36)
29Debug.Assert(_effectiveConverter != null);
142Debug.Assert(!IsConfigured);
296Debug.Assert(declaringTypeInfo is null || declaringType.IsAssignableFrom(declaringTypeInfo.Type));
308Debug.Assert(!info.IsForTypeInfo);
309Debug.Assert(!info.CanSerialize);
310Debug.Assert(!info.CanDeserialize);
331Debug.Assert(ParentTypeInfo != null);
332Debug.Assert(!IsConfigured);
374Debug.Assert(!IgnoreNullTokensOnRead);
388Debug.Assert(Name != null);
406Debug.Assert(Options.DefaultIgnoreCondition == JsonIgnoreCondition.Never);
428Debug.Assert(EffectiveConverter != null, "Must have calculated the effective converter.");
432Debug.Assert(MemberType is 0 or MemberTypes.Field or MemberTypes.Property);
465Debug.Assert(ParentTypeInfo != null, "We should have ensured parent is assigned in JsonTypeInfo");
466Debug.Assert(!ParentTypeInfo.IsConfigured);
493Debug.Assert(ParentTypeInfo != null, "We should have ensured parent is assigned in JsonTypeInfo");
494Debug.Assert(!IsConfigured, "Should not be called post-configuration.");
495Debug.Assert(_jsonTypeInfo != null, "Must have already been determined on configuration.");
520Debug.Assert(EffectiveConverter != null, "Must have calculated the effective converter.");
521Debug.Assert(ParentTypeInfo != null, "We should have ensured parent is assigned in JsonTypeInfo");
522Debug.Assert(!IsConfigured, "Should not be called post-configuration.");
562Debug.Assert(_jsonTypeInfo != null);
563Debug.Assert(_jsonTypeInfo.IsConfigurationStarted);
609Debug.Assert(EffectiveConverter.ElementType != null);
674Debug.Assert(MemberType == MemberTypes.Property || MemberType == MemberTypes.Field || MemberType == default);
712Debug.Assert(_name != null);
797Debug.Assert(propValue is Nodes.JsonObject);
812Debug.Assert(dictionaryValueInfo is JsonTypeInfo<TValue>);
823Debug.Assert(this == state.Current.JsonTypeInfo.ExtensionDataProperty);
864Debug.Assert(EffectiveConverter.CanPopulate, "Property is marked with Populate but converter cannot populate. This should have been validated in Configure");
865Debug.Assert(state.Parent.ReturnValue != null, "Parent object is null");
866Debug.Assert(!state.Current.IsPopulating, "We've called TryGetPrePopulatedValue more than once");
879Debug.Assert(_jsonTypeInfo?.IsConfigurationStarted == true);
978Debug.Assert(IsConfigured);
979Debug.Assert(IsRequired);
984Debug.Assert(!IsConfigured);