459 references to Assert
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}\".");
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)
695Debug.Assert(
Microsoft.AspNetCore.OpenApi (1)
Transformers\TypeBasedOpenApiDocumentTransformer.cs (1)
26Debug.Assert(transformer != null, $"The type {_transformerType} does not implement {nameof(IOpenApiDocumentTransformer)}.");
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)
24Debug.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)
689Debug.Assert(false, $"Failed to bind argument of type '{descriptor.OriginalParameterTypes[parameterPointer].Name}' for hub method '{descriptor.MethodExecutor.MethodInfo.Name}'.");
PresentationBuildTasks (4)
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\StyleModeStack.cs (2)
51Debug.Assert(Depth >= 0, $"StyleModeStack's depth was {Depth}, should be >= 0"); 68Debug.Assert(Depth >= 0, $"StyleMode::Pop() with depth of {Depth}, should be >= 0");
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlReaderHelper.cs (2)
5061Debug.Assert( xmlNodeType == XmlNodeType.Text || 5142Debug.Assert (parentNodeType == ElementContextType.Unknown,
PresentationFramework (16)
MS\Internal\Annotations\AnnotationMap.cs (1)
84Debug.Assert(list != null, $"there should be an attached annotation list for the annotationId: {annotationId}");
MS\Internal\Data\PropertyPathWorker.cs (1)
1296Debug.Assert(sb.Length == 0,
MS\Internal\Ink\StrokeCollectionDefaultValueFactory.cs (1)
41Debug.Assert(property.PropertyType == typeof(StrokeCollection),
System\Windows\Interop\ActiveXHost.cs (1)
523Debug.Assert(hr == NativeMethods.S_OK, $"DoVerb call failed for verb 0x{verb:X}");
System\Windows\Markup\BamlRecordReader.cs (1)
4250Debug.Assert(!context.CreateUsingTypeConverter,
System\Windows\Markup\StyleModeStack.cs (2)
51Debug.Assert(Depth >= 0, $"StyleModeStack's depth was {Depth}, should be >= 0"); 68Debug.Assert(Depth >= 0, $"StyleMode::Pop() with depth of {Depth}, should be >= 0");
System\Windows\Media\Animation\Storyboard.cs (2)
576Debug.Assert( mappedObject == null || mappedObject is AnimationClock || mappedObject is List<AnimationClock>, 617Debug.Assert( value is AnimationClock || value is List<AnimationClock> ,
System\Windows\StyleHelper.cs (5)
3083Debug.Assert(!StyleHelper.IsSetOnContainer(conditions[j].Property, ref containerDependents, true), 4353Debug.Assert(candidateTrigger is List<TriggerBase>, 5064Debug.Assert( existing is List<TriggerBase>, 5110Debug.Assert( existing is List<TriggerBase>, 5283Debug.Assert(candidateTrigger is List<TriggerBase>,
System\Windows\SystemResourceKey.cs (1)
1858Debug.Assert(((SystemResourceKeyID.InternalSystemColorsStart < id) && (id < SystemResourceKeyID.InternalSystemColorsEnd)) ||
System\Windows\Window.cs (1)
5882Debug.Assert(false, $"specifiedRestoreBounds can't be {specifiedRestoreBounds}");
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)
174Debug.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)
613Debug.Assert(eppa != null, $"Extender property {prop.Name} has no provider attribute. We will skip it."); 1228Debug.Assert(dbgEvent != null, $"Holes in event array for type {type}"); 1425Debug.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)
1781Debug.Assert((s_mapNameTypeXsd[i - 1].CompareTo(s_mapNameTypeXsd[i].name)) < 0, $"incorrect sorting {s_mapNameTypeXsd[i].name}"); 1847Debug.Assert((s_mapNameTypeXsd[i - 1].CompareTo(s_mapNameTypeXsd[i].name)) < 0, $"incorrect sorting {s_mapNameTypeXsd[i].name}"); 1895Debug.Assert((s_mapNameTypeXsd[i - 1].CompareTo(s_mapNameTypeXsd[i].name)) < 0, $"incorrect sorting {s_mapNameTypeXsd[i].name}"); 1905Debug.Assert(nt.name != name, $"FindNameType('{name}') -- failed. Existed name not found"); 1910Debug.Assert(s_mapNameTypeXsd[index].name == name, $"FindNameType('{name}') -- failed. Wrong name found");
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 (2)
System\Formats\Tar\TarEntry.cs (2)
382Debug.Assert(Path.IsPathFullyQualified(qualifiedPath), $"{qualifiedPath} is not qualified"); 475Debug.Assert(false, $"Metadata entry type should not be visible: '{EntryType}'");
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.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 (37)
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)
99Debug.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)
359Debug.Assert(descriptor.Parser.SupportsMultipleValues, $"Header '{descriptor.Name}' doesn't support multiple values"); 462Debug.Assert(headerRemoved, $"Existing header '{descriptor.Name}' couldn't be removed.");
System\Net\Http\HttpContent.cs (2)
296Debug.Assert(_contentReadStream is Stream, $"Expected a Stream, got ${_contentReadStream}"); 325Debug.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)
395Debug.Assert(_associatedHttp2ConnectionCount > (_availableHttp2Connections?.Count ?? 0), 418Debug.Assert((_availableHttp2Connections?.Count ?? 0) == 0, $"With {(_availableHttp2Connections?.Count ?? 0)} available HTTP2 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)
130Debug.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 (11)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
99Debug.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.Requests (1)
System\Net\WebRequest.cs (1)
362Debug.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)
99Debug.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)
33Debug.Assert(data != 0, $"No mapping found for cipherSuite {cipherSuite}");
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)
159Debug.Assert(ExceptionCheck.IsFatal(exception), $"handle:{handle}, error:{exception}"); 167Debug.Assert(ret, $"ReleaseHandle failed. handle:{handle}");
System\Net\Sockets\SafeSocketHandle.Unix.cs (2)
141Debug.Assert(value == -1 || value > 0, $"Unexpected value: {value}"); 154Debug.Assert(value == -1 || value > 0, $"Unexpected value: {value}");
System\Net\Sockets\Socket.Unix.cs (1)
291Debug.Assert(Equals(origValue, cloneValue), $"{pi.Name}. Expected: {origValue}, Actual: {cloneValue}");
System\Net\Sockets\SocketAsyncContext.Unix.cs (22)
164Debug.Assert(oldState == (int)State.Waiting, $"Unexpected operation state: {(State)oldState}"); 182Debug.Assert(state is (int)State.Running or (int)State.RunningWithPendingCancellation, $"Unexpected operation state: {(State)state}"); 258Debug.Assert(Interlocked.CompareExchange(ref _callbackQueued, 1, 0) == 0, $"Unexpected _callbackQueued: {_callbackQueued}"); 627Debug.Assert(ErrorCode == SocketError.Success || AcceptedFileDescriptor == (IntPtr)(-1), $"Unexpected values: ErrorCode={ErrorCode}, AcceptedFileDescriptor={AcceptedFileDescriptor}"); 1025Debug.Assert(_state == QueueState.Processing, $"_state={_state} while processing queue!"); 1053Debug.Assert(_state == QueueState.Processing, $"_state={_state} while processing queue!"); 1084Debug.Assert(_state == QueueState.Processing, $"_state={_state} while processing queue!"); 1344Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1419Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1426Debug.Assert(errorCode == SocketError.Success || acceptedFd == (IntPtr)(-1), $"Unexpected values: errorCode={errorCode}, acceptedFd={acceptedFd}"); 1444Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1454Debug.Assert(errorCode == SocketError.Success || acceptedFd == (IntPtr)(-1), $"Unexpected values: errorCode={errorCode}, acceptedFd={acceptedFd}"); 1480Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1508Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1556Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1697Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1764Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1799Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1888Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1918Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1996Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 2064Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}");
System\Net\Sockets\SocketAsyncEngine.Unix.cs (1)
191Debug.Assert(numEvents > 0, $"Unexpected numEvents: {numEvents}");
System\Net\Sockets\SocketAsyncEventArgs.cs (1)
508Debug.Assert(status == InProgress || status == Configuring || status == Disposed, $"Unexpected status: {status}");
System\Net\Sockets\SocketAsyncEventArgs.Unix.cs (1)
56Debug.Assert(acceptHandle == null, $"Unexpected acceptHandle: {acceptHandle}");
System\Net\Sockets\SocketPal.Unix.cs (9)
86Debug.Assert(fd == (IntPtr)(-1), $"Unexpected fd: {fd}"); 652Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 716Debug.Assert(err == Interop.Error.EBADF, $"Unexpected err: {err}"); 1489Debug.Assert(optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership, $"Unexpected optionName: {optionName}"); 1512Debug.Assert(optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership, $"Unexpected optionName={optionName}"); 1649Debug.Assert(optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership, $"Unexpected optionName={optionName}"); 1674Debug.Assert(optionName == SocketOptionName.AddMembership || optionName == SocketOptionName.DropMembership, $"Unexpected optionName={optionName}"); 1792Debug.Assert(offset == eventsLength, $"Invalid adds. offset={offset}, eventsLength={eventsLength}."); 1793Debug.Assert(refsAdded == eventsLength, $"Invalid ref adds. refsAdded={refsAdded}, eventsLength={eventsLength}.");
System.Net.WebSockets (9)
System\Net\WebSockets\ManagedWebSocket.cs (9)
149Debug.Assert(keepAliveInterval == Timeout.InfiniteTimeSpan || keepAliveInterval >= TimeSpan.Zero, $"Invalid {nameof(keepAliveInterval)}: {keepAliveInterval}"); 629Debug.Assert(sendBuffer.Length >= MaxMessageHeaderLength, $"Expected {nameof(sendBuffer)} to be at least {MaxMessageHeaderLength}, got {sendBuffer.Length}"); 796Debug.Assert(header.Opcode == MessageOpcode.Binary || header.Opcode == MessageOpcode.Text, $"Unexpected opcode {header.Opcode}"); 1279Debug.Assert( 1401Debug.Assert(count >= 0, $"Expected non-negative {nameof(count)}, got {count}"); 1402Debug.Assert(count <= _receiveBufferCount, $"Trying to consume {count}, which is more than exists {_receiveBufferCount}"); 1410Debug.Assert(minimumRequiredBytes <= _receiveBuffer.Length, $"Requested number of bytes {minimumRequiredBytes} must not exceed {_receiveBuffer.Length}"); 1477Debug.Assert(maskOffsetIndex < MaskLength, $"Unexpected {nameof(maskOffsetIndex)}: {maskOffsetIndex}"); 1478Debug.Assert(mask.Length >= MaskLength + maskOffset, $"Unexpected inputs: {mask.Length}, {maskOffset}");
System.Private.CoreLib (53)
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)
80Debug.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\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)
2016Debug.Assert(foundItemsCount >= 2 && foundItemsCount <= 64, $"{nameof(foundItemsCount)} == {foundItemsCount}"); 2111Debug.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)
2224Debug.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)
1555Debug.Assert(ret == result, $"Multiply overflow got: {ret}, expected: {result}"); 1598Debug.Assert(ret == left * right, $"Multiply overflow got: {ret}, expected: {left * right}");
src\libraries\System.Private.CoreLib\src\System\Net\WebUtility.cs (1)
714Debug.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)
547Debug.Assert((styles & ~TParser.AllowedStyles) == 0, $"Only handles subsets of {TParser.AllowedStyles} format");
src\libraries\System.Private.CoreLib\src\System\Random.cs (3)
345Debug.Assert(result >= minInclusive && result < maxExclusive, $"Expected {minInclusive} <= {result} < {maxExclusive}"); 349Debug.Assert(result == minInclusive, $"Expected {minInclusive} == {result}"); 356Debug.Assert(result >= 0.0 && result < 1.0, $"Expected 0.0 <= {result} < 1.0");
src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (2)
197Debug.Assert(index >= 0 && index < _numResources, $"Bad index into hash array. index: {index}"); 213Debug.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)
2144Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk), 2164Debug.Assert(indexInChunk >= chunk.m_ChunkLength || count == 0,
src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (2)
834Debug.Assert(exceptionList.Count > 0, $"Expected {exceptionList.Count} > 0"); 943Debug.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)
6063Debug.Assert(failedOrCanceled is Task, $"Expected Task, got {failedOrCanceled}");
src\System\Enum.CoreCLR.cs (1)
85Debug.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)
195Debug.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)
99Debug.Assert(loc.LocalType == itemStorageType || 116Debug.Assert(currentMethod.ReturnType == itemStorageType, 131Debug.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\TypeSystem\CustomAttribute.cs (1)
141Debug.Assert(false, $"Unexpected treatment {treatment}");
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)
197Debug.Assert(index >= 0 && index < _numResources, $"Bad index into hash array. index: {index}"); 213Debug.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)
80Debug.Assert(char.IsAsciiDigit((char)digit), $"Unexpected character found in Number: {digit}");
System\Numerics\BigInteger.cs (1)
1318Debug.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)
195Debug.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\HKDF.cs (2)
70Debug.Assert(written == prk.Length, $"Bytes written is {written} bytes which does not match output length ({prk.Length} bytes)"); 268Debug.Assert(bytesWritten == output.Length, $"Bytes written is {bytesWritten} 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.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 (22)
System\Text\Json\BitStack.cs (7)
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}"); 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}"); 135Debug.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\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)
1645Debug.Assert(node.Kind is RegexNodeKind.Alternate, $"Unexpected type: {node.Kind}"); 1646Debug.Assert(node.ChildCount() >= 2, $"Expected at least 2 children, found {node.ChildCount()}"); 1850Debug.Assert(node.Kind is RegexNodeKind.Backreference, $"Unexpected type: {node.Kind}"); 2025Debug.Assert(node.Kind is RegexNodeKind.BackreferenceConditional, $"Unexpected type: {node.Kind}"); 2026Debug.Assert(node.ChildCount() == 2, $"Expected 2 children, found {node.ChildCount()}"); 2184Debug.Assert(node.Kind is RegexNodeKind.ExpressionConditional, $"Unexpected type: {node.Kind}"); 2185Debug.Assert(node.ChildCount() == 3, $"Expected 3 children, found {node.ChildCount()}"); 2384Debug.Assert(node.Kind is RegexNodeKind.Capture, $"Unexpected type: {node.Kind}"); 2385Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 2514Debug.Assert(node.Kind is RegexNodeKind.PositiveLookaround, $"Unexpected type: {node.Kind}"); 2515Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 2565Debug.Assert(node.Kind is RegexNodeKind.NegativeLookaround, $"Unexpected type: {node.Kind}"); 2566Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 2830Debug.Assert(node.Kind is RegexNodeKind.Atomic or RegexNodeKind.PositiveLookaround or RegexNodeKind.NegativeLookaround or RegexNodeKind.ExpressionConditional, $"Unexpected type: {node.Kind}"); 2872Debug.Assert(node.Kind is RegexNodeKind.UpdateBumpalong, $"Unexpected type: {node.Kind}"); 2892Debug.Assert(node.Kind is RegexNodeKind.Concatenate, $"Unexpected type: {node.Kind}"); 2893Debug.Assert(node.ChildCount() >= 2, $"Expected at least 2 children, found {node.ChildCount()}"); 3038Debug.Assert(node.Kind is RegexNodeKind.Boundary or RegexNodeKind.NonBoundary or RegexNodeKind.ECMABoundary or RegexNodeKind.NonECMABoundary, $"Unexpected type: {node.Kind}"); 3082Debug.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}"); 3220Debug.Assert(node.Kind is RegexNodeKind.Multi, $"Unexpected type: {node.Kind}"); 3272Debug.Assert(node.Kind is RegexNodeKind.Oneloop or RegexNodeKind.Notoneloop or RegexNodeKind.Setloop, $"Unexpected type: {node.Kind}"); 3488Debug.Assert(node.Kind is RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy, $"Unexpected type: {node.Kind}"); 3835Debug.Assert(node.Kind is RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 3836Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 3837Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 3838Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 4357Debug.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}"); 4612Debug.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}"); 4701Debug.Assert(node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 4702Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 4703Debug.Assert(node.M == node.N, $"Unexpected M={node.M} == N={node.N}"); 4704Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 4739Debug.Assert(node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 4740Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 4741Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 4742Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 6165Debug.Assert(chars.Length > 3, $"chars.Length == {chars.Length}");
System\Text\RegularExpressions\RegexFindOptimizations.cs (2)
55Debug.Assert(maxLength >= MinRequiredLength, $"{maxLength} should have been greater than {MinRequiredLength} minimum"); 812Debug.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"); 2513Debug.Assert(Kind == RegexNodeKind.Concatenate, $"Expected Concatenate, got {Kind}"); 2629Debug.Assert(Kind == RegexNodeKind.Concatenate, $"Expected Concatenate, got {Kind}");
System\Text\RegularExpressions\RegexReplacement.cs (3)
39Debug.Assert(concat.Kind == RegexNodeKind.Concatenate, $"Expected Concatenate, got {concat.Kind}"); 262Debug.Assert(state.offsetAndCounts.Count % 2 == 0, $"{state.offsetAndCounts.Count}"); 263Debug.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)
154Debug.Assert(builder._solver is UInt64Solver or BitVectorSolver, $"Unsupported solver: {builder._solver}"); 327Debug.Assert(startat >= 0 && startat <= input.Length, $"{nameof(startat)} == {startat}, {nameof(input.Length)} == {input.Length}"); 596Debug.Assert(i >= 0, $"{nameof(i)} == {i}"); 597Debug.Assert(matchStartBoundary >= 0 && matchStartBoundary <= input.Length, $"{nameof(matchStartBoundary)} == {matchStartBoundary}"); 598Debug.Assert(i >= matchStartBoundary, $"Expected {i} >= {matchStartBoundary}.");
System.Threading.Tasks.Parallel (2)
System\Threading\Tasks\Parallel.ForEachAsync.cs (2)
665Debug.Assert(_completionRefCount == 0, $"Expected {nameof(_completionRefCount)} == 0, got {_completionRefCount}"); 695Debug.Assert(_scheduler == TaskScheduler.Default, $"Expected {nameof(_scheduler)} == TaskScheduler.Default, got {_scheduler}");