459 references to Assert
http2cat (2)
IIS.FunctionalTests (2)
IIS.LongTests (2)
IIS.NewHandler.FunctionalTests (2)
IIS.NewShim.FunctionalTests (2)
IISExpress.FunctionalTests (2)
Microsoft.AspNetCore.Components (1)
Microsoft.AspNetCore.Http.Results (1)
Microsoft.AspNetCore.Mvc.Abstractions (1)
Microsoft.AspNetCore.OpenApi (1)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (2)
Microsoft.AspNetCore.Server.Kestrel.Core (3)
Microsoft.AspNetCore.Shared.Tests (2)
Microsoft.AspNetCore.SignalR.Core (1)
PresentationBuildTasks (4)
PresentationFramework (16)
System.Collections.Concurrent (4)
System.ComponentModel.TypeConverter (7)
System.Data.Common (37)
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.Diagnostics.Process (2)
System.Drawing.Primitives (1)
System.Formats.Asn1 (3)
System.Formats.Tar (2)
System.IO.Compression.Brotli (1)
System.IO.FileSystem.DriveInfo (2)
System.Linq.Expressions (3)
System.Net.Http (37)
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.HttpListener (1)
System.Net.Mail (12)
System.Net.NameResolution (3)
System.Net.Ping (5)
System.Net.Primitives (3)
System.Net.Quic (11)
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.Requests (1)
System.Net.Security (5)
System.Net.Sockets (43)
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\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)
System.Private.DataContractSerialization (1)
System.Private.Uri (3)
System.Private.Xml (42)
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.Reflection.Metadata (2)
System.Resources.Extensions (3)
System.Resources.Writer (1)
System.Runtime.Caching (1)
System.Runtime.Numerics (2)
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\System\Security\Cryptography\Oids.Shared.cs (1)
119Debug.Assert(
System\Security\Cryptography\X509Certificates\UnixChainVerifier.cs (1)
38Debug.Assert(
System.Text.Encoding.CodePages (16)
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.RegularExpressions (63)
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\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.Threading.Tasks.Parallel (2)