602 references to Assert
Aspire.Dashboard (1)
Components\Controls\Chart\MetricTable.razor.cs (1)
212Debug.Assert(exemplars.Count == newMetrics.Sum(m => m.Value.Exemplars.Count), $"Expected {exemplars.Count} exemplars but got {newMetrics.Sum(m => m.Value.Exemplars.Count)} exemplars.");
CodeStyleConfigFileGenerator (1)
Program.cs (1)
156Debug.Assert(rule.CustomTags.Any(c => c == s_neverTag || c == s_whenExplicitlyEnabledTag || c == s_recommendedTag || c == s_highlyRecommendedTag),
http2cat (2)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (2)
603Debug.Assert(success, $"Stack-allocated space was too small for index '{index}'."); 615Debug.Assert(success, $"Stack-allocated space was too small for \"{name}\".");
IIS.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (2)
603Debug.Assert(success, $"Stack-allocated space was too small for index '{index}'."); 615Debug.Assert(success, $"Stack-allocated space was too small for \"{name}\".");
IIS.LongTests (2)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (2)
603Debug.Assert(success, $"Stack-allocated space was too small for index '{index}'."); 615Debug.Assert(success, $"Stack-allocated space was too small for \"{name}\".");
IIS.NewHandler.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (2)
603Debug.Assert(success, $"Stack-allocated space was too small for index '{index}'."); 615Debug.Assert(success, $"Stack-allocated space was too small for \"{name}\".");
IIS.NewShim.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (2)
603Debug.Assert(success, $"Stack-allocated space was too small for index '{index}'."); 615Debug.Assert(success, $"Stack-allocated space was too small for \"{name}\".");
IISExpress.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (2)
603Debug.Assert(success, $"Stack-allocated space was too small for index '{index}'."); 615Debug.Assert(success, $"Stack-allocated space was too small for \"{name}\".");
IOperationGenerator (1)
IOperationClassWriter.cs (1)
714Debug.Assert(node.ChildrenOrder != null, $"Encountered null children order for {type.Name}, should have been caught in verifier!");
Microsoft.AspNetCore.Components (1)
Rendering\RenderTreeBuilder.cs (1)
812Debug.Assert(frame.FrameTypeField == RenderTreeFrameType.Attribute, $"Frame type is {frame.FrameTypeField} at {i}");
Microsoft.AspNetCore.Http.Results (1)
ResultsOfTHelper.cs (1)
44Debug.Assert(populateMetadataMethod != null, $"Couldn't find PopulateMetadata method on {typeof(TTarget)}.");
Microsoft.AspNetCore.Mvc.Abstractions (1)
ModelBinding\ModelMetadata.cs (1)
790Debug.Assert(
Microsoft.AspNetCore.OpenApi (3)
Transformers\TypeBasedOpenApiDocumentTransformer.cs (1)
26Debug.Assert(transformer != null, $"The type {_transformerType} does not implement {nameof(IOpenApiDocumentTransformer)}.");
Transformers\TypeBasedOpenApiOperationTransformer.cs (1)
26Debug.Assert(transformer != null, $"The type {_transformerType} does not implement {nameof(IOpenApiOperationTransformer)}.");
Transformers\TypeBasedOpenApiSchemaTransformer.cs (1)
26Debug.Assert(transformer != null, $"The type {_transformerType} does not implement {nameof(IOpenApiSchemaTransformer)}.");
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (2)
603Debug.Assert(success, $"Stack-allocated space was too small for index '{index}'."); 615Debug.Assert(success, $"Stack-allocated space was too small for \"{name}\".");
Microsoft.AspNetCore.Server.Kestrel.Core (3)
Internal\Http2\FlowControl\FlowControl.cs (1)
31Debug.Assert(bytes == 0 || (bytes > 0 && bytes <= Available), $"{nameof(Advance)}({bytes}) called with {Available} bytes available.");
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (2)
603Debug.Assert(success, $"Stack-allocated space was too small for index '{index}'."); 615Debug.Assert(success, $"Stack-allocated space was too small for \"{name}\".");
Microsoft.AspNetCore.Shared.Tests (2)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (2)
603Debug.Assert(success, $"Stack-allocated space was too small for index '{index}'."); 615Debug.Assert(success, $"Stack-allocated space was too small for \"{name}\".");
Microsoft.AspNetCore.SignalR.Core (1)
Internal\DefaultHubDispatcher.cs (1)
760Debug.Assert(false, $"Failed to bind argument of type '{descriptor.OriginalParameterTypes[parameterPointer].Name}' for hub method '{descriptor.MethodExecutor.MethodInfo.Name}'.");
Microsoft.CodeAnalysis (1)
Operations\ControlFlowGraphBuilder.cs (1)
96Debug.Assert(body.Kind == OperationKind.Block ||
Microsoft.CodeAnalysis.CSharp (4)
BoundTree\BoundDecisionDagNode.cs (1)
67Debug.Assert(_id == -1, $"Id was set to {_id} and set again to {value}");
BoundTree\BoundExpression.cs (1)
22Debug.Assert(this.WasCompilerGenerated || this.Syntax is InvocationExpressionSyntax or ConstructorInitializerSyntax or PrimaryConstructorBaseTypeSyntax { ArgumentList: { } },
BoundTree\Constructors.cs (1)
194Debug.Assert(argumentRefKind is RefKind.None or RefKind.Ref or RefKind.In or RefKind.Out or RefKindExtensions.StrictIn &&
Symbols\Synthesized\SynthesizedSubstitutedTypeParameterSymbol.cs (1)
22Debug.Assert(this.TypeParameterKind == (ContainingSymbol is MethodSymbol ? TypeParameterKind.Method :
Microsoft.CodeAnalysis.Features.Test.Utilities (2)
EditAndContinue\SyntaxMapDescription.cs (2)
23Debug.Assert(index < Spans.Length, $"Marker <N:{index}> not present in new source"); 31Debug.Assert(index < newSpans.Length, $"Marker <S:{index}> not present in new source");
Microsoft.Extensions.Logging.Console (1)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
105Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
PresentationBuildTasks (4)
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\StyleModeStack.cs (2)
47Debug.Assert(Depth >= 0, $"StyleModeStack's depth was {Depth}, should be >= 0"); 64Debug.Assert(Depth >= 0, $"StyleMode::Pop() with depth of {Depth}, should be >= 0");
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlReaderHelper.cs (2)
5056Debug.Assert( xmlNodeType == XmlNodeType.Text || 5137Debug.Assert (parentNodeType == ElementContextType.Unknown,
PresentationFramework (16)
MS\Internal\Annotations\AnnotationMap.cs (1)
78Debug.Assert(list != null, $"there should be an attached annotation list for the annotationId: {annotationId}");
MS\Internal\Data\PropertyPathWorker.cs (1)
1278Debug.Assert(sb.Length == 0,
MS\Internal\Ink\StrokeCollectionDefaultValueFactory.cs (1)
38Debug.Assert(property.PropertyType == typeof(StrokeCollection),
System\Windows\Interop\ActiveXHost.cs (1)
509Debug.Assert(hr == NativeMethods.S_OK, $"DoVerb call failed for verb 0x{verb:X}");
System\Windows\Markup\BamlRecordReader.cs (1)
4232Debug.Assert(!context.CreateUsingTypeConverter,
System\Windows\Markup\StyleModeStack.cs (2)
47Debug.Assert(Depth >= 0, $"StyleModeStack's depth was {Depth}, should be >= 0"); 64Debug.Assert(Depth >= 0, $"StyleMode::Pop() with depth of {Depth}, should be >= 0");
System\Windows\Media\Animation\Storyboard.cs (2)
575Debug.Assert( mappedObject == null || mappedObject is AnimationClock || mappedObject is List<AnimationClock>, 616Debug.Assert( value is AnimationClock || value is List<AnimationClock> ,
System\Windows\StyleHelper.cs (5)
3069Debug.Assert(!StyleHelper.IsSetOnContainer(conditions[j].Property, ref containerDependents, true), 4343Debug.Assert(candidateTrigger is List<TriggerBase>, 5054Debug.Assert( existing is List<TriggerBase>, 5100Debug.Assert( existing is List<TriggerBase>, 5273Debug.Assert(candidateTrigger is List<TriggerBase>,
System\Windows\SystemResourceKey.cs (1)
1957Debug.Assert(((SystemResourceKeyID.InternalSystemColorsStart < id) && (id < SystemResourceKeyID.InternalSystemColorsEnd)) ||
System\Windows\Window.cs (1)
5967Debug.Assert(false, $"specifiedRestoreBounds can't be {specifiedRestoreBounds}");
Shared (7)
ServerSentEvents\ArrayBuffer.cs (1)
106Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
ServerSentEvents\SseParser_1.cs (6)
282Debug.Assert(searchOffset >= _lineOffset, $"{searchOffset}, {_lineLength}"); 283Debug.Assert(searchOffset <= _lineOffset + _lineLength, $"{searchOffset}, {_lineOffset}, {_lineLength}"); 284Debug.Assert(searchOffset <= _lineBuffer.Length, $"{searchOffset}, {_lineBuffer.Length}"); 286Debug.Assert(searchLength >= 0, $"{searchLength}"); 287Debug.Assert(searchLength <= _lineLength, $"{searchLength}, {_lineLength}"); 548Debug.Assert(_lineOffset == 0, $"Expected _lineOffset == 0, got {_lineOffset}");
System.Collections (1)
System\Collections\Generic\OrderedDictionary.cs (1)
423Debug.Assert(behavior is InsertionBehavior.IgnoreInsertion, $"Unknown behavior: {behavior}");
System.Collections.Concurrent (4)
System\Collections\Concurrent\ConcurrentBag.cs (1)
1064Debug.Assert(count >= 0, $"Expected _addTakeCount ({addTakeCount}) >= _stealCount ({stealCount}).");
System\Collections\Concurrent\PartitionerStatic.cs (3)
695Debug.Assert(requestedChunkSize == 1, $"Got requested chunk size of {requestedChunkSize} when single-chunking was on"); 696Debug.Assert(actualNumElementsGrabbed == 0, $"Expected actualNumElementsGrabbed == 0, instead it is {actualNumElementsGrabbed}"); 697Debug.Assert(destArray.Length == 1, $"Expected destArray to be of length 1, instead its length is {destArray.Length}");
System.ComponentModel.TypeConverter (7)
System\ComponentModel\Design\DesigntimeLicenseContextSerializer.cs (1)
175Debug.Assert(binaryWriterIdentifier == BinaryWriterMagic, $"Expected the first byte to be {BinaryWriterMagic}");
System\ComponentModel\ReflectEventDescriptor.cs (3)
89Debug.Assert(type.IsSubclassOf(typeof(Delegate)), $"Not a valid ReflectEvent: {componentClass.FullName}. {name} {type.FullName}"); 243Debug.Assert(_removeMethod != null, $"Null remove method for {Name}"); 246Debug.Assert(_addMethod != null, $"Null remove method for {Name}");
System\ComponentModel\ReflectTypeDescriptionProvider.cs (3)
612Debug.Assert(eppa != null, $"Extender property {prop.Name} has no provider attribute. We will skip it."); 1209Debug.Assert(dbgEvent != null, $"Holes in event array for type {type}"); 1406Debug.Assert(Array.TrueForAll(properties, dbgProp => dbgProp is not null), $"Holes in property array for type {type}");
System.Data.Common (37)
src\libraries\Common\src\System\Data\Common\DbConnectionOptions.Common.cs (3)
504Debug.Assert(parsetableContainsKey, $"{nameof(ParseInternal)} code vs. regex mismatch keyname <{keyname}>"); 505Debug.Assert(value1 == value2, $"{nameof(ParseInternal)} code vs. regex mismatch keyvalue <{value1}> <{value2}>"); 530Debug.Assert(isEquivalent, $"ParseInternal code vs regex message mismatch: <{msg1}> <{msg2}>");
System\Data\Common\DBCommandBuilder.cs (1)
201Debug.Assert(_isMutatedName[iMutatedName], $"{_baseParameterNames[iMutatedName]} expected to be a mutated name");
System\Data\Common\DbConnectionStringBuilder.cs (1)
251Debug.Assert(null != values[i], $"null value {keylist.Current}");
System\Data\Filter\AggregateNode.cs (1)
117Debug.Assert(_column != null, $"Failed to bind column {_columnName}");
System\Data\Filter\FunctionNode.cs (18)
321Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}"); 332Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}"); 344Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}"); 348Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}"); 352Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}"); 356Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}"); 360Debug.Assert(_argumentCount == 2, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}"); 362Debug.Assert(argumentValues[0] is string, $"Invalid argument type for {s_funcs[_info]._name}"); 363Debug.Assert(argumentValues[1] is string, $"Invalid argument type for {s_funcs[_info]._name}"); 377Debug.Assert(_argumentCount == 3, $"Invalid argument argumentCount: {_argumentCount.ToString(FormatProvider)}"); 404Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}"); 405Debug.Assert((argumentValues[0] is string) || (argumentValues[0] is SqlString), $"Invalid argument type for {s_funcs[_info]._name}"); 423Debug.Assert(_argumentCount == 3, $"Invalid argument argumentCount: {_argumentCount.ToString(FormatProvider)}"); 424Debug.Assert((argumentValues[0] is string) || (argumentValues[0] is SqlString), $"Invalid first argument {argumentValues[0].GetType().FullName} in {s_funcs[_info]._name}"); 425Debug.Assert(argumentValues[1] is int, $"Invalid second argument {argumentValues[1].GetType().FullName} in {s_funcs[_info]._name}"); 426Debug.Assert(argumentValues[2] is int, $"Invalid third argument {argumentValues[2].GetType().FullName} in {s_funcs[_info]._name}"); 465Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}"); 466Debug.Assert((argumentValues[0] is string) || (argumentValues[0] is SqlString), $"Invalid argument type for {s_funcs[_info]._name}");
System\Data\Filter\NameNode.cs (1)
61Debug.Assert(_column != null, $"Failed to bind column {_name}");
System\Data\ForeignKeyConstraint.cs (2)
507Debug.Assert(Table?.DataSet != null, $"Relation {ConstraintName} isn't part of a DataSet, so this check shouldn't be happening."); 520Debug.Assert(Table?.DataSet != null, $"ForeignKeyConstraint {ConstraintName} isn't part of a DataSet, so this check shouldn't be happening.");
System\Data\Merger.cs (1)
600Debug.Assert(MissingSchemaAction.Error == _missingSchemaAction, $"Unexpected value of MissingSchemaAction parameter : {_missingSchemaAction}");
System\Data\SQLTypes\SQLDecimal.cs (1)
421Debug.Assert(precision == bActualPrecision, $"CalculatePrecision={precision}, BActualPrec={bActualPrecision}. Results must be equal!");
System\Data\XDRSchema.cs (3)
133Debug.Assert(FEqualIdentity(node, Keywords.XDR_ELEMENTTYPE, Keywords.XDRNS), $"Invalid node type {node.LocalName}"); 285Debug.Assert(nt.name != name, $"FindNameType('{name}') -- failed. Existed name not found"); 290Debug.Assert(s_mapNameTypeXdr[index].name == name, $"FindNameType('{name}') -- failed. Wrong name found");
System\Data\XMLSchema.cs (5)
1789Debug.Assert((s_mapNameTypeXsd[i - 1].CompareTo(s_mapNameTypeXsd[i].name)) < 0, $"incorrect sorting {s_mapNameTypeXsd[i].name}"); 1855Debug.Assert((s_mapNameTypeXsd[i - 1].CompareTo(s_mapNameTypeXsd[i].name)) < 0, $"incorrect sorting {s_mapNameTypeXsd[i].name}"); 1903Debug.Assert((s_mapNameTypeXsd[i - 1].CompareTo(s_mapNameTypeXsd[i].name)) < 0, $"incorrect sorting {s_mapNameTypeXsd[i].name}"); 1913Debug.Assert(nt.name != name, $"FindNameType('{name}') -- failed. Existed name not found"); 1918Debug.Assert(s_mapNameTypeXsd[index].name == name, $"FindNameType('{name}') -- failed. Wrong name found");
System.Data.Odbc (6)
src\libraries\Common\src\System\Data\Common\DbConnectionOptions.Common.cs (3)
504Debug.Assert(parsetableContainsKey, $"{nameof(ParseInternal)} code vs. regex mismatch keyname <{keyname}>"); 505Debug.Assert(value1 == value2, $"{nameof(ParseInternal)} code vs. regex mismatch keyvalue <{value1}> <{value2}>"); 530Debug.Assert(isEquivalent, $"ParseInternal code vs regex message mismatch: <{msg1}> <{msg2}>");
System\Data\Odbc\OdbcParameter.cs (3)
410Debug.Assert((0 <= cch) && (cch < 0x3fffffff), $"GetColumnSize: cch = {cch} out of range, _internalShouldSerializeSize = {_internalShouldSerializeSize}, _internalSize = {_internalSize}"); 455Debug.Assert((0 <= cch) && (cch < 0x3fffffff), $"GetValueSize: cch = {cch} out of range, _internalShouldSerializeSize = {_internalShouldSerializeSize}, _internalSize = {_internalSize}"); 529Debug.Assert((0 <= ccb) && (ccb < 0x3fffffff), $"GetParameterSize: out of range {ccb}");
System.Diagnostics.Process (2)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.MountPoints.FormatInfo.cs (1)
17System.Diagnostics.Debug.Assert(GetDriveType(name) != DriveType.Unknown,
src\libraries\Common\src\Interop\Unix\System.Native\Interop.UnixFileSystemTypes.cs (1)
159Debug.Assert(Enum.IsDefined(fileSystemType) || fstatfsResult == 0, $"GetFileSystemType returned {fstatfsResult}");
System.Drawing.Primitives (1)
System\Drawing\Color.cs (1)
402Debug.Assert(tablename != null, $"Could not find known color '{(KnownColor)knownColor}' in the KnownColorTable");
System.Formats.Asn1 (3)
System\Formats\Asn1\AsnWriter.BitString.cs (1)
192Debug.Assert(_offset - savedOffset == expectedSize, $"expected size was {expectedSize}, actual was {_offset - savedOffset}");
System\Formats\Asn1\AsnWriter.GeneralizedTime.cs (1)
92Debug.Assert(bytesWritten > 2, $"{bytesWritten} should be > 2");
System\Formats\Asn1\AsnWriter.OctetString.cs (1)
165Debug.Assert(_offset - savedOffset == expectedSize, $"expected size was {expectedSize}, actual was {_offset - savedOffset}");
System.Formats.Tar (1)
System\Formats\Tar\TarEntry.cs (1)
397Debug.Assert(Path.IsPathFullyQualified(qualifiedPath), $"{qualifiedPath} is not qualified");
System.IO.Compression.Brotli (1)
System\IO\Compression\dec\BrotliStream.Decompress.cs (1)
223Debug.Assert(
System.IO.FileSystem.DriveInfo (2)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.MountPoints.FormatInfo.cs (1)
17System.Diagnostics.Debug.Assert(GetDriveType(name) != DriveType.Unknown,
src\libraries\Common\src\Interop\Unix\System.Native\Interop.UnixFileSystemTypes.cs (1)
159Debug.Assert(Enum.IsDefined(fileSystemType) || fstatfsResult == 0, $"GetFileSystemType returned {fstatfsResult}");
System.IO.Ports (1)
System\IO\Ports\SafeSerialDeviceHandle.Unix.cs (1)
42Debug.Assert(result == 0, $"Close failed with result {result} and error {Interop.Sys.GetLastErrorInfo()}");
System.Linq.Expressions (3)
System\Linq\Expressions\Interpreter\InstructionList.cs (2)
198Debug.Assert(_currentStackDepth >= 0, $"negative stack depth {instruction}"); 206Debug.Assert(_currentContinuationsDepth >= 0, $"negative continuations {instruction}");
System\Linq\Expressions\Interpreter\LightCompiler.cs (1)
3099Debug.Assert(_instructions.CurrentStackDepth == startingStackDepth + (expr.Type == typeof(void) ? 0 : 1),
System.Net.Http (39)
src\libraries\Common\src\System\CharArrayHelpers.cs (3)
14Debug.Assert(startIndex >= 0, $"Expected {nameof(startIndex)} to be >= 0, got {startIndex}"); 15Debug.Assert(length >= 0, $"Expected {nameof(length)} to be >= 0, got {length}"); 16Debug.Assert(startIndex <= array.Length - length, $"Expected {startIndex} to be <= {array.Length} - {length}, got {startIndex}");
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
105Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackEncoder.cs (2)
603Debug.Assert(success, $"Stack-allocated space was too small for index '{index}'."); 615Debug.Assert(success, $"Stack-allocated space was too small for \"{name}\".");
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (8)
71Debug.Assert(byteCount <= ActiveMemory.Length, $"MultiArrayBuffer.Discard: Expected byteCount={byteCount} <= {ActiveMemory.Length}"); 121Debug.Assert(byteCount <= AvailableMemory.Length, $"MultiArrayBuffer.Commit: Expected byteCount={byteCount} <= {AvailableMemory.Length}"); 220Debug.Assert(_activeStart / BlockSize == 0, $"Start is not in first block after move or resize?? _activeStart={_activeStart}"); 257Debug.Assert(_allocatedEnd % BlockSize == 0, $"_allocatedEnd={_allocatedEnd} not at block boundary?"); 279Debug.Assert(_activeStart == 0, $"No active bytes but _activeStart={_activeStart}"); 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}");
src\libraries\Common\src\System\Net\Security\SslClientAuthenticationOptionsExtensions.cs (5)
48Debug.Assert(cloneEnumerable != null, $"{pi.Name}. Expected enumerable cloned value."); 58Debug.Assert(e2.MoveNext(), $"{pi.Name}. Cloned enumerator too short."); 59Debug.Assert(Equals(e1.Current, e2.Current), $"{pi.Name}. Cloned enumerator's values don't match."); 61Debug.Assert(!e2.MoveNext(), $"{pi.Name}. Cloned enumerator too long."); 75Debug.Assert(Equals(origValue, cloneValue), $"{pi.Name}. Expected: {origValue}, Actual: {cloneValue}");
System\Net\Http\Headers\HeaderDescriptor.cs (1)
31Debug.Assert(customHeader || KnownHeaders.TryGetKnownHeader(headerName) is null, $"The {nameof(KnownHeader)} overload should be used for {headerName}");
System\Net\Http\Headers\HttpHeaders.cs (2)
386Debug.Assert(descriptor.Parser.SupportsMultipleValues, $"Header '{descriptor.Name}' doesn't support multiple values"); 489Debug.Assert(headerRemoved, $"Existing header '{descriptor.Name}' couldn't be removed.");
System\Net\Http\HttpContent.cs (2)
254Debug.Assert(_contentReadStream is Stream, $"Expected a Stream, got ${_contentReadStream}"); 283Debug.Assert(_contentReadStream is Task<Stream>, $"Expected a Task<Stream>, got ${_contentReadStream}");
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (3)
323Debug.Assert(_chunkBytesRemaining == 0, $"Expected {nameof(_chunkBytesRemaining)} == 0, got {_chunkBytesRemaining}"); 380Debug.Assert(_chunkBytesRemaining == 0, $"Expected {nameof(_chunkBytesRemaining)} == 0, got {_chunkBytesRemaining}"); 396Debug.Assert(_chunkBytesRemaining == 0, $"Expected {nameof(_chunkBytesRemaining)} == 0, got {_chunkBytesRemaining}");
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http1.cs (3)
105Debug.Assert(_associatedHttp11ConnectionCount >= connectionCount + _pendingHttp11ConnectionCount, 108Debug.Assert(_associatedHttp11ConnectionCount <= _maxHttp11Connections, 110Debug.Assert(_associatedHttp11ConnectionCount >= _pendingHttp11ConnectionCount,
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http2.cs (2)
394Debug.Assert(_associatedHttp2ConnectionCount > (_availableHttp2Connections?.Count ?? 0), 417Debug.Assert((_availableHttp2Connections?.Count ?? 0) == 0, $"With {(_availableHttp2Connections?.Count ?? 0)} available HTTP2 connections, we shouldn't have a waiter.");
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http3.cs (2)
397Debug.Assert(_associatedHttp3ConnectionCount > (_availableHttp3Connections?.Count ?? 0), 420Debug.Assert((_availableHttp3Connections?.Count ?? 0) == 0, $"With {(_availableHttp3Connections?.Count ?? 0)} available HTTP3 connections, we shouldn't have a waiter.");
System\Net\Http\SocketsHttpHandler\ConnectionPool\RequestQueue.cs (1)
167Debug.Assert(_attemptedConnectionsOffset < _size, $"{_attemptedConnectionsOffset} < {_size}");
System\Net\Http\SocketsHttpHandler\Http2Stream.cs (4)
248Debug.Assert(_requestCompletionState == StreamCompletionState.InProgress, $"Request already completed with state={_requestCompletionState}"); 291Debug.Assert(_requestCompletionState == StreamCompletionState.InProgress, $"Request already completed with state={_requestCompletionState}"); 827Debug.Assert(_responseCompletionState == StreamCompletionState.InProgress, $"Response already completed with state={_responseCompletionState}"); 901Debug.Assert(_responseCompletionState == StreamCompletionState.InProgress, $"Response already completed with state={_responseCompletionState}");
System.Net.HttpListener (1)
System\Net\HttpListenerRequestUriBuilder.cs (1)
122Debug.Assert((type == EncodingType.Primary) || (type == EncodingType.Secondary), $"Unknown 'EncodingType' value: {type}");
System.Net.Mail (12)
System\Net\Mail\DomainLiteralReader.cs (1)
34Debug.Assert(0 <= index && index < data.Length, $"index was outside the bounds of the string: {index}");
System\Net\Mail\DotAtomReader.cs (1)
40Debug.Assert(0 <= index && index < data.Length, $"index was outside the bounds of the string: {index}");
System\Net\Mail\MailAddressParser.cs (4)
30Debug.Assert(!parseSuccess || index == -1, $"The index indicates that part of the address was not parsed: {index}"); 70Debug.Assert(index >= 0 && index < data.Length, $"Index out of range: {index}, {data.Length}"); 382Debug.Assert(data[index + 1] == MailBnfHelper.Quote, $"Mis-aligned index: {index}"); 421Debug.Assert(index < 0 || data[index] == MailBnfHelper.Comma, $"Mis-aligned index: {index}");
System\Net\Mail\QuotedPairReader.cs (3)
37Debug.Assert(0 <= index && index < data.Length, $"Index out of range: {index}, {data.Length}"); 85Debug.Assert(index >= 0 && data[index] == MailBnfHelper.Backslash, $"index was not a backslash: {index}"); 96Debug.Assert(index < 0 || data[index] != MailBnfHelper.Backslash, $"index was a backslash: {index}");
System\Net\Mail\QuotedStringFormatReader.cs (3)
38Debug.Assert(0 <= index && index < data.Length, $"Index out of range: {index}, {data.Length}"); 40Debug.Assert(data[index] == MailBnfHelper.Quote, $"Initial char at index {index} was not a quote."); 129Debug.Assert(0 <= index && index < data.Length, $"Index out of range: {index}, {data.Length}");
System.Net.NameResolution (3)
src\libraries\Common\src\System\Net\InteropIPAddressExtensions.Unix.cs (1)
16Debug.Assert(bytesWritten == sizeof(uint) || bytesWritten == Interop.Sys.IPv6AddressBytes, $"Unexpected length: {bytesWritten}");
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
27Debug.Assert(err == Interop.Error.SUCCESS, $"Unexpected err: {err}");
System\Net\NameResolutionTelemetry.cs (1)
139Debug.Assert(host is not null, $"Unknown hostNameOrAddress type: {hostNameOrAddress.GetType().Name}");
System.Net.Ping (5)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
27Debug.Assert(err == Interop.Error.SUCCESS, $"Unexpected err: {err}");
src\libraries\Common\src\System\Net\Sockets\SocketErrorPal.Unix.cs (2)
14Debug.Assert(s_nativeErrorToSocketError.Count == NativeErrorToSocketErrorCount, 17Debug.Assert(s_socketErrorToNativeError.Count == SocketErrorToNativeErrorCount,
System\Net\NetworkInformation\Ping.cs (2)
101Debug.Assert(currentStatus == Disposed, $"Expected currentStatus == Disposed, got {currentStatus}"); 121Debug.Assert(_status == InProgress, $"Invalid status: {_status}");
System.Net.Primitives (3)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
27Debug.Assert(err == Interop.Error.SUCCESS, $"Unexpected err: {err}");
src\libraries\Common\src\System\Net\Sockets\SocketErrorPal.Unix.cs (2)
14Debug.Assert(s_nativeErrorToSocketError.Count == NativeErrorToSocketErrorCount, 17Debug.Assert(s_socketErrorToNativeError.Count == SocketErrorToNativeErrorCount,
System.Net.Quic (12)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
105Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (8)
71Debug.Assert(byteCount <= ActiveMemory.Length, $"MultiArrayBuffer.Discard: Expected byteCount={byteCount} <= {ActiveMemory.Length}"); 121Debug.Assert(byteCount <= AvailableMemory.Length, $"MultiArrayBuffer.Commit: Expected byteCount={byteCount} <= {AvailableMemory.Length}"); 220Debug.Assert(_activeStart / BlockSize == 0, $"Start is not in first block after move or resize?? _activeStart={_activeStart}"); 257Debug.Assert(_allocatedEnd % BlockSize == 0, $"_allocatedEnd={_allocatedEnd} not at block boundary?"); 279Debug.Assert(_activeStart == 0, $"No active bytes but _activeStart={_activeStart}"); 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}");
src\libraries\Common\src\System\Net\Security\CertificateValidation.Unix.cs (1)
60Debug.Assert(hostNameMatch == 0 || hostNameMatch == 1, $"Expected 0 or 1 from CheckX509Hostname, got {hostNameMatch}");
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
27Debug.Assert(err == Interop.Error.SUCCESS, $"Unexpected err: {err}");
System\Net\Quic\QuicConnection.cs (1)
639Debug.Assert(_negotiatedSslProtocol == SslProtocols.Tls13, $"Unexpected TLS version {info.TlsProtocolVersion}");
System.Net.Requests (1)
System\Net\WebRequest.cs (1)
364Debug.Assert(prefixList.Count == Count, $"Expected {Count}, got {prefixList.Count}");
System.Net.Security (5)
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.GssBuffer.cs (1)
22Debug.Assert((offset >= 0 && offset < destination.Length) || destination.Length == 0, $"invalid offset {offset}");
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (1)
76Debug.Assert(ret == 0, $"Unexpected response from X509DecodeOcspToExpiration: {ret}");
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
105Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
src\libraries\Common\src\System\Net\Security\CertificateValidation.Unix.cs (1)
60Debug.Assert(hostNameMatch == 0 || hostNameMatch == 1, $"Expected 0 or 1 from CheckX509Hostname, got {hostNameMatch}");
System\Net\Security\SslConnectionInfo.Unix.cs (1)
35Debug.Assert(data != 0, $"No mapping found for cipherSuite {cipherSuite}");
System.Net.ServerSentEvents (7)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
105Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
System\Net\ServerSentEvents\SseParser_1.cs (6)
266Debug.Assert(searchOffset >= _lineOffset, $"{searchOffset}, {_lineLength}"); 267Debug.Assert(searchOffset <= _lineOffset + _lineLength, $"{searchOffset}, {_lineOffset}, {_lineLength}"); 268Debug.Assert(searchOffset <= _lineBuffer.Length, $"{searchOffset}, {_lineBuffer.Length}"); 270Debug.Assert(searchLength >= 0, $"{searchLength}"); 271Debug.Assert(searchLength <= _lineLength, $"{searchLength}, {_lineLength}"); 524Debug.Assert(_lineOffset == 0, $"Expected _lineOffset == 0, got {_lineOffset}");
System.Net.Sockets (43)
src\libraries\Common\src\System\Net\InteropIPAddressExtensions.Unix.cs (1)
16Debug.Assert(bytesWritten == sizeof(uint) || bytesWritten == Interop.Sys.IPv6AddressBytes, $"Unexpected length: {bytesWritten}");
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
27Debug.Assert(err == Interop.Error.SUCCESS, $"Unexpected err: {err}");
src\libraries\Common\src\System\Net\Sockets\SocketErrorPal.Unix.cs (2)
14Debug.Assert(s_nativeErrorToSocketError.Count == NativeErrorToSocketErrorCount, 17Debug.Assert(s_socketErrorToNativeError.Count == SocketErrorToNativeErrorCount,
System\Net\Sockets\SafeSocketHandle.cs (2)
158Debug.Assert(ExceptionCheck.IsFatal(exception), $"handle:{handle}, error:{exception}"); 166Debug.Assert(ret, $"ReleaseHandle failed. handle:{handle}");
System\Net\Sockets\SafeSocketHandle.Unix.cs (2)
146Debug.Assert(value == -1 || value > 0, $"Unexpected value: {value}"); 159Debug.Assert(value == -1 || value > 0, $"Unexpected value: {value}");
System\Net\Sockets\Socket.Unix.cs (1)
304Debug.Assert(Equals(origValue, cloneValue), $"{pi.Name}. Expected: {origValue}, Actual: {cloneValue}");
System\Net\Sockets\SocketAsyncContext.Unix.cs (22)
164Debug.Assert(oldState == State.Waiting, $"Unexpected operation state: {(State)oldState}"); 182Debug.Assert(state is State.Running or State.RunningWithPendingCancellation, $"Unexpected operation state: {(State)state}"); 258Debug.Assert(!Interlocked.Exchange(ref _callbackQueued, true), $"Unexpected _callbackQueued: {_callbackQueued}"); 627Debug.Assert(ErrorCode == SocketError.Success || AcceptedFileDescriptor == (IntPtr)(-1), $"Unexpected values: ErrorCode={ErrorCode}, AcceptedFileDescriptor={AcceptedFileDescriptor}"); 1046Debug.Assert(_state == QueueState.Processing, $"_state={_state} while processing queue!"); 1074Debug.Assert(_state == QueueState.Processing, $"_state={_state} while processing queue!"); 1105Debug.Assert(_state == QueueState.Processing, $"_state={_state} while processing queue!"); 1376Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1451Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1458Debug.Assert(errorCode == SocketError.Success || acceptedFd == (IntPtr)(-1), $"Unexpected values: errorCode={errorCode}, acceptedFd={acceptedFd}"); 1476Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1486Debug.Assert(errorCode == SocketError.Success || acceptedFd == (IntPtr)(-1), $"Unexpected values: errorCode={errorCode}, acceptedFd={acceptedFd}"); 1514Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1541Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1608Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1753Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1822Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1859Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1951Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1983Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 2062Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 2132Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}");
System\Net\Sockets\SocketAsyncEngine.Unix.cs (1)
232Debug.Assert(numEvents > 0, $"Unexpected numEvents: {numEvents}");
System\Net\Sockets\SocketAsyncEventArgs.cs (1)
539Debug.Assert(status == OperationState.InProgress || status == OperationState.Configuring || status == OperationState.Disposed, $"Unexpected status: {status}");
System\Net\Sockets\SocketAsyncEventArgs.Unix.cs (1)
55Debug.Assert(acceptHandle == null, $"Unexpected acceptHandle: {acceptHandle}");
System\Net\Sockets\SocketPal.Unix.cs (9)
89Debug.Assert(fd == (IntPtr)(-1), $"Unexpected fd: {fd}"); 673Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 747Debug.Assert(err == Interop.Error.EBADF, $"Unexpected err: {err}"); 1534Debug.Assert(optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership, $"Unexpected optionName: {optionName}"); 1557Debug.Assert(optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership, $"Unexpected optionName={optionName}"); 1705Debug.Assert(optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership, $"Unexpected optionName={optionName}"); 1730Debug.Assert(optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership, $"Unexpected optionName={optionName}"); 1950Debug.Assert(offset == eventsLength, $"Invalid adds. offset={offset}, eventsLength={eventsLength}."); 1951Debug.Assert(refsAdded == eventsLength, $"Invalid ref adds. refsAdded={refsAdded}, eventsLength={eventsLength}.");
System.Net.WebSockets (10)
System\Net\WebSockets\ManagedWebSocket.cs (10)
146Debug.Assert(keepAliveInterval == Timeout.InfiniteTimeSpan || keepAliveInterval >= TimeSpan.Zero, $"Invalid {nameof(keepAliveInterval)}: {keepAliveInterval}"); 147Debug.Assert(keepAliveTimeout == Timeout.InfiniteTimeSpan || keepAliveTimeout >= TimeSpan.Zero, $"Invalid {nameof(keepAliveTimeout)}: {keepAliveTimeout}"); 720Debug.Assert(sendBuffer.Length >= MaxMessageHeaderLength, $"Expected {nameof(sendBuffer)} to be at least {MaxMessageHeaderLength}, got {sendBuffer.Length}"); 894Debug.Assert(header.Opcode == MessageOpcode.Binary || header.Opcode == MessageOpcode.Text, $"Unexpected opcode {header.Opcode}"); 1435Debug.Assert( 1574Debug.Assert(count >= 0, $"Expected non-negative {nameof(count)}, got {count}"); 1575Debug.Assert(count <= _receiveBufferCount, $"Trying to consume {count}, which is more than exists {_receiveBufferCount}"); 1583Debug.Assert(minimumRequiredBytes <= _receiveBuffer.Length, $"Requested number of bytes {minimumRequiredBytes} must not exceed {_receiveBuffer.Length}"); 1653Debug.Assert(maskOffsetIndex < MaskLength, $"Unexpected {nameof(maskOffsetIndex)}: {maskOffsetIndex}"); 1654Debug.Assert(mask.Length >= MaskLength + maskOffset, $"Unexpected inputs: {mask.Length}, {maskOffset}");
System.Numerics.Tensors (1)
System\Numerics\Tensors\netcore\TensorPrimitives.HammingDistance.cs (1)
198Debug.Assert(count >= 0 && count <= x.Length, $"Expected count to be in the range [0, {x.Length}], got {count}.");
System.Private.CoreLib (56)
src\libraries\Common\src\Interop\Unix\System.Native\Interop.UnixFileSystemTypes.cs (1)
159Debug.Assert(Enum.IsDefined(fileSystemType) || fstatfsResult == 0, $"GetFileSystemType returned {fstatfsResult}");
src\libraries\Common\src\System\Number.NumberBuffer.cs (1)
78Debug.Assert(char.IsAsciiDigit((char)digit), $"Unexpected character found in Number: {digit}");
src\libraries\System.Private.CoreLib\src\Microsoft\Win32\SafeHandles\SafeFileHandle.ThreadPoolValueTaskSource.cs (1)
56Debug.Assert(op == Operation.None, $"An operation was queued before the previous {op}'s completion.");
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlEncoder.cs (1)
161Debug.Assert(buffer.Length == charsWritten, $"The source length: {source.Length}, bytes written: {charsWritten}");
src\libraries\System.Private.CoreLib\src\System\Collections\Concurrent\ConcurrentQueueSegment.cs (2)
48Debug.Assert(boundedLength >= 2, $"Must be >= 2, got {boundedLength}"); 49Debug.Assert(BitOperations.IsPow2(boundedLength), $"Must be a power of 2, got {boundedLength}");
src\libraries\System.Private.CoreLib\src\System\Convert.cs (1)
2372Debug.Assert(result.Length == charsWritten, $"Expected {result.Length} == {charsWritten}");
src\libraries\System.Private.CoreLib\src\System\Enum.cs (2)
2014Debug.Assert(foundItemsCount >= 2 && foundItemsCount <= 64, $"{nameof(foundItemsCount)} == {foundItemsCount}"); 2109Debug.Assert(foundItems.Length >= 2, $"{nameof(foundItems)} == {foundItems.Length}");
src\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.Icu.cs (1)
331Debug.Assert(!unsupportedDateFieldSymbols.Contains(input[index]),
src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.cs (1)
2191Debug.Assert(index >= 10, $"Couldn't read native digits for '{_sWindowsName}' successfully.");
src\libraries\System.Private.CoreLib\src\System\Globalization\HebrewCalendar.cs (1)
659Debug.Assert(hebrewYearType >= 1 && hebrewYearType <= 6,
src\libraries\System.Private.CoreLib\src\System\IO\BufferedStream.cs (5)
383Debug.Assert(_readPos <= _readLen, $"_readPos <= _readLen [{_readPos} <= {_readLen}]"); 933Debug.Assert(_writePos < _bufferSize, $"Expected {_writePos} < {_bufferSize}"); 1225Debug.Assert(newPos == Position, $"newPos (={newPos}) == Position (={Position})"); 1251Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}"); 1290Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}");
src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEntry.Unix.cs (1)
82Debug.Assert(Directory.Length + FileName.Length < _pathBuffer.Length,
src\libraries\System.Private.CoreLib\src\System\IO\FileSystemInfo.Unix.cs (1)
24Debug.Assert(!PathInternal.IsPartiallyQualified(fullPath), $"'{fullPath}' should be fully qualified when constructed from directory enumeration");
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (4)
849Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}"); 880Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}"); 939Debug.Assert(newPos == Position, $"newPos (={newPos}) == Position (={Position})"); 977Debug.Assert(_readPos <= _readLen, $"_readPos <= _readLen [{_readPos} <= {_readLen}]");
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\OSFileStreamStrategy.cs (1)
221Debug.Assert(r >= 0, $"RandomAccess.ReadAtOffset returned {r}.");
src\libraries\System.Private.CoreLib\src\System\Math.cs (2)
1601Debug.Assert(ret == result, $"Multiply overflow got: {ret}, expected: {result}"); 1644Debug.Assert(ret == left * right, $"Multiply overflow got: {ret}, expected: {left * right}");
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (1)
5773Debug.Assert(_splitMode == SpanSplitEnumeratorMode.SearchValues, $"Unknown split mode: {_splitMode}");
src\libraries\System.Private.CoreLib\src\System\Net\WebUtility.cs (1)
675Debug.Assert(s_lookupTable.Count == 253, $"There should be 253 HTML entities, but {nameof(s_lookupTable)} has {s_lookupTable.Count} of them.");
src\libraries\System.Private.CoreLib\src\System\Number.Parsing.cs (1)
559Debug.Assert((styles & ~TParser.AllowedStyles) == 0, $"Only handles subsets of {TParser.AllowedStyles} format");
src\libraries\System.Private.CoreLib\src\System\Random.cs (3)
398Debug.Assert(result >= minInclusive && result < maxExclusive, $"Expected {minInclusive} <= {result} < {maxExclusive}"); 402Debug.Assert(result == minInclusive, $"Expected {minInclusive} == {result}"); 409Debug.Assert(result >= 0.0 && result < 1.0, $"Expected 0.0 <= {result} < 1.0");
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (2)
198Debug.Assert(index >= 0 && index < _numResources, $"Bad index into hash array. index: {index}"); 214Debug.Assert(index >= 0 && index < _numResources, $"Bad index into name position array. index: {index}");
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs (1)
342Debug.Assert(m_stateObject is null or ExecutionContext, $"Expected {nameof(m_stateObject)} to be null or an ExecutionContext but was {(m_stateObject is object o ? o.GetType().ToString() : "(null)")}.");
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\PoolingAsyncValueTaskMethodBuilderT.cs (3)
358Debug.Assert(s_perCoreCache.Length == Environment.ProcessorCount, $"{s_perCoreCache.Length} != {Environment.ProcessorCount}"); 367Debug.Assert(transientValue is null || transientValue is StateMachineBox<TStateMachine>, 391Debug.Assert(s is StateMachineBox<TStateMachine>, $"Expected {nameof(StateMachineBox<TStateMachine>)}, got '{s}'");
src\libraries\System.Private.CoreLib\src\System\Runtime\GCSettings.cs (1)
49Debug.Assert(status == SetLatencyModeStatus.Succeeded, $"Unexpected return value '{status}' from {nameof(SetGCLatencyMode)}.");
src\libraries\System.Private.CoreLib\src\System\SR.cs (1)
97Debug.Assert(s != null, $"Looking up resource '{key}' failed. Was your resource name misspelled? Did you rebuild after adding a resource?");
src\libraries\System.Private.CoreLib\src\System\Text\EncoderLatin1BestFitFallback.cs (2)
42Debug.Assert(_iCount < 1, $"[EncoderLatin1BestFitFallbackBuffer.Fallback(non surrogate)] Fallback char {(int)_cBestFit:X4} caused recursive fallback"); 68Debug.Assert(_iCount < 1, $"[EncoderLatin1BestFitFallbackBuffer.Fallback(surrogate)] Fallback char {(int)_cBestFit:X4} caused recursive fallback");
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (2)
2145Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk), 2165Debug.Assert(indexInChunk >= chunk.m_ChunkLength || count == 0,
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (2)
838Debug.Assert(exceptionList.Count > 0, $"Expected {exceptionList.Count} > 0"); 947Debug.Assert(s is CancellationTokenSource, $"Expected {typeof(CancellationTokenSource)}, got {s}");
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.WaitThread.cs (2)
299Debug.Assert(_numPendingRemoves <= _numUserWaits, $"Num removals {_numPendingRemoves} should be less than or equal to num user waits {_numUserWaits}"); 354Debug.Assert(originalNumUserWaits - originalNumPendingRemoves == _numUserWaits,
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Sources\ManualResetValueTaskSourceCore.cs (5)
244Debug.Assert(context is TaskScheduler or SynchronizationContext, $"context is {context}"); 259Debug.Assert(scheduler is SynchronizationContext or TaskScheduler, $"{nameof(scheduler)} is {scheduler}"); 279Debug.Assert( 301Debug.Assert(cc._scheduler is TaskScheduler, $"{nameof(cc._scheduler)} is {cc._scheduler}"); 320Debug.Assert(capturedContext is ExecutionContext or CapturedSchedulerAndExecutionContext, $"{nameof(capturedContext)} is {capturedContext}");
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (1)
6118Debug.Assert(failedOrCanceled is Task, $"Expected Task, got {failedOrCanceled}");
src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParser.cs (1)
64Debug.Assert(parsedName.GetNodeCount() == recursiveDepth, $"Node count mismatch for '{typeName.ToString()}'");
src\System\Enum.CoreCLR.cs (1)
82Debug.Assert(
System.Private.DataContractSerialization (1)
System\Xml\ValueHandle.cs (1)
772Debug.Assert(byteOffset + actualByteCount < bytes.Length,
System.Private.Uri (3)
System\IPv4AddressHelper.cs (1)
48Debug.Assert(result != Invalid, $"Failed to parse after already validated: {name}");
System\PercentEncodingHelper.cs (2)
90Debug.Assert(bytesConsumed >= 2, $"Rune.DecodeFromUtf8 consumed {bytesConsumed} bytes, likely indicating input was modified concurrently during UnescapePercentEncodedUTF8Sequence's execution"); 106Debug.Assert(bytesConsumed > 0, $"Rune.DecodeFromUtf8 consumed {bytesConsumed} bytes when decoding {bytesLeftInBuffer} bytes");
System.Private.Xml (42)
System\Xml\Cache\XPathNode.cs (3)
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}");
System\Xml\Schema\XsdDateTime.cs (1)
185Debug.Assert(dateTime.Kind == DateTimeKind.Local, $"Unknown DateTimeKind: {dateTime.Kind}");
System\Xml\XPath\XPathNavigatorReader.cs (1)
1028Debug.Assert(_nav.NodeType == XPathNodeType.Element, $"{_nav.NodeType} == XPathNodeType.Element");
System\Xml\Xsl\IlGen\IteratorDescriptor.cs (3)
100Debug.Assert(loc.LocalType == itemStorageType || 117Debug.Assert(currentMethod.ReturnType == itemStorageType, 133Debug.Assert(methGlobal.ReturnType == itemStorageType ||
System\Xml\Xsl\IlGen\OptimizerPatterns.cs (1)
236Debug.Assert(arg != null, $"There is no '{argNum}' argument.");
System\Xml\Xsl\IlGen\XmlILOptimizerVisitor.cs (1)
5432Debug.Assert(left.XmlType == right.XmlType, $"Comparison is not defined between {left.XmlType} and {right.XmlType}");
System\Xml\Xsl\IlGen\XmlIlVisitor.cs (2)
1753Debug.Assert(code != XmlTypeCode.QName, $"QName values do not support the {relOp} operation"); 4694Debug.Assert(_iterCurr.Storage.Location == ItemLocation.None ||
System\Xml\Xsl\Runtime\EarlyBoundInfo.cs (1)
28Debug.Assert(_constrInfo != null, $"The early bound object type {ebType.FullName} must have a public default constructor");
System\Xml\Xsl\Runtime\TreeIterators.cs (1)
930Debug.Assert(_state == IteratorState.NoNext, $"Illegal state: {_state}");
System\Xml\Xsl\Runtime\XmlQueryOutput.cs (17)
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."); 539Debug.Assert(_xstate == XmlState.EnumAttrs, $"WriteNamespaceDeclaration cannot be called in the {_xstate} state."); 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."); 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."); 1206Debug.Assert(_xstate == XmlState.WithinContent, $"EndCopy cannot be called in the {_xstate} state.");
System\Xml\Xsl\Runtime\XmlQueryRuntime.cs (3)
483Debug.Assert(destinationType == typeof(object) || !destinationType.IsAssignableFrom(value.GetType()), 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}");
System\Xml\Xsl\Runtime\XslNumber.cs (1)
298Debug.Assert(CharUtil.IsDecimalDigitOne(startChar), $"Unexpected startChar: {startChar}");
System\Xml\Xsl\Runtime\XsltConvert.cs (2)
49Debug.Assert(itemType == typeof(bool), $"Unexpected type of atomic sequence {itemType}"); 93Debug.Assert(itemType == typeof(bool), $"Unexpected type of atomic sequence {itemType}");
System\Xml\Xsl\Runtime\XsltFunctions.cs (1)
340Debug.Assert(itemType == typeof(bool), $"Unexpected type of atomic value {itemType}");
System\Xml\Xsl\Runtime\XsltLibrary.cs (1)
353Debug.Assert(itemType == typeof(bool), $"Unexpected type of atomic value {itemType}");
System\Xml\Xsl\XPath\XPathQilFactory.cs (1)
170Debug.Assert(IsAnyType(n), $"Unexpected expression type: {n.XmlType}");
System\Xml\Xsl\Xslt\XslAstAnalyzer.cs (1)
311Debug.Assert(
System\Xml\Xsl\Xslt\XsltQilFactory.cs (1)
37Debug.Assert(xt.IsNode, $"Unexpected expression type: {xt}");
System.Reflection.Metadata (2)
System\Reflection\Metadata\Internal\StringHeap.cs (1)
116Debug.Assert(s_virtualValues[i] != null, $"Missing virtual value for StringHandle.VirtualIndex.{(StringHandle.VirtualIndex)i}");
System\Reflection\Metadata\TypeNameParser.cs (1)
64Debug.Assert(parsedName.GetNodeCount() == recursiveDepth, $"Node count mismatch for '{typeName.ToString()}'");
System.Resources.Extensions (3)
src\libraries\Common\src\System\Resources\ResourceWriter.cs (1)
635Debug.Assert(typeCode >= ResourceTypeCode.StartOfUserTypes, $"ResourceReader: Unsupported ResourceTypeCode in .resources file! {typeCode}");
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (2)
198Debug.Assert(index >= 0 && index < _numResources, $"Bad index into hash array. index: {index}"); 214Debug.Assert(index >= 0 && index < _numResources, $"Bad index into name position array. index: {index}");
System.Resources.Writer (1)
src\libraries\Common\src\System\Resources\ResourceWriter.cs (1)
635Debug.Assert(typeCode >= ResourceTypeCode.StartOfUserTypes, $"ResourceReader: Unsupported ResourceTypeCode in .resources file! {typeCode}");
System.Runtime.Caching (1)
System\Runtime\Caching\CacheUsage.cs (1)
682Debug.Assert(maxFlush > 0, $"maxFlush is not greater than 0, instead is {maxFlush}");
System.Runtime.Numerics (2)
src\libraries\Common\src\System\Number.NumberBuffer.cs (1)
78Debug.Assert(char.IsAsciiDigit((char)digit), $"Unexpected character found in Number: {digit}");
System\Numerics\BigInteger.cs (1)
1328Debug.Assert(mode == GetBytesMode.AllocateArray || mode == GetBytesMode.Count || mode == GetBytesMode.Span, $"Unexpected mode {mode}.");
System.Security.Cryptography (12)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EcDsa.ImportExport.cs (1)
147Debug.Assert(
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.Chain.cs (1)
46Debug.Assert(resp == 0, $"Unexpected response from X509ChainHasStapledOcsp: {resp}");
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (1)
76Debug.Assert(ret == 0, $"Unexpected response from X509DecodeOcspToExpiration: {ret}");
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (1)
196Debug.Assert(cipher.BlockSize <= 128, $"Encountered unexpected block size: {cipher.BlockSize}");
src\libraries\Common\src\System\Security\Cryptography\Oids.Shared.cs (1)
119Debug.Assert(
System\Security\Cryptography\HKDFManagedImplementation.cs (2)
16Debug.Assert(written == prk.Length, $"Bytes written is {written} bytes which does not match output length ({prk.Length} bytes)"); 98Debug.Assert(written == output.Length, $"Bytes written is {written} bytes which does not match output length ({output.Length} bytes)");
System\Security\Cryptography\OidLookup.cs (2)
125Debug.Assert(s_friendlyNameToOid.Count == FriendlyNameToOidCount, 127Debug.Assert(s_oidToFriendlyName.Count == OidToFriendlyNameCount,
System\Security\Cryptography\OidLookup.OpenSsl.cs (1)
33Debug.Assert(result == 0, $"LookupFriendlyNameByOid returned unexpected result {result}");
System\Security\Cryptography\Pbkdf2Implementation.OpenSsl.cs (1)
25Debug.Assert(result == 0, $"Unexpected result {result}");
System\Security\Cryptography\X509Certificates\UnixChainVerifier.cs (1)
38Debug.Assert(
System.Security.Cryptography.Pkcs (5)
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (1)
196Debug.Assert(cipher.BlockSize <= 128, $"Encountered unexpected block size: {cipher.BlockSize}");
src\libraries\Common\src\System\Security\Cryptography\Oids.Shared.cs (1)
119Debug.Assert(
System\Security\Cryptography\Pkcs\CmsSignature.cs (2)
160Debug.Assert( 219Debug.Assert(
System\Security\Cryptography\Pkcs\CmsSignature.RSA.cs (1)
366Debug.Assert(hashAlgorithmName == HashAlgorithmName.MD5, $"Unsupported digest algorithm '{hashAlgorithmName.Name}'");
System.Text.Encoding.CodePages (16)
System\Text\BaseCodePageEncoding.cs (1)
348Debug.Assert(pCodePageIndex->ByteCount == 1 || pCodePageIndex->ByteCount == 2,
System\Text\DBCSCodePageEncoding.cs (1)
403Debug.Assert((arrayTemp.Length / 2) < 20,
System\Text\EncoderBestFitFallback.cs (2)
86Debug.Assert(_iCount < 1, $"[InternalEncoderBestFitFallbackBuffer.Fallback(non surrogate)] Fallback char {(int)_cBestFit:X4} caused recursive fallback"); 108Debug.Assert(_iCount < 1, $"[InternalEncoderBestFitFallbackBuffer.Fallback(surrogate)] Fallback char {(int)_cBestFit:X4} caused recursive fallback");
System\Text\GB18030Encoding.cs (4)
190Debug.Assert(count4Byte == GBLast4ByteCode + 1, 244Debug.Assert(char.IsHighSurrogate(charLeftOver), 274Debug.Assert(offset < 0x6f, 324Debug.Assert(iBytes < 0x7e,
System\Text\ISCIIEncoding.cs (6)
60Debug.Assert(_defaultCodePage >= CodeDevanagari && _defaultCodePage <= CodePunjabi, 239Debug.Assert(currentCodePage >= CodeDevanagari && currentCodePage <= CodePunjabi, 254Debug.Assert((indicTwoBytes >> 12) > 0 && (indicTwoBytes >> 12) <= 3, 352Debug.Assert(currentCodePage >= CodeDevanagari && currentCodePage <= CodePunjabi, 372Debug.Assert(((bLastVirama ? 1 : 0) + (bLastATR ? 1 : 0) + 600Debug.Assert(currentCodePage == CodeDevanagari && b == DevenagariExt,
System\Text\SBCSCodePageEncoding.cs (2)
182Debug.Assert(arrayTemp[byteTemp] == UNKNOWN_CHAR, $"[SBCSCodePageEncoding::ReadBestFitTable] Expected unallocated byte (not 0x{(int)arrayTemp[byteTemp]:X2}) for best fit byte at 0x{byteTemp:X2} for code page {CodePage}"); 281Debug.Assert(arrayTemp[iBestFitCount - 1] != (char)0,
System.Text.Json (24)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
105Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
System\Text\Json\BitStack.cs (7)
80Debug.Assert(index >= 0, $"Set - Negative - index: {index}, arrayLength: {_array.Length}"); 83Debug.Assert(_array.Length <= int.MaxValue / 32 + 1, $"index: {index}, arrayLength: {_array.Length}"); 92Debug.Assert(index >= 0 && index > (int)((uint)_array.Length * 32 - 1), $"Only grow when necessary - index: {index}, arrayLength: {_array.Length}"); 96Debug.Assert(elementIndex < _array.Length, $"Set - index: {index}, elementIndex: {elementIndex}, arrayLength: {_array.Length}, extraBits: {extraBits}"); 145Debug.Assert(index >= 0, $"Get - Negative - index: {index}, arrayLength: {_array.Length}"); 149Debug.Assert(elementIndex < _array.Length, $"Get - index: {index}, elementIndex: {elementIndex}, arrayLength: {_array.Length}, extraBits: {extraBits}"); 165Debug.Assert(_array.Length < int.MaxValue / 2, $"Array too large - arrayLength: {_array.Length}");
System\Text\Json\Document\JsonDocument.MetadataDb.cs (6)
270Debug.Assert(index <= Length - DbRow.Size, $"index {index} is out of bounds"); 271Debug.Assert(index % DbRow.Size == 0, $"index {index} is not at a record start position"); 348Debug.Assert( 361Debug.Assert( 367Debug.Assert( 373Debug.Assert(
System\Text\Json\Document\JsonDocument.Parse.cs (4)
563Debug.Assert( 567Debug.Assert( 587Debug.Assert( 591Debug.Assert(
System\Text\Json\Nodes\JsonValueOfTPrimitive.cs (1)
20Debug.Assert(TypeIsSupportedPrimitive, $"The type {typeof(TValue)} is not a supported primitive.");
System\Text\Json\Serialization\Converters\Collection\IAsyncEnumerableConverterFactory.cs (1)
25Debug.Assert(asyncEnumerableInterface is not null, $"{typeToConvert} not supported by converter.");
System\Text\Json\Serialization\JsonSerializer.Read.Utf8JsonReader.cs (4)
421Debug.Assert( 425Debug.Assert( 438Debug.Assert( 442Debug.Assert(
System.Text.RegularExpressions (63)
System\Text\RegularExpressions\RegexCharClass.cs (2)
324Debug.Assert( 331Debug.Assert(string.Compare(s_propTable[i][0], s_propTable[i + 1][0], StringComparison.Ordinal) < 0, $"RegexCharClass s_propTable is out of order at ({s_propTable[i][0]}, {s_propTable[i + 1][0]})");
System\Text\RegularExpressions\RegexCompiler.cs (37)
1648Debug.Assert(node.Kind is RegexNodeKind.Alternate, $"Unexpected type: {node.Kind}"); 1649Debug.Assert(node.ChildCount() >= 2, $"Expected at least 2 children, found {node.ChildCount()}"); 1853Debug.Assert(node.Kind is RegexNodeKind.Backreference, $"Unexpected type: {node.Kind}"); 2028Debug.Assert(node.Kind is RegexNodeKind.BackreferenceConditional, $"Unexpected type: {node.Kind}"); 2029Debug.Assert(node.ChildCount() == 2, $"Expected 2 children, found {node.ChildCount()}"); 2187Debug.Assert(node.Kind is RegexNodeKind.ExpressionConditional, $"Unexpected type: {node.Kind}"); 2188Debug.Assert(node.ChildCount() == 3, $"Expected 3 children, found {node.ChildCount()}"); 2387Debug.Assert(node.Kind is RegexNodeKind.Capture, $"Unexpected type: {node.Kind}"); 2388Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 2513Debug.Assert(node.Kind is RegexNodeKind.PositiveLookaround, $"Unexpected type: {node.Kind}"); 2514Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 2564Debug.Assert(node.Kind is RegexNodeKind.NegativeLookaround, $"Unexpected type: {node.Kind}"); 2565Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 2829Debug.Assert(node.Kind is RegexNodeKind.Atomic or RegexNodeKind.PositiveLookaround or RegexNodeKind.NegativeLookaround or RegexNodeKind.ExpressionConditional, $"Unexpected type: {node.Kind}"); 2871Debug.Assert(node.Kind is RegexNodeKind.UpdateBumpalong, $"Unexpected type: {node.Kind}"); 2891Debug.Assert(node.Kind is RegexNodeKind.Concatenate, $"Unexpected type: {node.Kind}"); 2892Debug.Assert(node.ChildCount() >= 2, $"Expected at least 2 children, found {node.ChildCount()}"); 3037Debug.Assert(node.Kind is RegexNodeKind.Boundary or RegexNodeKind.NonBoundary or RegexNodeKind.ECMABoundary or RegexNodeKind.NonECMABoundary, $"Unexpected type: {node.Kind}"); 3081Debug.Assert(node.Kind is RegexNodeKind.Beginning or RegexNodeKind.Start or RegexNodeKind.Bol or RegexNodeKind.End or RegexNodeKind.EndZ or RegexNodeKind.Eol, $"Unexpected type: {node.Kind}"); 3219Debug.Assert(node.Kind is RegexNodeKind.Multi, $"Unexpected type: {node.Kind}"); 3271Debug.Assert(node.Kind is RegexNodeKind.Oneloop or RegexNodeKind.Notoneloop or RegexNodeKind.Setloop, $"Unexpected type: {node.Kind}"); 3487Debug.Assert(node.Kind is RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy, $"Unexpected type: {node.Kind}"); 3834Debug.Assert(node.Kind is RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 3835Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 3836Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 3837Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 4356Debug.Assert(node.Kind is RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic, $"Unexpected type: {node.Kind}"); 4603Debug.Assert(node.Kind is RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or RegexNodeKind.Notoneloop or RegexNodeKind.Notoneloopatomic or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic, $"Unexpected type: {node.Kind}"); 4692Debug.Assert(node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 4693Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 4694Debug.Assert(node.M == node.N, $"Unexpected M={node.M} == N={node.N}"); 4695Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 4730Debug.Assert(node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 4731Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 4732Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 4733Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 6156Debug.Assert(chars.Length > 3, $"chars.Length == {chars.Length}");
System\Text\RegularExpressions\RegexFindOptimizations.cs (2)
56Debug.Assert(maxLength >= MinRequiredLength, $"{maxLength} should have been greater than {MinRequiredLength} minimum"); 835Debug.Assert(FindMode == FindNextStartingPositionMode.NoSearch, $"Unexpected FindMode {FindMode}");
System\Text\RegularExpressions\RegexNode.cs (12)
216Debug.Assert(child.Parent == node, $"{child.Describe()} missing reference to parent {node.Describe()}"); 258Debug.Assert(childCount == 0, $"Expected zero children for {node.Kind}, got {childCount}."); 267Debug.Assert(childCount == 1, $"Expected one and only one child for {node.Kind}, got {childCount}."); 271Debug.Assert(childCount == 2, $"Expected two children for {node.Kind}, got {childCount}"); 275Debug.Assert(childCount == 3, $"Expected three children for {node.Kind}, got {childCount}"); 280Debug.Assert(childCount >= 2, $"Expected at least two children for {node.Kind}, got {childCount}."); 293Debug.Assert(node.Str.Length >= 2, $"Expected {node.Str} to be at least two characters"); 300Debug.Assert(!string.IsNullOrEmpty(node.Str), $"Expected non-null, non-empty string for {node.Kind}."); 304Debug.Assert(node.Str is null, $"Expected null string for {node.Kind}, got \"{node.Str}\"."); 315Debug.Assert((node.Options & RegexOptions.IgnoreCase) == 0, $"{node.Kind} node should not have RegexOptions.IgnoreCase"); 2516Debug.Assert(Kind == RegexNodeKind.Concatenate, $"Expected Concatenate, got {Kind}"); 2632Debug.Assert(Kind == RegexNodeKind.Concatenate, $"Expected Concatenate, got {Kind}");
System\Text\RegularExpressions\RegexReplacement.cs (3)
36Debug.Assert(concat.Kind == RegexNodeKind.Concatenate, $"Expected Concatenate, got {concat.Kind}"); 259Debug.Assert(state.offsetAndCounts.Count % 2 == 0, $"{state.offsetAndCounts.Count}"); 260Debug.Assert(state.offsetAndCounts.Count >= 4, $"{state.offsetAndCounts.Count}");
System\Text\RegularExpressions\Symbolic\RegexNodeConverter.cs (2)
428Debug.Assert(cat >= 0 && cat < categoryCodes.Length, $"Expected {cat} to be in range [0, {categoryCodes.Length})."); 523Debug.Assert(Enum.IsDefined(code) || code == (UnicodeCategory)(RegexCharClass.SpaceConst - 1), $"Unknown category: {code}");
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.cs (5)
171Debug.Assert(builder._solver is UInt64Solver or BitVectorSolver, $"Unsupported solver: {builder._solver}"); 356Debug.Assert(startat >= 0 && startat <= input.Length, $"{nameof(startat)} == {startat}, {nameof(input.Length)} == {input.Length}"); 863Debug.Assert(i >= 0, $"{nameof(i)} == {i}"); 864Debug.Assert(matchStartBoundary >= 0 && matchStartBoundary <= input.Length, $"{nameof(matchStartBoundary)} == {matchStartBoundary}"); 865Debug.Assert(i >= matchStartBoundary, $"Expected {i} >= {matchStartBoundary}.");
System.Threading.Tasks.Parallel (2)
System\Threading\Tasks\Parallel.ForEachAsync.cs (2)
641Debug.Assert(_completionRefCount == 0, $"Expected {nameof(_completionRefCount)} == 0, got {_completionRefCount}"); 671Debug.Assert(_scheduler == TaskScheduler.Default, $"Expected {nameof(_scheduler)} == TaskScheduler.Default, got {_scheduler}");
System.Windows.Forms (56)
System\Windows\Forms\Accessibility\AccessibleObject.cs (5)
434Debug.Assert(child is not null, $"GetChild({index}) returned null!"); 458Debug.Assert(result == HRESULT.DISP_E_MEMBERNOTFOUND, $"{nameof(GetSystemIAccessibleFocus)} failed with {result}"); 502Debug.Assert(child is not null, $"GetChild({index}) returned null!"); 526Debug.Assert(result == HRESULT.DISP_E_MEMBERNOTFOUND, $"{nameof(TryGetSystemIAccessibleSelection)} failed with {result}"); 545Debug.Assert(child is not null, $"GetChild({index}) returned null!");
System\Windows\Forms\Accessibility\AccessibleObjectExtensions.cs (11)
42Debug.Assert( 62Debug.Assert( 96Debug.Assert( 116Debug.Assert( 136Debug.Assert( 156Debug.Assert(result.Succeeded, $"{nameof(TryGetName)}: get_accName call failed with {result}"); 195Debug.Assert(result.Succeeded, $"{nameof(TryGetRole)}: get_accRole call failed with {result}"); 214Debug.Assert( 232Debug.Assert( 253Debug.Assert( 268Debug.Assert(
System\Windows\Forms\ActiveX\AxHost.cs (2)
2592Debug.Assert(baseProps[i] is not null, $"Null base prop at location: {i}"); 2628Debug.Assert(propDesc is not null, $"Cannot find cached entry for: {propName}");
System\Windows\Forms\ActiveX\Control.ActiveXImpl.cs (2)
1167Debug.Assert( 1551Debug.Assert(
System\Windows\Forms\Application.ComponentThreadContext.cs (1)
149Debug.Assert(result,
System\Windows\Forms\ComponentModel\COM2Interop\Com2AboutBoxPropertyDescriptor.AboutBoxUITypeEditor.cs (1)
34Debug.Assert(hr.Succeeded, $"Failed to launch about box. {hr}");
System\Windows\Forms\ComponentModel\COM2Interop\COM2FontConverter.cs (2)
27Debug.Assert(nativeValue.IsEmpty, $"Expected IUnknown, got {nativeValue.Type}"); 82Debug.Assert(nativeValue.IsEmpty, $"Expected IUnknown, got {nativeValue.Type}");
System\Windows\Forms\ComponentModel\COM2Interop\COM2IManagedPerPropertyBrowsingHandler.cs (2)
122Debug.Assert(typeof(Attribute).IsAssignableFrom(type), $"Attribute type {type.FullName} does not derive from Attribute"); 142Debug.Assert(typeof(Attribute).IsAssignableFrom(type), $"Attribute type {type.FullName} does not derive from Attribute");
System\Windows\Forms\ComponentModel\COM2Interop\COM2PictureConverter.cs (1)
37Debug.Assert(nativeValue.IsEmpty, $"Expected IUnknown, got {nativeValue.Type}");
System\Windows\Forms\ComponentModel\COM2Interop\COM2PropertyBuilderUITypeEditor.cs (1)
50Debug.Assert(hr.Succeeded, $"Failed to get IProvidePropertyBuilder: {hr}");
System\Windows\Forms\Control.cs (1)
1862Debug.Assert(
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (1)
2217Debug.Assert(insertIndex == index, $"NativeComboBox inserted at {insertIndex} not the requested index of {index}");
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (1)
3596Debug.Assert(columnIndex >= 0 && columnIndex < Columns.Count, $"Invalid columnIndex: {columnIndex}");
System\Windows\Forms\Controls\ListBoxes\ListBox.AccessibleObject.cs (1)
260Debug.Assert(child is not null, $"GetChild({index}) returned null");
System\Windows\Forms\Controls\ListBoxes\ListBox.cs (1)
1605Debug.Assert(insertIndex == index, $"NativeListBox inserted at {insertIndex} not the requested index of {index}");
System\Windows\Forms\Controls\ListView\ListView.cs (1)
4141Debug.Assert(result != IntPtr.Zero, $"Doesn't contain group id: {lvItem.iGroupId}");
System\Windows\Forms\Controls\ListView\ListView.ListViewNativeItemCollection.cs (1)
235Debug.Assert(item is not null, $"Failed to get item at index {i}");
System\Windows\Forms\Controls\ListView\ListViewItem.cs (1)
1102Debug.Assert(!updateOwner || result != 0, $"Doesn't contain group id: {lvItem.iGroupId}");
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\GridEntry.cs (1)
1380Debug.Assert(!s_pbrsAssertPropsSwitch.Enabled, $"Bad property '{PropertyLabel}.{property.Name}': {w}");
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (1)
3551Debug.Assert(childCount == e.NewChildCount, $"parent reports {childCount} new children, event reports {e.NewChildCount}");
System\Windows\Forms\Controls\TextBox\MaskedTextBox.cs (1)
1506Debug.Assert(keyCode is Keys.Delete or Keys.Back, $"Delete called with keyCode == {keyCode}");
System\Windows\Forms\Controls\TextBox\TextBoxBase.cs (1)
909Debug.Assert(end <= len,
System\Windows\Forms\Controls\ToolStrips\ToolStripManager.ModalMenuFilter.HostedWindowsFormsMessageHook.cs (1)
32Debug.Assert(
System\Windows\Forms\Controls\ToolStrips\ToolStripPanelRow.ToolStripPanelRowControlCollection.ToolStripPanelCellToControlEnumerator.cs (1)
29Debug.Assert(cell is not null, $"Expected ToolStripPanel cells only!!!{_arrayListEnumerator.Current.GetType()}");
System\Windows\Forms\Controls\TreeView\TreeNode.cs (1)
338Debug.Assert(
System\Windows\Forms\Controls\UpDown\DomainUpDown.cs (1)
401Debug.Assert(_domainIndex >= 0 || UserEdit, $"UserEdit should be true when domainIndex < 0 {UserEdit}");
System\Windows\Forms\Controls\WebBrowser\WebBrowserBase.cs (2)
674Debug.Assert(hr.Succeeded, $"DoVerb call failed for verb 0x{verb}"); 1176Debug.Assert(!result.Failed, $"{result}");
System\Windows\Forms\Input\CursorConverter.cs (1)
168Debug.Assert(prop.GetValue(null, tempIndex) is not null, $"Property {prop.Name} returned NULL");
System\Windows\Forms\Input\InputLanguage.cs (1)
158Debug.Assert(subKeyName.Length == 8, $"unexpected key length in registry: {subKey.Name}");
System\Windows\Forms\Layout\DefaultLayout.cs (1)
833Debug.Assert(AppContextSwitches.AnchorLayoutV2, $"AnchorLayoutV2 should be called only when {AppContextSwitches.AnchorLayoutV2SwitchName} is enabled.");
System\Windows\Forms\Layout\TableLayout.cs (5)
1435Debug.Assert(layoutInfo.Equals(oldLayoutInfo[layoutInfo.Element]), 1490Debug.Assert(containerInfo.ColumnStyles[k].SizeType == SizeType.Absolute, $"column {k} is not absolutely sized"); 1495Debug.Assert(containerInfo.ColumnStyles[k].SizeType == SizeType.Absolute, $"column {k} is not absolutely sized"); 1507Debug.Assert(containerInfo.RowStyles[k].SizeType == SizeType.Absolute, $"column {k} is not absolutely sized"); 1512Debug.Assert(containerInfo.RowStyles[k].SizeType == SizeType.Absolute, $"column {k} is not absolutely sized");
System\Windows\Forms\NativeWindow.cs (1)
484Debug.Assert(DpiAwarenessContext.IsEquivalent(controlHandleDpiContext),
System\Windows\Forms\WinCategoryAttribute.cs (1)
35Debug.Assert(localizedValue is not null, $"All Windows Forms category attributes should have localized strings. Category '{value}' not found.");
System.Windows.Forms.Design (35)
System\ComponentModel\Design\DesignSurface.cs (1)
429Debug.Assert(serviceType == typeof(IReferenceService), $"Demand created service not supported: {serviceType.Name}");
System\ComponentModel\Design\InheritedPropertyDescriptor.cs (2)
25Debug.Assert(propertyDescriptor is not InheritedPropertyDescriptor, $"Recursive inheritance propertyDescriptor {propertyDescriptor}"); 126Debug.Assert(value is not InheritedPropertyDescriptor, $"Recursive inheritance propertyDescriptor {_propertyDescriptor}");
System\ComponentModel\Design\ReferenceService.cs (4)
320Debug.Assert(sitedComponent.Site is not null, $"Sited component is not really sited: {sitedComponent}"); 321Debug.Assert(TypeDescriptor.GetComponentName(sitedComponent) is not null, $"Sited component has no name: {sitedComponent}"); 350Debug.Assert(SitedComponent.Site is not null, $"Sited component is not really sited: {SitedComponent}"); 351Debug.Assert(siteName is not null, $"Sited component has no name: {SitedComponent}");
System\ComponentModel\Design\Serialization\CodeDomComponentSerializationService.CodeDomSerializationStore.cs (1)
264Debug.Assert(instance is not null, $"Failed to deserialize object {name}");
System\ComponentModel\Design\Serialization\CodeDomDesignerLoader.cs (1)
798Debug.Assert(_rootSerializer is not null || _typeSerializer is not null, $"What are we saving right now? Base component has no serializer: {LoaderHost.RootComponent.GetType().FullName}");
System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs (1)
994Debug.Assert(o is IConvertible, $"Array size expression could not be resolved to IConvertible: {(o.GetType().Name)}");
System\Drawing\Design\CursorEditor.CursorUI.cs (1)
28Debug.Assert(
System\Windows\Forms\Design\Behavior\BehaviorService.AdornerWindow.MouseHook.cs (1)
50Debug.Assert(
System\Windows\Forms\Design\Behavior\BehaviorService.cs (1)
397Debug.Assert(false, $"Could not find the behavior to pop - did it already get popped off? {behavior}");
System\Windows\Forms\Design\CollectionEditVerbManager.cs (1)
197Debug.Assert(itemsEditor is not null, $"Didn't get a collection editor for type '{_targetProperty.PropertyType.FullName}'");
System\Windows\Forms\Design\ComponentTray.cs (3)
1755Debug.Assert(c.Visible, $"TrayControl for {c.Component} should not be positioned"); 1811Debug.Assert(Visible == c.Visible, $"TrayControl for {((TrayControl)c).Component} should not be positioned"); 1820Debug.Assert(c.Visible, $"TrayControl for {c.Component} should not be positioned");
System\Windows\Forms\Design\DesignerFrame.cs (3)
420Debug.Assert(_overlayList.IndexOf(control) == -1, $"Duplicate overlay in overlay service: {control.GetType().FullName}"); 438Debug.Assert(_overlayList.IndexOf(control) != -1, $"Control is not in overlay service: {control.GetType().FullName}"); 449Debug.Assert(_overlayList.IndexOf(control) == -1, $"Duplicate overlay in overlay service: {control.GetType().FullName}");
System\Windows\Forms\Design\DocumentDesigner.AxToolboxItem.cs (11)
88Debug.Assert(tlbRef is not null, $"Null reference returned by AddActiveX (tlbimp) by the project system for: {_clsid}"); 98Debug.Assert(axRef is not null, $"Null reference returned by AddActiveX (aximp) by the project system for: {_clsid}"); 179Debug.Assert(a is not null, $"No assembly found at {fullPath}"); 201Debug.Assert(attrs is not null && attrs.Length == 1, $"Invalid number of GuidAttributes found on: {t.FullName}"); 236Debug.Assert(project is not null, $"No DTE Project for the current project item: {name}"); 239Debug.Assert(vsproject is not null, $"No VS Project for the current project item: {name}"); 242Debug.Assert(references is not null, $"No References for the current project item: {name}"); 266Debug.Assert(verKey is not null, $"No version registry key found for: {controlKey}"); 285Debug.Assert(majorVer > 0 && minorVer >= 0, $"No Major version number found for: {controlKey}"); 292Debug.Assert(!tlbGuid.Equals(Guid.Empty), $"No valid Guid found for: {controlKey}"); 311Debug.Assert(inprocServer is not null, $"No valid InprocServer32 found for: {controlKey}");
System\Windows\Forms\Design\EditorServiceContext.cs (1)
149Debug.Assert(itemsEditor is not null, $"Didn't get a collection editor for type '{_targetProperty!.PropertyType.FullName}'");
System\Windows\Forms\Design\OleDragDropHandler.ComponentDataObject.cs (1)
47Debug.Assert(_components[i] is IComponent, $"Item {_components[i].GetType().Name} is not an IComponent");
System\Windows\Forms\Design\SplitContainerDesigner.cs (1)
232Debug.Assert(_splitContainer is not null, $"Component must be a non-null SplitContainer, it is a: {component.GetType().FullName}");
System\Windows\Forms\Design\TableLayoutPanelDesigner.cs (1)
1142Debug.Assert(Table.RowStyles[i] is not null, $"Table's RowStyle[{i}] is null!");
System.Windows.Forms.IntegrationTests.Common (1)
TestHelpers.cs (1)
464Debug.Assert(true, $"Given process could not be made to be the ForegroundWindow. The current window is {windowTitle}.");
System.Windows.Forms.Primitives (2)
System\Windows\Forms\Internals\ScaleHelper.cs (1)
85Debug.Assert(result.Succeeded, $"Failed to get ProcessDpi HRESULT: {result}");
Windows\Win32\PInvoke.UiaDisconnectProvider.cs (1)
24Debug.Assert(result == HRESULT.S_OK || result == HRESULT.E_INVALIDARG, $"UiaDisconnectProvider failed with {result}");