608 references to Assert
Aspire.Dashboard (2)
Components\Controls\Chart\MetricTable.razor.cs (1)
217Debug.Assert(exemplars.Count == newMetrics.Sum(m => m.Value.Exemplars.Count), $"Expected {exemplars.Count} exemplars but got {newMetrics.Sum(m => m.Value.Exemplars.Count)} exemplars.");
src\Shared\LoggingHelpers.cs (1)
93Debug.Assert(url is null || !url.Contains(';'), $"{paramName} should not contain ';': {url}");
Aspire.Hosting (1)
src\Shared\LoggingHelpers.cs (1)
93Debug.Assert(url is null || !url.Contains(';'), $"{paramName} should not contain ';': {url}");
CodeStyleConfigFileGenerator (1)
Program.cs (1)
160Debug.Assert(rule.CustomTags.Any(c => c == s_neverTag || c == s_whenExplicitlyEnabledTag || c == s_recommendedTag || c == s_highlyRecommendedTag),
dotnet-aot (2)
parent\dotnet\Commands\Test\MTP\TestResultsDirectoryResolver.cs (1)
119Debug.Assert(IsUnderRoot(resolved, resultsRoot), $"'{resolved}' escaped the results directory '{resultsRoot}'.");
parent\dotnet\Telemetry\ExternalTelemetryProperties.cs (1)
68Debug.Assert(false, $"Unexpected exception from GetProductInfo: ${e.GetType().Name}: ${e.Message}");
GenerateDocumentationAndConfigFiles (1)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (1)
320Debug.Assert(operation.Kind is OperationKind.None or OperationKind.Attribute, $"Unexpected root operation kind: {operation.Kind}");
ILCompiler.Compiler (7)
parent\parent\Common\Compiler\ObjectWriter\ObjectWriter.cs (1)
421Debug.Assert(codeNode.Signature != null, $"Wasm code node {codeNode.GetType()} has null signature");
parent\parent\Common\Compiler\ObjectWriter\WasmObjectWriter.cs (1)
305Debug.Assert(added, $"Duplicate global name: {name}");
parent\parent\Common\JitInterface\WasmLowering.cs (5)
320Debug.Assert(!isV128 || ((DefType)type).InstanceFieldAlignment.AsInt == 16, 460Debug.Assert(returnType is not null, $"No cached struct of size {structSize} for return type in signature '{sig}'"); 527Debug.Assert(cachedStruct is not null, 555Debug.Assert(roundtrippedStr.Equals(wasmSignature.SignatureString, StringComparison.Ordinal), 785Debug.Assert(slotCount is >= 2 and <= 9,
ILCompiler.ReadyToRun (12)
parent\parent\Common\Compiler\ObjectWriter\ObjectWriter.cs (1)
421Debug.Assert(codeNode.Signature != null, $"Wasm code node {codeNode.GetType()} has null signature");
parent\parent\Common\Compiler\ObjectWriter\WasmObjectWriter.cs (1)
305Debug.Assert(added, $"Duplicate global name: {name}");
parent\parent\Common\Compiler\ObjectWriter\WebCilObjectWriter.cs (5)
49Debug.Assert(added, 71Debug.Assert(section != null || alignment == 1, $"Section: {sectionIndex} is not a WebcilSection but alignment {alignment} requested"); 566Debug.Assert(writeCursor <= blobs[b].Start, $"Write cursor {writeCursor} is beyond the start of blob {blobs[b].Start}"); 584Debug.Assert(sectionStream.Position == firstReloc.Offset, $"Section stream position sectionStream.Position does not match first reloc offset {firstReloc.Offset}"); 610Debug.Assert(tempStream.Position <= blob.Size && blob.Size <= tempStream.Length, $"Temp stream position {tempStream.Position} exceeds blob size {blob.Size}");
parent\parent\Common\JitInterface\WasmLowering.cs (5)
320Debug.Assert(!isV128 || ((DefType)type).InstanceFieldAlignment.AsInt == 16, 460Debug.Assert(returnType is not null, $"No cached struct of size {structSize} for return type in signature '{sig}'"); 527Debug.Assert(cachedStruct is not null, 555Debug.Assert(roundtrippedStr.Equals(wasmSignature.SignatureString, StringComparison.Ordinal), 785Debug.Assert(slotCount is >= 2 and <= 9,
illink (1)
Microsoft.AspNetCore.Components (1)
Rendering\RenderTreeBuilder.cs (1)
846Debug.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)
25Debug.Assert(transformer != null, $"The type {_transformerType} does not implement {nameof(IOpenApiDocumentTransformer)}.");
Transformers\TypeBasedOpenApiOperationTransformer.cs (1)
25Debug.Assert(transformer != null, $"The type {_transformerType} does not implement {nameof(IOpenApiOperationTransformer)}.");
Transformers\TypeBasedOpenApiSchemaTransformer.cs (1)
25Debug.Assert(transformer != null, $"The type {_transformerType} does not implement {nameof(IOpenApiSchemaTransformer)}.");
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\aspnetcore\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.Transport.DirectTls (2)
TlsEventPump.UserCallbacks.cs (2)
207Debug.Assert(value >= 1, $"The wakeup fd reported a counter of {value}."); 225Debug.Assert(false, $"Reading the wakeup fd returned {read} bytes.");
Microsoft.AspNetCore.SignalR.Core (1)
Internal\DefaultHubDispatcher.cs (1)
867Debug.Assert(false, $"Failed to bind argument of type '{descriptor.OriginalParameterTypes[parameterPointer].Name}' for hub method '{descriptor.MethodExecutor.MethodInfo.Name}'.");
Microsoft.AspNetCore.StaticAssets (4)
Development\StaticAssetDevelopmentRuntimeHandler.cs (4)
51Debug.Assert(originalETag != null, $"The static asset descriptor {asset.Route} - {asset.AssetPath} does not have an original-resource property."); 52Debug.Assert(originalAsset != null, $"The static asset descriptor {asset.Route} - {asset.AssetPath} has an original-resource property that does not match any known static asset descriptor."); 122Debug.Assert(etag != null, $"The static asset descriptor {descriptor.Route} - {descriptor.AssetPath} does not have an ETag response header."); 123Debug.Assert(_descriptorsMap.ContainsKey((descriptor.Route, etag)),
Microsoft.Build (1)
Evaluation\Expander.Function.cs (1)
158System.Diagnostics.Debug.Assert(
Microsoft.Build.Tasks.Core (7)
BootstrapperUtil\BootstrapperBuilder.cs (2)
953Debug.Assert(langNode != null, $"Unable to find a package node in {strLangManifestFilename}"); 1995Debug.Assert(s != null, $"EmbeddedResource '{name}' not found");
ManifestUtil\Util.cs (1)
203Debug.Assert(s != null, $"EmbeddedResource '{name}' not found");
ResolveManifestFiles.cs (4)
367Debug.Assert(!String.IsNullOrEmpty(itemCulture), $"Satellite item '{item.ItemSpec}' is missing expected attribute 'Culture'"); 888Debug.Assert(!_dictionary.ContainsKey(key), $"Two or more items with same key '{key}' detected"); 957Debug.Assert(!_dictionary.ContainsKey(key), $"Two or more items with same key '{key}' detected"); 998Debug.Assert(!_dictionary.ContainsKey(key), $"Two or more items with same '{(object)ItemMetadataNames.targetPath}' attribute detected");
Microsoft.CodeAnalysis (2)
CodeGen\LocalSlotManager.cs (1)
165Debug.Assert(removed, $"Attempted to free '{symbol}' more than once.");
CommandLine\Feature.cs (1)
43Debug.Assert(flags.Contains(s), $"Unknown feature flag: {s}");
Microsoft.CodeAnalysis.CSharp (5)
Binder\DecisionDagBuilder_CheckOrReachability.cs (1)
869Debug.Assert(node is BoundBinaryPattern
Binder\RefSafetyAnalysis.cs (1)
1443Debug.Assert(element is BoundCollectionElementInitializer or BoundExpression, $"Unexpected collection expression element {element}");
BoundTree\BoundExpression.cs (1)
22Debug.Assert(this.WasCompilerGenerated ||
Emitter\EditAndContinue\CSharpSymbolMatcher.cs (1)
66Debug.Assert(
Symbols\Synthesized\SynthesizedTypeParameterSymbol.cs (1)
30Debug.Assert(this.TypeParameterKind == (ContainingSymbol is MethodSymbol ? TypeParameterKind.Method :
Microsoft.CodeAnalysis.Features (2)
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (1)
116Debug.Assert(document.Name != FileName, $"New document name is same as old document name:{FileName}");
Completion\CompletionService_GetCompletions.cs (1)
227Debug.Assert(lspProvider.TriggerCharacters.Contains(character),
Microsoft.CodeAnalysis.Razor.Compiler (6)
Language\CodeGeneration\CodeWriter.WriteInterpolatedStringHandler.cs (1)
81Debug.Assert(!typeof(T).IsValueType, $"Handle {typeof(T).FullName} to avoid boxing to {nameof(IWriteableValue)}");
Language\Legacy\RoslynCSharpTokenizer.cs (1)
97Debug.Assert(CurrentState == RoslynCSharpTokenizerState.TriviaForCSharpToken, $"Unexpected state: {CurrentState}");
Language\Legacy\Tokenizer.cs (1)
206Debug.Assert(tokenContent == Buffer.ToString(), $"Token content mismatch: '{tokenContent}' != '{Buffer}'. Token Type: '{type}'.");
Language\RazorCodeDocument.cs (1)
364Debug.Assert(validateNamespace == @namespace, $"We cached a namespace of {@namespace} but calculated that it should be {validateNamespace}");
Language\RazorHtmlWriter.cs (1)
53Debug.Assert(
Language\TagHelpers\Producers\ComponentTagHelperProducer.cs (1)
594Debug.Assert(false, $"Need to add support for '{arg.Kind}' and make sure the output is 'global::' prefixed.");
Microsoft.Diagnostics.DataContractReader (2)
ContractDescriptorTarget.cs (2)
838Debug.Assert( 866Debug.Assert(
Microsoft.Diagnostics.DataContractReader.Abstractions (7)
TargetFieldExtensions.cs (7)
75Debug.Assert( 88Debug.Assert( 101Debug.Assert( 116Debug.Assert( 180Debug.Assert( 207Debug.Assert( 215Debug.Assert(
Microsoft.Diagnostics.DataContractReader.Contracts (1)
Contracts\StackWalk\StackWalk_1.cs (1)
829Debug.Assert(
Microsoft.DotNet.HotReload.Watch (1)
src\sdk\src\Dotnet.Watch\AspireService\Models\RunSessionRequest.cs (1)
68Debug.Assert(LaunchConfigurations.Length == 1, $"Unexpected number of launch configurations {LaunchConfigurations.Length}");
Microsoft.Extensions.AI.Abstractions (2)
Utilities\AIJsonUtilities.Schema.Create.cs (2)
296Debug.Assert(refUri is "#" || refUri.StartsWith("#/", StringComparison.Ordinal), $"Expected {nameof(refUri)} to be either # or start with #/, got {refUri}"); 418Debug.Assert(kind is JsonValueKind.True, $"Invalid schema type: {kind}");
Microsoft.Extensions.Caching.Hybrid (1)
Internal\HybridCacheEventSource.cs (1)
230Debug.Assert(IsEnabled(), $"Missing check to {nameof(HybridCacheEventSource)}.{nameof(Log)}.{nameof(IsEnabled)} from {caller}");
Microsoft.Extensions.Logging.Console (1)
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
103Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
Microsoft.NET.Build.Containers (2)
Resources\Resource.cs (2)
35Debug.Assert(resource != null, $"Resource with name {name} was not found"); 49Debug.Assert(resource != null, $"Resource with name {name} was not found");
Microsoft.NET.HostModel (5)
Bundle\Bundler.cs (3)
345Debug.Assert(endOfHost == hostLength, $"Host file size on disk does not match bytes written to the bundle. Expected {hostLength}, but got {endOfHost}. This may indicate that the host file is not a valid native binary or that it is not a single-file apphost."); 373Debug.Assert(bundleStream.Position - endOfHost <= bundledFilesSize, $"Not enough space allocated for bundled files. Allocated {bundledFilesSize}, but written {bundleStream.Position - endOfHost}"); 384Debug.Assert((long)endOfBundle == endOfBundledFiles + bundleManifestLength, $"Bundle manifest is unexpected size. Expected {bundleManifestLength}, but got {(long)endOfBundle - endOfBundledFiles}");
Bundle\FileEntry.cs (1)
56Debug.Assert(writer.BaseStream.Position - start == GetFileEntryLength(BundleMajorVersion, RelativePath),
Bundle\Manifest.cs (1)
176Debug.Assert(writer.BaseStream.Position - startOffset == GetManifestLength(BundleMajorVersion, Files.Select(static f => f.RelativePath)),
Microsoft.Win32.Registry (2)
Microsoft\Win32\RegistryKey.cs (2)
407Debug.Assert(errorCode == 0, $"RegDeleteValue failed. Here's your error code: {errorCode}"); 1078Debug.Assert((uint)dataLength <= span.Length, $"Expected {dataLength} <= {span.Length}");
NuGet.Packaging (5)
Signing\DerEncoding\DerEncoder.cs (4)
1107Debug.Assert(x!.Length == 3, $"x.Length is {x.Length} when it should be 3"); 1108Debug.Assert(y!.Length == 3, $"y.Length is {y.Length} when it should be 3"); 1139Debug.Assert(x[0].Length == 1, $"x[0].Length is {x[0].Length} when it should be 1"); 1140Debug.Assert(y[0].Length == 1, $"y[0].Length is {y[0].Length} when it should be 1");
Signing\DerEncoding\DerSequenceReader.cs (1)
483Debug.Assert(
NuGet.ProjectModel (2)
PackageSpecReferenceDependencyProvider.cs (2)
65Debug.Assert( 74Debug.Assert(
PresentationBuildTasks (4)
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\StyleModeStack.cs (2)
46Debug.Assert(Depth >= 0, $"StyleModeStack's depth was {Depth}, should be >= 0"); 63Debug.Assert(Depth >= 0, $"StyleMode::Pop() with depth of {Depth}, should be >= 0");
src\wpf\src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlReaderHelper.cs (2)
5051Debug.Assert( xmlNodeType == XmlNodeType.Text || 5132Debug.Assert (parentNodeType == ElementContextType.Unknown,
PresentationFramework (13)
MS\Internal\Annotations\AnnotationMap.cs (1)
77Debug.Assert(list != null, $"there should be an attached annotation list for the annotationId: {annotationId}");
MS\Internal\Ink\StrokeCollectionDefaultValueFactory.cs (1)
37Debug.Assert(property.PropertyType == typeof(StrokeCollection),
System\Windows\Interop\ActiveXHost.cs (1)
505Debug.Assert(hr == NativeMethods.S_OK, $"DoVerb call failed for verb 0x{verb:X}");
System\Windows\Markup\BamlRecordReader.cs (1)
4225Debug.Assert(!context.CreateUsingTypeConverter,
System\Windows\Markup\StyleModeStack.cs (2)
46Debug.Assert(Depth >= 0, $"StyleModeStack's depth was {Depth}, should be >= 0"); 63Debug.Assert(Depth >= 0, $"StyleMode::Pop() with depth of {Depth}, should be >= 0");
System\Windows\Media\Animation\Storyboard.cs (2)
574Debug.Assert( mappedObject == null || mappedObject is AnimationClock || mappedObject is List<AnimationClock>, 615Debug.Assert( value is AnimationClock || value is List<AnimationClock> ,
System\Windows\StyleHelper.cs (4)
4340Debug.Assert(candidateTrigger is List<TriggerBase>, 5051Debug.Assert( existing is List<TriggerBase>, 5097Debug.Assert( existing is List<TriggerBase>, 5270Debug.Assert(candidateTrigger is List<TriggerBase>,
System\Windows\SystemResourceKey.cs (1)
1956Debug.Assert(((SystemResourceKeyID.InternalSystemColorsStart < id) && (id < SystemResourceKeyID.InternalSystemColorsEnd)) ||
System.Collections (1)
System\Collections\Generic\OrderedDictionary.cs (1)
417Debug.Assert(behavior is InsertionBehavior.IgnoreInsertion, $"Unknown behavior: {behavior}");
System.Collections.Concurrent (4)
System\Collections\Concurrent\ConcurrentBag.cs (1)
1058Debug.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 (6)
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 (2)
611Debug.Assert(eppa != null, $"Extender property {prop.Name} has no provider attribute. We will skip it."); 1399Debug.Assert(Array.TrueForAll(properties, dbgProp => dbgProp is not null), $"Holes in property array for type {type}");
System.Data.Common (28)
System\Data\Common\DBCommandBuilder.cs (1)
201Debug.Assert(_isMutatedName[iMutatedName], $"{_baseParameterNames[iMutatedName]} expected to be a mutated name");
System\Data\Common\DbConnectionStringBuilder.cs (1)
254Debug.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)
597Debug.Assert(MissingSchemaAction.Error == _missingSchemaAction, $"Unexpected value of MissingSchemaAction parameter : {_missingSchemaAction}");
System\Data\XDRSchema.cs (2)
133Debug.Assert(FEqualIdentity(node, Keywords.XDR_ELEMENTTYPE, Keywords.XDRNS), $"Invalid node type {node.LocalName}"); 290Debug.Assert(s_mapNameTypeXdr[index].name == name, $"FindNameType('{name}') -- failed. Wrong name found");
System\Data\XMLSchema.cs (1)
1914Debug.Assert(s_mapNameTypeXsd[index].name == name, $"FindNameType('{name}') -- failed. Wrong name found");
System.Data.Odbc (3)
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.Data.OleDb (3)
ColumnBinding.cs (1)
58Debug.Assert(ODB.SizeOf_tagDBBINDING <= offset, $"invalid offset {offset}");
DbPropSet.cs (1)
264Debug.Assert(null != properties[i], $"null tagDBPROP {i.ToString(CultureInfo.InvariantCulture)}");
System\Data\ProviderBase\DbConnectionPoolCounters.cs (1)
260Debug.Assert(result.Length == CounterInstanceNameMaxLength,
System.Diagnostics.PerformanceCounter (1)
System\Diagnostics\SharedPerformanceCounter.cs (1)
696Debug.Assert(counterNamesObject is string[], $"Expected string[], got '{counterNamesObject}' of type '{counterNamesObject?.GetType()}' with kind '{categoryKey.GetValueKind("Counter Names")}' for category '{_categoryName}'");
System.Drawing.Primitives (1)
System\Drawing\Color.cs (1)
403Debug.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)
523Debug.Assert(Path.IsPathFullyQualified(qualifiedPath), $"{qualifiedPath} is not qualified");
System.IO.Compression (3)
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
103Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
System\IO\Compression\WinZipAesKeyMaterial.cs (1)
60Debug.Assert(salt.Length == saltSize, $"Salt must be {saltSize} bytes for AES-{keySizeBits}.");
System\IO\Compression\Zstandard\ZstandardStream.Decompress.cs (1)
104Debug.Assert(
System.IO.Compression.Brotli (1)
System\IO\Compression\dec\BrotliStream.Decompress.cs (1)
243Debug.Assert(
System.IO.FileSystem.AccessControl (1)
src\runtime\src\libraries\Common\src\System\IO\FileSystem.Attributes.Windows.cs (1)
66Debug.Assert(errorCode == Interop.Errors.ERROR_ACCESS_DENIED || errorCode == Interop.Errors.ERROR_SHARING_VIOLATION || errorCode == Interop.Errors.ERROR_SEM_TIMEOUT,
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)
3118Debug.Assert(_instructions.CurrentStackDepth == startingStackDepth + (expr.Type == typeof(void) ? 0 : 1),
System.Net.Http (33)
src\runtime\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\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
103Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
src\runtime\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\runtime\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}");
System\Net\Http\Headers\HeaderDescriptor.cs (1)
33Debug.Assert(customHeader || KnownHeaders.TryGetKnownHeader(headerName) is null, $"The {nameof(KnownHeader)} overload should be used for {headerName}");
System\Net\Http\Headers\HttpHeaders.cs (2)
451Debug.Assert(descriptor.Parser.SupportsMultipleValues, $"Header '{descriptor.Name}' doesn't support multiple values"); 573Debug.Assert(headerRemoved, $"Existing header '{descriptor.Name}' couldn't be removed.");
System\Net\Http\HttpContent.cs (2)
264Debug.Assert(_contentReadStream is Stream, $"Expected a Stream, got ${_contentReadStream}"); 293Debug.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 (2)
108Debug.Assert(_associatedHttp11ConnectionCount <= _maxHttp11Connections, 110Debug.Assert(_associatedHttp11ConnectionCount >= _pendingHttp11ConnectionCount,
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http2.cs (2)
415Debug.Assert(_associatedHttp2ConnectionCount > (_availableHttp2Connections?.Count ?? 0), 438Debug.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)
394Debug.Assert(_associatedHttp3ConnectionCount > (_availableHttp3Connections?.Count ?? 0), 417Debug.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.Http.WinHttpHandler (3)
src\runtime\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}");
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}"); 396Debug.Assert(data[index + 1] == MailBnfHelper.Quote, $"Mis-aligned index: {index}"); 435Debug.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\runtime\src\libraries\Common\src\System\Net\InteropIPAddressExtensions.Unix.cs (1)
16Debug.Assert(bytesWritten == sizeof(uint) || bytesWritten == Interop.Sys.IPv6AddressBytes, $"Unexpected length: {bytesWritten}");
src\runtime\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 (3)
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
27Debug.Assert(err == Interop.Error.SUCCESS, $"Unexpected err: {err}");
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 (1)
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
27Debug.Assert(err == Interop.Error.SUCCESS, $"Unexpected err: {err}");
System.Net.Quic (12)
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
103Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
src\runtime\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\runtime\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\runtime\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)
637Debug.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 (6)
src\runtime\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\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OCSP.cs (1)
76Debug.Assert(ret == 0, $"Unexpected response from X509DecodeOcspToExpiration: {ret}");
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (1)
910Debug.Assert(
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
103Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
src\runtime\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 (1)
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
103Debug.Assert(byteCount <= ActiveLength, $"Expected {byteCount} <= {ActiveLength}");
System.Net.Sockets (37)
src\runtime\src\libraries\Common\src\System\Net\InteropIPAddressExtensions.Unix.cs (1)
16Debug.Assert(bytesWritten == sizeof(uint) || bytesWritten == Interop.Sys.IPv6AddressBytes, $"Unexpected length: {bytesWritten}");
src\runtime\src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (1)
27Debug.Assert(err == Interop.Error.SUCCESS, $"Unexpected err: {err}");
System\Net\Sockets\SafeSocketHandle.Unix.cs (2)
175Debug.Assert(value == -1 || value > 0, $"Unexpected value: {value}"); 188Debug.Assert(value == -1 || value > 0, $"Unexpected value: {value}");
System\Net\Sockets\SocketAsyncContext.Unix.cs (21)
164Debug.Assert(oldState == State.Waiting, $"Unexpected operation state: {(State)oldState}"); 182Debug.Assert(state is State.Running or State.RunningWithPendingCancellation, $"Unexpected operation state: {(State)state}"); 627Debug.Assert(ErrorCode == SocketError.Success || AcceptedFileDescriptor == (IntPtr)(-1), $"Unexpected values: ErrorCode={ErrorCode}, AcceptedFileDescriptor={AcceptedFileDescriptor}"); 1048Debug.Assert(_state == QueueState.Processing, $"_state={_state} while processing queue!"); 1076Debug.Assert(_state == QueueState.Processing, $"_state={_state} while processing queue!"); 1107Debug.Assert(_state == QueueState.Processing, $"_state={_state} while processing queue!"); 1397Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1472Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1479Debug.Assert(errorCode == SocketError.Success || acceptedFd == (IntPtr)(-1), $"Unexpected values: errorCode={errorCode}, acceptedFd={acceptedFd}"); 1497Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1507Debug.Assert(errorCode == SocketError.Success || acceptedFd == (IntPtr)(-1), $"Unexpected values: errorCode={errorCode}, acceptedFd={acceptedFd}"); 1535Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1562Debug.Assert(socketAddress.Length > 0, $"Unexpected socketAddressLen: {socketAddress.Length}"); 1640Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1785Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1854Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1891Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 1983Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 2015Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 2094Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}"); 2164Debug.Assert(timeout == -1 || timeout > 0, $"Unexpected timeout: {timeout}");
System\Net\Sockets\SocketAsyncEngine.Unix.cs (1)
240Debug.Assert(numEvents > 0, $"Unexpected numEvents: {numEvents}");
System\Net\Sockets\SocketAsyncEventArgs.cs (1)
543Debug.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}"); 715Debug.Assert(sendBuffer.Length >= MaxMessageHeaderLength, $"Expected {nameof(sendBuffer)} to be at least {MaxMessageHeaderLength}, got {sendBuffer.Length}"); 890Debug.Assert(header.Opcode == MessageOpcode.Binary || header.Opcode == MessageOpcode.Text, $"Unexpected opcode {header.Opcode}"); 1455Debug.Assert( 1595Debug.Assert(count >= 0, $"Expected non-negative {nameof(count)}, got {count}"); 1596Debug.Assert(count <= _receiveBufferCount, $"Trying to consume {count}, which is more than exists {_receiveBufferCount}"); 1605Debug.Assert(minimumRequiredBytes <= _receiveBuffer.Length, $"Requested number of bytes {minimumRequiredBytes} must not exceed {_receiveBuffer.Length}"); 1671Debug.Assert(maskOffsetIndex < MaskLength, $"Unexpected {nameof(maskOffsetIndex)}: {maskOffsetIndex}"); 1672Debug.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 (51)
src\runtime\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\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Encoder.cs (1)
214Debug.Assert(buffer.Length == charsWritten, $"The source length: {source.Length}, chars written: {charsWritten}");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlEncoder.cs (1)
171Debug.Assert(buffer.Length == charsWritten, $"The source length: {source.Length}, bytes written: {charsWritten}");
src\runtime\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\runtime\src\libraries\System.Private.CoreLib\src\System\Convert.cs (1)
2366Debug.Assert(buffer.Length == charsWritten, $"Expected {buffer.Length} == {charsWritten}");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Enum.cs (2)
2015Debug.Assert(foundItemsCount >= 2 && foundItemsCount <= 64, $"{nameof(foundItemsCount)} == {foundItemsCount}"); 2110Debug.Assert(foundItems.Length >= 2, $"{nameof(foundItems)} == {foundItems.Length}");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.Icu.cs (1)
332Debug.Assert(!unsupportedDateFieldSymbols.Contains(input[index]),
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CultureData.cs (1)
2204Debug.Assert(index >= 10, $"Couldn't read native digits for '{_sWindowsName}' successfully.");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\HebrewCalendar.cs (1)
659Debug.Assert(hebrewYearType >= 1 && hebrewYearType <= 6,
src\runtime\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}"); 1229Debug.Assert(newPos == Position, $"newPos (={newPos}) == Position (={Position})"); 1255Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}"); 1294Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}");
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Enumeration\FileSystemEntry.Unix.cs (1)
86Debug.Assert(Directory.Length + FileName.Length < _pathBuffer.Length,
src\runtime\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\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (4)
851Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}"); 882Debug.Assert(readBytes >= 0, $"Expected a non-negative number of bytes in buffer, got {readBytes}"); 941Debug.Assert(newPos == Position, $"newPos (={newPos}) == Position (={Position})"); 979Debug.Assert(_readPos <= _readLen, $"_readPos <= _readLen [{_readPos} <= {_readLen}]");
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\OSFileStreamStrategy.cs (1)
221Debug.Assert(r >= 0, $"RandomAccess.ReadAtOffset returned {r}.");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
1685Debug.Assert(ret == left * right, $"Multiply overflow got: {ret}, expected: {left * right}");
src\runtime\src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (1)
5994Debug.Assert(_splitMode == SpanSplitEnumeratorMode.SearchValues, $"Unknown split mode: {_splitMode}");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.Parsing.cs (1)
638Debug.Assert((styles & ~TParser.AllowedStyles) == 0, $"Only handles subsets of {TParser.AllowedStyles} format");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Random.cs (3)
732Debug.Assert(result >= minInclusive && result < maxExclusive, $"Expected {minInclusive} <= {result} < {maxExclusive}"); 736Debug.Assert(result == minInclusive, $"Expected {minInclusive} == {result}"); 743Debug.Assert(result >= 0.0 && result < 1.0, $"Expected 0.0 <= {result} < 1.0");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (2)
191Debug.Assert(index >= 0 && index < _numResources, $"Bad index into hash array. index: {index}"); 207Debug.Assert(index >= 0 && index < _numResources, $"Bad index into name position array. index: {index}");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs (1)
478Debug.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\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\PoolingAsyncValueTaskMethodBuilderT.cs (2)
387Debug.Assert(s_perCoreCache.Length == Environment.ProcessorCount, $"{s_perCoreCache.Length} != {Environment.ProcessorCount}"); 420Debug.Assert(s is StateMachineBox<TStateMachine>, $"Expected {nameof(StateMachineBox<TStateMachine>)}, got '{s}'");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\GCSettings.cs (1)
49Debug.Assert(status == SetLatencyModeStatus.Succeeded, $"Unexpected return value '{status}' from {nameof(SetGCLatencyMode)}.");
src\runtime\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\runtime\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\runtime\src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (2)
2195Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk), 2215Debug.Assert(indexInChunk >= chunk.m_ChunkLength || count == 0,
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\CancellationTokenSource.cs (2)
829Debug.Assert(exceptionList.Count > 0, $"Expected {exceptionList.Count} > 0"); 938Debug.Assert(s is CancellationTokenSource, $"Expected {typeof(CancellationTokenSource)}, got {s}");
src\runtime\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\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Sources\ManualResetValueTaskSourceCore.cs (5)
261Debug.Assert(context is TaskScheduler or SynchronizationContext, $"context is {context}"); 276Debug.Assert(scheduler is SynchronizationContext or TaskScheduler, $"{nameof(scheduler)} is {scheduler}"); 296Debug.Assert( 318Debug.Assert(cc._scheduler is TaskScheduler, $"{nameof(cc._scheduler)} is {cc._scheduler}"); 337Debug.Assert(capturedContext is ExecutionContext or CapturedSchedulerAndExecutionContext, $"{nameof(capturedContext)} is {capturedContext}");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (1)
6298Debug.Assert(failedOrCanceled is Task, $"Expected Task, got {failedOrCanceled}");
src\runtime\src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParser.cs (1)
64Debug.Assert(parsedName.GetNodeCount() == recursiveDepth, $"Node count mismatch for '{typeName.ToString()}'");
System.Private.DataContractSerialization (1)
System\Xml\ValueHandle.cs (1)
772Debug.Assert(byteOffset + actualByteCount < bytes.Length,
System.Private.Reflection.Execution (1)
src\runtime\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?");
System.Private.TypeLoader (1)
src\runtime\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?");
System.Private.Uri (3)
System\IPv4AddressHelper.cs (1)
18Debug.Assert(result != Invalid, $"Failed to parse after already validated: {str}");
System\PercentEncodingHelper.cs (2)
75Debug.Assert(bytesConsumed >= 2, $"Rune.DecodeFromUtf8 consumed {bytesConsumed} bytes, likely indicating input was modified concurrently during UnescapePercentEncodedUTF8Sequence's execution"); 91Debug.Assert(bytesConsumed > 0, $"Rune.DecodeFromUtf8 consumed {bytesConsumed} bytes when decoding {bytesLeftInBuffer} bytes");
System.Private.Windows.Core (1)
Windows\Win32\Foundation\HRESULT.cs (1)
58public void AssertSuccess() => Debug.Assert(Succeeded, $"Result failed: {this}");
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)
213Debug.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)
418Debug.Assert(_xstate == XmlState.WithinSequence, $"StartTree cannot be called in the {_xstate} state."); 429Debug.Assert(_xstate == XmlState.EnumAttrs || _xstate == XmlState.WithinContent, $"EndTree cannot be called in the {_xstate} state."); 445Debug.Assert(_xstate == XmlState.WithinContent, $"WriteStartElement cannot be called in the {_xstate} state."); 468Debug.Assert(_xstate == XmlState.EnumAttrs, $"StartElementContent cannot be called in the {_xstate} state."); 483Debug.Assert(_xstate == XmlState.EnumAttrs || _xstate == XmlState.WithinContent, $"WriteEndElement cannot be called in the {_xstate} state."); 503Debug.Assert(_xstate == XmlState.EnumAttrs, $"WriteStartAttribute cannot be called in the {_xstate} state."); 522Debug.Assert(_xstate == XmlState.WithinAttr, $"WriteEndAttribute cannot be called in the {_xstate} state."); 538Debug.Assert(_xstate == XmlState.EnumAttrs, $"WriteNamespaceDeclaration cannot be called in the {_xstate} state."); 571Debug.Assert(_xstate != XmlState.WithinSequence && _xstate != XmlState.EnumAttrs, $"WriteTextBlock cannot be called in the {_xstate} state."); 580Debug.Assert(_xstate != XmlState.WithinSequence && _xstate != XmlState.EnumAttrs, $"WriteTextBlockNoEntities cannot be called in the {_xstate} state."); 761Debug.Assert(_xstate == XmlState.WithinNmsp, $"WriteNamespaceString cannot be called in the {_xstate} state."); 770Debug.Assert(_xstate == XmlState.WithinNmsp, $"WriteEndNamespace cannot be called in the {_xstate} state."); 800Debug.Assert(_xstate == XmlState.WithinComment, $"WriteCommentString cannot be called in the {_xstate} state."); 809Debug.Assert(_xstate == XmlState.WithinComment, $"WriteEndComment cannot be called in the {_xstate} state."); 843Debug.Assert(_xstate == XmlState.WithinPI, $"WriteProcessingInstructionString cannot be called in the {_xstate} state."); 852Debug.Assert(_xstate == XmlState.WithinPI, $"WriteEndProcessingInstruction cannot be called in the {_xstate} state."); 1205Debug.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\runtime\src\libraries\Common\src\System\Resources\ResourceWriter.cs (1)
617Debug.Assert(typeCode >= ResourceTypeCode.StartOfUserTypes, $"ResourceReader: Unsupported ResourceTypeCode in .resources file! {typeCode}");
src\runtime\src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (2)
191Debug.Assert(index >= 0 && index < _numResources, $"Bad index into hash array. index: {index}"); 207Debug.Assert(index >= 0 && index < _numResources, $"Bad index into name position array. index: {index}");
System.Resources.Writer (1)
src\runtime\src\libraries\Common\src\System\Resources\ResourceWriter.cs (1)
617Debug.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 (1)
System\Numerics\BigInteger.cs (1)
1977Debug.Assert(mode is GetBytesMode.AllocateArray or GetBytesMode.Count or GetBytesMode.Span, $"Unexpected mode {mode}.");
System.Security.Cryptography (14)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\DSACng.ImportExport.cs (8)
215Debug.Assert(offset == sizeof(BCRYPT_DSA_KEY_BLOB), $"Expected offset = sizeof(BCRYPT_DSA_KEY_BLOB), got {offset} != {sizeof(BCRYPT_DSA_KEY_BLOB)}"); 225Debug.Assert(offset == blobSize, $"Expected offset = blobSize, got {offset} != {blobSize}"); 280Debug.Assert(offset == sizeof(BCRYPT_DSA_KEY_BLOB_V2), $"Expected offset = sizeof(BCRYPT_DSA_KEY_BLOB_V2), got {offset} != {sizeof(BCRYPT_DSA_KEY_BLOB_V2)}"); 290Debug.Assert(offset == sizeof(BCRYPT_DSA_KEY_BLOB_V2), $"Expected offset = sizeof(BCRYPT_DSA_KEY_BLOB_V2), got {offset} != {sizeof(BCRYPT_DSA_KEY_BLOB_V2)}"); 307Debug.Assert(offset == blobSize, $"Expected offset = blobSize, got {offset} != {blobSize}"); 363Debug.Assert(offset == sizeof(BCRYPT_DSA_KEY_BLOB), $"Expected offset = sizeof(BCRYPT_DSA_KEY_BLOB), got {offset} != {sizeof(BCRYPT_DSA_KEY_BLOB)}"); 395Debug.Assert(offset == sizeof(BCRYPT_DSA_KEY_BLOB_V2), $"Expected offset = sizeof(BCRYPT_DSA_KEY_BLOB_V2), got {offset} != {sizeof(BCRYPT_DSA_KEY_BLOB_V2)}"); 415Debug.Assert(offset == dsaBlob.Length, $"Expected offset = dsaBlob.Length, got {offset} != {dsaBlob.Length}");
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (1)
229Debug.Assert(cipher.BlockSize <= 128, $"Encountered unexpected block size: {cipher.BlockSize}");
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Oids.Shared.cs (1)
86Debug.Assert(
System\Security\Cryptography\CapiHelper.Windows.cs (1)
875Debug.Assert(cbKey >= 0, $"cbKey is less than 0 ({cbKey})");
System\Security\Cryptography\HKDFManagedImplementation.cs (2)
15Debug.Assert(written == prk.Length, $"Bytes written is {written} bytes which does not match output length ({prk.Length} bytes)"); 97Debug.Assert(written == output.Length, $"Bytes written is {written} bytes which does not match output length ({output.Length} bytes)");
System\Security\Cryptography\LiteHash.Windows.cs (1)
360Debug.Assert(destination.Length >= _hashSizeInBytes, $"{destination.Length} >= {_hashSizeInBytes}");
System.Security.Cryptography.Pkcs (5)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (1)
229Debug.Assert(cipher.BlockSize <= 128, $"Encountered unexpected block size: {cipher.BlockSize}");
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Oids.Shared.cs (1)
86Debug.Assert(
System\Security\Cryptography\Pkcs\CmsSignature.cs (2)
175Debug.Assert( 234Debug.Assert(
System\Security\Cryptography\Pkcs\CmsSignature.RSA.cs (1)
381Debug.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)
392Debug.Assert((arrayTemp.Length / 2) < 20,
System\Text\EncoderBestFitFallback.cs (2)
75Debug.Assert(_iCount < 1, $"[InternalEncoderBestFitFallbackBuffer.Fallback(non surrogate)] Fallback char {(int)_cBestFit:X4} caused recursive fallback"); 97Debug.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)
171Debug.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}"); 270Debug.Assert(arrayTemp[iBestFitCount - 1] != (char)0,
System.Text.Json (22)
src\runtime\src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
103Debug.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 (3)
263Debug.Assert(index <= Length - DbRow.Size, $"index {index} is out of bounds"); 264Debug.Assert(index % DbRow.Size == 0, $"index {index} is not at a record start position"); 341Debug.Assert(
System\Text\Json\Document\JsonDocument.Parse.cs (4)
583Debug.Assert( 587Debug.Assert( 607Debug.Assert( 611Debug.Assert(
System\Text\Json\Document\JsonDocument.PropertyNameSet.cs (1)
126Debug.Assert(success, $"Property name {propertyName} should not already exist in the set.");
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( 441Debug.Assert( 445Debug.Assert(
System.Text.RegularExpressions (56)
System\Text\RegularExpressions\RegexCompiler.cs (42)
1673Debug.Assert(node.Kind is RegexNodeKind.Alternate, $"Unexpected type: {node.Kind}"); 1674Debug.Assert(node.ChildCount() >= 2, $"Expected at least 2 children, found {node.ChildCount()}"); 2095Debug.Assert(multi.Kind is RegexNodeKind.Multi, $"Expected a Multi node, got {multi.Kind}"); 2105Debug.Assert(node.Kind is RegexNodeKind.Backreference, $"Unexpected type: {node.Kind}"); 2295Debug.Assert(node.Kind is RegexNodeKind.BackreferenceConditional, $"Unexpected type: {node.Kind}"); 2296Debug.Assert(node.ChildCount() == 2, $"Expected 2 children, found {node.ChildCount()}"); 2454Debug.Assert(node.Kind is RegexNodeKind.ExpressionConditional, $"Unexpected type: {node.Kind}"); 2455Debug.Assert(node.ChildCount() == 3, $"Expected 3 children, found {node.ChildCount()}"); 2647Debug.Assert(node.Kind is RegexNodeKind.Capture, $"Unexpected type: {node.Kind}"); 2648Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 2773Debug.Assert(node.Kind is RegexNodeKind.PositiveLookaround, $"Unexpected type: {node.Kind}"); 2774Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 2817Debug.Assert(node.Kind is RegexNodeKind.NegativeLookaround, $"Unexpected type: {node.Kind}"); 2818Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 3076Debug.Assert(node.Kind is RegexNodeKind.Atomic or RegexNodeKind.PositiveLookaround or RegexNodeKind.NegativeLookaround or RegexNodeKind.ExpressionConditional, $"Unexpected type: {node.Kind}"); 3077Debug.Assert(node.Kind is RegexNodeKind.ExpressionConditional ? node.ChildCount() >= 1 : node.ChildCount() == 1, $"Unexpected number of children: {node.ChildCount()}"); 3120Debug.Assert(node.Kind is RegexNodeKind.UpdateBumpalong, $"Unexpected type: {node.Kind}"); 3140Debug.Assert(node.Kind is RegexNodeKind.Concatenate, $"Unexpected type: {node.Kind}"); 3141Debug.Assert(node.ChildCount() >= 2, $"Expected at least 2 children, found {node.ChildCount()}"); 3211Debug.Assert(node.IsOneFamily || node.IsNotoneFamily || node.IsSetFamily, $"Unexpected type: {node.Kind}"); 3286Debug.Assert(node.Kind is RegexNodeKind.Boundary or RegexNodeKind.NonBoundary or RegexNodeKind.ECMABoundary or RegexNodeKind.NonECMABoundary, $"Unexpected type: {node.Kind}"); 3346Debug.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}"); 3484Debug.Assert(node.Kind is RegexNodeKind.Multi, $"Unexpected type: {node.Kind}"); 3536Debug.Assert(node.Kind is RegexNodeKind.Oneloop or RegexNodeKind.Notoneloop or RegexNodeKind.Setloop, $"Unexpected type: {node.Kind}"); 3811Debug.Assert(node.Kind is RegexNodeKind.Onelazy or RegexNodeKind.Notonelazy or RegexNodeKind.Setlazy, $"Unexpected type: {node.Kind}"); 4158Debug.Assert(node.Kind is RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 4159Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 4160Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 4161Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 4530Debug.Assert(node.IsOneFamily || node.IsNotoneFamily || node.IsSetFamily, $"Unexpected type: {node.Kind}"); 4680Debug.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}"); 4927Debug.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}"); 5016Debug.Assert(node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 5017Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 5018Debug.Assert(node.M == node.N, $"Unexpected M={node.M} == N={node.N}"); 5019Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 5020Debug.Assert(!analysis.MayBacktrack(node.Child(0)), $"Expected non-backtracking node {node.Kind}"); 5054Debug.Assert(node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop, $"Unexpected type: {node.Kind}"); 5055Debug.Assert(node.M < int.MaxValue, $"Unexpected M={node.M}"); 5056Debug.Assert(node.N >= node.M, $"Unexpected M={node.M}, N={node.N}"); 5057Debug.Assert(node.ChildCount() == 1, $"Expected 1 child, found {node.ChildCount()}"); 6480Debug.Assert(chars.Length > 3, $"chars.Length == {chars.Length}");
System\Text\RegularExpressions\RegexFindOptimizations.cs (2)
86Debug.Assert(maxLength >= MinRequiredLength, $"{maxLength} should have been greater than {MinRequiredLength} minimum"); 865Debug.Assert(FindMode == FindNextStartingPositionMode.NoSearch, $"Unexpected FindMode {FindMode}");
System\Text\RegularExpressions\RegexNode.cs (2)
3105Debug.Assert(Kind == RegexNodeKind.Concatenate, $"Expected Concatenate, got {Kind}"); 3241Debug.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}"); 865Debug.Assert(i >= 0, $"{nameof(i)} == {i}"); 866Debug.Assert(matchStartBoundary >= 0 && matchStartBoundary <= input.Length, $"{nameof(matchStartBoundary)} == {matchStartBoundary}"); 867Debug.Assert(i >= matchStartBoundary, $"Expected {i} >= {matchStartBoundary}.");
System.Threading.Channels (1)
System\Threading\Channels\AsyncOperation.cs (1)
421Debug.Assert(scheduler is SynchronizationContext or TaskScheduler, $"{nameof(scheduler)} is {scheduler}");
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 (49)
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)
2589Debug.Assert(baseProps[i] is not null, $"Null base prop at location: {i}"); 2625Debug.Assert(propDesc is not null, $"Cannot find cached entry for: {propName}");
System\Windows\Forms\ActiveX\Control.ActiveXImpl.cs (2)
1166Debug.Assert( 1550Debug.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)
2127Debug.Assert(
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (1)
2303Debug.Assert(insertIndex == index, $"NativeComboBox inserted at {insertIndex} not the requested index of {index}");
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (1)
3650Debug.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.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)
1371Debug.Assert(!s_pbrsAssertPropsSwitch.Enabled, $"Bad property '{PropertyLabel}.{property.Name}': {w}");
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (1)
3601Debug.Assert(childCount == e.NewChildCount, $"parent reports {childCount} new children, event reports {e.NewChildCount}");
System\Windows\Forms\Controls\TextBox\MaskedTextBox.cs (1)
1500Debug.Assert(keyCode is Keys.Delete or Keys.Back, $"Delete called with keyCode == {keyCode}");
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\UpDown\DomainUpDown.cs (1)
403Debug.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}"); 1170Debug.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\TableLayout.cs (4)
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\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 (34)
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)
792Debug.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)
31Debug.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)
1740Debug.Assert(c.Visible, $"TrayControl for {c.Component} should not be positioned"); 1796Debug.Assert(Visible == c.Visible, $"TrayControl for {((TrayControl)c).Component} should not be positioned"); 1805Debug.Assert(c.Visible, $"TrayControl for {c.Component} should not be positioned");
System\Windows\Forms\Design\DesignerFrame.cs (3)
417Debug.Assert(_overlayList.IndexOf(control) == -1, $"Duplicate overlay in overlay service: {control.GetType().FullName}"); 435Debug.Assert(_overlayList.IndexOf(control) != -1, $"Control is not in overlay service: {control.GetType().FullName}"); 446Debug.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}"); 178Debug.Assert(a is not null, $"No assembly found at {fullPath}"); 200Debug.Assert(attrs is not null && attrs.Length == 1, $"Invalid number of GuidAttributes found on: {t.FullName}"); 231Debug.Assert(project is not null, $"No DTE Project for the current project item: {name}"); 234Debug.Assert(vsproject is not null, $"No VS Project for the current project item: {name}"); 237Debug.Assert(references is not null, $"No References for the current project item: {name}"); 261Debug.Assert(verKey is not null, $"No version registry key found for: {controlKey}"); 280Debug.Assert(majorVer > 0 && minorVer >= 0, $"No Major version number found for: {controlKey}"); 287Debug.Assert(!tlbGuid.Equals(Guid.Empty), $"No valid Guid found for: {controlKey}"); 306Debug.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)
1136Debug.Assert(Table.RowStyles[i] is not null, $"Table's RowStyle[{i}] is null!");
System.Windows.Forms.Primitives (2)
System\Windows\Forms\Internals\ScaleHelper.cs (1)
91Debug.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}");
VBCSCompiler (1)
src\roslyn\src\Compilers\Server\VBCSCompiler\CompilerServerTelemetry.cs (1)
136Debug.Assert(!_stopwatch.IsRunning, $"A telemetry timer is already running when {callerName} was called.");