8993 references to Assert
aspire (20)
Backchannel\AppHostBackchannel.cs (1)
219Debug.Assert(_rpcTaskCompletionSource.Task.IsCompletedSuccessfully);
Backchannel\ExtensionBackchannel.cs (2)
86Debug.Assert(endpoint is not null); 573Debug.Assert(!string.IsNullOrEmpty(serverCertificate));
Interaction\ExtensionInteractionService.cs (17)
66Debug.Assert(result); 70Debug.Assert(result); 77Debug.Assert(result); 80Debug.Assert(result); 170Debug.Assert(result); 177Debug.Assert(result); 184Debug.Assert(result); 191Debug.Assert(result); 198Debug.Assert(result); 205Debug.Assert(result); 211Debug.Assert(result); 218Debug.Assert(result); 224Debug.Assert(result); 231Debug.Assert(result); 244Debug.Assert(result); 256Debug.Assert(result); 272Debug.Assert(result);
Aspire.Azure.Npgsql (2)
AspireAzureNpgsqlExtensions.cs (2)
38Debug.Assert(azureSettings != null); 67Debug.Assert(azureSettings != null);
Aspire.Confluent.Kafka (2)
KafkaConsumerSettings.cs (1)
50Debug.Assert(Config is not null);
KafkaProducerSettings.cs (1)
50Debug.Assert(Config is not null);
Aspire.Dashboard (9)
Components\Controls\Chart\ChartBase.cs (2)
490Debug.Assert(InstrumentViewModel.MatchedDimensions != null); 491Debug.Assert(InstrumentViewModel.Instrument != null);
Components\Controls\ResourceDetails.razor.cs (1)
262Debug.Assert(_isMaskAllChecked != null);
Components\Pages\ConsoleLogs.razor.cs (1)
286Debug.Assert(_resources is not null);
Components\Pages\TraceDetail.razor.cs (2)
154Debug.Assert(_spanWaterfallViewModels != null); 365Debug.Assert(_layout is not null);
Model\ResourceViewModel.cs (2)
205Debug.Assert(x != null); 206Debug.Assert(y != null);
src\Shared\ConsoleLogs\LogEntries.cs (1)
211Debug.Assert(BaseLineNumber is not null);
Aspire.Hosting (9)
ApplicationModel\ResourceLoggerService.cs (3)
471Debug.Assert(Monitor.IsEntered(_lock)); 482Debug.Assert(Monitor.IsEntered(_lock)); 497Debug.Assert(Monitor.IsEntered(_lock));
Dcp\DcpExecutor.cs (1)
1637Debug.Assert(ea.IsProxied);
Exec\ExecResourceManager.cs (2)
237Debug.Assert(command[0] == '"' && command[^1] == '"'); 267Debug.Assert(command[0] == '"' && command[^1] == '"');
src\Shared\ConsoleLogs\LogEntries.cs (1)
211Debug.Assert(BaseLineNumber is not null);
Utils\PasswordGenerator.cs (1)
84Debug.Assert(destination.Length >= minValues);
VersionChecking\VersionCheckService.cs (1)
82Debug.Assert(_appHostVersion != null);
Aspire.Hosting.Azure (2)
AzureProvisioningResource.cs (1)
88Debug.Assert(compilation.Count == 1);
Provisioning\Internal\BicepCompiler.cs (1)
80Debug.Assert(!string.IsNullOrWhiteSpace(command));
Aspire.Hosting.Azure.AppContainers (1)
AzureContainerAppExtensions.cs (1)
262Debug.Assert(resourceToken is not null);
Aspire.Playground.Tests (2)
src\Aspire.Hosting\Utils\PasswordGenerator.cs (1)
84Debug.Assert(destination.Length >= minValues);
tests\Aspire.TestUtilities\FileUtil.cs (1)
14Debug.Assert(!string.IsNullOrWhiteSpace(command));
Aspire.RabbitMQ.Client (5)
RabbitMQEventSourceLogForwarder.cs (5)
48Debug.Assert( 103Debug.Assert(EventData.PayloadNames?.Count == 2 && EventData.Payload?.Count == 2); 104Debug.Assert(EventData.PayloadNames[0] == "message"); 105Debug.Assert(EventData.PayloadNames[1] == "ex"); 111Debug.Assert(exData is not null && exData.Count == 4);
Aspire.TestUtilities (1)
FileUtil.cs (1)
14Debug.Assert(!string.IsNullOrWhiteSpace(command));
BuildBoss (1)
CompilerNuGetCheckerUtil.cs (1)
343Debug.Assert(string.IsNullOrEmpty(folderRelativePath) || folderRelativePath[0] != '\\');
ConfigurationSchemaGenerator (30)
ConfigurationBindingGenerator.ForSchemaGeneration.cs (1)
86Debug.Assert(result is not null);
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (8)
83Debug.Assert(invocation is not null); 86Debug.Assert(targetMethod.IsExtensionMethod); 139Debug.Assert((MethodsToGen.ServiceCollectionExt_Any & overload) is not 0); 195Debug.Assert(spec is ArraySpec or UnsupportedTypeSpec); 370Debug.Assert(spec is DictionarySpec or UnsupportedTypeSpec); 375Debug.Assert(spec is EnumerableSpec or UnsupportedTypeSpec); 657Debug.Assert(initExceptionMessage is not null); 692Debug.Assert(ctor is not null);
RuntimeSource\Configuration.Binder\Parser\BinderInvocation.cs (1)
25Debug.Assert(IsCandidateSyntaxNode(context.Node));
RuntimeSource\Configuration.Binder\Parser\ConfigurationBinder.cs (2)
258Debug.Assert((MethodsToGen.ConfigBinder_Any & overload) is not 0); 270Debug.Assert((MethodsToGen.ConfigBinder_Get & overload) is not 0 ||
RuntimeSource\Configuration.Binder\Parser\OptionsBuilderConfigurationExtensions.cs (4)
30Debug.Assert(typeSymbol?.IsValueType is not true); 49Debug.Assert(paramCount >= 2); 76Debug.Assert(paramCount >= 2); 89Debug.Assert((MethodsToGen.OptionsBuilderExt_Any & overload) is not 0);
RuntimeSource\Configuration.Binder\Parser\OptionsConfigurationServiceCollectionExtensions.cs (3)
68Debug.Assert(paramCount is 4); 74Debug.Assert(typeSymbol?.IsValueType is not true); 92Debug.Assert((MethodsToGen.ServiceCollectionExt_Any & overload) is not 0);
RuntimeSource\Configuration.Binder\Specs\BindingHelperInfo.cs (1)
175Debug.Assert(registeredForBindCore);
RuntimeSource\Configuration.Binder\Specs\InterceptorInfo.cs (6)
31Debug.Assert((MethodsToGen.ConfigBinder_Bind & interceptor) is 0); 44Debug.Assert((MethodsToGen.ServiceCollectionExt_Any & interceptor) is not 0); 65Debug.Assert((MethodsToGen.ConfigBinder_Bind & overload) is not 0); 91Debug.Assert((MethodsToGen.ConfigBinder_Bind & overload) is 0); 103Debug.Assert((MethodsToGen.ServiceCollectionExt_Any & overload) is not 0); 171Debug.Assert(BinderInvocation.IsBindingOperation(invocation));
RuntimeSource\Configuration.Binder\Specs\Members\MemberSpec.cs (1)
14Debug.Assert(member is IPropertySymbol or IParameterSymbol);
RuntimeSource\Configuration.Binder\Specs\TypeIndex.cs (3)
82Debug.Assert(castType is not CollectionPopulationCastType.NotApplicable); 110Debug.Assert(type.StringParsableTypeKind is not StringParsableTypeKind.AssignFromSectionValue); 125Debug.Assert(displayString.Length > 0);
dotnet-svcutil-lib (1179)
CodeDomFixup\CodeDomVisitors\AttributeFixer.cs (1)
41System.Diagnostics.Debug.Assert(generator != null);
FrameworkFork\Microsoft.CodeDom\Microsoft\CSharpCodeProvider.cs (1)
3269Debug.Assert(names.Length > 0);
FrameworkFork\Microsoft.Xml\Xml\Base64Decoder.cs (7)
128Debug.Assert(buffer != null); 129Debug.Assert(count >= 0); 130Debug.Assert(index >= 0); 131Debug.Assert(buffer.Length - index >= count); 132Debug.Assert((buffer as byte[]) != null); 162Debug.Assert(pCharsEndPos - pChars >= 0); 163Debug.Assert(pBytesEndPos - pBytes >= 0);
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\SqlUtils.cs (10)
143Debug.Assert(rguiData.Length == 4); 168Debug.Assert(rgulU.Length == s_cNumeMax); 338Debug.Assert(dwlAccum < s_ulInt32Base); 407Debug.Assert(dwlAccum < dwlDivisor); 409Debug.Assert((dwlAccum / dwlDivisor) < s_ulInt32Base); 433Debug.Assert(dwlAccum < s_ulInt32Base); 458Debug.Assert(uiDigit < 10); 644Debug.Assert(val >= 0 && val < 100); 650Debug.Assert(val > -10000 && val < 10000); 662Debug.Assert(val >= 0 && val < 1000);
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\XmlBinaryReader.cs (12)
388Debug.Assert(len >= 2 && (data[0] == 0xdf && data[1] == 0xff)); 925Debug.Assert(decl != null); 2036Debug.Assert((_attributes[i].contentPos >= 0) && (_attributes[i].contentPos <= (end))); 2044Debug.Assert(_attrCount == 0); 2062Debug.Assert((_pos + require) >= _end); 2102Debug.Assert(0 != (b & 0x80)); 2335Debug.Assert(pos >= 0 && cch >= 0); 2352Debug.Assert((offset & 1) == 0); 2971Debug.Assert(_mark < 0); 3096Debug.Assert(_pos >= 3); 3101Debug.Assert(_pos >= 1); 3107Debug.Assert(_pos >= 2);
FrameworkFork\Microsoft.Xml\Xml\BinHexDecoder.cs (7)
123Debug.Assert(buffer != null); 124Debug.Assert(count >= 0); 125Debug.Assert(index >= 0); 126Debug.Assert(buffer.Length - index >= count); 127Debug.Assert((buffer as byte[]) != null); 189Debug.Assert(pCharsEndPos - pChars >= 0); 190Debug.Assert(pBytesEndPos - pBytes >= 0);
FrameworkFork\Microsoft.Xml\Xml\BufferBuilder.cs (3)
433Debug.Assert(_lastBuffer == null); 481Debug.Assert(_buffers != null); 532Debug.Assert(newLength <= _length);
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathDocumentBuilder.cs (17)
148Debug.Assert(prefix != null && localName != null && ns != null && localName.Length != 0 && baseUri != null); 209Debug.Assert(_pageParent[_idxParent].NodeType == XPathNodeType.Element); 283Debug.Assert(!prefix.Equals("xmlns")); 284Debug.Assert(_idxParent == 0 || _pageParent[_idxParent].NodeType == XPathNodeType.Element); 285Debug.Assert(_idxSibling == 0 || _pageSibling[_idxSibling].NodeType == XPathNodeType.Attribute); 302Debug.Assert(_pageSibling[_idxSibling].NodeType == XPathNodeType.Attribute); 475Debug.Assert(_pageParent[_idxParent].NodeType == XPathNodeType.Element); 486Debug.Assert(_idxSibling == 0 || _pageSibling[_idxSibling].NodeType == XPathNodeType.Attribute); 487Debug.Assert(!prefix.Equals("xmlns") && !namespaceName.Equals(XmlReservedNs.NsXmlNs)); 488Debug.Assert(_idxParent == 0 || _idxNmsp != 0); 489Debug.Assert(_idxParent == 0 || _pageParent[_idxParent].NodeType == XPathNodeType.Element); 622Debug.Assert(pageElem == null || pageElem[idxElem].NodeType == XPathNodeType.Element); 652Debug.Assert(xptyp != XPathNodeType.Namespace); 723Debug.Assert(xptyp != XPathNodeType.Root && xptyp != XPathNodeType.Namespace); 739Debug.Assert(_idxParent + 1 == idxNew || idxNew == 1); 889Debug.Assert((int)XPathNodeType.Text < (int)XPathNodeType.SignificantWhitespace); 890Debug.Assert((int)XPathNodeType.SignificantWhitespace < (int)XPathNodeType.Whitespace);
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathDocumentNavigator.cs (8)
40Debug.Assert(pageCurrent != null && idxCurrent != 0); 41Debug.Assert((pageParent == null) == (idxParent == 0)); 100Debug.Assert(_pageCurrent[_idxCurrent].NodeType == XPathNodeType.Text); 119Debug.Assert(page[idx].NodeType == XPathNodeType.Element || page[idx].IsText); 453Debug.Assert(_pageParent != null); 494Debug.Assert(page[idx].NodeType == XPathNodeType.Element); 690Debug.Assert(page[idx].HasCollapsedText); 698Debug.Assert(page[idx].IsText);
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathNode.cs (3)
363Debug.Assert(info != null && idxParent <= UInt16.MaxValue); 402Debug.Assert(NodeType == XPathNodeType.Element); 413Debug.Assert(NodeType == XPathNodeType.Element);
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathNodeHelper.cs (9)
30Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element); 79Debug.Assert(pageNode[idxNode].NodeType == XPathNodeType.Attribute); 123Debug.Assert(idx != 0); 183Debug.Assert(idxNode <= UInt16.MaxValue); 184Debug.Assert(pageNode[0].PageInfo.PageNumber <= Int16.MaxValue); 203Debug.Assert(idx != 0); 315Debug.Assert(typ != XPathNodeType.Attribute && typ != XPathNodeType.Namespace); 335Debug.Assert(pageNode[idxNode].NodeType != XPathNodeType.Attribute); 371Debug.Assert(idxAnc != 0 && pageAnc != null);
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathNodeInfoAtom.cs (4)
125Debug.Assert(localName != null && namespaceUri != null && prefix != null && doc != null); 286Debug.Assert(that != null); 287Debug.Assert((object)_doc == (object)that._doc); 288Debug.Assert(_pageInfo == null);
FrameworkFork\Microsoft.Xml\Xml\Core\CharEntityEncoderFallback.cs (2)
165Debug.Assert(_charEntityIndex < _charEntity.Length); 180Debug.Assert(_charEntityIndex <= _charEntity.Length);
FrameworkFork\Microsoft.Xml\Xml\Core\HtmlEncodedRawTextWriter.cs (20)
79Debug.Assert(name != null && name.Length > 0); 126Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 132Debug.Assert(prefix.Length == 0); 171Debug.Assert(prefix.Length == 0); 196Debug.Assert(prefix.Length == 0); 316Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 320Debug.Assert(prefix.Length == 0); 383Debug.Assert(target != null && target.Length != 0 && text != null); 405Debug.Assert(text != null); 440Debug.Assert(buffer != null); 441Debug.Assert(index >= 0); 442Debug.Assert(count >= 0 && index + count <= buffer.Length); 465Debug.Assert((int)ElementProperties.URI_PARENT == (int)AttributeProperties.URI); 466Debug.Assert((int)ElementProperties.BOOL_PARENT == (int)AttributeProperties.BOOLEAN); 467Debug.Assert((int)ElementProperties.NAME_PARENT == (int)AttributeProperties.NAME); 602Debug.Assert(pSrc <= pSrcEnd); 690Debug.Assert(pSrc <= pSrcEnd); 858Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 866Debug.Assert(prefix.Length == 0); 922Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\HtmlUtf8RawTextWriter.cs (20)
78Debug.Assert(name != null && name.Length > 0); 125Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 131Debug.Assert(prefix.Length == 0); 170Debug.Assert(prefix.Length == 0); 195Debug.Assert(prefix.Length == 0); 315Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 319Debug.Assert(prefix.Length == 0); 382Debug.Assert(target != null && target.Length != 0 && text != null); 404Debug.Assert(text != null); 439Debug.Assert(buffer != null); 440Debug.Assert(index >= 0); 441Debug.Assert(count >= 0 && index + count <= buffer.Length); 464Debug.Assert((int)ElementProperties.URI_PARENT == (int)AttributeProperties.URI); 465Debug.Assert((int)ElementProperties.BOOL_PARENT == (int)AttributeProperties.BOOLEAN); 466Debug.Assert((int)ElementProperties.NAME_PARENT == (int)AttributeProperties.NAME); 599Debug.Assert(pSrc <= pSrcEnd); 687Debug.Assert(pSrc <= pSrcEnd); 854Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null); 862Debug.Assert(prefix.Length == 0); 918Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\IncrementalReadDecoders.cs (15)
70Debug.Assert(chars != null); 71Debug.Assert(len >= 0); 72Debug.Assert(startPos >= 0); 73Debug.Assert(chars.Length - startPos >= len); 75Debug.Assert(len > 0); 90Debug.Assert(str != null); 91Debug.Assert(len >= 0); 92Debug.Assert(startPos >= 0); 93Debug.Assert(str.Length - startPos >= len); 95Debug.Assert(len > 0); 114Debug.Assert(buffer != null); 115Debug.Assert(count >= 0); 116Debug.Assert(index >= 0); 117Debug.Assert(buffer.Length - index >= count); 119Debug.Assert((buffer as char[]) != null);
FrameworkFork\Microsoft.Xml\Xml\Core\QueryOutputWriter.cs (2)
137Debug.Assert(!_outputDocType); 350Debug.Assert(!_inCDataSection);
FrameworkFork\Microsoft.Xml\Xml\Core\QueryOutputWriterV1.cs (2)
134Debug.Assert(!_outputDocType); 313Debug.Assert(!_inCDataSection);
FrameworkFork\Microsoft.Xml\Xml\Core\ReadContentAsBinaryHelper.cs (11)
110Debug.Assert(false); 114Debug.Assert(_state == State.InReadContent); 166Debug.Assert(false); 170Debug.Assert(_state == State.InReadContent); 222Debug.Assert(false); 226Debug.Assert(_state == State.InReadElementContent); 278Debug.Assert(false); 282Debug.Assert(_state == State.InReadElementContent); 333Debug.Assert(_reader.NodeType == XmlNodeType.Element); 387Debug.Assert(_decoder != null); 412Debug.Assert(_valueOffset == _valueChunkLength);
FrameworkFork\Microsoft.Xml\Xml\Core\ReadContentAsBinaryHelperAsync.cs (11)
60Debug.Assert(false); 64Debug.Assert(_state == State.InReadContent); 116Debug.Assert(false); 120Debug.Assert(_state == State.InReadContent); 172Debug.Assert(false); 176Debug.Assert(_state == State.InReadElementContent); 228Debug.Assert(false); 232Debug.Assert(_state == State.InReadElementContent); 276Debug.Assert(_reader.NodeType == XmlNodeType.Element); 304Debug.Assert(_decoder != null); 329Debug.Assert(_valueOffset == _valueChunkLength);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlAsyncCheckReader.cs (3)
43Debug.Assert(!(reader is IXmlSchemaInfo)); 50Debug.Assert(!(reader is IXmlSchemaInfo)); 55Debug.Assert(!(reader is IXmlSchemaInfo));
FrameworkFork\Microsoft.Xml\Xml\Core\XmlAutoDetectWriter.cs (6)
35Debug.Assert(writerSettings.OutputMethod == XmlOutputMethod.AutoDetect); 107Debug.Assert(_wrapped != null); 310Debug.Assert(_wrapped != null); 316Debug.Assert(_wrapped != null); 322Debug.Assert(_wrapped != null); 414Debug.Assert(_wrapped == null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlCharCheckingReader.cs (3)
58Debug.Assert(checkCharacters || ignoreWhitespace || ignoreComments || ignorePis || (int)dtdProcessing != -1); 200Debug.Assert(false); 685Debug.Assert(readerAsNSResolver != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlCharCheckingReaderAsync.cs (1)
51Debug.Assert(false);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlCharCheckingWriter.cs (1)
65Debug.Assert(checkValues || replaceNewLines);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlEncodedRawTextWriter.cs (45)
136Debug.Assert(writer != null && settings != null); 154Debug.Assert(stream != null && settings != null); 263Debug.Assert(name != null && name.Length > 0); 304Debug.Assert(localName != null && localName.Length > 0); 305Debug.Assert(prefix != null); 336Debug.Assert(localName != null && localName.Length > 0); 337Debug.Assert(prefix != null); 368Debug.Assert(localName != null && localName.Length > 0); 369Debug.Assert(prefix != null); 388Debug.Assert(localName != null && localName.Length > 0); 389Debug.Assert(prefix != null); 421Debug.Assert(prefix != null && namespaceName != null); 438Debug.Assert(prefix != null); 474Debug.Assert(text != null); 481Debug.Assert(bufPos >= 4); 511Debug.Assert(text != null); 530Debug.Assert(name != null && name.Length > 0); 531Debug.Assert(text != null); 552Debug.Assert(name != null && name.Length > 0); 599Debug.Assert(ws != null); 620Debug.Assert(text != null); 656Debug.Assert(buffer != null); 657Debug.Assert(index >= 0); 658Debug.Assert(count >= 0 && index + count <= buffer.Length); 680Debug.Assert(buffer != null); 681Debug.Assert(index >= 0); 682Debug.Assert(count >= 0 && index + count <= buffer.Length); 698Debug.Assert(data != null); 796Debug.Assert(stream != null || writer != null); 816Debug.Assert(_textContentMarks[0] == 1); 878Debug.Assert(bufPos == 1); 917Debug.Assert(pSrc <= pSrcEnd); 1023Debug.Assert(pSrc <= pSrcEnd); 1106Debug.Assert(s != null); 1136Debug.Assert(pSrc <= pSrcEnd); 1183Debug.Assert(pSrc <= pSrcEnd); 1285Debug.Assert(pSrc <= pSrcEnd); 1418Debug.Assert(pSrc <= pSrcEnd); 1508Debug.Assert(XmlCharType.IsSurrogate(*pSrc)); 1534Debug.Assert(!xmlCharType.IsWhiteSpace((char)ch)); 1535Debug.Assert(!xmlCharType.IsAttributeValueChar((char)ch)); 1566Debug.Assert(inTextContent != value); 1567Debug.Assert(inTextContent || ((_lastMarkPos & 1) == 0)); 1578Debug.Assert(_lastMarkPos + 1 == _textContentMarks.Length); 1845Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlEventCache.cs (2)
128Debug.Assert(idxPage + 1 == _pages.Count); 286Debug.Assert(idxPage + 1 == _pages.Count);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlReader.cs (59)
1066Debug.Assert(parentDepth == 0); 1090Debug.Assert(NodeType == XmlNodeType.EndElement || NodeType == XmlNodeType.None || ReadState == ReadState.Error); 1112Debug.Assert(parentDepth == 0); 1137Debug.Assert(NodeType == XmlNodeType.EndElement); 1260Debug.Assert(xtw is XmlTextWriter); 1442Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.None))); 1443Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Element))); 1444Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Attribute))); 1445Debug.Assert(0 != (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Text))); 1446Debug.Assert(0 != (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.CDATA))); 1447Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.EntityReference))); 1448Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Entity))); 1449Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.ProcessingInstruction))); 1450Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Comment))); 1451Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Document))); 1452Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.DocumentType))); 1453Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.DocumentFragment))); 1454Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Notation))); 1455Debug.Assert(0 != (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.Whitespace))); 1456Debug.Assert(0 != (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.SignificantWhitespace))); 1457Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.EndElement))); 1458Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.EndEntity))); 1459Debug.Assert(0 == (s_isTextualNodeBitmap & (1 << (int)XmlNodeType.XmlDeclaration))); 1469Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.None))); 1470Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Element))); 1471Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Attribute))); 1472Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Text))); 1473Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.CDATA))); 1474Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.EntityReference))); 1475Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Entity))); 1476Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.ProcessingInstruction))); 1477Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Comment))); 1478Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Document))); 1479Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.DocumentType))); 1480Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.DocumentFragment))); 1481Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Notation))); 1482Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.Whitespace))); 1483Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.SignificantWhitespace))); 1484Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.EndElement))); 1485Debug.Assert(0 != (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.EndEntity))); 1486Debug.Assert(0 == (s_canReadContentAsBitmap & (1 << (int)XmlNodeType.XmlDeclaration))); 1496Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.None))); 1497Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.Element))); 1498Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.Attribute))); 1499Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.Text))); 1500Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.CDATA))); 1501Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.EntityReference))); 1502Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.Entity))); 1503Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.ProcessingInstruction))); 1504Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.Comment))); 1505Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.Document))); 1506Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.DocumentType))); 1507Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.DocumentFragment))); 1508Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.Notation))); 1509Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.Whitespace))); 1510Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.SignificantWhitespace))); 1511Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.EndElement))); 1512Debug.Assert(0 == (s_hasValueBitmap & (1 << (int)XmlNodeType.EndEntity))); 1513Debug.Assert(0 != (s_hasValueBitmap & (1 << (int)XmlNodeType.XmlDeclaration)));
FrameworkFork\Microsoft.Xml\Xml\Core\XmlReaderAsync.cs (1)
233Debug.Assert(xtw is XmlTextWriter);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlSubtreeReader.cs (49)
426Debug.Assert(reader.NodeType == XmlNodeType.Element); 451Debug.Assert(_curNode.type == XmlNodeType.Attribute); 473Debug.Assert(reader.Depth >= _initialDepth); 483Debug.Assert(reader.NodeType == XmlNodeType.Element && !reader.IsEmptyElement); 527Debug.Assert(false); 544Debug.Assert(reader.Depth >= _initialDepth); 581Debug.Assert(reader.Depth >= _initialDepth); 595Debug.Assert(reader.NodeType == XmlNodeType.EndElement || 610Debug.Assert(reader.Depth >= _initialDepth); 646Debug.Assert(false); 867Debug.Assert(AttributeCount > 0); 870Debug.Assert(false); 893Debug.Assert(false); 950Debug.Assert(false); 1003Debug.Assert(AttributeCount > 0); 1006Debug.Assert(false); 1029Debug.Assert(false); 1085Debug.Assert(false); 1144Debug.Assert(false); 1319Debug.Assert(_state == State.ClearNsAttributes || _state == State.Interactive || _state == State.PopNamespaceScope); 1347Debug.Assert(index >= 0 && index <= _nsAttrCount); 1380Debug.Assert(_state == State.Interactive); 1387Debug.Assert(_state == State.ReadElementContentAsBase64 || _state == State.ReadElementContentAsBinHex); 1421Debug.Assert(_state == State.ReadContentAsBase64 || _state == State.ReadContentAsBinHex); 1451Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.Initial))); 1452Debug.Assert(0 != (AttributeActiveStates & (1 << (int)State.Interactive))); 1453Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.Error))); 1454Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.EndOfFile))); 1455Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.Closed))); 1456Debug.Assert(0 != (AttributeActiveStates & (1 << (int)State.PopNamespaceScope))); 1457Debug.Assert(0 != (AttributeActiveStates & (1 << (int)State.ClearNsAttributes))); 1458Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.ReadElementContentAsBase64))); 1459Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.ReadElementContentAsBinHex))); 1460Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.ReadContentAsBase64))); 1461Debug.Assert(0 == (AttributeActiveStates & (1 << (int)State.ReadContentAsBinHex))); 1472Debug.Assert(0 == (NamespaceActiveStates & (1 << (int)State.Initial))); 1473Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.Interactive))); 1474Debug.Assert(0 == (NamespaceActiveStates & (1 << (int)State.Error))); 1475Debug.Assert(0 == (NamespaceActiveStates & (1 << (int)State.EndOfFile))); 1476Debug.Assert(0 == (NamespaceActiveStates & (1 << (int)State.Closed))); 1477Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.PopNamespaceScope))); 1478Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.ClearNsAttributes))); 1479Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.ReadElementContentAsBase64))); 1480Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.ReadElementContentAsBinHex))); 1481Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.ReadContentAsBase64))); 1482Debug.Assert(0 != (NamespaceActiveStates & (1 << (int)State.ReadContentAsBinHex))); 1490Debug.Assert(_tmpNode.localName == string.Empty && _tmpNode.prefix == string.Empty && _tmpNode.name == string.Empty && _tmpNode.namespaceUri == string.Empty); 1533Debug.Assert(false); 1541Debug.Assert(_state == State.Interactive ||
FrameworkFork\Microsoft.Xml\Xml\Core\XmlSubtreeReaderAsync.cs (19)
47Debug.Assert(reader.Depth >= _initialDepth); 57Debug.Assert(reader.NodeType == XmlNodeType.Element && !reader.IsEmptyElement); 101Debug.Assert(false); 118Debug.Assert(reader.Depth >= _initialDepth); 132Debug.Assert(reader.NodeType == XmlNodeType.EndElement || 147Debug.Assert(reader.Depth >= _initialDepth); 183Debug.Assert(false); 284Debug.Assert(AttributeCount > 0); 287Debug.Assert(false); 310Debug.Assert(false); 367Debug.Assert(false); 420Debug.Assert(AttributeCount > 0); 423Debug.Assert(false); 446Debug.Assert(false); 502Debug.Assert(false); 553Debug.Assert(false); 584Debug.Assert(_state == State.Interactive); 591Debug.Assert(_state == State.ReadElementContentAsBase64 || _state == State.ReadElementContentAsBinHex); 625Debug.Assert(_state == State.ReadContentAsBase64 || _state == State.ReadContentAsBinHex);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextEncoder.cs (2)
233Debug.Assert((ch < 0x20 && !_xmlCharType.IsWhiteSpace(ch)) || (ch > 0xFFFD)); 392Debug.Assert((ch < 0x20 && !_xmlCharType.IsWhiteSpace(ch)) || (ch > 0xFFFD));
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextReaderImpl.cs (168)
323Debug.Assert(nt != null); 343Debug.Assert(_index == 0); 387Debug.Assert(_nameTableFromSettings == false); 408Debug.Assert(_index == 0); 457Debug.Assert(false); 621Debug.Assert(baseUri == null); 714Debug.Assert(baseUri == null); 822Debug.Assert(xmlFragment != null); 848default: Debug.Assert(false); goto case XmlNodeType.None; 1242Debug.Assert(_nextParsingFunction == ParsingFunction.DocumentContent); 1245Debug.Assert(!_ps.appendMode); 1273Debug.Assert(_parsingFunction == ParsingFunction.ElementContent || 1278Debug.Assert(_curNode.type == XmlNodeType.Element); 1342Debug.Assert(false); 1370Debug.Assert(false); 1402Debug.Assert(_curNode.type == XmlNodeType.EndElement); 1403Debug.Assert(_parsingFunction != ParsingFunction.Eof); 1505Debug.Assert(_parsingMode == ParsingMode.Full); 1524Debug.Assert(false); 1550Debug.Assert(false); 1566Debug.Assert(value is XmlTextReader); 1585Debug.Assert(_outerReader is XmlTextReaderImpl); 2228Debug.Assert(_stringBuilder.Length == 0); 2269Debug.Assert(_outerReader is XmlTextReader); 2311Debug.Assert(_outerReader is XmlTextReader); 2348Debug.Assert(_outerReader is XmlTextReader); 2479Debug.Assert(value >= 0 && value <= _ps.charsUsed); 2566Debug.Assert(_parsingMode == ParsingMode.Full); 2655Debug.Assert(_parsingStatesStackTop == -1); 2656Debug.Assert((systemId != null && systemId.Length > 0) || (publicId != null && publicId.Length > 0)); 2671Debug.Assert(_ps.appendMode); 2687Debug.Assert(_parsingStatesStackTop == -1); 2688Debug.Assert(internalDtd != null); 2845Debug.Assert(InAttributeValueIterator); 2881Debug.Assert(baseUriStr != null); 2887Debug.Assert(baseUri != null); 2898Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.textReader == null); 2899Debug.Assert(baseUriStr != null); 2900Debug.Assert(baseUri == null || (baseUri.ToString().Equals(baseUriStr))); 2991Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0 && _ps.stream == null); 2992Debug.Assert(baseUriStr != null); 3022Debug.Assert(_ps.stream == null && _ps.textReader == null); 3023Debug.Assert(_ps.charPos == 0 && _ps.charsUsed == 0); 3024Debug.Assert(baseUriStr != null); 3025Debug.Assert(str != null); 3080Debug.Assert(_parsingFunction == ParsingFunction.SwitchToInteractiveXmlDecl); 3084Debug.Assert(_parsingFunction == ParsingFunction.SwitchToInteractiveXmlDecl); 3085Debug.Assert(_nextParsingFunction == ParsingFunction.DocumentContent); 3109Debug.Assert(context != null && context.HasDtdInfo); 3133Debug.Assert(_url != null && _url.Length > 0); 3140Debug.Assert(_xmlResolver != null || !Microsoft.Xml.XmlReaderSettings.EnableLegacyXmlSettings()); 3166Debug.Assert(_ps.bytes != null); 3167Debug.Assert(_ps.bytePos == 0); 3251Debug.Assert(_ps.charPos == 0); 3279Debug.Assert(_ps.stream != null); 3337Debug.Assert(newEncoding.EncodingName != "UTF-8"); 3351Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null); 3533Debug.Assert(_ps.charsUsed < _ps.chars.Length); 3543Debug.Assert(_ps.stream != null && _ps.decoder != null && _ps.bytes != null); 3544Debug.Assert(maxCharsCount <= _ps.chars.Length - _ps.charsUsed - 1); 3568Debug.Assert(maxCharsCount >= charsCount); 3660Debug.Assert(_stringBuilder.Length == 0 || isTextDecl); 3881Debug.Assert(!isTextDecl); 3891Debug.Assert(false); 4147Debug.Assert(pos == _ps.charsUsed && !_ps.isEof); 4171Debug.Assert(_index == 0); 4545Debug.Assert(_curNode.type == XmlNodeType.Element); 4733Debug.Assert(_index > 0); 4738Debug.Assert(_curNode == startTagNode); 4765Debug.Assert(startTag.type == XmlNodeType.EntityReference); 4777Debug.Assert(_attrCount == 0); 4837Debug.Assert(_curNode.type == XmlNodeType.Element); 4845Debug.Assert(_curNode.type == XmlNodeType.Element); 4966Debug.Assert(attrNameLineNo == _ps.LineNo); 5090Debug.Assert(_curNode.type == XmlNodeType.Element); 5227Debug.Assert(_stringBuilder.Length == 0); 5441Debug.Assert(_ps.isEof); 5459Debug.Assert(false); 5499Debug.Assert(attr.nextAttrValueChunk == null); 5528Debug.Assert(_stringBuilder.Length == 0); 5542Debug.Assert(endPos - startPos > 0); 5565Debug.Assert(_stringBuilder.Length > 0); 5586Debug.Assert(endPos - startPos > 0); 5853Debug.Assert(_ps.isEof); 5895Debug.Assert(_stringBuilder.Length == 0); 5896Debug.Assert(_parsingFunction == ParsingFunction.PartialTextValue || 5910Debug.Assert(_stringBuilder.Length > 0); 5964Debug.Assert(_parsingFunction == ParsingFunction.PartialTextValue || _parsingFunction == ParsingFunction.InReadValueChunk || 5976Debug.Assert(_parsingFunction == ParsingFunction.InReadValueChunk); 5981Debug.Assert((_index > 0) ? _nextParsingFunction == ParsingFunction.ElementContent : _nextParsingFunction == ParsingFunction.DocumentContent); 5993Debug.Assert(_parsingFunction == ParsingFunction.InReadContentAsBinary || _parsingFunction == ParsingFunction.InReadElementContentAsBinary); 5998Debug.Assert((_index > 0) ? _nextParsingFunction == ParsingFunction.ElementContent : _nextParsingFunction == ParsingFunction.DocumentContent); 6026Debug.Assert(_stringBuilder.Length == 0); 6067Debug.Assert(_ps.chars[_ps.charPos] == '&'); 6076Debug.Assert(_ps.chars[_ps.charPos] == '&'); 6091Debug.Assert(entityType == EntityType.CharacterDec || entityType == EntityType.CharacterHex); 6243Debug.Assert(false); 6284Debug.Assert(_lastEntity != null); 6290Debug.Assert(_curNode.depth == _index); 6303Debug.Assert(_curNode.type == XmlNodeType.EntityReference); 6304Debug.Assert(Ref.Equal(_lastEntity.Name, _curNode.localName)); 6323Debug.Assert(_stringBuilder.Length == 0); 6349Debug.Assert(_ps.charPos < _ps.charsUsed); 6393Debug.Assert(_stringBuilder.Length == 0); 6451Debug.Assert(!_ps.eolNormalized); 6598Debug.Assert(_stringBuilder.Length == 0); 6659Debug.Assert(!_ps.eolNormalized); 6838Debug.Assert(_dtdProcessing == DtdProcessing.Ignore); 7169Debug.Assert(_ps.isEof); 7275Debug.Assert(_ps.isEof); 7284Debug.Assert(_ps.chars[startPos] == '&'); 7316Debug.Assert(_ps.chars[_ps.charPos] == '&'); 7336Debug.Assert(_ps.chars[startPos] == '&' && _ps.chars[startPos + 1] == '#'); 7449Debug.Assert(pos > 0); 7485Debug.Assert(_ps.chars[_ps.charPos] == '&'); 7505Debug.Assert(startPos < _ps.charsUsed); 7506Debug.Assert(_ps.chars[startPos] == '&'); 7507Debug.Assert(_ps.chars[startPos + 1] != '#'); 7615Debug.Assert(pos > 0); 7771Debug.Assert(nodeIndex < _nodes.Length); 7772Debug.Assert(_nodes[_nodes.Length - 1] == null); 7785Debug.Assert(nodeIndex < _nodes.Length); 7792Debug.Assert(nodeIndex < _nodes.Length); 7865Debug.Assert(attr.type == XmlNodeType.Attribute); 7899Debug.Assert(_ps.isEof); 7960Debug.Assert(_xmlContext.defaultNamespace == uri); 7996Debug.Assert(_curNode.xmlContextPushed); 8093Debug.Assert(_xmlResolver != null); 8131Debug.Assert(entity.IsExternal); 8144Debug.Assert(_ps.appendMode); 8173Debug.Assert(!entity.IsExternal); 8243Debug.Assert(_parsingStatesStackTop == -1); 8259Debug.Assert(_parsingStatesStackTop >= 0); 8360Debug.Assert(XmlConvert.StrEqual(_ps.chars, _ps.charPos - 2, 2, "?>")); 8368Debug.Assert(XmlConvert.StrEqual(_ps.chars, _ps.charPos - 3, 3, "-->")); 8376Debug.Assert(XmlConvert.StrEqual(_ps.chars, _ps.charPos - 3, 3, "]]>")); 8400Debug.Assert(false); 8403Debug.Assert(_incReadState == IncrementalReadState.Text || 8515Debug.Assert(_ps.charPos - pos == 0); 8516Debug.Assert(_ps.charPos - startPos == 0); 8555Debug.Assert(_ps.charPos - pos == 0); 8556Debug.Assert(_ps.charPos - startPos == 0); 8676Debug.Assert(_fragmentType == XmlNodeType.Attribute); 8693Debug.Assert(_parsingFunction == ParsingFunction.InReadAttributeValue); 8720Debug.Assert(_stringBuilder.Length == 0); 8931Debug.Assert(_ps.charPos < _ps.charsUsed); 9000Debug.Assert(_dtdInfo == null && _fragmentParserContext != null && _fragmentParserContext.HasDtdInfo); 9016Debug.Assert(_parsingFunction != ParsingFunction.InReadContentAsBinary); 9042Debug.Assert(_parsingFunction != ParsingFunction.InReadElementContentAsBinary); 9043Debug.Assert(_curNode.type == XmlNodeType.Element); 9121Debug.Assert(context != null); 9142Debug.Assert(nt != null); 9159Debug.Assert(_nameTableFromSettings == false); 9187Debug.Assert(_dtdInfo == null); 9348Debug.Assert(attr != null); 9373Debug.Assert(prefix != null); 9394Debug.Assert(attr != null); 9426Debug.Assert(_nodes[_index].type == XmlNodeType.Element); 9444Debug.Assert(_nodes[_index].type == XmlNodeType.Element); 9478Debug.Assert(_incReadDecoder != null); 9587Debug.Assert(_parsingFunction != ParsingFunction.InReadElementContentAsBinary); 9646Debug.Assert(characters >= 0); 9688Debug.Assert(startPos >= 0); 9689Debug.Assert(endPos < chars.Length); 9690Debug.Assert(startPos <= endPos); 9700Debug.Assert(startPos >= 0); 9701Debug.Assert(endPos < str.Length); 9702Debug.Assert(startPos <= endPos);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextReaderImplHelpers.cs (17)
293Debug.Assert(internalDtd != null); 435Debug.Assert(type == XmlNodeType.Element); 448Debug.Assert(type == XmlNodeType.Attribute); 518Debug.Assert(value != null); 544Debug.Assert(localName != null); 545Debug.Assert(localName.Length > 0); 574Debug.Assert(_valueStartPos != -1); 575Debug.Assert(_chars != null); 585Debug.Assert(_valueStartPos != -1); 586Debug.Assert(_chars != null); 606Debug.Assert(_valueStartPos != -1); 607Debug.Assert(_chars != null); 632Debug.Assert(_valueStartPos != -1); 633Debug.Assert(_chars != null); 673Debug.Assert(nameWPrefix == null); 730Debug.Assert(x == null || x is NodeData || x is IDtdDefaultAttributeInfo); 731Debug.Assert(y == null || y is NodeData || y is IDtdDefaultAttributeInfo);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextWriter.cs (3)
973Debug.Assert(false); 1509Debug.Assert(_useNsHashtable); 1512Debug.Assert(_nsHashtable.ContainsKey(_nsStack[i].prefix));
FrameworkFork\Microsoft.Xml\Xml\Core\XmlUtf8RawTextWriter.cs (40)
120Debug.Assert(stream != null && settings != null); 215Debug.Assert(name != null && name.Length > 0); 254Debug.Assert(localName != null && localName.Length > 0); 255Debug.Assert(prefix != null); 284Debug.Assert(localName != null && localName.Length > 0); 285Debug.Assert(prefix != null); 314Debug.Assert(localName != null && localName.Length > 0); 315Debug.Assert(prefix != null); 332Debug.Assert(localName != null && localName.Length > 0); 333Debug.Assert(prefix != null); 362Debug.Assert(prefix != null && namespaceName != null); 379Debug.Assert(prefix != null); 411Debug.Assert(text != null); 416Debug.Assert(bufPos >= 4); 446Debug.Assert(text != null); 463Debug.Assert(name != null && name.Length > 0); 464Debug.Assert(text != null); 483Debug.Assert(name != null && name.Length > 0); 526Debug.Assert(ws != null); 546Debug.Assert(text != null); 580Debug.Assert(buffer != null); 581Debug.Assert(index >= 0); 582Debug.Assert(count >= 0 && index + count <= buffer.Length); 602Debug.Assert(buffer != null); 603Debug.Assert(index >= 0); 604Debug.Assert(count >= 0 && index + count <= buffer.Length); 618Debug.Assert(data != null); 688Debug.Assert(stream != null); 752Debug.Assert(pSrc <= pSrcEnd); 858Debug.Assert(pSrc <= pSrcEnd); 941Debug.Assert(s != null); 971Debug.Assert(pSrc <= pSrcEnd); 1018Debug.Assert(pSrc <= pSrcEnd); 1120Debug.Assert(pSrc <= pSrcEnd); 1253Debug.Assert(pSrc <= pSrcEnd); 1350Debug.Assert(XmlCharType.IsSurrogate(*pSrc)); 1382Debug.Assert(!xmlCharType.IsWhiteSpace((char)ch)); 1383Debug.Assert(!xmlCharType.IsAttributeValueChar((char)ch)); 1421Debug.Assert(ch >= 0x80 && !XmlCharType.IsSurrogate(ch)); 1720Debug.Assert(localName != null && localName.Length != 0 && prefix != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlValidatingReaderImpl.cs (5)
581Debug.Assert(false); 747Debug.Assert(value is XmlValidatingReader); 1010Debug.Assert(_parserContext != null); 1011Debug.Assert(_coreReaderImpl.DtdInfo == null); 1049Debug.Assert(_coreReader.NodeType == XmlNodeType.EntityReference);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWellformedWriter.cs (14)
254Debug.Assert(writer != null); 255Debug.Assert(settings != null); 256Debug.Assert(MaxNamespacesWalkCount <= 3); 484Debug.Assert(prefix.Length == 0); 1346Debug.Assert(i >= 0); 1357Debug.Assert(i >= 0); 1681Debug.Assert(_stateTable == s_stateTableAuto); 1725Debug.Assert(prefix == "xmlns"); 1913Debug.Assert(_useNsHashtable); 1914Debug.Assert(indexFrom <= indexTo); 1917Debug.Assert(_nsHashtable.ContainsKey(_nsStack[i].prefix)); 2144Debug.Assert(ncname != null && ncname.Length > 0); 2249Debug.Assert(_attrHashTable.Count == 0); 2291Debug.Assert(prev >= 0 && _attrStack[prev].localName == localName);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWellformedWriterHelpers.cs (3)
100Debug.Assert(kind == NamespaceKind.NeedToWrite); 499Debug.Assert(_singleStringValue != null); 500Debug.Assert(_lastItem == -1);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWrappingReader.cs (1)
30Debug.Assert(baseReader != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWrappingWriter.cs (1)
61Debug.Assert(baseWriter != null);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWriter.cs (1)
539Debug.Assert(false);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlWriterSettings.cs (2)
330Debug.Assert(_cdataSections != null); 502Debug.Assert(Encoding.UTF8.WebName == "utf-8");
FrameworkFork\Microsoft.Xml\Xml\Core\XsdCachingReader.cs (8)
495Debug.Assert(_coreReader.NodeType == XmlNodeType.EndElement || (_coreReader.NodeType == XmlNodeType.Element && _coreReader.IsEmptyElement)); 500Debug.Assert(endElementNode.NodeType == XmlNodeType.EndElement); 508Debug.Assert(_coreReader.NodeType == XmlNodeType.EndElement || (_coreReader.NodeType == XmlNodeType.Element && _coreReader.IsEmptyElement)); 573Debug.Assert(_cacheState == CachingReaderState.Replay); 603Debug.Assert(_cacheState == CachingReaderState.Replay); 664Debug.Assert(attIndex <= _attributeEvents.Length); 688Debug.Assert(_contentIndex <= _contentEvents.Length); 714Debug.Assert(_coreReader.NodeType == XmlNodeType.Element);
FrameworkFork\Microsoft.Xml\Xml\Core\XsdCachingReaderAsync.cs (1)
133Debug.Assert(_cacheState == CachingReaderState.Replay);
FrameworkFork\Microsoft.Xml\Xml\Core\XsdValidatingReader.cs (17)
1148Debug.Assert(attNode != null); 1199Debug.Assert(_attributePSVI != null); 1304Debug.Assert(moveTo); 1896Debug.Assert(_attributePSVI != null); 2035Debug.Assert(_atomicValue != null); 2123Debug.Assert(_coreReaderNameTable.Get(localName) != null); 2124Debug.Assert(_coreReaderNameTable.Get(ns) != null); 2165Debug.Assert(_coreReaderNameTable.Get(attrLocalName) != null); 2166Debug.Assert(_coreReaderNameTable.Get(ns) != null); 2186Debug.Assert(attIndex <= _attributePSVINodes.Length); 2215Debug.Assert(_inlineSchemaParser != null); 2323Debug.Assert(this.NodeType == XmlNodeType.Element); 2450Debug.Assert(_coreReader.NodeType == XmlNodeType.EndElement); 2461Debug.Assert(false); //Should not happen as the caching reader does not cache elements in simple content 2514Debug.Assert(false); //Should not happen as the caching reader does not cache elements in simple content 2572Debug.Assert(xmlType != null && xmlType.Datatype != null); 2586Debug.Assert(NodeType != XmlNodeType.Attribute);
FrameworkFork\Microsoft.Xml\Xml\Core\XsdValidatingReaderAsync.cs (3)
611Debug.Assert(_atomicValue != null); 627Debug.Assert(_inlineSchemaParser != null); 750Debug.Assert(this.NodeType == XmlNodeType.Element);
FrameworkFork\Microsoft.Xml\Xml\Dom\DocumentSchemaValidator.cs (16)
73Debug.Assert(schemas != null && schemas.Count > 0); 95Debug.Assert(nodeToValidate.SchemaInfo != null); 121Debug.Assert(schemaElement.ElementSchemaType == schemaInfo.SchemaType); 346Debug.Assert(elementNode != null); 360Debug.Assert(_nameTable.Get(attr.NamespaceURI) != null); 361Debug.Assert(_nameTable.Get(attr.LocalName) != null); 444Debug.Assert(schemaAttribute != null); 461Debug.Assert(_attributeSchemaInfo != null); 473Debug.Assert(simpleValue != null); 510Debug.Assert(elementToValidate.ParentNode.NodeType != XmlNodeType.Document); //Handle if it is the documentElement seperately 635Debug.Assert(_nodeSequenceToValidate[0] == elementToValidate.ParentNode); 702Debug.Assert(elementNode != null); 716Debug.Assert(_nameTable.Get(attr.NamespaceURI) != null); 717Debug.Assert(_nameTable.Get(attr.LocalName) != null); 783Debug.Assert(child == childToStopAt); 816Debug.Assert(ex != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\DocumentXmlWriter.cs (3)
427Debug.Assert(elem != null); 432Debug.Assert(attr != null); 443Debug.Assert(attr != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\DocumentXPathNavigator.cs (30)
530Debug.Assert(false); 538Debug.Assert(attributes != null); 558Debug.Assert(attributes != null && attributes.parent != null); 590Debug.Assert(_namespaceParent != null); 644Debug.Assert(false); 652Debug.Assert(attributes != null); 653Debug.Assert(0 <= index && index < attributes.Count); 673Debug.Assert(attributes != null && attributes.parent != null); 735Debug.Assert(parent != null); 771Debug.Assert(parent != null); 799Debug.Assert(sibling != null); 1324Debug.Assert(node1 != null); 1325Debug.Assert(node2 != null); 1328Debug.Assert(OwnerNode(node1) == OwnerNode(node2)); 1410Debug.Assert(node1 != node2); 1451Debug.Assert(node1 != node2); 1471Debug.Assert(this.NodeType != XPathNodeType.Attribute && this.NodeType != XPathNodeType.Namespace && this.NodeType != XPathNodeType.All); 2281Debug.Assert(((XmlNode)nav.UnderlyingObject).NodeType != XmlNodeType.Attribute); 2294Debug.Assert(node != null); 2335Debug.Assert(((XmlNode)nav.UnderlyingObject).NodeType != XmlNodeType.Attribute); 2336Debug.Assert(Ref.Equal(nav.NameTable.Get(nsAtom), nsAtom)); 2350Debug.Assert(node != null); 2351Debug.Assert(node.NodeType == XmlNodeType.Element); 2393Debug.Assert(((XmlNode)nav.UnderlyingObject).NodeType != XmlNodeType.Attribute); 2394Debug.Assert(Ref.Equal(nav.NameTable.Get(localNameAtom), localNameAtom)); 2395Debug.Assert(Ref.Equal(nav.NameTable.Get(nsAtom), nsAtom)); 2396Debug.Assert(localNameAtom.Length > 0); // Use DocumentXPathNodeIterator_ElemChildren_NoLocalName class for special magic value of localNameAtom 2415Debug.Assert(node != null); 2416Debug.Assert(node.NodeType == XmlNodeType.Element); 2426Debug.Assert(localNameAtom.Length > 0); // Use DocumentXPathNodeIterator_ElemChildren_AndSelf_NoLocalName if localName == String.Empty
FrameworkFork\Microsoft.Xml\Xml\Dom\DomNameTable.cs (1)
30Debug.Assert((_entries.Length & _mask) == 0); // entries.Length must be a power of two
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlAttribute.cs (3)
21Debug.Assert(name != null); 22Debug.Assert(doc != null); 54Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlAttributeCollection.cs (10)
191Debug.Assert(offset != -1); // the if statement above guarantees that the ref node is in the collection 220Debug.Assert(offset != -1); // the if statement above guarantees that the ref node is in the collection 297Debug.Assert(retNode is XmlAttribute); 313Debug.Assert(retNode is XmlAttribute); 377Debug.Assert(parentElem != null); 379Debug.Assert(doc != null); 393Debug.Assert(parentElem != null); 395Debug.Assert(doc != null); 408Debug.Assert(-1 == FindNodeOffset(node)); 411Debug.Assert(retNode is XmlAttribute);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlCDATASection.cs (1)
74Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlCharacterData.cs (1)
202Debug.Assert(XmlDocument.IsTextNode(node.NodeType) || (node.ParentNode != null && node.ParentNode.NodeType == XmlNodeType.EntityReference));
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlComment.cs (1)
40Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlDeclaration.cs (1)
152Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlDocument.cs (12)
141Debug.Assert((prefix == null) ? (n.Prefix.Length == 0) : (prefix == n.Prefix)); 142Debug.Assert(n.LocalName == localName); 143Debug.Assert((namespaceURI == null) ? (n.NamespaceURI.Length == 0) : (n.NamespaceURI == namespaceURI)); 150Debug.Assert(n == null || ((prefix == null) ? (n.Prefix.Length == 0) : (prefix == n.Prefix))); 151Debug.Assert(n == null || n.LocalName == localName); 152Debug.Assert(n == null || ((namespaceURI == null) ? (n.NamespaceURI.Length == 0) : (n.NamespaceURI == namespaceURI))); 159Debug.Assert((prefix == null) ? (xmlName.Prefix.Length == 0) : (prefix == xmlName.Prefix)); 160Debug.Assert(xmlName.LocalName == localName); 161Debug.Assert((namespaceURI == null) ? (xmlName.NamespaceURI.Length == 0) : (xmlName.NamespaceURI == namespaceURI)); 912Debug.Assert(((XmlAttribute)node).Specified); 977Debug.Assert(toNode.NodeType != XmlNodeType.EntityReference); 1723Debug.Assert(doc == this);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlDocumentFragment.cs (3)
113Debug.Assert(OwnerDocument != null); 159Debug.Assert(newChild != null); //should be checked that newChild is not null before this function call 175Debug.Assert(newChild != null); //should be checked that newChild is not null before this function call
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlDocumentType.cs (2)
34Debug.Assert(doc != null); 65Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlElement.cs (5)
25Debug.Assert(name != null); 55Debug.Assert(OwnerDocument != null); 478Debug.Assert(n != null); 491Debug.Assert(n != null); 497Debug.Assert(n != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlElementList.cs (11)
31Debug.Assert(parent != null); 32Debug.Assert(parent.NodeType == XmlNodeType.Element || parent.NodeType == XmlNodeType.Document); 34Debug.Assert(parent.Document != null); 72Debug.Assert(parent.Document != null); 74Debug.Assert(nt != null); 83Debug.Assert(parent.Document != null); 85Debug.Assert(nt != null); 107Debug.Assert(curNode != null); 134Debug.Assert(curNode != null); 179Debug.Assert(n != null); 193Debug.Assert(n != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlEntityReference.cs (1)
87Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlLoader.cs (18)
61Debug.Assert(_reader != null); 62Debug.Assert(parentDoc != null); 154Debug.Assert(parent.NodeType == XmlNodeType.Element); 176Debug.Assert(parent == null); 231Debug.Assert(node != null); 256Debug.Assert(_reader.NodeType == XmlNodeType.Attribute); 295Debug.Assert(node != null); 304Debug.Assert(_reader.IsDefault); 354Debug.Assert(node != null); 362Debug.Assert(_reader.NodeType == XmlNodeType.EntityReference); 385Debug.Assert(_reader.NodeType == XmlNodeType.XmlDeclaration); 408Debug.Assert(false); 423Debug.Assert(_reader.NodeType == XmlNodeType.DocumentType); 498Debug.Assert(parent.NodeType == XmlNodeType.Element); 552Debug.Assert(node != null); 756Debug.Assert(parentNode.NodeType != XmlNodeType.Document); 758Debug.Assert(_doc != null); 948Debug.Assert(tr.EntityHandling == EntityHandling.ExpandCharEntities);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlName.cs (2)
92Debug.Assert(_prefix != null); 115Debug.Assert(Ref.Equal(_name, ownerDoc.NameTable.Get(_name)));
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlNode.cs (8)
42Debug.Assert(doc != null); 115Debug.Assert(parentNode != null); 172Debug.Assert(parentNode != null); 777Debug.Assert(firstNode.NodeType == XmlNodeType.Text 1407Debug.Assert(prevNode.IsText); 1408Debug.Assert(nextNode.IsText); 1415Debug.Assert(prevNode.IsText); 1416Debug.Assert(nextNode.IsText);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlNodeReader.cs (11)
110Debug.Assert(nt == XmlNodeType.XmlDeclaration || nt == XmlNodeType.DocumentType); 131Debug.Assert(_curNode.NodeType == XmlNodeType.XmlDeclaration || _curNode.NodeType == XmlNodeType.DocumentType); 136Debug.Assert(_nAttrInd >= 0 && _nAttrInd < AttributeCount); 232Debug.Assert(_curNode.NodeType == XmlNodeType.XmlDeclaration || _curNode.NodeType == XmlNodeType.DocumentType); 233Debug.Assert(_nAttrInd >= 0 && _nAttrInd < AttributeCount); 252Debug.Assert(nt == XmlNodeType.XmlDeclaration || nt == XmlNodeType.DocumentType); 253Debug.Assert(_nAttrInd >= 0 && _nAttrInd < AttributeCount); 618Debug.Assert(IsOnDeclOrDocType); 1061Debug.Assert(_curNode.NodeType == XmlNodeType.XmlDeclaration || _curNode.NodeType == XmlNodeType.DocumentType); 1091Debug.Assert(_curNode != null); 1639Debug.Assert(_curDepth == 0);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlProcessingInstruction.cs (1)
90Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlSignificantWhitespace.cs (1)
75Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlText.cs (1)
77Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlWhitespace.cs (1)
91Debug.Assert(OwnerDocument != null);
FrameworkFork\Microsoft.Xml\Xml\Resolvers\XmlPreloadedResolver.cs (2)
214Debug.Assert(s_rss091_Dtd.Length == 1); 361Debug.Assert(uri != null);
FrameworkFork\Microsoft.Xml\Xml\schema\BaseProcessor.cs (2)
29Debug.Assert(nameTable != null); 160Debug.Assert(item is XmlSchemaElement);
FrameworkFork\Microsoft.Xml\Xml\schema\basevalidator.cs (2)
49Debug.Assert(schemaCollection == null || schemaCollection.NameTable == reader.NameTable); 185Debug.Assert(names.Count > 0);
FrameworkFork\Microsoft.Xml\Xml\schema\BitSet.cs (1)
82Debug.Assert(startFrom >= -1 && startFrom <= _count);
FrameworkFork\Microsoft.Xml\Xml\schema\ChameleonKey.cs (1)
70Debug.Assert((chameleonLocation.OriginalString.Length == 0 && originalSchema != null)
FrameworkFork\Microsoft.Xml\Xml\schema\CompiledIdentityConstraint.cs (1)
66Debug.Assert(fields.Count > 0);
FrameworkFork\Microsoft.Xml\Xml\schema\ConstraintStruct.cs (3)
214Debug.Assert(_dstruct != null); 222Debug.Assert(_dstruct != null); 399Debug.Assert(dim > 0);
FrameworkFork\Microsoft.Xml\Xml\schema\ContentValidator.cs (15)
97Debug.Assert(_particles.Count == _last + 1); 137Debug.Assert(_particles.Count == _last + 1); 990Debug.Assert(parent is SequenceNode); 991Debug.Assert(this == parent.RightChild); 1318Debug.Assert(ContentType == XmlSchemaContentType.ElementOnly || ContentType == XmlSchemaContentType.Mixed); 1330Debug.Assert(!IsOpen); 1432Debug.Assert(lrNode != null); 1450Debug.Assert(lrNode1 != null); 1566Debug.Assert(state == (int)stateTable[statePosSet]); // just make sure that statePosSet is for correct state 1957Debug.Assert(_minMaxNodesCount != 0); 2067Debug.Assert(_minMaxNodesCount > 0); 2092Debug.Assert(lrNode != null); 2184Debug.Assert(runningPositions[i].curpos != null); 2229Debug.Assert(runningPositions[i].curpos != null); 2288Debug.Assert(_elements.Count > 0);
FrameworkFork\Microsoft.Xml\Xml\schema\DatatypeImplementation.cs (7)
178Debug.Assert(qname != null && dataType != null); 194Debug.Assert(derivedType != null && baseType != null); 367Debug.Assert(currentType != null); 987Debug.Assert(arr1 != null && arr2 != null); 997Debug.Assert(atomicValues2 != null); 1065Debug.Assert(valuesToCheck != null); 1162Debug.Assert(array.GetType() == ListValueType);
FrameworkFork\Microsoft.Xml\Xml\schema\DtdParser.cs (36)
217Debug.Assert((int)Token.CDATA == (int)XmlTokenizedType.CDATA && (int)XmlTokenizedType.CDATA == 0); 218Debug.Assert((int)Token.ID == (int)XmlTokenizedType.ID && (int)XmlTokenizedType.ID == 1); 219Debug.Assert((int)Token.IDREF == (int)XmlTokenizedType.IDREF && (int)XmlTokenizedType.IDREF == 2); 220Debug.Assert((int)Token.IDREFS == (int)XmlTokenizedType.IDREFS && (int)XmlTokenizedType.IDREFS == 3); 221Debug.Assert((int)Token.ENTITY == (int)XmlTokenizedType.ENTITY && (int)XmlTokenizedType.ENTITY == 4); 222Debug.Assert((int)Token.ENTITIES == (int)XmlTokenizedType.ENTITIES && (int)XmlTokenizedType.ENTITIES == 5); 223Debug.Assert((int)Token.NMTOKEN == (int)XmlTokenizedType.NMTOKEN && (int)XmlTokenizedType.NMTOKEN == 6); 224Debug.Assert((int)Token.NMTOKENS == (int)XmlTokenizedType.NMTOKENS && (int)XmlTokenizedType.NMTOKENS == 7); 225Debug.Assert((int)Token.NOTATION == (int)XmlTokenizedType.NOTATION && (int)XmlTokenizedType.NOTATION == 8); 244Debug.Assert(readerAdapter != null); 504Debug.Assert(ParsingInternalSubset); 510Debug.Assert(_externalEntitiesDepth == 0); 531Debug.Assert(_readerAdapter.EntityStackLength == 0 || 601Debug.Assert(_curPos > 0 && _chars[_curPos - 1] == ']'); 613Debug.Assert(_readerAdapter.EntityStackLength == 0 || 633Debug.Assert(false); 637Debug.Assert(_scanningFunction == ScanningFunction.SubsetContent); 1518Debug.Assert(idTokenType == Token.PUBLIC); 1680Debug.Assert(false); 2418Debug.Assert(_chars[_curPos] == '"' || _chars[_curPos] == '\''); 2637Debug.Assert(_curPos - _tokenStartPos == 0); 3183Debug.Assert(_chars[_curPos] == 'P'); 3203Debug.Assert(_chars[_curPos] == 'S'); 3226Debug.Assert(_curPos - _tokenStartPos > 0); 3248Debug.Assert(_curPos - _tokenStartPos > 0); 3271Debug.Assert(_curPos == 0 || _chars[_curPos - 1] == '"' || _chars[_curPos - 1] == '\''); 3304Debug.Assert(_internalSubsetValueSb != null); 3320Debug.Assert(_chars[_curPos] == '&' || _chars[_curPos] == '%'); 3328Debug.Assert(_chars[_curPos - 1] == ';'); 3393Debug.Assert(!ParsingInternalSubset || _freeFloatingDtd); 3394Debug.Assert(_currentEntityId == 0); 3418Debug.Assert(_chars[_curPos - 1] == ';'); 3474Debug.Assert(_validate); 3480Debug.Assert(_validate); 3486Debug.Assert(_validate); 3613Debug.Assert(startPos < _charsUsed);
FrameworkFork\Microsoft.Xml\Xml\schema\dtdvalidator.cs (2)
43Debug.Assert(reader != null); 146Debug.Assert(reader.NodeType == XmlNodeType.Element);
FrameworkFork\Microsoft.Xml\Xml\schema\FacetChecker.cs (2)
463Debug.Assert(false); 1648Debug.Assert(values != null);
FrameworkFork\Microsoft.Xml\Xml\schema\Inference\infer.cs (6)
301Debug.Assert(compiledAttributes != null); //AttributeUses is never null 1022Debug.Assert(elem.ElementDecl == null); 1225Debug.Assert(_xtr.NodeType == XmlNodeType.Attribute); 1265Debug.Assert(ct != null); 1276Debug.Assert(ct != null); //either the user-defined type itself is a complex type or we switched from a simple type to a complex type 1280Debug.Assert(sce != null);
FrameworkFork\Microsoft.Xml\Xml\schema\NamespaceList.cs (7)
34Debug.Assert(targetNamespace != null); 74Debug.Assert(_set != null); 117Debug.Assert(false); 162Debug.Assert(false); 184Debug.Assert(super._type == ListType.Set); 202Debug.Assert(o1 != o2); 320Debug.Assert(o1 != o2); //clause 1
FrameworkFork\Microsoft.Xml\Xml\schema\Parser.cs (8)
94Debug.Assert(_schemaType == SchemaType.XDR); 142Debug.Assert(false); 246Debug.Assert(_parentNode != null); 327Debug.Assert(currentNode != null); 328Debug.Assert(_parentNode != null); 336Debug.Assert(_reader.NodeType == XmlNodeType.Element); 421Debug.Assert(_reader.NodeType == XmlNodeType.Attribute); 447Debug.Assert(_reader.NodeType == XmlNodeType.EntityReference);
FrameworkFork\Microsoft.Xml\Xml\schema\ParserAsync.cs (1)
59Debug.Assert(_schemaType == SchemaType.XDR);
FrameworkFork\Microsoft.Xml\Xml\schema\Preprocessor.cs (4)
324Debug.Assert(import != null); 730Debug.Assert(false); 856Debug.Assert(_currentSchema != null); 1013Debug.Assert((currentSchemaObject as XmlSchema) == null); //The current object should not be schema
FrameworkFork\Microsoft.Xml\Xml\schema\SchemaCollectionCompiler.cs (9)
53Debug.Assert(!members.Contains(element)); 504Debug.Assert(group.CanonicalParticle != null); 1020Debug.Assert(baseType.ElementDecl.ContentValidator != null); 1405Debug.Assert(false); 1860Debug.Assert(attribute.Use != XmlSchemaUse.Prohibited); 2333Debug.Assert(xe.ElementSchemaType != null); 2577Debug.Assert(particle == XmlSchemaParticle.Empty); 2624Debug.Assert(!p.IsEmpty); 2643Debug.Assert(false);
FrameworkFork\Microsoft.Xml\Xml\schema\SchemaInfo.cs (1)
330Debug.Assert(false);
FrameworkFork\Microsoft.Xml\Xml\schema\SchemaSetCompiler.cs (13)
118Debug.Assert(_schemaForSchema != null); 482Debug.Assert(examplar != null); //Headelement presence is checked while building subst groups 585Debug.Assert(group.CanonicalParticle != null); 1630Debug.Assert(false); 2207Debug.Assert(attribute.Use != XmlSchemaUse.Prohibited); 2764Debug.Assert(xe.ElementSchemaType != null); 2785Debug.Assert(decl != null); 3020Debug.Assert(particle == XmlSchemaParticle.Empty); 3068Debug.Assert(!((XmlSchemaParticle)particles[i]).IsEmpty); 3087Debug.Assert(false); 3244Debug.Assert(baseFixedValue != null); 3249Debug.Assert(derivedFixedValue != null); 3265Debug.Assert(simpleFixedValue != null);
FrameworkFork\Microsoft.Xml\Xml\schema\XdrBuilder.cs (1)
634Debug.Assert(_GroupDef != null);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlAtomicValue.cs (1)
159Debug.Assert(qname != null); //string representation is handled in a different overload
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchema.cs (2)
272Debug.Assert(_isPreprocessed); 702Debug.Assert(extList != null && schema != null);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaObject.cs (4)
91get { Debug.Assert(false); return null; } 92set { Debug.Assert(false); } 101get { Debug.Assert(false); return null; } 102set { Debug.Assert(false); }
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaObjectTable.cs (8)
38Debug.Assert(oldValue != null); 40Debug.Assert(matchedIndex >= 0); 42Debug.Assert(_entries[matchedIndex].qname == name); 57Debug.Assert(oldValue != null); 59Debug.Assert(_entries[matchedIndex].qname == name); 77Debug.Assert(matchedIndex >= 0); 78Debug.Assert(_entries[matchedIndex].qname == name); 100Debug.Assert(_table.Count == _entries.Count);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaSet.cs (2)
1022Debug.Assert(ns != null); 1033Debug.Assert(schema.BaseUri.Equals(schemaUri));
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaSimpleType.cs (1)
29Debug.Assert(SchemaContentType == XmlSchemaContentType.TextOnly);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlSchemaValidator.cs (27)
345Debug.Assert(_validatedNamespaces != null); 628Debug.Assert(_currentState == ValidatorState.TopLevelAttribute); //Re-set state back to start on error with partial validation type 638Debug.Assert(currentElementDecl != null); 640Debug.Assert(ct != null); 657Debug.Assert(attributeDef != null); 677Debug.Assert(simpleValue != null); 828Debug.Assert(names.Count > 0); 960Debug.Assert(_context.Validity != XmlSchemaValidity.Valid); 1090Debug.Assert(attSchemaInfo != null); 1454Debug.Assert(currentElementDecl.Datatype != null); 1515Debug.Assert(simpleValue != null); 1527Debug.Assert(decl != null && decl.SchemaType != null); 1567Debug.Assert(_validationStack.Length > 1); 1646Debug.Assert(_partialValidationType is XmlSchemaAttribute); 1683Debug.Assert(elementDecl.DefaultValueTyped != null); 1837Debug.Assert(elementDecl.ContentValidator.ContentType == XmlSchemaContentType.Mixed && elementDecl.DefaultValueTyped != null); 1850Debug.Assert(decl != null); 1863Debug.Assert(_xmlResolver != null); 1959Debug.Assert(dtype != null); 1996Debug.Assert(dtype != null); 2130Debug.Assert(currentElementDecl != null); 2340Debug.Assert(datatype != null); 2534Debug.Assert(contentValidator is DfaContentValidator || contentValidator is NfaContentValidator || contentValidator is RangeContentValidator || contentValidator is AllElementsContentValidator); 2558Debug.Assert(names.Count > 0); 2608Debug.Assert(names.Count > 0); 2647Debug.Assert(builder.Length != 0); 2756Debug.Assert(nsList.Length > 0);
FrameworkFork\Microsoft.Xml\Xml\schema\XmlValueConverter.cs (1)
3678Debug.Assert(schemaType.DerivedBy == XmlSchemaDerivationMethod.Union);
FrameworkFork\Microsoft.Xml\Xml\schema\XsdBuilder.cs (5)
712Debug.Assert(_currentEntry.InitFunc != null); 715Debug.Assert(_xso != null); 1340Debug.Assert(false); 2381Debug.Assert(false); 2430Debug.Assert(false);
FrameworkFork\Microsoft.Xml\Xml\schema\XsdDuration.cs (1)
115Debug.Assert(durationType == DurationType.Duration || durationType == DurationType.DayTimeDuration);
FrameworkFork\Microsoft.Xml\Xml\schema\xsdvalidator.cs (1)
502Debug.Assert(attnDef.SchemaType != null);
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeExporter.cs (1)
176Debug.Assert(comments != null);
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeGenerator.cs (29)
47System.Diagnostics.Debug.Assert(typeBuilder != null); 129System.Diagnostics.Debug.Assert(_argList != null && _argList.ContainsKey(name)); 135System.Diagnostics.Debug.Assert(_currentScope != null && _currentScope.ContainsKey(name)); 182System.Diagnostics.Debug.Assert(false); 226Debug.Assert(_currentScope.parent != null); 235Debug.Assert(_freeLocals != null); 257Debug.Assert(!_currentScope.ContainsKey(name)); 273Debug.Assert(local.LocalType == type); 314Debug.Assert(forState != null); 636Debug.Assert(methodInfo != null); 645Debug.Assert(ctor != null); 651Debug.Assert(constructorInfo != null); 802System.Diagnostics.Debug.Assert(getMethod != null); 839System.Diagnostics.Debug.Assert(getMethod != null); 877System.Diagnostics.Debug.Assert(setMethod != null); 1288Debug.Assert(_currentScope.ContainsKey(name)); 1300Debug.Assert(local.LocalType == type); 1311Debug.Assert(_currentScope.ContainsKey(name)); 1313Debug.Assert(local.LocalType == type); 1529Debug.Assert(!opCode.Equals(OpCodes.Nop)); 1849Debug.Assert(ifState != null); 2043Debug.Assert(_initElseIfStack == -1); 2053Debug.Assert(_initIfStack == -1); 2073Debug.Assert(_initIfStack == -1 && _initElseIfStack == -1); 2094Debug.Assert(_initIfStack == -1 && _initElseIfStack == -1); 2878Debug.Assert(this.MethodBuilder.ReturnType == returnType); 2879Debug.Assert(this.MethodBuilder.Attributes == attributes); 2880Debug.Assert(this.ParameterTypes.Length == parameterTypes.Length); 2883Debug.Assert(this.ParameterTypes[i] == parameterTypes[i]);
FrameworkFork\Microsoft.Xml\Xml\Serialization\SourceInfo.cs (4)
115Debug.Assert(get_Item != null); 192Debug.Assert(match.Groups["arg"].Value == Arg); 193Debug.Assert(match.Groups["cast"].Value == CodeIdentifier.GetCSharpName(Type)); 218System.Diagnostics.Debug.Assert(targetType == nullableType || targetType.IsAssignableFrom(nullableType.GetGenericArguments()[0]));
FrameworkFork\Microsoft.Xml\Xml\Serialization\Types.cs (2)
1136Debug.Assert(propertyInfo != null); 1137Debug.Assert(typeDesc != null);
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationILGen.cs (5)
47System.Diagnostics.Debug.Assert(access == "public"); 62get { System.Diagnostics.Debug.Assert(_moduleBuilder != null); return _moduleBuilder; } 63set { System.Diagnostics.Debug.Assert(_moduleBuilder == null && value != null); _moduleBuilder = value; } 107System.Diagnostics.Debug.Assert(_methodBuilders.ContainsKey(methodName)); 572System.Diagnostics.Debug.Assert(memberInfos.ContainsKey(source.Substring(3)));
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriterILGen.cs (11)
1093System.Diagnostics.Debug.Assert(xmlnsSource.StartsWith("o.@", StringComparison.Ordinal)); 1444System.Diagnostics.Debug.Assert(parent == "o" || parent == "p"); 2316Debug.Assert(!local.LocalType.GetTypeInfo().IsValueType); 2516Debug.Assert(type.GetTypeInfo().IsValueType); 2600Debug.Assert(initValue.MemberInfo != null); 2601Debug.Assert(initValue.MemberInfo.Name == initValue.Arg.Substring(3)); 2646Debug.Assert(typeName == arrayTypeDesc.CSharpName || typeName == arrayTypeDesc.CSharpName + "[]"); 2658Debug.Assert(type != null); 2659Debug.Assert(ilg != null); 2667Debug.Assert(arrayType != null); 2668Debug.Assert(ilg != null);
FrameworkFork\Microsoft.Xml\Xml\ValidateNames.cs (7)
42Debug.Assert(s != null && offset <= s.Length); 78Debug.Assert(s != null && offset <= s.Length); 121Debug.Assert(s != null && offset <= s.Length); 181Debug.Assert(s != null && offset <= s.Length); 400Debug.Assert(offsetBadChar < s.Length); 420Debug.Assert(offsetBadChar < s.Length); 491Debug.Assert(prefix != null && localName != null && ns != null);
FrameworkFork\Microsoft.Xml\Xml\XmlCharType.cs (8)
472Debug.Assert(s_CharProperties != null); 704Debug.Assert(str != null); 705Debug.Assert(startPos + len <= str.Length); 706Debug.Assert(startPos <= str.Length); 720Debug.Assert(chars != null); 721Debug.Assert(startPos + len <= chars.Length); 722Debug.Assert(startPos <= chars.Length); 752Debug.Assert(start <= end);
FrameworkFork\Microsoft.Xml\Xml\XmlEncoding.cs (2)
433Debug.Assert(i == 1); 484Debug.Assert(i == 1);
FrameworkFork\Microsoft.Xml\Xml\XmlException.cs (3)
200Debug.Assert(invCharIndex < data.Length); 201Debug.Assert(invCharIndex < length); 202Debug.Assert(length <= data.Length);
FrameworkFork\Microsoft.Xml\Xml\XmlNamespaceManager.cs (4)
124Debug.Assert(decl >= 2); 187Debug.Assert(_hashTable == null); 251Debug.Assert(i >= 2); 262Debug.Assert(prefix != null);
FrameworkFork\Microsoft.Xml\Xml\XmlQualifiedName.cs (3)
175Debug.Assert(name != null && ns != null); 183Debug.Assert(ns != null); 198Debug.Assert(_name != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\AttributeQuery.cs (1)
50Debug.Assert(!currentNode.NamespaceURI.Equals(XmlReservedNs.NsXmlNs));
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\Axis.cs (2)
43Debug.Assert(prefix != null); 44Debug.Assert(name != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\baseaxisquery.cs (3)
38Debug.Assert(qyInput != null); 68Debug.Assert(context != null); 125Debug.Assert(this is AttributeQuery || this is ChildrenQuery);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\BooleanExpr.cs (2)
22Debug.Assert(op == Operator.Op.AND || op == Operator.Op.OR); 23Debug.Assert(opnd1 != null && opnd2 != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\CacheAxisQuery.cs (2)
43Debug.Assert(0 <= count && count <= outputBuffer.Count); 55Debug.Assert(0 <= count && count <= outputBuffer.Count);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\CacheOutputQuery.cs (2)
53Debug.Assert(0 <= count && count <= outputBuffer.Count); 65Debug.Assert(0 <= count && count <= outputBuffer.Count);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\CompiledXpathExpr.cs (1)
123Debug.Assert(prefix != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\ForwardPositionQuery.cs (1)
16Debug.Assert(input != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\LogicalExpr.cs (3)
22Debug.Assert( 93Debug.Assert(op == Operator.Op.EQ || op == Operator.Op.NE); 126Debug.Assert(
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\NamespaceQuery.cs (1)
62Debug.Assert(e.NodeType == XPathNodeType.Namespace);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\NumericExpr.cs (3)
22Debug.Assert( 27Debug.Assert(opnd1 != null && opnd2 != null); 62Debug.Assert(op == Operator.Op.PLUS || op == Operator.Op.MINUS || op == Operator.Op.MOD || op == Operator.Op.DIV || op == Operator.Op.MUL);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\Operator.cs (1)
52Debug.Assert(Op.EQ <= op && op <= Op.GE);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\Query.cs (1)
156Debug.Assert(0 <= l && l < r);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\SortQuery.cs (6)
83Debug.Assert(0 <= count && count <= _results.Count); 95Debug.Assert(0 <= count && count <= _results.Count); 168Debug.Assert(_expressions.Length == _comparers.Length); 169Debug.Assert(0 < _expressions.Length); 170Debug.Assert(0 <= _numSorts && _numSorts <= _expressions.Length); 184Debug.Assert(_numSorts < _expressions.Length);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\StringFunctions.cs (1)
94Debug.Assert(GetXPathType(argVal) == XPathResultType.Number);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathArrayIterator.cs (2)
54Debug.Assert(index <= list.Count); 69Debug.Assert(index <= list.Count);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathMultyIterator.cs (1)
101Debug.Assert(firstNotEmpty <= item && item < arr.Length);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathParser.cs (4)
424Debug.Assert(nodeType != XPathNodeType.Root); 477Debug.Assert(IsPrimaryExpr(_scanner)); 668Debug.Assert(_scanner.CanBeFunction); 880Debug.Assert(scaner.Kind == XPathScanner.LexKind.Axe);
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathScanner.cs (15)
45Debug.Assert(0 <= _xpathExprIndex && _xpathExprIndex <= _xpathExpr.Length); 77Debug.Assert(_kind == LexKind.Name || _kind == LexKind.Axe); 78Debug.Assert(_name != null); 87Debug.Assert(_kind == LexKind.Name); 88Debug.Assert(_prefix != null); 97Debug.Assert(_kind == LexKind.String); 98Debug.Assert(_stringValue != null); 107Debug.Assert(_kind == LexKind.Number); 108Debug.Assert(_numberValue != double.NaN); 119Debug.Assert(_kind == LexKind.Name); 288Debug.Assert(this.CurerntChar == '.' || XmlCharType.IsDigit(this.CurerntChar)); 308Debug.Assert(XmlCharType.IsDigit(this.CurerntChar)); 310Debug.Assert(0 <= start && _xpathExpr[start] == '.'); 333Debug.Assert(this.CurerntChar == endChar); 340Debug.Assert(_xmlCharType.IsStartNCNameSingleChar(this.CurerntChar)
FrameworkFork\Microsoft.Xml\Xml\XPath\Internal\XPathSingletonIterator.cs (1)
20Debug.Assert(nav != null);
FrameworkFork\Microsoft.Xml\Xml\XPath\XPathDocument.cs (4)
221Debug.Assert(reader.LocalName == "xmlns"); 226Debug.Assert(reader.Prefix == "xmlns"); 396Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element && pageNmsp[idxNmsp].NodeType == XPathNodeType.Namespace); 410Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element);
FrameworkFork\Microsoft.Xml\Xml\XPath\XPathNavigator.cs (7)
1150Debug.Assert(args != null); 1917Debug.Assert(!n1.IsSamePosition(n2)); 1919Debug.Assert(p1.MoveToParent() && p2.MoveToParent() && p1.IsSamePosition(p2)); 2154Debug.Assert(reader.LocalName == "xmlns"); 2159Debug.Assert(reader.Prefix == "xmlns"); 2216Debug.Assert(reader.LocalName == "xmlns"); 2221Debug.Assert(reader.Prefix == "xmlns");
FrameworkFork\Microsoft.Xml\Xml\XPath\XPathNavigatorReader.cs (2)
520Debug.Assert(value == null); 646Debug.Assert(XPathNodeType.Namespace == _nav.NodeType);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CodeGenerator.cs (5)
39Debug.Assert(s_getTypeFromHandle != null); 63Debug.Assert(s_objectEquals != null); 86Debug.Assert(s_arraySetValue != null); 103Debug.Assert(s_objectToString != null); 118Debug.Assert(s_stringFormat != null);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\Globals.cs (3)
1051Debug.Assert(s_typeOfScriptObject != null); 1069Debug.Assert(s_serializeFunc != null); 1075Debug.Assert(s_deserializeFunc != null);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlFormatGeneratorStatics.cs (65)
34Debug.Assert(s_writeStartElementMethod2 != null); 50Debug.Assert(s_writeStartElementMethod3 != null); 66Debug.Assert(s_writeEndElementMethod != null); 82Debug.Assert(s_writeNamespaceDeclMethod != null); 112Debug.Assert(s_ienumeratorMoveNextMethod != null); 128Debug.Assert(s_ienumeratorGetCurrentMethod != null); 144Debug.Assert(s_getItemContractMethod != null); 160Debug.Assert(s_isStartElementMethod2 != null); 176Debug.Assert(s_isStartElementMethod0 != null); 192Debug.Assert(s_getUninitializedObjectMethod != null); 208Debug.Assert(s_nodeTypeProperty != null); 237Debug.Assert(s_getStreamingContextMethod != null); 253Debug.Assert(s_getCollectionMemberMethod != null); 269Debug.Assert(s_storeCollectionMemberInfoMethod != null); 285Debug.Assert(s_storeIsGetOnlyCollectionMethod != null); 301Debug.Assert(s_throwNullValueReturnedForGetOnlyCollectionExceptionMethod != null); 316Debug.Assert(s_throwArrayExceededSizeExceptionMethod != null); 332Debug.Assert(s_incrementItemCountMethod != null); 349Debug.Assert(s_internalDeserializeMethod != null); 365Debug.Assert(s_moveToNextElementMethod != null); 381Debug.Assert(s_getMemberIndexMethod != null); 397Debug.Assert(s_getMemberIndexWithRequiredMembersMethod != null); 413Debug.Assert(s_throwRequiredMemberMissingExceptionMethod != null); 429Debug.Assert(s_skipUnknownElementMethod != null); 445Debug.Assert(s_readIfNullOrRefMethod != null); 461Debug.Assert(s_readAttributesMethod != null); 477Debug.Assert(s_resetAttributesMethod != null); 493Debug.Assert(s_getObjectIdMethod != null); 509Debug.Assert(s_getArraySizeMethod != null); 525Debug.Assert(s_addNewObjectMethod != null); 541Debug.Assert(s_addNewObjectWithIdMethod != null); 557Debug.Assert(s_getExistingObjectMethod != null); 573Debug.Assert(s_ensureArraySizeMethod != null); 589Debug.Assert(s_trimArraySizeMethod != null); 605Debug.Assert(s_checkEndOfArrayMethod != null); 622Debug.Assert(s_getArrayLengthMethod != null); 638Debug.Assert(s_createSerializationExceptionMethod != null); 654Debug.Assert(s_createUnexpectedStateExceptionMethod != null); 670Debug.Assert(s_internalSerializeReferenceMethod != null); 686Debug.Assert(s_internalSerializeMethod != null); 702Debug.Assert(s_writeNullMethod != null); 718Debug.Assert(s_incrementArrayCountMethod != null); 734Debug.Assert(s_incrementCollectionCountMethod != null); 750Debug.Assert(s_incrementCollectionCountGenericMethod != null); 766Debug.Assert(s_getDefaultValueMethod != null); 782Debug.Assert(s_getNullableValueMethod != null); 798Debug.Assert(s_throwRequiredMemberMustBeEmittedMethod != null); 814Debug.Assert(s_getHasValueMethod != null); 832Debug.Assert(s_isMemberTypeSameAsMemberValue != null); 848Debug.Assert(s_writeXmlValueMethod != null); 864Debug.Assert(s_readXmlValueMethod != null); 880Debug.Assert(s_namespaceProperty != null); 896Debug.Assert(s_contractNamespacesField != null); 912Debug.Assert(s_memberNamesField != null); 928Debug.Assert(s_childElementNamespacesProperty != null); 944Debug.Assert(s_collectionItemNameProperty != null); 960Debug.Assert(s_childElementNamespaceProperty != null); 976Debug.Assert(s_getDateTimeOffsetMethod != null); 992Debug.Assert(s_getDateTimeOffsetAdapterMethod != null); 1007Debug.Assert(s_getTypeHandleMethod != null); 1021Debug.Assert(s_getTypeMethod != null); 1037Debug.Assert(s_throwInvalidDataContractExceptionMethod != null); 1053Debug.Assert(s_serializeReadOnlyTypesProperty != null); 1069Debug.Assert(s_classSerializationExceptionMessageProperty != null); 1085Debug.Assert(s_collectionSerializationExceptionMessageProperty != null);
GenerateDocumentationAndConfigFiles (2)
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (2)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
ILLink.RoslynAnalyzer (89)
DataFlow\ControlFlowGraphExtensions.cs (2)
18Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 25Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
DataFlow\ControlFlowGraphProxy.cs (2)
66Debug.Assert(region != null); 174Debug.Assert(enclosingRegion.Kind == ControlFlowRegionKind.TryAndCatch);
DataFlow\InterproceduralState.cs (1)
54Debug.Assert(!Methods.IsUnknown());
DataFlow\LocalDataFlowAnalysis.cs (2)
83Debug.Assert(Context.OwningSymbol is not IMethodSymbol methodSymbol || 92Debug.Assert(!oldInterproceduralState.Methods.IsUnknown());
DataFlow\LocalDataFlowVisitor.cs (17)
180Debug.Assert(assemblyType != null); 184Debug.Assert(method != null); 397Debug.Assert(targetOperation is not IFlowCaptureReferenceOperation); 482Debug.Assert(IsLValueFlowCapture(flowCaptureReference.Id)); 483Debug.Assert(flowCaptureReference.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Write)); 485Debug.Assert(!capturedReferences.IsUnknown()); 524Debug.Assert(addMethod != null); 532Debug.Assert(removeMethod != null); 602Debug.Assert(operation.Value is not IFlowCaptureReferenceOperation); 626Debug.Assert(!capturedReferences.IsUnknown()); 678Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction); 735Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Read)); 750Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Reference)); 785Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Read)); 829Debug.Assert(operation.Symbol.ContainingSymbol is IMethodSymbol or IFieldSymbol); 831Debug.Assert(lambda.MethodKind == MethodKind.LambdaMethod); 954Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction);
DataFlow\MethodBodyValue.cs (2)
23Debug.Assert(owningSymbol is (IMethodSymbol or IFieldSymbol or IPropertySymbol)); 33Debug.Assert(ControlFlowGraph == other.ControlFlowGraph);
DynamicallyAccessedMembersAnalyzer.cs (1)
76Debug.Assert((int)first < (int)last);
IOperationExtensions.cs (1)
125Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\libraries\Common\src\System\HexConverter.cs (2)
187Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 204Debug.Assert(destination.Length >= (source.Length * 2));
src\libraries\Common\src\System\Reflection\AssemblyNameFormatter.cs (1)
23Debug.Assert(name.Length != 0);
src\libraries\Common\src\System\Reflection\AssemblyNameParser.cs (1)
66Debug.Assert(input.Length > 0);
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
38Debug.Assert(value >= 0); 39Debug.Assert(value <= _chars.Length); 49Debug.Assert(capacity >= 0); 85Debug.Assert(index < _pos); 281Debug.Assert(additionalCapacityBeyondPos > 0);
src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeName.cs (2)
345Debug.Assert(_fullName is not null); 391Debug.Assert(rootTypeName._fullName is not null);
src\libraries\System.Reflection.Metadata\src\System\Reflection\Metadata\TypeNameParserHelpers.cs (1)
188Debug.Assert(rankOrModifier >= 2);
src\tools\illink\src\ILLink.Shared\Annotations.cs (1)
54Debug.Assert(memberTypes != DynamicallyAccessedMemberTypes.None);
src\tools\illink\src\ILLink.Shared\DataFlow\ForwardDataFlowAnalysis.cs (9)
70Debug.Assert(entryOut != null); 202Debug.Assert(successor.ConditionKind is ConditionKind.WhenTrue or ConditionKind.WhenFalse); 325Debug.Assert(isPredecessorInFinally); 393Debug.Assert(result); 405Debug.Assert(exceptionState != null); 406Debug.Assert(oldExceptionState != null); 413Debug.Assert(enclosingTryOrCatch.Kind != RegionKind.Filter); 445Debug.Assert(finallyExit != null); 448Debug.Assert(finallyExit.Value.ConditionKind == ConditionKind.Unconditional);
src\tools\illink\src\ILLink.Shared\DataFlow\ValueSet.cs (4)
190Debug.Assert(other._values == UnknownSentinel); 206Debug.Assert(other._values == UnknownSentinel); 212Debug.Assert(_values == UnknownSentinel); 242Debug.Assert(_values == UnknownSentinel);
src\tools\illink\src\ILLink.Shared\TrimAnalysis\ArrayOfAnnotatedSystemTypeValue.cs (1)
34Debug.Assert(!IsModified);
src\tools\illink\src\ILLink.Shared\TrimAnalysis\HandleCallAction.cs (3)
95Debug.Assert(requiresDataFlowAnalysis || annotatedMethodReturnValue.DynamicallyAccessedMemberTypes == DynamicallyAccessedMemberTypes.None); 100Debug.Assert(instanceValue.IsEmpty()); 101Debug.Assert(argumentValues.Count == 1);
src\tools\illink\src\ILLink.Shared\TrimAnalysis\NullableSystemTypeValue.cs (1)
21Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
src\tools\illink\src\ILLink.Shared\TrimAnalysis\NullableValueWithDynamicallyAccessedMembers.cs (1)
23Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
src\tools\illink\src\ILLink.Shared\TrimAnalysis\RuntimeTypeHandleForNullableSystemTypeValue.cs (1)
21Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
src\tools\illink\src\ILLink.Shared\TrimAnalysis\RuntimeTypeHandleForNullableValueWithDynamicallyAccessedMembers.cs (1)
21Debug.Assert(nullableType.IsTypeOf(WellKnownType.System_Nullable_T));
TrimAnalysis\ArrayValue.cs (1)
80System.Diagnostics.Debug.Assert(v is not ArrayValue);
TrimAnalysis\DiagnosticContext.cs (1)
48Debug.Assert(Location != null);
TrimAnalysis\FlowAnnotations.cs (2)
181Debug.Assert(property != null); 204Debug.Assert(property != null);
TrimAnalysis\HandleCallAction.cs (1)
316Debug.Assert(property != null);
TrimAnalysis\ReflectionAccessAnalyzer.cs (2)
123Debug.Assert(member is IMethodSymbol or IFieldSymbol); 130Debug.Assert(_typeHierarchyType is not null);
TrimAnalysis\TrimAnalysisAssignmentPattern.cs (2)
44Debug.Assert(Operation == other.Operation); 45Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol));
TrimAnalysis\TrimAnalysisBackingFieldAccessPattern.cs (3)
37Debug.Assert(SymbolEqualityComparer.Default.Equals(Property, other.Property)); 38Debug.Assert(Operation == other.Operation); 39Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol));
TrimAnalysis\TrimAnalysisFieldAccessPattern.cs (3)
36Debug.Assert(SymbolEqualityComparer.Default.Equals(Field, other.Field)); 37Debug.Assert(Operation == other.Operation); 38Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol));
TrimAnalysis\TrimAnalysisGenericInstantiationPattern.cs (3)
35Debug.Assert(Operation == other.Operation); 36Debug.Assert(SymbolEqualityComparer.Default.Equals(GenericInstantiation, other.GenericInstantiation)); 37Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol));
TrimAnalysis\TrimAnalysisMethodCallPattern.cs (4)
58Debug.Assert(Operation == other.Operation); 59Debug.Assert(SymbolEqualityComparer.Default.Equals(CalledMethod, other.CalledMethod)); 60Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol)); 61Debug.Assert(Arguments.Length == other.Arguments.Length);
TrimAnalysis\TrimAnalysisReflectionAccessPattern.cs (3)
35Debug.Assert(SymbolEqualityComparer.Default.Equals(ReferencedMethod, other.ReferencedMethod)); 36Debug.Assert(Operation == other.Operation); 37Debug.Assert(SymbolEqualityComparer.Default.Equals(OwningSymbol, other.OwningSymbol));
TrimAnalysis\TrimAnalysisVisitor.cs (2)
393Debug.Assert(OwningSymbol is IMethodSymbol); 409Debug.Assert(OwningSymbol is IMethodSymbol);
Metrics (485)
Program.cs (1)
281Debug.Assert(projectOrSolution.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase) ||
src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (11)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 309Debug.Assert(this.Count >= 1); 343Debug.Assert(_count >= 1);
src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (1)
714Debug.Assert(data.All(d => d.Count() == count));
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
27Debug.Assert(childrenCount != 0);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
503Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 515Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (6)
211Debug.Assert(isInsideAnonymousObjectInitializer == 289Debug.Assert(success); 290Debug.Assert(cfg != null); 334Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 496Debug.Assert(parameterIndex >= 0); 497Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
47Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
74Debug.Assert(!string.IsNullOrEmpty(sectionName)); 91Debug.Assert(!string.IsNullOrEmpty(key)); 92Debug.Assert(key == key.Trim()); 93Debug.Assert(value == value.Trim());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.cs (1)
313Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
79Debug.Assert(expectedValueText == actualValueText); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 219Debug.Assert(char.IsSurrogate(ch));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
104Debug.Assert(index + 1 >= data.Length ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
196Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 197Debug.Assert(_span.End == virtualChars._span.Start); 208Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 215Debug.Assert(branch.Destination == null); 220Debug.Assert(branch.Destination == null); 226Debug.Assert(branch.Destination != null); 257Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 261Debug.Assert(enclosing.NestedRegions[0] == region); 262Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 279Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 324Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 325Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 347Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 349Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 373Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(startAt > 0); 375Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 389Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 390Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 144Debug.Assert(cfg.Parent != null); 145Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 146Debug.Assert(parentAnalysisData != null); 303Debug.Assert(lambdaOrLocalFunctionCfg != null); 313Debug.Assert(anonymousFunctionCfg != null); 322Debug.Assert(localFunction.IsLocalFunction()); 330Debug.Assert(localFunctionCfg != null); 346Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 487Debug.Assert(localFunction.IsLocalFunction()); 488Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 578Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (3)
92Debug.Assert(BitConverter.IsLittleEndian); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (17)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1082Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1083Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1168Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (3)
85Debug.Assert(current < length); 107Debug.Assert(current < length); 126Debug.Assert(char.IsUpper(identifier[current - 1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
134Debug.Assert(similarityWeight <= _threshold);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Metrics.Legacy (485)
src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (11)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 309Debug.Assert(this.Count >= 1); 343Debug.Assert(_count >= 1);
src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (1)
714Debug.Assert(data.All(d => d.Count() == count));
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\RoslynAnalyzers\Tools\Metrics\Program.cs (1)
281Debug.Assert(projectOrSolution.EndsWith(".csproj", StringComparison.OrdinalIgnoreCase) ||
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
27Debug.Assert(childrenCount != 0);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
503Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 515Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (6)
211Debug.Assert(isInsideAnonymousObjectInitializer == 289Debug.Assert(success); 290Debug.Assert(cfg != null); 334Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 496Debug.Assert(parameterIndex >= 0); 497Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
47Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
74Debug.Assert(!string.IsNullOrEmpty(sectionName)); 91Debug.Assert(!string.IsNullOrEmpty(key)); 92Debug.Assert(key == key.Trim()); 93Debug.Assert(value == value.Trim());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.cs (1)
313Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
79Debug.Assert(expectedValueText == actualValueText); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 219Debug.Assert(char.IsSurrogate(ch));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
104Debug.Assert(index + 1 >= data.Length ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
196Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 197Debug.Assert(_span.End == virtualChars._span.Start); 208Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 215Debug.Assert(branch.Destination == null); 220Debug.Assert(branch.Destination == null); 226Debug.Assert(branch.Destination != null); 257Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 261Debug.Assert(enclosing.NestedRegions[0] == region); 262Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 279Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 324Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 325Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 347Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 349Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 373Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(startAt > 0); 375Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 389Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 390Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 144Debug.Assert(cfg.Parent != null); 145Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 146Debug.Assert(parentAnalysisData != null); 303Debug.Assert(lambdaOrLocalFunctionCfg != null); 313Debug.Assert(anonymousFunctionCfg != null); 322Debug.Assert(localFunction.IsLocalFunction()); 330Debug.Assert(localFunctionCfg != null); 346Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 487Debug.Assert(localFunction.IsLocalFunction()); 488Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 578Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (3)
92Debug.Assert(BitConverter.IsLittleEndian); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (17)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1082Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1083Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1168Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (3)
85Debug.Assert(current < length); 107Debug.Assert(current < length); 126Debug.Assert(char.IsUpper(identifier[current - 1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
134Debug.Assert(similarityWeight <= _threshold);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Microsoft.AspNetCore.Analyzer.Testing (1)
DiagnosticVerifier.cs (1)
144Debug.Assert(sources.Length == documents.Length);
Microsoft.AspNetCore.Analyzers (3)
BuildServiceProviderAnalyzer.cs (1)
21Debug.Assert(context.Symbol.Kind == SymbolKind.NamedType);
UseAuthorizationAnalyzer.cs (1)
22Debug.Assert(context.Symbol.Kind == SymbolKind.NamedType);
UseMvcAnalyzer.cs (1)
21Debug.Assert(context.Symbol.Kind == SymbolKind.NamedType);
Microsoft.AspNetCore.App.Analyzers (63)
Infrastructure\EmbeddedSyntax\EmbeddedSeparatedSyntaxNodeList.cs (4)
26Debug.Assert(!nodesAndTokens.IsDefault); 44Debug.Assert(NodesAndTokens[i].IsNode); 45Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 50Debug.Assert(!NodesAndTokens[i].IsNode);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxNode.cs (1)
25Debug.Assert((int)(object)kind != 0);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxNodeOrToken.cs (2)
25Debug.Assert((int)(object)token.Kind != 0); 33Debug.Assert(Node == null);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxToken.cs (1)
30Debug.Assert(!diagnostics.IsDefault);
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxTrivia.cs (1)
27Debug.Assert(virtualChars.Length > 0);
Infrastructure\RoutePattern\RoutePatternNodes.cs (20)
19Debug.Assert(parts != null); 20Debug.Assert(endOfFileToken.Kind == RoutePatternKind.EndOfFile); 72Debug.Assert(openBracketToken.Kind == RoutePatternKind.OpenBracketToken); 73Debug.Assert(textToken.Kind == RoutePatternKind.ReplacementToken); 74Debug.Assert(closeBracketToken.Kind == RoutePatternKind.CloseBracketToken); 108Debug.Assert(openBraceToken.Kind == RoutePatternKind.OpenBraceToken); 109Debug.Assert(closeBraceToken.Kind == RoutePatternKind.CloseBraceToken); 146Debug.Assert(literalToken.Kind == RoutePatternKind.Literal); 170Debug.Assert(separatorToken.Kind == RoutePatternKind.DotToken); 194Debug.Assert(separatorToken.Kind == RoutePatternKind.SlashToken); 218Debug.Assert(asteriskToken.Kind == RoutePatternKind.AsteriskToken); 242Debug.Assert(questionMarkToken.Kind == RoutePatternKind.QuestionMarkToken); 266Debug.Assert(equalsToken.Kind == RoutePatternKind.EqualsToken); 267Debug.Assert(defaultValueToken.Kind == RoutePatternKind.DefaultValueToken); 294Debug.Assert(parameterNameToken.Kind == RoutePatternKind.ParameterNameToken); 318Debug.Assert(colonToken.Kind == RoutePatternKind.ColonToken); 345Debug.Assert(openParenToken.Kind == RoutePatternKind.OpenParenToken); 346Debug.Assert(argumentToken.Kind == RoutePatternKind.PolicyFragmentToken); 347Debug.Assert(closeParenToken.Kind == RoutePatternKind.CloseParenToken); 377Debug.Assert(argumentToken.Kind == RoutePatternKind.PolicyFragmentToken);
Infrastructure\RoutePattern\RoutePatternParser.cs (3)
65Debug.Assert(_lexer.Position == _lexer.Text.Length); 66Debug.Assert(_currentToken.Kind == RoutePatternKind.EndOfFile); 439Debug.Assert(_routePatternOptions.SupportTokenReplacement);
Infrastructure\VirtualChars\AbstractVirtualCharService.cs (5)
76Debug.Assert(expectedValueText == actualValueText); 132Debug.Assert(!token.ContainsDiagnostics); 136Debug.Assert(startDelimiter == ""); 137Debug.Assert(endDelimiter == ""); 218Debug.Assert(char.IsSurrogate(ch));
Infrastructure\VirtualChars\CSharpVirtualCharService.cs (9)
58Debug.Assert(!token.ContainsDiagnostics); 341Debug.Assert(char.IsSurrogate(ch)); 351Debug.Assert(tokenText[index] == '\\'); 364Debug.Assert(tokenText[index] == '\\'); 397Debug.Assert(tokenText[index] == '\\'); 416Debug.Assert(tokenText[index] == '\\'); 461Debug.Assert(uintChar is > 0x0000FFFF and <= 0x0010FFFF); 501Debug.Assert(character == 'x'); 533Debug.Assert(IsHexDigit(c));
Infrastructure\VirtualChars\VirtualCharSequence.Chunks.cs (2)
72Debug.Assert(index >= 0); 150Debug.Assert(index + 1 >= _underlyingData.Length ||
Infrastructure\VirtualChars\VirtualCharSequence.cs (3)
214Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 215Debug.Assert(_span.End == virtualChars._span.Start); 226Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
Mvc\DetectAmbiguousActionRoutes.cs (1)
110Debug.Assert(!httpMethods.IsDefault);
Mvc\DetectOverriddenAuthorizeAttribute.cs (3)
29Debug.Assert(authorizeAttributes.Count is 0); 59Debug.Assert(authorizeAttributes.Count is 0); 109Debug.Assert(currentMethod is null);
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (1)
549Debug.Assert(token.IsKind(SyntaxKind.StringLiteralToken));
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (1)
401Debug.Assert(token.IsKind(SyntaxKind.StringLiteralToken));
RouteHandlers\DetectAmbiguousRoutes.cs (1)
153Debug.Assert(!httpMethods.IsDefault);
src\Shared\Diagnostics\AnalyzerDebug.cs (2)
12/// <inheritdoc cref="Debug.Assert(bool)"/> 14public static void Assert([DoesNotReturnIf(false)] bool b) => Debug.Assert(b);
src\Shared\Roslyn\CodeAnalysisExtensions.cs (3)
34Debug.Assert(methodSymbol != null); 159Debug.Assert(method.PartialImplementationPart == null && !SymbolEqualityComparer.Default.Equals(method.PartialDefinitionPart, method)); 165Debug.Assert(!SymbolEqualityComparer.Default.Equals(method.PartialImplementationPart, method));
Microsoft.AspNetCore.Diagnostics (1)
src\Shared\Diagnostics\AnalyzerDebug.cs (1)
12/// <inheritdoc cref="Debug.Assert(bool)"/>
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (1)
src\Shared\Diagnostics\AnalyzerDebug.cs (1)
12/// <inheritdoc cref="Debug.Assert(bool)"/>
Microsoft.AspNetCore.Http.RequestDelegateGenerator (2)
src\Shared\Diagnostics\AnalyzerDebug.cs (2)
12/// <inheritdoc cref="Debug.Assert(bool)"/> 14public static void Assert([DoesNotReturnIf(false)] bool b) => Debug.Assert(b);
Microsoft.AspNetCore.Mvc.Analyzers (3)
src\Shared\Roslyn\CodeAnalysisExtensions.cs (3)
34Debug.Assert(methodSymbol != null); 159Debug.Assert(method.PartialImplementationPart == null && !SymbolEqualityComparer.Default.Equals(method.PartialDefinitionPart, method)); 165Debug.Assert(!SymbolEqualityComparer.Default.Equals(method.PartialImplementationPart, method));
Microsoft.AspNetCore.Mvc.Api.Analyzers (3)
src\Shared\Roslyn\CodeAnalysisExtensions.cs (3)
34Debug.Assert(methodSymbol != null); 159Debug.Assert(method.PartialImplementationPart == null && !SymbolEqualityComparer.Default.Equals(method.PartialDefinitionPart, method)); 165Debug.Assert(!SymbolEqualityComparer.Default.Equals(method.PartialImplementationPart, method));
Microsoft.AspNetCore.OpenApi.SourceGenerators (2)
src\Shared\Diagnostics\AnalyzerDebug.cs (2)
12/// <inheritdoc cref="Debug.Assert(bool)"/> 14public static void Assert([DoesNotReturnIf(false)] bool b) => Debug.Assert(b);
Microsoft.Build.Framework (3)
BinaryTranslator.cs (1)
658Debug.Assert(count == 2);
EnvironmentUtilities.cs (2)
44Debug.Assert(processId != 0); 75Debug.Assert(processPath != null);
Microsoft.Build.Tasks.CodeAnalysis (2)
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (2)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
Microsoft.Build.Tasks.CodeAnalysis.Sdk (11)
src\Compilers\Core\MSBuildTask\CommandLineBuilderExtension.cs (1)
124Debug.Assert(!_isQuotingRequired);
src\Compilers\Core\MSBuildTask\MapSourceRoots.cs (1)
176Debug.Assert(mappedTopLevelPath.EndsWith("/", StringComparison.Ordinal));
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Shared\BuildProtocol.cs (1)
506Debug.Assert(reason is object);
src\Compilers\Shared\BuildServerConnection.cs (4)
71Debug.Assert(workingDirectory is object); 182Debug.Assert(pipeName is object); 706Debug.Assert(Stream is null); 744Debug.Assert(Stream is not null);
Microsoft.CodeAnalysis (2)
InternalUtilities\Debug.cs (2)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
Microsoft.CodeAnalysis.Analyzers (507)
MetaAnalyzers\CompareSymbolsCorrectlyAnalyzer.cs (1)
241Debug.Assert(destinationTypeIndex < method.TypeArguments.Length);
MetaAnalyzers\DiagnosticAnalyzerAPIUsageAnalyzer.cs (3)
106Debug.Assert(added); 135Debug.Assert(SymbolEqualityComparer.Default.Equals(typeToProcess.ContainingAssembly, declaredType.ContainingAssembly)); 136Debug.Assert(namedTypesToAccessedTypesMap.ContainsKey(typeToProcess));
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer.cs (5)
693Debug.Assert(diagnostic.Id is DiagnosticIds.DefineDiagnosticTitleCorrectlyRuleId or 963Debug.Assert(IsMultiSentences(s)); 973Debug.Assert(EndsWithPeriod(s)); 982Debug.Assert(ContainsLineReturn(s)); 1023Debug.Assert(HasLeadingOrTrailingWhitespaces(s));
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ResourceStringsFormat.cs (2)
42Debug.Assert(HasResxAdditionalFiles(options)); 43Debug.Assert(!resourceFileName.EndsWith(".resx", StringComparison.OrdinalIgnoreCase));
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.cs (1)
413Debug.Assert(newRuleEntriesToAdd == null || newRuleEntriesToAdd.Count == 0);
MetaAnalyzers\Fixers\DefineDiagnosticDescriptorArgumentsCorrectlyFix.CustomFixAllProvider.cs (1)
39Debug.Assert(fixAllContext.CodeActionEquivalenceKey.EndsWith(AdditionalDocumentEquivalenceKeySuffix, StringComparison.Ordinal));
MetaAnalyzers\RegisterActionAnalyzer.cs (1)
540Debug.Assert(IsContextType(contextParameter.Type, _codeBlockStartAnalysisContext, _compilationStartAnalysisContext, _operationBlockStartAnalysisContext));
MetaAnalyzers\ReleaseTrackingHelper.cs (1)
482Debug.Assert(kind is ReleaseTrackingRuleEntryKind.New or ReleaseTrackingRuleEntryKind.Removed);
src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (11)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 309Debug.Assert(this.Count >= 1); 343Debug.Assert(_count >= 1);
src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
27Debug.Assert(childrenCount != 0);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
503Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 515Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (6)
211Debug.Assert(isInsideAnonymousObjectInitializer == 289Debug.Assert(success); 290Debug.Assert(cfg != null); 334Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 496Debug.Assert(parameterIndex >= 0); 497Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
47Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
74Debug.Assert(!string.IsNullOrEmpty(sectionName)); 91Debug.Assert(!string.IsNullOrEmpty(key)); 92Debug.Assert(key == key.Trim()); 93Debug.Assert(value == value.Trim());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.cs (1)
313Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
79Debug.Assert(expectedValueText == actualValueText); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 219Debug.Assert(char.IsSurrogate(ch));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
104Debug.Assert(index + 1 >= data.Length ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
196Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 197Debug.Assert(_span.End == virtualChars._span.Start); 208Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 215Debug.Assert(branch.Destination == null); 220Debug.Assert(branch.Destination == null); 226Debug.Assert(branch.Destination != null); 257Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 261Debug.Assert(enclosing.NestedRegions[0] == region); 262Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 279Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 324Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 325Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 347Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 349Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 373Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(startAt > 0); 375Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 389Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 390Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 144Debug.Assert(cfg.Parent != null); 145Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 146Debug.Assert(parentAnalysisData != null); 303Debug.Assert(lambdaOrLocalFunctionCfg != null); 313Debug.Assert(anonymousFunctionCfg != null); 322Debug.Assert(localFunction.IsLocalFunction()); 330Debug.Assert(localFunctionCfg != null); 346Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 487Debug.Assert(localFunction.IsLocalFunction()); 488Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 578Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (3)
92Debug.Assert(BitConverter.IsLittleEndian); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (17)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1082Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1083Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1168Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (3)
85Debug.Assert(current < length); 107Debug.Assert(current < length); 126Debug.Assert(char.IsUpper(identifier[current - 1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
134Debug.Assert(similarityWeight <= _threshold);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
342Debug.Assert(desiredGroupIndex >= 0); 343Debug.Assert(desiredGroupIndex <= declarationList.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
42Debug.Assert(!isInitOnly || methodKind == MethodKind.PropertySet);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (3)
49Debug.Assert(diagnostic != null); 103Debug.Assert(analyzerConfigPath != null); 104Debug.Assert(PathUtilities.IsAbsolute(analyzerConfigPath));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
74Debug.Assert(!semanticModel.IsSpeculativeSemanticModel);
Microsoft.CodeAnalysis.AnalyzerUtilities (871)
src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (11)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 309Debug.Assert(this.Count >= 1); 343Debug.Assert(_count >= 1);
src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
27Debug.Assert(childrenCount != 0);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
503Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 515Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (6)
211Debug.Assert(isInsideAnonymousObjectInitializer == 289Debug.Assert(success); 290Debug.Assert(cfg != null); 334Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 496Debug.Assert(parameterIndex >= 0); 497Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
47Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\RoslynAnalyzers\Utilities\FlowAnalysis\Extensions\BasicBlockExtensions.cs (1)
199Debug.Assert(ordinal < basicBlock.Ordinal);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAbstractValue.cs (10)
24Debug.Assert(analysisEntities.IsEmpty != kind.IsKnown()); 25Debug.Assert(kind != CopyAbstractValueKind.KnownReferenceCopy || analysisEntities.All(a => !a.Type.IsValueType)); 41Debug.Assert(!kind.IsKnown()); 54Debug.Assert(!analysisEntities.IsEmpty); 59Debug.Assert(AnalysisEntities.Contains(entityToRemove)); 60Debug.Assert(AnalysisEntities.Count > 1); 61Debug.Assert(Kind.IsKnown()); 68Debug.Assert(entitiesToRemove.All(AnalysisEntities.Contains)); 69Debug.Assert(AnalysisEntities.Count > 1); 70Debug.Assert(Kind.IsKnown());
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAnalysis.CopyAbstractValueDomain.cs (4)
73Debug.Assert(value1.Kind.IsKnown()); 74Debug.Assert(value2.Kind.IsKnown()); 83Debug.Assert(_entitiesDomain.Equals(mergedEntities, value1.AnalysisEntities)); 88Debug.Assert(_entitiesDomain.Equals(mergedEntities, value2.AnalysisEntities));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAnalysis.CopyDataFlowOperationVisitor.cs (7)
157Debug.Assert(ReferenceEquals(sourceCopyAnalysisData, targetCopyAnalysisData) || fromPredicateKind.HasValue); 181Debug.Assert(existingValue.AnalysisEntities.Contains(analysisEntity)); 319Debug.Assert(operation.Parameter?.RefKind is RefKind.Ref or RefKind.Out); 453Debug.Assert(SymbolEqualityComparer.Default.Equals(throwBranchWithExceptionType.ExceptionType, ExceptionNamedType)); 545Debug.Assert(copyValue.AnalysisEntities.Contains(key)); 546Debug.Assert(predicate == null || copyValue.AnalysisEntities.All(predicate)); 628Debug.Assert(!inference.AlwaysSucceed || !inference.AlwaysFail);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\CopyAnalysis\CopyAnalysisData.cs (9)
52Debug.Assert(IsReachableBlockData || !data.IsReachableBlockData); 93Debug.Assert(HasPredicatedData); 169Debug.Assert(newCopyEntities.SetEquals(currentValue.AnalysisEntities)); 180Debug.Assert(predicatedData.All(kvp => kvp.Value.AnalysisEntities.IsSubsetOf(coreAnalysisData[kvp.Key].AnalysisEntities))); 206Debug.Assert(!coreCopyAnalysisData.IsDisposed); 212Debug.Assert(kvp.Value.AnalysisEntities.Contains(kvp.Key)); 216Debug.Assert(map[analysisEntity] == kvp.Value); 228Debug.Assert(kvp.Value.AnalysisEntities.Contains(defaultCopyValyeEntity)); 229Debug.Assert(map.ContainsKey(defaultCopyValyeEntity));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAbstractValue.cs (6)
26Debug.Assert(kind != DisposeAbstractValueKind.Disposed); 38Debug.Assert(Kind != DisposeAbstractValueKind.NotDisposable); 45Debug.Assert(Kind != DisposeAbstractValueKind.NotDisposable); 46Debug.Assert(Kind != DisposeAbstractValueKind.Unknown); 60Debug.Assert(disposingOrEscapingOperations.IsEmpty); 66Debug.Assert(!disposingOrEscapingOperations.IsEmpty);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAnalysis.cs (2)
58Debug.Assert(!analyzerOptions.IsConfiguredToSkipAnalysis(rule, owningSymbol, wellKnownTypeProvider.Compilation)); 98Debug.Assert(wellKnownTypeProvider.TryGetOrCreateTypeByMetadataName(WellKnownTypeNames.SystemIDisposable, out _));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAnalysis.DisposeAbstractValueDomain.cs (2)
83Debug.Assert(!mergedDisposingOperations.IsEmpty); 89Debug.Assert(!value1.DisposingOrEscapingOperations.IsEmpty || !value2.DisposingOrEscapingOperations.IsEmpty);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAnalysis.DisposeDataFlowOperationVisitor.cs (8)
36Debug.Assert(IDisposableNamedType != null); 37Debug.Assert(CollectionNamedTypes.All(ct => ct.TypeKind == TypeKind.Interface)); 38Debug.Assert(analysisContext.DisposeOwnershipTransferLikelyTypes != null); 39Debug.Assert(analysisContext.PointsToAnalysisResult != null); 181Debug.Assert(!escapedLocations.IsEmpty); 182Debug.Assert(parameter.RefKind != RefKind.None); 190Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 427Debug.Assert(disposedState == DisposeAbstractValue.NotDisposed);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\DisposeAnalysis\DisposeAnalysisContext.cs (3)
99Debug.Assert(pointsToAnalysisResult != null); 100Debug.Assert(copyAnalysisResult == null); 101Debug.Assert(valueContentAnalysisResult == null);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\GlobalFlowStateAnalysis\GlobalFlowStateAnalysis.GlobalFlowStateAnalysisValueSetDomain.cs (5)
78Debug.Assert(value1.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 79Debug.Assert(value2.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 144Debug.Assert(value1.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 145Debug.Assert(value2.Kind == GlobalFlowStateAnalysisValueSetKind.Known); 228Debug.Assert(value1.Height == value2.Height);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\GlobalFlowStateAnalysis\GlobalFlowStateAnalysisValueSet.cs (13)
33Debug.Assert((!analysisValues.IsEmpty || !parents.IsEmpty) == (kind == GlobalFlowStateAnalysisValueSetKind.Known)); 34Debug.Assert(analysisValues.All(value => value != null)); 35Debug.Assert(parents.All(parent => parent != null)); 36Debug.Assert(height >= 0); 37Debug.Assert(height == 0 || kind == GlobalFlowStateAnalysisValueSetKind.Known); 38Debug.Assert(height == 0 == parents.IsEmpty); 51Debug.Assert(!analysisValues.IsEmpty || !parents.IsEmpty); 65Debug.Assert(Kind == GlobalFlowStateAnalysisValueSetKind.Known); 89Debug.Assert(Kind != GlobalFlowStateAnalysisValueSetKind.Unknown); 107Debug.Assert(Kind == GlobalFlowStateAnalysisValueSetKind.Known); 135Debug.Assert(AnalysisValues.Count > 1); 136Debug.Assert(parentsBuilder.Count > 1); 145Debug.Assert(parents.Count > 0);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\GlobalFlowStateAnalysis\GlobalFlowStateDataFlowOperationVisitor.cs (1)
86Debug.Assert(input.ContainsKey(GlobalEntity));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\GlobalFlowStateAnalysis\GlobalFlowStateValueSetFlowOperationVisitor.cs (2)
45Debug.Assert(HasPredicatedGlobalState || !negate); 63Debug.Assert(HasPredicatedGlobalState || value.Parents.IsEmpty);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ParameterValidationAnalysis\ParameterValidationAnalysis.cs (1)
41Debug.Assert(!analyzerOptions.IsConfiguredToSkipAnalysis(rule, owningSymbol, compilation));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ParameterValidationAnalysis\ParameterValidationAnalysis.ParameterValidationDataFlowOperationVisitor.cs (7)
34Debug.Assert(analysisContext.OwningSymbol.Kind == SymbolKind.Method); 35Debug.Assert(analysisContext.PointsToAnalysisResult != null); 176Debug.Assert(_hazardousParameterUsageBuilder != null); 193Debug.Assert(IsNotOrMaybeValidatedLocation(location)); 290Debug.Assert(!targetMethod.IsLambdaOrLocalFunctionOrDelegate()); 319Debug.Assert(!targetMethod.IsVirtual && !targetMethod.IsOverride); 358Debug.Assert(targetMethod.MethodKind is MethodKind.LambdaMethod or MethodKind.LocalFunction);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ParameterValidationAnalysis\ParameterValidationAnalysisContext.cs (3)
76Debug.Assert(pointsToAnalysisResult != null); 77Debug.Assert(copyAnalysisResult == null); 78Debug.Assert(valueContentAnalysisResult == null);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAbstractValue.cs (16)
33Debug.Assert(!locations.IsEmpty); 34Debug.Assert(locations.All(location => !location.IsNull) || nullState != NullAbstractValue.NotNull); 35Debug.Assert(nullState != NullAbstractValue.Undefined); 36Debug.Assert(nullState != NullAbstractValue.Invalid); 37Debug.Assert(!locations.Any(l => l.IsAnalysisEntityDefaultLocation && l.AnalysisEntity!.HasUnknownInstanceLocation)); 38Debug.Assert(locations.Count <= LocationThreshold); 48Debug.Assert(!lValueCapturedOperations.IsEmpty); 58Debug.Assert(kind != PointsToAbstractValueKind.KnownLocations); 59Debug.Assert(kind != PointsToAbstractValueKind.KnownLValueCaptures); 82Debug.Assert(!locations.IsEmpty); 114Debug.Assert(!lValueCapturedOperations.IsEmpty); 120Debug.Assert(Kind != PointsToAbstractValueKind.KnownLValueCaptures); 147Debug.Assert(Kind != PointsToAbstractValueKind.KnownLValueCaptures); 164Debug.Assert(Kind != PointsToAbstractValueKind.KnownLValueCaptures); 165Debug.Assert(NullState != NullAbstractValue.Null); 177Debug.Assert(Locations.All(location => !location.IsNull));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysis.CorePointsToAnalysisDataDomain.cs (2)
122Debug.Assert(Compare(forwardEdgeAnalysisData.CoreAnalysisData, resultMap) <= 0); 123Debug.Assert(Compare(backEdgeAnalysisData.CoreAnalysisData, resultMap) <= 0);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysis.cs (1)
100Debug.Assert(pointsToAnalysisKind != PointsToAnalysisKind.None);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysis.PointsToAbstractValueDomain.cs (5)
127Debug.Assert(value2.Kind == PointsToAbstractValueKind.KnownLValueCaptures); 133Debug.Assert(value1.Kind == PointsToAbstractValueKind.KnownLocations); 134Debug.Assert(value2.Kind == PointsToAbstractValueKind.KnownLocations); 141Debug.Assert(Compare(value1, result) <= 0); 142Debug.Assert(Compare(value2, result) <= 0);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysis.PointsToAnalysisDomain.cs (1)
39Debug.Assert(forwardEdgeAnalysisData.IsReachableBlockData == backEdgeAnalysisData.IsReachableBlockData);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysis.PointsToDataFlowOperationVisitor.cs (16)
91Debug.Assert(!ShouldBeTracked(analysisEntity)); 92Debug.Assert(!CurrentAnalysisData.TryGetValue(analysisEntity, out var existingValue) || existingValue == PointsToAbstractValue.NoLocation); 177Debug.Assert(ShouldBeTracked(analysisEntity) || !HasAbstractValue(analysisEntity)); 183Debug.Assert(value == _defaultPointsToValueGenerator.GetOrCreateDefaultValue(analysisEntity)); 184Debug.Assert(!CurrentAnalysisData.TryGetValue(analysisEntity, out var currentValue) || 254Debug.Assert(DataFlowAnalysisContext.InterproceduralAnalysisData == null); 282Debug.Assert(operation.Type == null || !operation.Type.IsNonNullableValueType() || defaultValue == PointsToAbstractValue.NoLocation); 289Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 451Debug.Assert(!targetAnalysisData.HasAbstractValue(key)); 452Debug.Assert(!sourceAnalysisData.HasAbstractValue(key)); 514Debug.Assert(IsValidValueForPredicateAnalysis(nullState) || nullState == NullAbstractValue.Invalid); 563Debug.Assert(IsValidValueForPredicateAnalysis(value)); 791Debug.Assert(value.NullState == NullAbstractValue.NotNull || DataFlowAnalysisContext.InterproceduralAnalysisData != null); 893Debug.Assert(operation.Initializer == null || initializerValue == pointsToAbstractValue); 1193Debug.Assert(!inference.AlwaysSucceed || !inference.AlwaysFail); 1214Debug.Assert(!inference.IsUnboxing);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysisContext.cs (3)
42Debug.Assert(pointsToAnalysisKind != PointsToAnalysisKind.None); 76Debug.Assert(pointsToAnalysisResult == null); 77Debug.Assert(valueContentAnalysisResult == null);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\PointsToAnalysisData.cs (6)
76Debug.Assert(IsReachableBlockData || !data.IsReachableBlockData); 108Debug.Assert(key.CaptureId == null); 126Debug.Assert(!corePointsToAnalysisData.IsDisposed); 141Debug.Assert(value.Kind != PointsToAbstractValueKind.Undefined); 142Debug.Assert(!key.IsLValueFlowCaptureEntity || value.Kind == PointsToAbstractValueKind.KnownLValueCaptures); 143Debug.Assert(PointsToAnalysis.ShouldBeTracked(key, PointsToAnalysisKind.Complete, isDisposable));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PointsToAnalysis\TrackedEntitiesBuilder.cs (2)
33Debug.Assert(pointsToAnalysisKind != PointsToAnalysisKind.None); 50Debug.Assert(analysisEntity.ShouldBeTrackedForPointsToAnalysis(PointsToAnalysisKind));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAbstractValue.cs (1)
154Debug.Assert(index >= 0);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAnalysis.cs (1)
203Debug.Assert(success);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAnalysis.PropertySetDataFlowOperationVisitor.cs (4)
60Debug.Assert(analysisContext.PointsToAnalysisResult != null); 78Debug.Assert(this.TrackedTypeSymbols.Any()); 173Debug.Assert(this.DataFlowAnalysisContext.ValueContentAnalysisResult != null); 300Debug.Assert(this.DataFlowAnalysisContext.ValueContentAnalysisResult != null);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAnalysisContext.cs (2)
115Debug.Assert(pointsToAnalysisResult != null); 116Debug.Assert(copyAnalysisResult == null);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataAbstractValue.cs (3)
77Debug.Assert(value1.Kind == TaintedDataAbstractValueKind.Tainted); 78Debug.Assert(value2.Kind == TaintedDataAbstractValueKind.Tainted); 95Debug.Assert(value.Kind == TaintedDataAbstractValueKind.Tainted);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataAnalysis.TaintedDataOperationVisitor.cs (1)
466Debug.Assert(!this.TryGetInterproceduralAnalysisResult(invocationOperation, out _));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\TaintedDataAnalysis\TaintedDataAnalysisContext.cs (2)
58Debug.Assert(pointsToAnalysisResult != null); 81Debug.Assert(pointsToAnalysisResult != null);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAbstractValue.cs (4)
204Debug.Assert(value1 == ValueContainsNonLiteralState.No); 205Debug.Assert(value2 == ValueContainsNonLiteralState.No); 241Debug.Assert(IsLiteralState); 242Debug.Assert(value2.IsLiteralState);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAnalysis.CoreAnalysisDataDomain.cs (2)
52Debug.Assert(Compare(forwardEdgeAnalysisData, resultMap) <= 0); 53Debug.Assert(Compare(backEdgeAnalysisData, resultMap) <= 0);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAnalysis.cs (1)
64Debug.Assert(!analyzerOptions.IsConfiguredToSkipAnalysis(rule, owningSymbol, wellKnownTypeProvider.Compilation));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAnalysis.ValueContentAnalysisDomain.cs (1)
35Debug.Assert(forwardEdgeAnalysisData.IsReachableBlockData == backEdgeAnalysisData.IsReachableBlockData);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\ValueContentAnalysis\ValueContentAnalysisContext.cs (1)
82Debug.Assert(valueContentAnalysisResult == null);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AbstractDataFlowAnalysisContext.cs (5)
46Debug.Assert(owningSymbol.Kind is SymbolKind.Method or 50Debug.Assert(Equals(owningSymbol.OriginalDefinition, owningSymbol)); 51Debug.Assert(pointsToAnalysisResult == null || 53Debug.Assert(copyAnalysisResult == null || 55Debug.Assert(valueContentAnalysisResult == null ||
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AbstractLocation.cs (4)
37Debug.Assert(isSpecialSingleton ^ (locationType != null)); 50Debug.Assert(creation != null ^ symbol != null ^ analysisEntity != null ^ captureId != null); 51Debug.Assert(locationType != null); 129Debug.Assert(Creation != null);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AbstractLocationDataFlowOperationVisitor.cs (5)
25Debug.Assert(analysisContext.PointsToAnalysisResult != null); 43Debug.Assert(DataFlowAnalysisContext.InterproceduralAnalysisData != null); 69Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 99Debug.Assert(Equals(analysisEntity.Symbol, parameter)); 109Debug.Assert(SymbolEqualityComparer.Default.Equals(analysisEntity.Symbol, parameter));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AddressSharedEntitiesProvider.cs (1)
85Debug.Assert(builder.All(e => !e.HasUnknownInstanceLocation));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntity.cs (16)
49Debug.Assert(!indices.IsDefault); 50Debug.Assert(symbol != null || !indices.IsEmpty || instanceReferenceOperationSyntax != null || captureId.HasValue); 51Debug.Assert(parent == null || parent.Type.HasValueCopySemantics() || !indices.IsEmpty); 52Debug.Assert(entityForInstanceLocation == null || parent == null); 53Debug.Assert(entityForInstanceLocation == null || location.Kind == PointsToAbstractValueKind.KnownLocations); 72Debug.Assert(symbol != null || !indices.IsEmpty); 79Debug.Assert(instanceReferenceOperation != null); 97Debug.Assert(symbol != null || !indices.IsEmpty); 98Debug.Assert(parent == null || parent.InstanceLocation == instanceLocation); 99Debug.Assert(entityForInstanceLocation == null || instanceLocation.Kind == PointsToAbstractValueKind.KnownLocations); 119Debug.Assert(instanceLocation.Locations.Count == 1); 120Debug.Assert(instanceLocation.Locations.Single().Creation == null); 121Debug.Assert(Equals(instanceLocation.Locations.Single().Symbol, typeSymbol)); 128Debug.Assert(EqualsIgnoringInstanceLocation(analysisEntityToMerge)); 129Debug.Assert(!InstanceLocation.Equals(analysisEntityToMerge.InstanceLocation)); 160Debug.Assert(Parent == null || result);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntityBasedPredicateAnalysisData.cs (3)
44Debug.Assert(data1.IsReachableBlockData == data2.IsReachableBlockData); 95Debug.Assert(!CoreAnalysisData.IsDisposed); 96AssertValidPredicatedAnalysisData(map => Debug.Assert(!map.IsDisposed));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntityDataFlowOperationVisitor.cs (20)
34Debug.Assert(!analysisContext.PredicateAnalysis || SupportsPredicateAnalysis); 66Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 82Debug.Assert(operation.Parameter!.RefKind is RefKind.Ref or RefKind.Out); 103Debug.Assert(locals.Any() || flowCaptures.Any()); 157Debug.Assert(analysisEntity.Symbol is IParameterSymbol parameter && parameter.IsParams); 258Debug.Assert(success || assignedValueEntity == null); 280Debug.Assert(addressSharedCopyValue.AnalysisEntities.Contains(targetAnalysisEntity)); 294Debug.Assert(SymbolEqualityComparer.Default.Equals(analysisEntity.Symbol, parameter)); 307Debug.Assert(Equals(analysisEntity.Symbol, parameter)); 328Debug.Assert(HasPointsToAnalysisResult); 329Debug.Assert(analysisEntity.Type.HasValueCopySemantics()); 337Debug.Assert(HasPointsToAnalysisResult); 362Debug.Assert(HasPointsToAnalysisResult); 363Debug.Assert(targetAnalysisEntity.Type.HasValueCopySemantics()); 411Debug.Assert(analysisEntity.Type.HasValueCopySemantics()); 571Debug.Assert(ShouldProcessPointsToValue(pointsToValue)); 688Debug.Assert(DataFlowAnalysisContext.InterproceduralAnalysisData != null); 742Debug.Assert(throwBranchWithExceptionType.ExceptionType.Equals(ExceptionNamedType)); 769Debug.Assert(tupleOperation.Elements.Length == tupleElementEntities.Length); 776Debug.Assert(tupleElementEntity.Symbol is IFieldSymbol field);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntityFactory.cs (8)
313Debug.Assert(symbol.Kind is SymbolKind.Local or SymbolKind.Parameter or SymbolKind.Field or SymbolKind.Property); 352Debug.Assert(parentTupleOperationOpt.Elements.Length == parentTupleElementEntities.Length); 372Debug.Assert(parentEntity.InstanceLocation == instanceLocation); 399Debug.Assert(!indices.IsEmpty); 421Debug.Assert(_interproceduralCallStack.Last().Descendants().Contains(flowCaptureOrReference)); 425Debug.Assert(_controlFlowGraph.DescendantOperations().Contains(flowCaptureOrReference)); 442Debug.Assert(symbol != null || !indices.IsEmpty); 519Debug.Assert(symbol.Kind == SymbolKind.Local || symbol.Kind == SymbolKind.Parameter || symbol.IsStatic || symbol.IsLambdaOrLocalFunction());
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\AnalysisEntityMapAbstractDomain.cs (16)
99Debug.Assert(!map2.ContainsKey(key1)); 100Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 164Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 165Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 185Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 186Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 194Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 206Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 213Debug.Assert(!map1.ContainsKey(newKey)); 214Debug.Assert(!map2.ContainsKey(newKey)); 226Debug.Assert(Compare(map1, resultMap) <= 0); 227Debug.Assert(Compare(map2, resultMap) <= 0); 247Debug.Assert(values.Count > 0); 259Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0); 260Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0); 267Debug.Assert(isNewKey == (!map1.ContainsKey(key) && !map2.ContainsKey(key)));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowAnalysis.cs (16)
234Debug.Assert(tryRegion.Kind == ControlFlowRegionKind.Try); 261Debug.Assert(needsAtLeastOnePass); 268Debug.Assert(!currentInfeasibleData.IsDisposed); 279Debug.Assert(enclosingTryAndCatchRegion.Kind == ControlFlowRegionKind.TryAndCatch); 280Debug.Assert(block.EnclosingRegion.Kind is ControlFlowRegionKind.Catch or ControlFlowRegionKind.Filter); 281Debug.Assert(block.EnclosingRegion.FirstBlockOrdinal == block.Ordinal); 282Debug.Assert(!catchBlockInput.IsDisposed); 353Debug.Assert(finallyRegion.Kind == ControlFlowRegionKind.Finally); 381Debug.Assert(!ReferenceEquals(dataToDispose, newSuccessorInput)); 440Debug.Assert(currentSuccessorInput == null || AnalysisDomain.Compare(currentSuccessorInput, newSuccessorInput) <= 0); 456Debug.Assert(dominatorBlockOrdinal >= block.Ordinal); 457Debug.Assert(dominatorBlockOrdinal >= successorBlock.Ordinal); 471Debug.Assert(IsValidWorklistState()); 493Debug.Assert(tryAndCatchRegion.Kind == ControlFlowRegionKind.TryAndCatch); 628Debug.Assert(basicBlock.EnclosingRegion.Kind == ControlFlowRegionKind.Finally); 730Debug.Assert(finallyRegion.Kind == ControlFlowRegionKind.Finally);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowAnalysisResult.cs (3)
118Debug.Assert(operation.GetAncestor<IBlockOperation>(OperationKind.Block, predicate: b => b.Parent == null) == null); 159Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction); 170Debug.Assert(lambdaOrLocalFunctionOperation.Kind is OperationKind.AnonymousFunction or OperationKind.LocalFunction);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (97)
177Debug.Assert(!_currentAnalysisData.IsDisposed); 182Debug.Assert(!value.IsDisposed); 191Debug.Assert(_currentBasicBlock != null); 234Debug.Assert(ExceptionNamedType != null); 430Debug.Assert(_pendingArgumentsToReset.Count == 0); 431Debug.Assert(_pendingArgumentsToPostProcess.Count == 0); 551Debug.Assert(entryBlock.Kind == BasicBlockKind.Entry); 564Debug.Assert(result); 584Debug.Assert(exitBlock.Kind == BasicBlockKind.Exit); 634Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction); 635Debug.Assert(DataFlowAnalysisContext.ControlFlowGraph.LocalFunctions.Contains(localFunction)); 643Debug.Assert(_visitedLambdas.Contains(lambda)); 651Debug.Assert(exitBlock.Kind == BasicBlockKind.Exit); 745Debug.Assert(branch.ControlFlowConditionKind != ControlFlowConditionKind.None); 788Debug.Assert(branch.ControlFlowConditionKind != ControlFlowConditionKind.None); 823Debug.Assert(implicitTaskPointsToValueOpt.Kind == PointsToAbstractValueKind.KnownLocations); 852Debug.Assert(ExecutingExceptionPathsAnalysisPostPass); 853Debug.Assert(!SkipExceptionPathsAnalysisPostPass); 932Debug.Assert(ExecutingExceptionPathsAnalysisPostPass); 933Debug.Assert(!SkipExceptionPathsAnalysisPostPass); 962Debug.Assert(locals.Any() || flowCaptures.Any()); 1004/// Checks if the method is an overload of the <see cref="Debug.Assert(bool)"/> method. 1007/// <returns>True if the method is an overlaod of the <see cref="Debug.Assert(bool)"/> method.</returns> 1141Debug.Assert(parameterEntity.Symbol?.Kind == SymbolKind.Parameter); 1154Debug.Assert(CurrentBasicBlock.Kind == BasicBlockKind.Entry); 1358Debug.Assert(PredicateAnalysis); 1364Debug.Assert(PredicateAnalysis); 1388Debug.Assert(PredicateAnalysis); 1389Debug.Assert(operation.Kind is OperationKind.BinaryOperator or 1436Debug.Assert(result); 1439Debug.Assert(HasPredicatedDataForEntity(flowCaptureReferenceEntity)); 1453Debug.Assert(!ReferenceEquals(truePredicatedData, CurrentAnalysisData)); 1458Debug.Assert(!ReferenceEquals(falsePredicatedData, CurrentAnalysisData)); 1491Debug.Assert(IsContractCheckArgument((IArgumentOperation)operation)); 1529Debug.Assert(targetEntity.CaptureId != null); 1546Debug.Assert(PredicateAnalysis); 1547Debug.Assert(FlowBranchConditionKind != ControlFlowConditionKind.None); 1670Debug.Assert(IsContractCheckArgument(argument)); 1684Debug.Assert(result); 1827Debug.Assert(PredicateAnalysis); 1852Debug.Assert(PredicateAnalysis); 1853Debug.Assert(operation.IsComparisonOperator()); 1854Debug.Assert(FlowBranchConditionKind != ControlFlowConditionKind.None); 1896Debug.Assert(PredicateAnalysis); 1902Debug.Assert(PredicateAnalysis); 1908Debug.Assert(PredicateAnalysis); 1914Debug.Assert(PredicateAnalysis); 1923Debug.Assert(PredicateAnalysis); 1929Debug.Assert(PredicateAnalysis); 1935Debug.Assert(PredicateAnalysis); 1951Debug.Assert(IsLValueFlowCaptureReference(flowCaptureReference)); 2026Debug.Assert(HasPointsToAnalysisResult); 2027Debug.Assert(operation.Type!.HasValueCopySemantics()); 2045Debug.Assert(HasPointsToAnalysisResult); 2046Debug.Assert(!operation.Type!.HasValueCopySemantics()); 2268Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph); 2269Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph); 2270Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph); 2333Debug.Assert(arguments.All(arg => !_pendingArgumentsToReset.Contains(arg))); 2348Debug.Assert(popped == originalOperation); 2395Debug.Assert(arguments.All(_pendingArgumentsToReset.Contains)); 2485Debug.Assert(originalOperation.Kind == OperationKind.ObjectCreation); 2516Debug.Assert(arguments.Length == invokedMethod.Parameters.Length); 2558Debug.Assert(invokedMethod.Parameters.Length == method.GetParameters().Length || 2624Debug.Assert(success); 2635Debug.Assert(IsStandaloneAnalysisRequiredForLocalFunction(localFunction)); 2653Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph); 2654Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph); 2655Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph); 2685Debug.Assert(IsStandaloneAnalysisRequiredForLambda(lambda)); 2703Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph); 2704Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph); 2705Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph); 3000Debug.Assert(result); 3009Debug.Assert(HasPredicatedDataForEntity(flowCaptureReferenceEntity)); 3035Debug.Assert(flowCaptureEntity.CaptureId != null); 3079Debug.Assert(FlowBranchConditionKind == ControlFlowConditionKind.None); 3241Debug.Assert(!arguments.IsEmpty); 3260Debug.Assert(arguments.Length >= 2); 3284Debug.Assert(IsPointsToAnalysis); 3328Debug.Assert(operation != null ^ invocationTarget != null); 3339Debug.Assert(invocation.Instance == null); 3347Debug.Assert(targetMethod.MethodKind is MethodKind.LambdaMethod or 3381Debug.Assert(knownTargetInvocations); 3388Debug.Assert(knownTargetInvocations); 3395Debug.Assert(knownTargetInvocations); 3417Debug.Assert(knownTargetInvocations); 3462Debug.Assert(methodTargetsOptBuilder.Count > 0 || lambdaTargets.Count > 0); 3480Debug.Assert(!ReferenceEquals(oldMergedAnalysisData, CurrentAnalysisData)); 3492Debug.Assert(!ReferenceEquals(oldMergedAnalysisData, CurrentAnalysisData)); 3496Debug.Assert(mergedCurrentAnalysisData == null || ReferenceEquals(mergedCurrentAnalysisData, CurrentAnalysisData)); 3587Debug.Assert(_interproceduralResultsBuilder.ContainsKey(originalOperation)); 3605Debug.Assert(_interproceduralResultsBuilder.ContainsKey(originalOperation)); 3682Debug.Assert(elementEntities.Length == elementValueBuilder.Count); 3683Debug.Assert(elementEntities.Length == operation.Elements.Length); 3761Debug.Assert(caughtExceptionType != null || CurrentBasicBlock.IsFirstBlockOfFinally(out _)); 3794Debug.Assert(CurrentBasicBlock.IsFirstBlockOfFinally(out _));
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DictionaryAnalysisData.cs (17)
35Debug.Assert(!IsDisposed); 43Debug.Assert(!IsDisposed); 48Debug.Assert(!IsDisposed); 57Debug.Assert(!IsDisposed); 71Debug.Assert(!IsDisposed); 80Debug.Assert(!IsDisposed); 87Debug.Assert(!IsDisposed); 93Debug.Assert(!IsDisposed); 99Debug.Assert(!IsDisposed); 105Debug.Assert(!IsDisposed); 111Debug.Assert(!IsDisposed); 117Debug.Assert(!IsDisposed); 123Debug.Assert(!IsDisposed); 129Debug.Assert(!IsDisposed); 135Debug.Assert(!IsDisposed); 143Debug.Assert(!IsDisposed); 149Debug.Assert(!IsDisposed);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\PerEntityPredicatedAnalysisData.cs (1)
22Debug.Assert(truePredicatedData != null || falsePredicatedData != null);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\PredicateAnalysisEntityDataFlowOperationVisitor.cs (2)
30Debug.Assert(PredicateAnalysis); 33Debug.Assert(!isReachable || predicatedData.IsReachableBlockData);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\PredicatedAnalysisData.cs (11)
65Debug.Assert(!_lazyPredicateDataMap.IsDisposed); 71Debug.Assert(!value.TruePredicatedData.IsDisposed); 72Debug.Assert(builder.Add(value.TruePredicatedData)); 77Debug.Assert(!value.FalsePredicatedData.IsDisposed); 78Debug.Assert(builder.Add(value.FalsePredicatedData)); 91Debug.Assert(predicatedEntity.IsCandidatePredicateEntity()); 105Debug.Assert(HasPredicatedDataForEntity(predicatedEntity)); 128Debug.Assert(HasPredicatedDataForEntity(fromEntity)); 144Debug.Assert(HasPredicatedDataForEntity(predicatedEntity)); 175Debug.Assert(HasPredicatedData); 437Debug.Assert(_lazyPredicateDataMap.IsDisposed);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\ThrownExceptionInfo.cs (2)
50Debug.Assert(enclosingRegion.NestedRegions[0].Kind == ControlFlowRegionKind.Try); 71Debug.Assert(interproceduralCallStack != InterproceduralCallStack);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
74Debug.Assert(!string.IsNullOrEmpty(sectionName)); 91Debug.Assert(!string.IsNullOrEmpty(key)); 92Debug.Assert(key == key.Trim()); 93Debug.Assert(value == value.Trim());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.cs (1)
313Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
79Debug.Assert(expectedValueText == actualValueText); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 219Debug.Assert(char.IsSurrogate(ch));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
104Debug.Assert(index + 1 >= data.Length ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
196Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 197Debug.Assert(_span.End == virtualChars._span.Start); 208Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 215Debug.Assert(branch.Destination == null); 220Debug.Assert(branch.Destination == null); 226Debug.Assert(branch.Destination != null); 257Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 261Debug.Assert(enclosing.NestedRegions[0] == region); 262Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 279Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 324Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 325Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 347Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 349Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 373Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(startAt > 0); 375Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 389Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 390Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 144Debug.Assert(cfg.Parent != null); 145Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 146Debug.Assert(parentAnalysisData != null); 303Debug.Assert(lambdaOrLocalFunctionCfg != null); 313Debug.Assert(anonymousFunctionCfg != null); 322Debug.Assert(localFunction.IsLocalFunction()); 330Debug.Assert(localFunctionCfg != null); 346Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 487Debug.Assert(localFunction.IsLocalFunction()); 488Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 578Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (3)
92Debug.Assert(BitConverter.IsLittleEndian); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (17)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1082Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1083Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1168Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (3)
85Debug.Assert(current < length); 107Debug.Assert(current < length); 126Debug.Assert(char.IsUpper(identifier[current - 1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
134Debug.Assert(similarityWeight <= _threshold);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Microsoft.CodeAnalysis.BannedApiAnalyzers (493)
RestrictedInternalsVisibleToAnalyzer.cs (1)
255Debug.Assert(saved == banned);
src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (11)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 309Debug.Assert(this.Count >= 1); 343Debug.Assert(_count >= 1);
src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
27Debug.Assert(childrenCount != 0);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
503Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 515Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (6)
211Debug.Assert(isInsideAnonymousObjectInitializer == 289Debug.Assert(success); 290Debug.Assert(cfg != null); 334Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 496Debug.Assert(parameterIndex >= 0); 497Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
47Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
74Debug.Assert(!string.IsNullOrEmpty(sectionName)); 91Debug.Assert(!string.IsNullOrEmpty(key)); 92Debug.Assert(key == key.Trim()); 93Debug.Assert(value == value.Trim());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.cs (1)
313Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
79Debug.Assert(expectedValueText == actualValueText); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 219Debug.Assert(char.IsSurrogate(ch));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
104Debug.Assert(index + 1 >= data.Length ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
196Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 197Debug.Assert(_span.End == virtualChars._span.Start); 208Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 215Debug.Assert(branch.Destination == null); 220Debug.Assert(branch.Destination == null); 226Debug.Assert(branch.Destination != null); 257Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 261Debug.Assert(enclosing.NestedRegions[0] == region); 262Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 279Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 324Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 325Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 347Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 349Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 373Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(startAt > 0); 375Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 389Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 390Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 144Debug.Assert(cfg.Parent != null); 145Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 146Debug.Assert(parentAnalysisData != null); 303Debug.Assert(lambdaOrLocalFunctionCfg != null); 313Debug.Assert(anonymousFunctionCfg != null); 322Debug.Assert(localFunction.IsLocalFunction()); 330Debug.Assert(localFunctionCfg != null); 346Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 487Debug.Assert(localFunction.IsLocalFunction()); 488Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 578Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (3)
92Debug.Assert(BitConverter.IsLittleEndian); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (17)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1082Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1083Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1168Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (3)
85Debug.Assert(current < length); 107Debug.Assert(current < length); 126Debug.Assert(char.IsUpper(identifier[current - 1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
134Debug.Assert(similarityWeight <= _threshold);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
342Debug.Assert(desiredGroupIndex >= 0); 343Debug.Assert(desiredGroupIndex <= declarationList.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
42Debug.Assert(!isInitOnly || methodKind == MethodKind.PropertySet);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (3)
49Debug.Assert(diagnostic != null); 103Debug.Assert(analyzerConfigPath != null); 104Debug.Assert(PathUtilities.IsAbsolute(analyzerConfigPath));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
74Debug.Assert(!semanticModel.IsSpeculativeSemanticModel);
Microsoft.CodeAnalysis.CodeStyle (500)
src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer.cs (2)
75Debug.Assert(options.Count > 1); 87Debug.Assert(option is { Definition.DefaultValue: ICodeStyleOption2 } == descriptor.CustomTags.Contains(WellKnownDiagnosticTags.CustomSeverityConfigurable));
src\Analyzers\Core\Analyzers\AbstractBuiltInCodeStyleDiagnosticAnalyzer_Core.cs (4)
29Debug.Assert(!isUnnecessary || this is AbstractBuiltInUnnecessaryCodeStyleDiagnosticAnalyzer); 43Debug.Assert(!supportedDiagnostics.Any(descriptor => descriptor.CustomTags.Any(t => t == WellKnownDiagnosticTags.Unnecessary)) || this is AbstractBuiltInUnnecessaryCodeStyleDiagnosticAnalyzer); 161Debug.Assert(_minimumReportedSeverity != null); 245Debug.Assert(editorConfigSeverity != null);
src\Analyzers\Core\Analyzers\DiagnosticCustomTags.cs (3)
64Debug.Assert(customTags.Length == tags.Length); 68Debug.Assert(customTags[i] == tags[i]); 74Debug.Assert(isConfigurable || enforceOnBuild == EnforceOnBuild.Never);
src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (1)
337Debug.Assert(id.StartsWith("IDE", StringComparison.Ordinal));
src\Analyzers\Core\Analyzers\IDEDiagnosticIdToOptionMappingHelper.cs (4)
51Debug.Assert(perLanguageValuedOption.IsPerLanguage); 87Debug.Assert(!map.TryGetValue(diagnosticId, out var existingOptions) || options.SetEquals(existingOptions)); 88Debug.Assert(options.All(option => option.Definition.IsEditorConfigOption)); 100Debug.Assert(!s_diagnosticIdToFadingOptionMap.TryGetValue(diagnosticId, out var existingOption) || existingOption.Equals(fadingOption));
src\Analyzers\Core\Analyzers\MakeFieldReadonly\AbstractMakeFieldReadonlyDiagnosticAnalyzer.cs (3)
109Debug.Assert(fieldStateMap.ContainsKey(field.OriginalDefinition)); 219Debug.Assert(IsCandidateField(field)); 293Debug.Assert(isInInstanceConstructor);
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
104Debug.Assert(preference.Value == ParenthesesPreference.NeverIfUnnecessary ||
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (4)
422Debug.Assert(!analyzer.IsCompilerAnalyzer()); 454Debug.Assert(semanticModel.Compilation.Options.ReportSuppressedDiagnostics); 554Debug.Assert(diagnostic.Location.IsInSource); 555Debug.Assert(diagnostic.Location.SourceTree == tree);
src\Analyzers\Core\Analyzers\RemoveUnusedMembers\AbstractRemoveUnusedMembersDiagnosticAnalyzer.cs (3)
399Debug.Assert(memberReference.Parent is ICompoundAssignmentOperation compoundAssignment && 539Debug.Assert(IsCandidateSymbol(member)); 540Debug.Assert(!member.IsImplicitlyDeclared);
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs (3)
257Debug.Assert(unusedValueExpressionStatementSeverity.Severity != ReportDiagnostic.Suppress || 318Debug.Assert(TryGetUnusedValuePreference(diagnostic, out _)); 324Debug.Assert(TryGetUnusedValuePreference(diagnostic, out _));
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (4)
259Debug.Assert(operation.Kind is OperationKind.DelegateCreation or OperationKind.AnonymousFunction); 308Debug.Assert(operation.Kind is OperationKind.LocalReference or OperationKind.ParameterReference); 509Debug.Assert(!SymbolUsageAnalysis.Run(context.GetControlFlowGraph(operationBlock), context.OwningSymbol, context.CancellationToken) 594Debug.Assert(symbol is not ILocalSymbol local || !local.IsRef);
src\Analyzers\Core\Analyzers\UseCompoundAssignment\UseCompoundAssignmentUtilities.cs (2)
36Debug.Assert(binaryToAssignmentMap.Count == assignmentToTokenMap.Count); 37Debug.Assert(binaryToAssignmentMap.Values.All(assignmentToTokenMap.ContainsKey));
src\Analyzers\Core\Analyzers\UseSystemHashCode\UseSystemHashCodeDiagnosticAnalyzer.cs (1)
70Debug.Assert(elementCount >= 2 || statements.Length >= 2);
src\Analyzers\Core\Analyzers\ValidateFormatString\AbstractValidateFormatStringDiagnosticAnalyzer.cs (1)
202Debug.Assert(syntaxFacts.IsArgument(argsArgument));
src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (11)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 309Debug.Assert(this.Count >= 1); 343Debug.Assert(_count >= 1);
src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (7)
308Debug.Assert(PeekNextChar() is '(' or '['); 495Debug.Assert(PeekNextChar() == '!'); 542Debug.Assert(bindingContext != null); 657Debug.Assert(PeekNextChar() == '<'); 698Debug.Assert(PeekNextChar() == '['); 884Debug.Assert(type != null); 890Debug.Assert(startIndex >= 0);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
74Debug.Assert(!string.IsNullOrEmpty(sectionName)); 91Debug.Assert(!string.IsNullOrEmpty(key)); 92Debug.Assert(key == key.Trim()); 93Debug.Assert(value == value.Trim());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.cs (1)
313Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
79Debug.Assert(expectedValueText == actualValueText); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 219Debug.Assert(char.IsSurrogate(ch));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
104Debug.Assert(index + 1 >= data.Length ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
196Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 197Debug.Assert(_span.End == virtualChars._span.Start); 208Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 215Debug.Assert(branch.Destination == null); 220Debug.Assert(branch.Destination == null); 226Debug.Assert(branch.Destination != null); 257Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 261Debug.Assert(enclosing.NestedRegions[0] == region); 262Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 279Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 324Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 325Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 347Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 349Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 373Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(startAt > 0); 375Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 389Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 390Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 144Debug.Assert(cfg.Parent != null); 145Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 146Debug.Assert(parentAnalysisData != null); 303Debug.Assert(lambdaOrLocalFunctionCfg != null); 313Debug.Assert(anonymousFunctionCfg != null); 322Debug.Assert(localFunction.IsLocalFunction()); 330Debug.Assert(localFunctionCfg != null); 346Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 487Debug.Assert(localFunction.IsLocalFunction()); 488Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 578Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (3)
92Debug.Assert(BitConverter.IsLittleEndian); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (17)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1082Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1083Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1168Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (3)
85Debug.Assert(current < length); 107Debug.Assert(current < length); 126Debug.Assert(char.IsUpper(identifier[current - 1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
134Debug.Assert(similarityWeight <= _threshold);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Microsoft.CodeAnalysis.CodeStyle.Fixes (24)
src\Analyzers\Core\CodeFixes\ConflictMarkerResolution\AbstractConflictMarkerCodeFixProvider.cs (1)
396Debug.Assert(
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
87Debug.Assert(constructor.Parameters.Length == expressions.Length);
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (1)
224Debug.Assert(syntaxFacts.IsInvocationExpression(invocationExpression));
src\Analyzers\Core\CodeFixes\MatchFolderAndNamespace\AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs (2)
45Debug.Assert(diagnostics.Select(diagnostic => diagnostic.Properties[MatchFolderAndNamespaceConstants.TargetNamespace]).Distinct().Count() == 1); 64Debug.Assert(newSolution != document.Project.Solution);
src\Analyzers\Core\CodeFixes\PopulateSwitch\AbstractPopulateSwitchCodeFixProvider.cs (1)
60Debug.Assert(missingCases || missingDefaultCase);
src\Analyzers\Core\CodeFixes\RemoveUnusedMembers\AbstractRemoveUnusedMembersCodeFixProvider.cs (1)
99Debug.Assert(childDeclarators.All(c => !declarators.Contains(c)));
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (7)
249Debug.Assert(success); 254Debug.Assert(diagnosticId == diagnostic.Id); 255Debug.Assert(AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.TryGetUnusedValuePreference(diagnostic, out var diagnosticPreference) && 257Debug.Assert(removeAssignments == AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.GetIsRemovableAssignmentDiagnostic(diagnostic)); 410Debug.Assert(semanticModel.Language != LanguageNames.VisualBasic); 517Debug.Assert(syntaxFacts.IsLeftSideOfAnyAssignment(node)); 726Debug.Assert(removeAssignments);
src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (2)
132Debug.Assert(fieldDocument.Project == propertyDocument.Project); 189Debug.Assert(fieldDocument.Project == propertyDocument.Project);
src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (1)
285Debug.Assert(syntaxFacts.IsElementAccessExpression(elementAccess));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
342Debug.Assert(desiredGroupIndex >= 0); 343Debug.Assert(desiredGroupIndex <= declarationList.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
42Debug.Assert(!isInitOnly || methodKind == MethodKind.PropertySet);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (3)
49Debug.Assert(diagnostic != null); 103Debug.Assert(analyzerConfigPath != null); 104Debug.Assert(PathUtilities.IsAbsolute(analyzerConfigPath));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
74Debug.Assert(!semanticModel.IsSpeculativeSemanticModel);
Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities (1)
src\Workspaces\CoreTestUtilities\OptionsCollection.cs (1)
40Debug.Assert(optionKey.Option is IOption2 { Definition.StorageMapping: null });
Microsoft.CodeAnalysis.CSharp.CodeStyle (60)
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (1)
273Debug.Assert(ifStatementOrElseClause.IsKind(SyntaxKind.IfStatement));
src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredExpressionParenthesesDiagnosticAnalyzer.cs (1)
58Debug.Assert(IsBinaryLike(binaryLike));
src\Analyzers\CSharp\Analyzers\AddRequiredParentheses\CSharpAddRequiredPatternParenthesesDiagnosticAnalyzer.cs (1)
33Debug.Assert(IsBinaryLike(binaryPattern));
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (1)
135Debug.Assert(labels.Count >= 1);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
189Debug.Assert(initializer.Parent is EqualsValueClauseSyntax);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.InfoCache.cs (2)
70Debug.Assert(IsIntIndexingMethod(method)); 93Debug.Assert(method.MethodKind == MethodKind.Ordinary);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs (1)
132Debug.Assert(IsTwoArgumentSliceLikeMethod(sliceLikeMethod) || IsOneArgumentSliceLikeMethod(sliceLikeMethod));
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (2)
42Debug.Assert(localStatement.IsKind(SyntaxKind.LocalDeclarationStatement)); 43Debug.Assert(enclosingBlock.Kind() is SyntaxKind.Block or SyntaxKind.SwitchSection);
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
377Debug.Assert(constructorDeclaration.Initializer.Kind() == SyntaxKind.ThisConstructorInitializer);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (9)
59Debug.Assert(!token.ContainsDiagnostics); 354Debug.Assert(char.IsSurrogate(ch)); 364Debug.Assert(tokenText[index] == '\\'); 377Debug.Assert(tokenText[index] == '\\'); 411Debug.Assert(tokenText[index] == '\\'); 430Debug.Assert(tokenText[index] == '\\'); 475Debug.Assert(uintChar is > 0x0000FFFF and <= 0x0010FFFF); 515Debug.Assert(character == 'x'); 547Debug.Assert(IsHexDigit(c));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SimpleNameSyntaxExtensions.cs (1)
16Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.IsParentKind(SyntaxKind.NameMemberCref));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (2)
155Debug.Assert(trivia.Kind() == SyntaxKind.WhitespaceTrivia); 156Debug.Assert(trivia.Width() == trivia.FullWidth());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (3)
48Debug.Assert(trivia.ToString() == trivia.ToFullString()); 138Debug.Assert(trivia.ToString() == trivia.ToFullString()); 323Debug.Assert(trivia.HasStructure);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
74Debug.Assert(this.SecondTokenIsFirstTokenOnLine);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (11)
34Debug.Assert(this.TreeInfo.GetTextBetween(default, token).All(IsCSharpWhitespace)); 42Debug.Assert(this.TreeInfo.GetTextBetween(default, token).All(IsCSharpWhitespace)); 54Debug.Assert(this.TreeInfo.GetTextBetween(token, default).All(IsCSharpWhitespace)); 62Debug.Assert(this.TreeInfo.GetTextBetween(token, default).All(IsCSharpWhitespace)); 74Debug.Assert(string.IsNullOrWhiteSpace(this.TreeInfo.GetTextBetween(token1, token2))); 82Debug.Assert(string.IsNullOrWhiteSpace(this.TreeInfo.GetTextBetween(token1, token2))); 140Debug.Assert(result.Tab >= 0); 141Debug.Assert(result.LineBreaks >= 0); 165Debug.Assert(Options.UseTabs); 178Debug.Assert((indentation / Options.TabSize) == result.Tab); 179Debug.Assert((indentation % Options.TabSize) == result.Space);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (1)
98Debug.Assert(_options.Indentation.HasFlag(IndentationPlacement.SwitchCaseContents) != _options.Indentation.HasFlag(IndentationPlacement.SwitchCaseContentsWhenBlock));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
334Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
117Debug.Assert(oldNode.Kind() == newNode.Kind());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
854Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember); 895Debug.Assert(topLevel || methodLevel);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (5)
803Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 1251Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1307Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1337Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1517Debug.Assert(!rewrittenType.IsReferenceType && !IsIntrinsicOrEnum(rewrittenType));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (11)
73Debug.Assert(expression != null); 128Debug.Assert(semanticModel.ParentModel != null); 129Debug.Assert(!semanticModel.ParentModel.IsSpeculativeSemanticModel); 181Debug.Assert(nodeToSpeculate is ExpressionSyntax); 212Debug.Assert(originalParams.Count == replacedParams.Count); 277Debug.Assert(originalIdentifierNodes.Any()); 278Debug.Assert(originalIdentifierNodes.Count() == replacedIdentifierNodes.Count()); 297Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 298Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 372Debug.Assert(newExpression.WhenTrue == previousReplacedNode); 378Debug.Assert(newExpression.WhenFalse == previousReplacedNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (1)
83Debug.Assert(node.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (21)
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
108Debug.Assert(nextStatement.Kind() is SyntaxKind.ThrowStatement or SyntaxKind.ReturnStatement);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (4)
85Debug.Assert(SyntaxFacts.IsAssignmentExpression(nodeToGenerate)); 86Debug.Assert(_assignmentTarget != null); 207Debug.Assert(statements.Count is 1 or 2); 208Debug.Assert(!statements[0].IsKind(SyntaxKind.BreakStatement));
src\Analyzers\CSharp\CodeFixes\DisambiguateSameVariable\CSharpDisambiguateSameVariableCodeFixProvider.cs (1)
82Debug.Assert(leftSymbol.Equals(rightSymbol));
src\Analyzers\CSharp\CodeFixes\FixReturnType\CSharpFixReturnTypeCodeFixProvider.cs (1)
64Debug.Assert(diagnostics.Length == 1);
src\Analyzers\CSharp\CodeFixes\GenerateMethod\GenerateDeconstructMethodCodeFixProvider.cs (1)
101Debug.Assert(!codeActions.IsDefault);
src\Analyzers\CSharp\CodeFixes\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
66Debug.Assert(diagnostic.Properties[Constants.Kind] == Constants.SingleIfStatementForm);
src\Analyzers\CSharp\CodeFixes\MakeMethodAsynchronous\CSharpMakeMethodAsynchronousCodeFixProvider.cs (1)
80Debug.Assert(addAsyncModifier || node is MethodDeclarationSyntax);
src\Analyzers\CSharp\CodeFixes\RemoveConfusingSuppression\CSharpRemoveConfusingSuppressionCodeFixProvider.cs (1)
69Debug.Assert(node.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression);
src\Analyzers\CSharp\CodeFixes\UseImplicitOrExplicitType\UseExplicitTypeCodeFixProvider.cs (2)
182Debug.Assert(typeSymbol.IsTupleType); 184Debug.Assert(elements.Length == parensDesignation.Variables.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
245Debug.Assert(method.ExplicitInterfaceImplementations.Any() || method.IsOverride);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (1)
130Debug.Assert(!endOfLine.IsKind(SyntaxKind.None));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
132Debug.Assert(oldUsings.Count == newUsings.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
242Debug.Assert(IsDiscardDeclaration(variable));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (1)
77Debug.Assert(_seenContextNode);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1704Debug.Assert(expressionOpt != null);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
205Debug.Assert(block.Statements.Count == 0); 240Debug.Assert(IsExpressionBody(body));
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
RawStringLiteral\RawStringLiteralCommandHandler_Return.cs (1)
80Debug.Assert(quotesAfter > 0);
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider (18)
src\Compilers\CSharp\Portable\Parser\CharacterInfo.cs (3)
55Debug.Assert(IsHexDigit(c)); 65Debug.Assert(IsBinaryDigit(c)); 75Debug.Assert(IsDecDigit(c));
src\Compilers\CSharp\Portable\Symbols\Synthesized\GeneratedNameParser.cs (2)
179Debug.Assert((char)GeneratedNameKind.PrimaryConstructorParameter == 'P'); 200Debug.Assert(s_regexPatternString[0] == FileTypeNameStartChar);
src\Compilers\CSharp\Portable\Syntax\SyntaxKindFacts.cs (6)
22Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 151Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 181Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 187Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 193Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 1241Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i));
src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpFormatter.TypeNames.cs (3)
91Debug.Assert(!sawSingleInvalidIdentifier); 102Debug.Assert(rank > 0); 113Debug.Assert(type.IsObject());
src\ExpressionEvaluator\CSharp\Source\ResultProvider\CSharpFormatter.Values.cs (4)
48Debug.Assert(lmrType.IsArray); 111Debug.Assert(!string.IsNullOrEmpty(argument)); 112Debug.Assert(!string.IsNullOrEmpty(type)); 200Debug.Assert(!string.IsNullOrEmpty(type));
Microsoft.CodeAnalysis.Debugging.Package (32)
CustomDebugInfoEncoder.cs (8)
25Debug.Assert(builder.Count == 0); 50Debug.Assert(_recordCount <= byte.MaxValue); 85Debug.Assert(groupSizes.Count <= ushort.MaxValue); 102Debug.Assert(usingCount <= ushort.MaxValue); 152Debug.Assert(info.Flags.Length <= DynamicAttributeSize); 153Debug.Assert(info.LocalName.Length <= IdentifierSize); 172Debug.Assert(infos.Count > 0); 179Debug.Assert((info.SlotIndex == -1) ^ (info.ScopeStart == 0 && info.ScopeEnd == 0));
CustomDebugInfoReader.cs (7)
256Debug.Assert(flagsBuilder.Count == 0); 257Debug.Assert(nameBuilder.Length == 0); 397Debug.Assert(!allModuleInfoImportStrings.IsDefault); 421Debug.Assert(!importStrings.IsDefault); 451Debug.Assert(groupBuilder.Count == 0); 492Debug.Assert(!importStrings.IsDefault); 511Debug.Assert(!importStrings.IsDefault);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
StateMachineHoistedLocalScope.cs (2)
26Debug.Assert(startOffset >= 0); 27Debug.Assert(endOffset > startOffset || startOffset == 0 && endOffset == 0);
TupleElementNamesInfo.cs (1)
22Debug.Assert(!elementNames.IsDefault);
Microsoft.CodeAnalysis.EditorFeatures (39)
AutomaticCompletion\BraceCompletionSessionProvider.BraceCompletionSession.cs (1)
230Debug.Assert(caretPos.HasValue && caretPos.Value.Position < closingSnapshotPoint.Position);
Classification\Syntactic\SyntacticClassificationTaggerProvider.ClassifiedLineCache.cs (1)
179Debug.Assert(_spanToLruNode[firstNode.Value.Span] == firstNode);
CodeActions\CodeActionEditHandlerService.cs (1)
189Debug.Assert(operationsList.Length > 0);
EditAndContinue\ActiveStatementTrackingService.cs (3)
214Debug.Assert(openDocumentIds.Length == baseActiveStatementSpans.Length); 267Debug.Assert(oldSpans.Length == newSpans.Length); 354Debug.Assert(TryGetSnapshot(document, out var s) && s == snapshot);
EditAndContinue\PdbMatchingSourceTextProvider.cs (1)
38Debug.Assert(_workspaceChangedDisposer == null);
Editor\EditorLayerExtensionManager.cs (1)
50Debug.Assert(exception is not OperationCanceledException);
InlineDiagnostics\InlineDiagnosticsTaggerProvider.cs (1)
52Debug.Assert(!string.IsNullOrWhiteSpace(diagnostic.Message));
InlineRename\InlineRenameSession.cs (3)
260Debug.Assert(buffer.GetRelatedDocuments().Count() == 1); 261Debug.Assert(buffer.IsReadOnly(0) == buffer.IsReadOnly(VisualStudio.Text.Span.FromBounds(0, buffer.CurrentSnapshot.Length))); // All or nothing. 634Debug.Assert(outcome.HasFlag(RenameLogMessage.UserActionOutcome.Canceled));
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (1)
248Debug.Assert(trackingSpansTouched.Count() == 1);
InlineRename\UI\Adornment\RenameFlyoutViewModel.cs (1)
271Debug.Assert(_oleComponent is null);
IntelliSense\AsyncCompletion\FilterSet.cs (2)
140Debug.Assert(_supportExpander); 176Debug.Assert(!_vector[s_expanderMask] || (_supportExpander && _vector[s_expanderMask]));
IntelliSense\AsyncCompletion\Helpers.cs (1)
37Debug.Assert(item.DisplayText.StartsWith(Completion.Utilities.UnicodeStarAndSpace));
IntelliSense\AsyncCompletion\ItemManager.CompletionListUpdater.cs (4)
344Debug.Assert(matchResults.Count > 0); 402Debug.Assert(selectedItemIndex < matchResults.Count); 683Debug.Assert(filteredMatchResults.Count > 0); 807Debug.Assert(_filterText.Length > 0 || item.Rules.MatchPriority != MatchPriority.Default);
Interactive\InteractiveCommandHandler.cs (1)
101Debug.Assert(buffer != null);
Interactive\InteractiveEvaluator.cs (2)
74Debug.Assert(languageInfo.InteractiveResponseFileName.IndexOfAny([Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar]) == -1); 211Debug.Assert(GetInteractiveCommands().CommandPrefix == CommandPrefix);
Interactive\InteractivePasteCommandHandler.cs (2)
94Debug.Assert(data != null); 98Debug.Assert(!(dataHasLineCutCopyTag && dataHasBoxCutCopyTag));
Interactive\InteractiveSession.cs (1)
188Debug.Assert(_lastSuccessfulSubmissionProjectId == null);
Preview\AbstractPreviewFactoryService.cs (1)
485Debug.Assert(oldDocument.Kind is TextDocumentKind.AdditionalDocument or TextDocumentKind.AnalyzerConfigDocument);
QuickInfo\LazyToolTip.cs (4)
62Debug.Assert(_element.ToolTip == this); 63Debug.Assert(_disposableToolTip == null); 80Debug.Assert(_disposableToolTip != null); 81Debug.Assert(_element.ToolTip == _disposableToolTip.ToolTip);
Remote\SolutionChecksumUpdater.cs (1)
124Debug.Assert(e.Kind == WorkspaceChangeKind.AdditionalDocumentChanged);
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
194Debug.Assert(newFullText.ToString() == documentWithOriginalName.GetTextSynchronously(cancellationToken).ToString());
Shared\Tagging\EventSources\TaggerEventSources.ParseOptionChangedEventSource.cs (1)
22Debug.Assert(_workspaceChangedDisposer == null);
SignatureHelp\Presentation\SignatureHelpPresenter.SignatureHelpPresenterSession.cs (1)
97Debug.Assert(_signatureMap.ContainsKey(selectedItem));
StringIndentation\StringIndentationAdornmentManager.VisibleBlock.cs (1)
38Debug.Assert(span.Snapshot == view.TextSnapshot);
Suggestions\SuggestedActionWithNestedActions.cs (1)
38Debug.Assert(!nestedActionSets.IsDefaultOrEmpty);
Tagging\AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs (1)
39Debug.Assert(_dataSource.CaretChangeBehavior.HasFlag(TaggerCaretChangeBehavior.RemoveAllTagsOnCaretMoveOutsideOfTag));
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (7)
BraceHighlighting\MultiCharacterBraceHighlightingTests.cs (5)
38Debug.Assert(text.Substring(braces.Value.LeftSpan.Start, braces.Value.LeftSpan.Length) == "<@"); 39Debug.Assert(text.Substring(braces.Value.RightSpan.Start, braces.Value.RightSpan.Length) == "@>"); 57Debug.Assert(text[position + 1] == '@'); 72Debug.Assert(text[position + 1] == '>'); 81Debug.Assert(text[position - 1] == '@');
Threading\WpfTestRunner.cs (2)
61Debug.Assert(sta.StaThread == Thread.CurrentThread); 67Debug.Assert(SynchronizationContext.Current is DispatcherSynchronizationContext);
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Shared\Extensions\TextSpanExtensions.cs (1)
29Debug.Assert(snapshot != null);
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (39)
CustomTypeInfo.cs (2)
178Debug.Assert(str.Length > 0); 179Debug.Assert(str[0] == NameSeparator);
DkmUtilities.cs (5)
71Debug.Assert(size > 0); 89Debug.Assert(block.ModuleId.Id == module.Mvid); 115Debug.Assert(size > 0); 151Debug.Assert(size > 0); 227Debug.Assert(compResult.Assembly != null);
DynamicFlagsCustomTypeInfo.cs (3)
17Debug.Assert(startIndex >= 0); 35Debug.Assert(f == numFlags); 54Debug.Assert(index >= 0);
ExpressionCompiler.cs (3)
72Debug.Assert((builder.Count == 0) == (assembly.Count == 0)); 192Debug.Assert( 462Debug.Assert(missingAssemblyIdentities.IsEmpty);
FrameDecoder.cs (1)
191Debug.Assert((formattedArgument == null) || (formattedArgument.Flags & DkmEvaluationResultFlags.Expandable) == 0);
ILSpan.cs (1)
21Debug.Assert(start <= end);
MetadataUtilities.cs (5)
219Debug.Assert(corLibrary != null); 271Debug.Assert(modules.Count == identities.Count); 310Debug.Assert(referencedIndices.Count <= modules.Count); 311Debug.Assert(referencedIndices.Count <= referencedModules.Count); 329Debug.Assert(metadata.Module.IsManifestModule);
MethodContextReuseConstraints.cs (8)
22Debug.Assert(moduleId.Id != Guid.Empty); 23Debug.Assert(MetadataTokens.Handle(methodToken).Kind == HandleKind.MethodDefinition); 24Debug.Assert(methodVersion >= 1); 34Debug.Assert(moduleId.Id != Guid.Empty); 35Debug.Assert(MetadataTokens.Handle(methodToken).Kind == HandleKind.MethodDefinition); 36Debug.Assert(methodVersion >= 1); 37Debug.Assert(ilOffset >= 0); 64Debug.Assert(ilOffset >= 0);
PDB\MethodDebugInfo.Native.cs (8)
298Debug.Assert(importStringGroups.IsDefault == externAliasStrings.IsDefault); 453Debug.Assert(localNames.Count == 0); 560Debug.Assert(alias == null); // The default namespace is never aliased. 561Debug.Assert(target != null); 562Debug.Assert(kind == ImportTargetKind.DefaultNamespace); 566Debug.Assert(lazyDefaultNamespaceName == null); 583Debug.Assert(scope == VBImportScopeKind.File || scope == VBImportScopeKind.Unspecified); 708Debug.Assert(localInfo.Length >= names.Length);
PDB\MethodDebugInfo.Portable.cs (1)
300Debug.Assert(importGroupBuilder.Count == 0);
PseudoVariableUtilities.cs (2)
44Debug.Assert(name.StartsWith("$ReturnValue", StringComparison.OrdinalIgnoreCase)); 66Debug.Assert(alias.Kind != DkmClrAliasKind.ReturnValue ||
Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver (32)
CSharp\MemberSignatureParser.cs (5)
52Debug.Assert(token.Kind != TokenKind.End); 98Debug.Assert(CurrentToken.Kind == TokenKind.LessThan); 147Debug.Assert(signature != null); 173Debug.Assert(CurrentToken.Kind == TokenKind.LessThan); 256Debug.Assert(CurrentToken.Kind == TokenKind.OpenParen);
CSharp\Scanner.cs (3)
116Debug.Assert(_offset > 0); 117Debug.Assert(UnicodeCharacterUtilities.IsIdentifierStartCharacter(_text[_offset - 1])); 118Debug.Assert(_offset == 1 || !UnicodeCharacterUtilities.IsIdentifierPartCharacter(_text[_offset - 2]));
FunctionResolver.cs (2)
72Debug.Assert(module != null); // <Filter><RuntimeId RequiredValue="DkmRuntimeId.Clr"/></Filter> should ensure this. 188Debug.Assert(result == 0 || result == 1);
MetadataResolver.cs (1)
350Debug.Assert(!handle.IsNil);
Name.cs (3)
31Debug.Assert(qualifiedName != null); 32Debug.Assert(!typeParameters.IsDefault); 65Debug.Assert(!string.IsNullOrEmpty(name));
src\Compilers\CSharp\Portable\Symbols\Synthesized\GeneratedNameParser.cs (2)
179Debug.Assert((char)GeneratedNameKind.PrimaryConstructorParameter == 'P'); 200Debug.Assert(s_regexPatternString[0] == FileTypeNameStartChar);
src\Compilers\CSharp\Portable\Syntax\SyntaxKindFacts.cs (6)
22Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 151Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 181Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 187Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 193Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i)); 1241Debug.Assert(Enum.IsDefined(typeof(SyntaxKind), (SyntaxKind)i));
TypeSignature.cs (5)
33Debug.Assert(qualifiedName != null); 34Debug.Assert(!typeArguments.IsDefault); 67Debug.Assert(!string.IsNullOrEmpty(name)); 86Debug.Assert(elementType != null); 110Debug.Assert(pointedAtType != null);
VisualBasic\MemberSignatureParser.cs (5)
61Debug.Assert(token.Kind != TokenKind.End); 116Debug.Assert(IsStartOfTypeArguments()); 166Debug.Assert(signature != null); 198Debug.Assert(IsStartOfTypeArguments()); 296Debug.Assert(CurrentToken.Kind == TokenKind.OpenParen);
Microsoft.CodeAnalysis.ExpressionEvaluator.FunctionResolver.UnitTests (1)
FunctionResolverTestBase.cs (1)
197Debug.Assert(arity >= 0);
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (129)
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\Xml\XmlCharType.cs (8)
1125Debug.Assert(str != null); 1126Debug.Assert(startPos + len <= str.Length); 1127Debug.Assert(startPos <= str.Length); 1141Debug.Assert(chars != null); 1142Debug.Assert(startPos + len <= chars.Length); 1143Debug.Assert(startPos <= chars.Length); 1173Debug.Assert(start <= end); 1182Debug.Assert(start <= end);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\ExpressionEvaluator\Core\Source\ExpressionCompiler\CustomTypeInfo.cs (2)
178Debug.Assert(str.Length > 0); 179Debug.Assert(str[0] == NameSeparator);
src\ExpressionEvaluator\Core\Source\ExpressionCompiler\DynamicFlagsCustomTypeInfo.cs (3)
17Debug.Assert(startIndex >= 0); 35Debug.Assert(f == numFlags); 54Debug.Assert(index >= 0);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\ArrayExpansion.cs (7)
25Debug.Assert(elementTypeAndInfo.Type != null); 26Debug.Assert(sizes != null); 27Debug.Assert(lowerBounds != null); 28Debug.Assert(sizes.Count > 0); 29Debug.Assert(sizes.Count == lowerBounds.Count); 41Debug.Assert(count > 0); 109Debug.Assert(_lowerBounds == null || _lowerBounds.Count == 1);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\DebuggerTypeProxyExpansion.cs (3)
38Debug.Assert((inspectionContext.EvaluationFlags & DkmEvaluationFlags.NoExpansion) == 0); 51Debug.Assert(rawView != null); 115Debug.Assert(proxyValue != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\DynamicViewExpansion.cs (3)
32Debug.Assert((proxyValue == null) || (!proxyValue.IsNull && !proxyValue.IsError() && !proxyValue.HasExceptionThrown())); 64Debug.Assert(proxyValue != null); 65Debug.Assert(proxyMembers != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\MemberExpansion.cs (6)
45Debug.Assert(!value.IsNull); 50Debug.Assert(!runtimeType.IsInterface || value.IsNull); 174Debug.Assert(staticExpansions.Count > 0); 279Debug.Assert(members != null); 280Debug.Assert(members.Length > 0); 281Debug.Assert(customTypeInfoMap != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\PointerDereferenceExpansion.cs (1)
19Debug.Assert(elementTypeAndInfo.Type != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\ResultsViewExpansion.cs (5)
76Debug.Assert(errorMessage != null); 130Debug.Assert(!value.IsError()); 198Debug.Assert(proxyValue != null); 199Debug.Assert(proxyMembers != null); 229Debug.Assert(parent != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\TupleExpansion.cs (8)
231Debug.Assert(declaringTypeAndInfo.ClrType != null); 232Debug.Assert(fieldTypeAndInfo.ClrType != null); 233Debug.Assert(fieldInfo != null); 234Debug.Assert(name != null); 235Debug.Assert(declaringTypeAndInfo.Type.Equals(fieldInfo.DeclaringType)); 236Debug.Assert(fieldTypeAndInfo.Type.Equals(fieldInfo.FieldType)); 237Debug.Assert(parent == null || parent.FieldInfo.FieldType.Equals(fieldInfo.DeclaringType)); 268Debug.Assert(declaringTypeAndInfo.Type.GetTupleCardinalityIfAny() == cardinality);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\TypeVariablesExpansion.cs (5)
25Debug.Assert(declaredType.IsGenericType); 26Debug.Assert(!declaredType.IsGenericTypeDefinition); 34Debug.Assert(_typeParameters.Length == _typeArguments.Length); 35Debug.Assert(Array.TrueForAll(_typeParameters, t => t.IsGenericParameter)); 36Debug.Assert(Array.TrueForAll(_typeArguments, t => !t.IsGenericParameter));
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.cs (2)
77Debug.Assert(inspectionContext != null); 344Debug.Assert((formatSpecifiers.Count == 0) == (newLength == oldLength));
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.TypeNames.cs (6)
160Debug.Assert(!IsPredefinedType(type)); 197Debug.Assert(hasTypeArguments == (typeArguments != null)); 403Debug.Assert(nTypeArgs > 0); 404Debug.Assert(nTypeArgs <= TypeHelpers.TupleFieldRestPosition); 432Debug.Assert(!DynamicFlagsCustomTypeInfo.GetFlag(dynamicFlags, dynamicFlagIndex)); 438Debug.Assert(nameIndex == lastNameIndex);
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.Values.cs (11)
102Debug.Assert(tmp != null); 181Debug.Assert(value.Type.GetLmrType().IsCharacter()); 193Debug.Assert(charTemp != null); 218Debug.Assert(!value.IsError()); 274Debug.Assert(lmrType.IsEnum); 275Debug.Assert(value != null); 350Debug.Assert(lmrType.IsEnum); 367Debug.Assert(inspectionContext != null); 377Debug.Assert(value != null); 447Debug.Assert(value != null); 471Debug.Assert(valueStr != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\ArrayBuilder.cs (1)
26Debug.Assert(builder.Count == 0);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\CustomTypeInfoTypeArgumentMap.cs (10)
34Debug.Assert(typeDefinition != null); 35Debug.Assert((dynamicFlags != null) == (dynamicFlagStartIndices != null)); 36Debug.Assert((tupleElementNames != null) == (tupleElementNameStartIndices != null)); 39Debug.Assert(typeDefinition.IsGenericTypeDefinition); 41Debug.Assert(dynamicFlagStartIndices == null || dynamicFlagStartIndices.Length == n + 1); 42Debug.Assert(tupleElementNameStartIndices == null || tupleElementNameStartIndices.Length == n + 1); 61Debug.Assert(type != null); 76Debug.Assert(typeDefinition != null); 177Debug.Assert(typeArgs.Length > 0); 204Debug.Assert(type.IsGenericParameter);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\EvalResultDataItem.cs (3)
170Debug.Assert(name != null); 171Debug.Assert(formatSpecifiers != null); 172Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\MemberAndDeclarationInfo.cs (2)
79Debug.Assert(member != null); 236Debug.Assert(accessors.Length > 0);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\TypeAndCustomInfo.cs (1)
21Debug.Assert(type != null); // Can only be null in the default instance.
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\TypeHelpers.cs (17)
43Debug.Assert(!type.IsInterface); 53Debug.Assert(memberLocation == DeclarationInfo.FromSubTypeOfDeclaredType); 151Debug.Assert(memberNameAlreadySeen != (previousDeclaration == DeclarationInfo.None)); 304Debug.Assert(result == type.IsMscorlibType("System", "Object")); 415Debug.Assert(value.Type.GetLmrType().IsNullable()); 483Debug.Assert(index >= 0); 700Debug.Assert(typeDef.IsGenericTypeDefinition); 701Debug.Assert(typeDef.GetGenericArguments().Length == typeArgs.Length); 778Debug.Assert(type != null); 779Debug.Assert(baseType != null); 780Debug.Assert(!baseType.IsInterface); 824Debug.Assert((@namespace == null) || (@namespace.Length > 0)); // Type.Namespace is null not empty. 825Debug.Assert(!string.IsNullOrEmpty(name)); 860Debug.Assert(((PropertyInfo)member).GetIndexParameters().Length == 0); 876Debug.Assert(interfaceType.IsInterface); 884Debug.Assert(index >= 0); 887Debug.Assert(interfaceType.GetGenericTypeDefinition().Equals(result.GetGenericTypeDefinition()));
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\TypeWalker.cs (1)
80Debug.Assert(_stack != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\ValueHelpers.cs (2)
19Debug.Assert(valueStr != null); 55Debug.Assert(values != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.cs (14)
141Debug.Assert(index >= numRows); 142Debug.Assert(initialRequestSize >= numRows); 184Debug.Assert(count >= numRows); 565Debug.Assert(value.Type.GetProxyType() == null); 574Debug.Assert(declaredType.Equals(value.Type.GetLmrType())); 591Debug.Assert(lmrNullableTypeArg.Equals(value.Type.GetLmrType())); // If this is not the case, add a test for includeRuntimeTypeIfNecessary. 652Debug.Assert(formatSpecifiers != null); 657Debug.Assert(type.Equals(declaredType.GetLmrType())); 678Debug.Assert(dataItem.Flags == (DkmEvaluationResultFlags.ReadOnly | DkmEvaluationResultFlags.Expandable)); 859Debug.Assert(name != null); 942Debug.Assert(!declaredType.IsTypeVariables()); 992Debug.Assert(declaredTypeAndInfo.Info?.PayloadTypeId != CustomTypeInfo.PayloadTypeId); 1070Debug.Assert(_completionRoutine == null); 1080Debug.Assert(_state != State.Executing);
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (139)
Debugger\Engine\DkmClrModuleInstance.cs (1)
55Debug.Assert(typeArguments.Count == type.GetGenericArguments().Length);
Debugger\Engine\DkmClrRuntimeInstance.cs (1)
106Debug.Assert(mscorlib == null);
Debugger\Engine\DkmClrValue.cs (6)
42Debug.Assert((type == null) || !type.GetLmrType().IsTypeVariables() || (valueFlags == DkmClrValueFlags.Synthetic)); 43Debug.Assert((alias == null) || evalFlags.Includes(DkmEvaluationResultFlags.HasObjectId)); 45Debug.Assert((type == null) || !type.GetLmrType().IsPointer || (value != null)); 407Debug.Assert(declaringType != null); 628Debug.Assert(!lmrType.IsGenericTypeDefinition); 683Debug.Assert(typeArgs.Count <= 1);
Debugger\MemberInfo\AssemblyImpl.cs (1)
21Debug.Assert(assembly != null);
Debugger\MemberInfo\ConstructorInfoImpl.cs (1)
22Debug.Assert(constructor != null);
Debugger\MemberInfo\CustomAttributeDataImpl.cs (1)
21Debug.Assert(customAttributeData != null);
Debugger\MemberInfo\EventInfoImpl.cs (1)
21Debug.Assert(@event != null);
Debugger\MemberInfo\FieldInfoImpl.cs (1)
23Debug.Assert(field != null);
Debugger\MemberInfo\MethodInfoImpl.cs (1)
22Debug.Assert(method != null);
Debugger\MemberInfo\ModuleImpl.cs (1)
21Debug.Assert(module != null);
Debugger\MemberInfo\ParameterInfoImpl.cs (1)
21Debug.Assert(parameter != null);
Debugger\MemberInfo\PropertyInfoImpl.cs (1)
23Debug.Assert(property != null);
Debugger\MemberInfo\TypeImpl.cs (1)
24Debug.Assert(type != null);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\ExpressionEvaluator\Core\Source\ExpressionCompiler\CustomTypeInfo.cs (2)
178Debug.Assert(str.Length > 0); 179Debug.Assert(str[0] == NameSeparator);
src\ExpressionEvaluator\Core\Source\ExpressionCompiler\DynamicFlagsCustomTypeInfo.cs (3)
17Debug.Assert(startIndex >= 0); 35Debug.Assert(f == numFlags); 54Debug.Assert(index >= 0);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\ArrayExpansion.cs (7)
25Debug.Assert(elementTypeAndInfo.Type != null); 26Debug.Assert(sizes != null); 27Debug.Assert(lowerBounds != null); 28Debug.Assert(sizes.Count > 0); 29Debug.Assert(sizes.Count == lowerBounds.Count); 41Debug.Assert(count > 0); 109Debug.Assert(_lowerBounds == null || _lowerBounds.Count == 1);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\DebuggerTypeProxyExpansion.cs (3)
38Debug.Assert((inspectionContext.EvaluationFlags & DkmEvaluationFlags.NoExpansion) == 0); 51Debug.Assert(rawView != null); 115Debug.Assert(proxyValue != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\DynamicViewExpansion.cs (3)
32Debug.Assert((proxyValue == null) || (!proxyValue.IsNull && !proxyValue.IsError() && !proxyValue.HasExceptionThrown())); 64Debug.Assert(proxyValue != null); 65Debug.Assert(proxyMembers != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\MemberExpansion.cs (6)
45Debug.Assert(!value.IsNull); 50Debug.Assert(!runtimeType.IsInterface || value.IsNull); 174Debug.Assert(staticExpansions.Count > 0); 279Debug.Assert(members != null); 280Debug.Assert(members.Length > 0); 281Debug.Assert(customTypeInfoMap != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\PointerDereferenceExpansion.cs (1)
19Debug.Assert(elementTypeAndInfo.Type != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\ResultsViewExpansion.cs (5)
76Debug.Assert(errorMessage != null); 130Debug.Assert(!value.IsError()); 198Debug.Assert(proxyValue != null); 199Debug.Assert(proxyMembers != null); 229Debug.Assert(parent != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\TupleExpansion.cs (8)
231Debug.Assert(declaringTypeAndInfo.ClrType != null); 232Debug.Assert(fieldTypeAndInfo.ClrType != null); 233Debug.Assert(fieldInfo != null); 234Debug.Assert(name != null); 235Debug.Assert(declaringTypeAndInfo.Type.Equals(fieldInfo.DeclaringType)); 236Debug.Assert(fieldTypeAndInfo.Type.Equals(fieldInfo.FieldType)); 237Debug.Assert(parent == null || parent.FieldInfo.FieldType.Equals(fieldInfo.DeclaringType)); 268Debug.Assert(declaringTypeAndInfo.Type.GetTupleCardinalityIfAny() == cardinality);
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\TypeVariablesExpansion.cs (5)
25Debug.Assert(declaredType.IsGenericType); 26Debug.Assert(!declaredType.IsGenericTypeDefinition); 34Debug.Assert(_typeParameters.Length == _typeArguments.Length); 35Debug.Assert(Array.TrueForAll(_typeParameters, t => t.IsGenericParameter)); 36Debug.Assert(Array.TrueForAll(_typeArguments, t => !t.IsGenericParameter));
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.cs (2)
77Debug.Assert(inspectionContext != null); 344Debug.Assert((formatSpecifiers.Count == 0) == (newLength == oldLength));
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.TypeNames.cs (6)
160Debug.Assert(!IsPredefinedType(type)); 197Debug.Assert(hasTypeArguments == (typeArguments != null)); 403Debug.Assert(nTypeArgs > 0); 404Debug.Assert(nTypeArgs <= TypeHelpers.TupleFieldRestPosition); 432Debug.Assert(!DynamicFlagsCustomTypeInfo.GetFlag(dynamicFlags, dynamicFlagIndex)); 438Debug.Assert(nameIndex == lastNameIndex);
src\ExpressionEvaluator\Core\Source\ResultProvider\Formatter.Values.cs (11)
102Debug.Assert(tmp != null); 181Debug.Assert(value.Type.GetLmrType().IsCharacter()); 193Debug.Assert(charTemp != null); 218Debug.Assert(!value.IsError()); 274Debug.Assert(lmrType.IsEnum); 275Debug.Assert(value != null); 350Debug.Assert(lmrType.IsEnum); 367Debug.Assert(inspectionContext != null); 377Debug.Assert(value != null); 447Debug.Assert(value != null); 471Debug.Assert(valueStr != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\ArrayBuilder.cs (1)
26Debug.Assert(builder.Count == 0);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\CustomTypeInfoTypeArgumentMap.cs (10)
34Debug.Assert(typeDefinition != null); 35Debug.Assert((dynamicFlags != null) == (dynamicFlagStartIndices != null)); 36Debug.Assert((tupleElementNames != null) == (tupleElementNameStartIndices != null)); 39Debug.Assert(typeDefinition.IsGenericTypeDefinition); 41Debug.Assert(dynamicFlagStartIndices == null || dynamicFlagStartIndices.Length == n + 1); 42Debug.Assert(tupleElementNameStartIndices == null || tupleElementNameStartIndices.Length == n + 1); 61Debug.Assert(type != null); 76Debug.Assert(typeDefinition != null); 177Debug.Assert(typeArgs.Length > 0); 204Debug.Assert(type.IsGenericParameter);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\EvalResultDataItem.cs (3)
170Debug.Assert(name != null); 171Debug.Assert(formatSpecifiers != null); 172Debug.Assert((flags & DkmEvaluationResultFlags.Expandable) == 0);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\MemberAndDeclarationInfo.cs (2)
79Debug.Assert(member != null); 236Debug.Assert(accessors.Length > 0);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\TypeAndCustomInfo.cs (1)
21Debug.Assert(type != null); // Can only be null in the default instance.
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\TypeHelpers.cs (17)
43Debug.Assert(!type.IsInterface); 53Debug.Assert(memberLocation == DeclarationInfo.FromSubTypeOfDeclaredType); 151Debug.Assert(memberNameAlreadySeen != (previousDeclaration == DeclarationInfo.None)); 304Debug.Assert(result == type.IsMscorlibType("System", "Object")); 415Debug.Assert(value.Type.GetLmrType().IsNullable()); 483Debug.Assert(index >= 0); 700Debug.Assert(typeDef.IsGenericTypeDefinition); 701Debug.Assert(typeDef.GetGenericArguments().Length == typeArgs.Length); 778Debug.Assert(type != null); 779Debug.Assert(baseType != null); 780Debug.Assert(!baseType.IsInterface); 824Debug.Assert((@namespace == null) || (@namespace.Length > 0)); // Type.Namespace is null not empty. 825Debug.Assert(!string.IsNullOrEmpty(name)); 860Debug.Assert(((PropertyInfo)member).GetIndexParameters().Length == 0); 876Debug.Assert(interfaceType.IsInterface); 884Debug.Assert(index >= 0); 887Debug.Assert(interfaceType.GetGenericTypeDefinition().Equals(result.GetGenericTypeDefinition()));
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\TypeWalker.cs (1)
80Debug.Assert(_stack != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\Helpers\ValueHelpers.cs (2)
19Debug.Assert(valueStr != null); 55Debug.Assert(values != null);
src\ExpressionEvaluator\Core\Source\ResultProvider\ResultProvider.cs (14)
141Debug.Assert(index >= numRows); 142Debug.Assert(initialRequestSize >= numRows); 184Debug.Assert(count >= numRows); 565Debug.Assert(value.Type.GetProxyType() == null); 574Debug.Assert(declaredType.Equals(value.Type.GetLmrType())); 591Debug.Assert(lmrNullableTypeArg.Equals(value.Type.GetLmrType())); // If this is not the case, add a test for includeRuntimeTypeIfNecessary. 652Debug.Assert(formatSpecifiers != null); 657Debug.Assert(type.Equals(declaredType.GetLmrType())); 678Debug.Assert(dataItem.Flags == (DkmEvaluationResultFlags.ReadOnly | DkmEvaluationResultFlags.Expandable)); 859Debug.Assert(name != null); 942Debug.Assert(!declaredType.IsTypeVariables()); 992Debug.Assert(declaredTypeAndInfo.Info?.PayloadTypeId != CustomTypeInfo.PayloadTypeId); 1070Debug.Assert(_completionRoutine == null); 1080Debug.Assert(_state != State.Executing);
Microsoft.CodeAnalysis.Extensions.Package (129)
Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Microsoft.CodeAnalysis.Features.Test.Utilities (4)
EditAndContinue\EditAndContinueTestVerifier.cs (1)
149Debug.Assert(oldDocuments.Length == newDocuments.Length);
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (1)
150Debug.Assert(document != null);
EditAndContinue\SourceMarkers.cs (1)
167Debug.Assert(minor == -1);
EditAndContinue\SyntaxMapDescription.cs (1)
63Debug.Assert(OldNodeSpans.Length == 1);
Microsoft.CodeAnalysis.InteractiveHost (144)
Interactive\Core\InteractiveHost.RemoteService.cs (1)
110Debug.Assert(ascii.Length % 2 == 0);
Interactive\Core\InteractiveHost.Service.cs (4)
78Debug.Assert(!sourceSearchPaths.IsDefault); 79Debug.Assert(scriptOptions.MetadataResolver is ScriptMetadataResolver); 554Debug.Assert(cmdLineReference.Properties.Kind == MetadataImageKind.Assembly && !cmdLineReference.Properties.EmbedInteropTypes); 706Debug.Assert(PathUtilities.IsAbsolute(fullPath));
Interactive\Core\InteractiveHostPlatformInfo.cs (1)
36Debug.Assert(!platformAssemblyPaths.IsDefault);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
Microsoft.CodeAnalysis.LanguageServer.Protocol (11)
Extensions\ProtocolConversions.cs (2)
241Debug.Assert(!path.Split(System.IO.Path.DirectorySeparatorChar).Any(p => p == "." || p == "..")); 473Debug.Assert(document.FilePath != null);
Features\EditAndContinue\EditAndContinueDiagnosticSource_OpenDocument.cs (2)
66Debug.Assert(data.DataLocation != null); 67Debug.Assert(designTimeDocument.FilePath != null);
Features\Options\SolutionAnalyzerConfigOptionsUpdater.cs (1)
39Debug.Assert(target is Workspace);
Features\UnifiedSuggestions\UnifiedSuggestedActionsSource.cs (1)
371Debug.Assert(set.CategoryName is UnifiedPredefinedSuggestedActionCategoryNames.CodeFix or
Handler\Completion\CompletionResultFactory.cs (3)
534Debug.Assert(change.Span == defaultSpan); 544Debug.Assert(selectedItem.Flags.IsExpanded()); 691Debug.Assert(selectedItem.IsComplexTextEdit);
Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
234Debug.Assert(desiredCaretLocation >= textChange.Span.Start);
Protocol\Converters\FormattingOptionsConverter.cs (1)
23Debug.Assert(reader.TokenType == JsonTokenType.StartObject);
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (492)
src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (11)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 309Debug.Assert(this.Count >= 1); 343Debug.Assert(_count >= 1);
src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
27Debug.Assert(childrenCount != 0);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
503Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 515Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (6)
211Debug.Assert(isInsideAnonymousObjectInitializer == 289Debug.Assert(success); 290Debug.Assert(cfg != null); 334Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 496Debug.Assert(parameterIndex >= 0); 497Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
47Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
74Debug.Assert(!string.IsNullOrEmpty(sectionName)); 91Debug.Assert(!string.IsNullOrEmpty(key)); 92Debug.Assert(key == key.Trim()); 93Debug.Assert(value == value.Trim());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.cs (1)
313Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
79Debug.Assert(expectedValueText == actualValueText); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 219Debug.Assert(char.IsSurrogate(ch));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
104Debug.Assert(index + 1 >= data.Length ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
196Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 197Debug.Assert(_span.End == virtualChars._span.Start); 208Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 215Debug.Assert(branch.Destination == null); 220Debug.Assert(branch.Destination == null); 226Debug.Assert(branch.Destination != null); 257Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 261Debug.Assert(enclosing.NestedRegions[0] == region); 262Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 279Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 324Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 325Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 347Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 349Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 373Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(startAt > 0); 375Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 389Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 390Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 144Debug.Assert(cfg.Parent != null); 145Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 146Debug.Assert(parentAnalysisData != null); 303Debug.Assert(lambdaOrLocalFunctionCfg != null); 313Debug.Assert(anonymousFunctionCfg != null); 322Debug.Assert(localFunction.IsLocalFunction()); 330Debug.Assert(localFunctionCfg != null); 346Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 487Debug.Assert(localFunction.IsLocalFunction()); 488Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 578Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (3)
92Debug.Assert(BitConverter.IsLittleEndian); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (17)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1082Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1083Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1168Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (3)
85Debug.Assert(current < length); 107Debug.Assert(current < length); 126Debug.Assert(char.IsUpper(identifier[current - 1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
134Debug.Assert(similarityWeight <= _threshold);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
342Debug.Assert(desiredGroupIndex >= 0); 343Debug.Assert(desiredGroupIndex <= declarationList.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
42Debug.Assert(!isInitOnly || methodKind == MethodKind.PropertySet);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (3)
49Debug.Assert(diagnostic != null); 103Debug.Assert(analyzerConfigPath != null); 104Debug.Assert(PathUtilities.IsAbsolute(analyzerConfigPath));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
74Debug.Assert(!semanticModel.IsSpeculativeSemanticModel);
Microsoft.CodeAnalysis.PooledObjects.Package (14)
ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
Microsoft.CodeAnalysis.PublicApiAnalyzers (489)
DeclarePublicApiAnalyzer.cs (2)
129Debug.Assert(errors.Count == 0); 246Debug.Assert(allData.Count > 0);
DeclarePublicApiAnalyzer.Impl.cs (2)
178Debug.Assert(!symbol.IsImplicitlyDeclared); 229Debug.Assert(IsTrackedAPI(symbol, cancellationToken));
src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (11)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 309Debug.Assert(this.Count >= 1); 343Debug.Assert(_count >= 1);
src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
27Debug.Assert(childrenCount != 0);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
503Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 515Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (6)
211Debug.Assert(isInsideAnonymousObjectInitializer == 289Debug.Assert(success); 290Debug.Assert(cfg != null); 334Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 496Debug.Assert(parameterIndex >= 0); 497Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
47Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
74Debug.Assert(!string.IsNullOrEmpty(sectionName)); 91Debug.Assert(!string.IsNullOrEmpty(key)); 92Debug.Assert(key == key.Trim()); 93Debug.Assert(value == value.Trim());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.cs (1)
313Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
79Debug.Assert(expectedValueText == actualValueText); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 219Debug.Assert(char.IsSurrogate(ch));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
104Debug.Assert(index + 1 >= data.Length ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
196Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 197Debug.Assert(_span.End == virtualChars._span.Start); 208Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 215Debug.Assert(branch.Destination == null); 220Debug.Assert(branch.Destination == null); 226Debug.Assert(branch.Destination != null); 257Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 261Debug.Assert(enclosing.NestedRegions[0] == region); 262Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 279Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 324Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 325Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 347Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 349Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 373Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(startAt > 0); 375Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 389Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 390Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 144Debug.Assert(cfg.Parent != null); 145Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 146Debug.Assert(parentAnalysisData != null); 303Debug.Assert(lambdaOrLocalFunctionCfg != null); 313Debug.Assert(anonymousFunctionCfg != null); 322Debug.Assert(localFunction.IsLocalFunction()); 330Debug.Assert(localFunctionCfg != null); 346Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 487Debug.Assert(localFunction.IsLocalFunction()); 488Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 578Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (3)
92Debug.Assert(BitConverter.IsLittleEndian); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (17)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1082Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1083Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1168Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (3)
85Debug.Assert(current < length); 107Debug.Assert(current < length); 126Debug.Assert(char.IsUpper(identifier[current - 1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
134Debug.Assert(similarityWeight <= _threshold);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Microsoft.CodeAnalysis.PublicApiAnalyzers.CodeFixes (2)
DeclarePublicApiFix.cs (2)
116Debug.Assert(unshippedText.Length > 0); 308Debug.Assert(newSymbolNames.All(newSymbolName => !symbolNamesToRemove.Contains(newSymbolName)));
Microsoft.CodeAnalysis.Remote.ServiceHub (6)
Host\RemoteWorkspace.SolutionCreator.cs (4)
122Debug.Assert(projectCone.ProjectIds.Count == newVersions.Map.Count); 123Debug.Assert(projectCone.ProjectIds.All(id => newVersions.Map.ContainsKey(id))); 127Debug.Assert(solution.ProjectIds.Count == newVersions.Map.Count); 128Debug.Assert(solution.ProjectIds.All(id => newVersions.Map.ContainsKey(id)));
Services\BrokeredServiceBase.FactoryBase.cs (2)
35Debug.Assert(typeof(TService).IsInterface); 117Debug.Assert(typeof(TCallback).IsInterface);
Microsoft.CodeAnalysis.Remote.Workspaces (3)
BrokeredServiceConnection.cs (1)
332Debug.Assert(cancellationToken.IsCancellationRequested);
EditAndContinue\ManagedHotReloadLanguageServiceDescriptor.cs (1)
20=> Debug.Assert(Descriptor.Moniker.Name == MonikerName);
Serialization\MessagePackFormatters.cs (1)
189Debug.Assert(kind != TextEncodingKind.None);
Microsoft.CodeAnalysis.ResxSourceGenerator (485)
src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (11)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 309Debug.Assert(this.Count >= 1); 343Debug.Assert(_count >= 1);
src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
27Debug.Assert(childrenCount != 0);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
503Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 515Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (6)
211Debug.Assert(isInsideAnonymousObjectInitializer == 289Debug.Assert(success); 290Debug.Assert(cfg != null); 334Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 496Debug.Assert(parameterIndex >= 0); 497Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
47Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
74Debug.Assert(!string.IsNullOrEmpty(sectionName)); 91Debug.Assert(!string.IsNullOrEmpty(key)); 92Debug.Assert(key == key.Trim()); 93Debug.Assert(value == value.Trim());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.cs (1)
313Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
79Debug.Assert(expectedValueText == actualValueText); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 219Debug.Assert(char.IsSurrogate(ch));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
104Debug.Assert(index + 1 >= data.Length ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
196Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 197Debug.Assert(_span.End == virtualChars._span.Start); 208Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 215Debug.Assert(branch.Destination == null); 220Debug.Assert(branch.Destination == null); 226Debug.Assert(branch.Destination != null); 257Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 261Debug.Assert(enclosing.NestedRegions[0] == region); 262Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 279Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 324Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 325Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 347Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 349Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 373Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(startAt > 0); 375Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 389Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 390Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 144Debug.Assert(cfg.Parent != null); 145Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 146Debug.Assert(parentAnalysisData != null); 303Debug.Assert(lambdaOrLocalFunctionCfg != null); 313Debug.Assert(anonymousFunctionCfg != null); 322Debug.Assert(localFunction.IsLocalFunction()); 330Debug.Assert(localFunctionCfg != null); 346Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 487Debug.Assert(localFunction.IsLocalFunction()); 488Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 578Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (3)
92Debug.Assert(BitConverter.IsLittleEndian); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (17)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1082Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1083Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1168Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (3)
85Debug.Assert(current < length); 107Debug.Assert(current < length); 126Debug.Assert(char.IsUpper(identifier[current - 1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
134Debug.Assert(similarityWeight <= _threshold);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Microsoft.CodeAnalysis.VisualBasic (8)
Semantics\Operators.vb (3)
3171Debug.Assert(method.ParameterCount = If(argument2 Is Nothing, 1, 2)) 3172Debug.Assert(method.Arity = 0) 3173Debug.Assert(Not method.IsSub)
Symbols\ConstraintsHelper.vb (1)
747Debug.Assert(info.Severity = DiagnosticSeverity.Error)
Symbols\ObsoleteAttributeHelpers.vb (3)
139Debug.Assert(Not data.IsUninitialized) 143Debug.Assert(Not data.IsError) 149Debug.Assert(Not data.IsError)
Symbols\TypeSymbolExtensions.vb (1)
691Call Global.System.Diagnostics.Debug.Assert(matchingInterface.Arity = 1)
Microsoft.CodeAnalysis.Workspaces (2)
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (2)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (165)
Build\ProjectBuildManager.cs (3)
92Debug.Assert(loadedProjects.Count == 1); 207Debug.Assert(BatchBuildStarted); 277Debug.Assert(BatchBuildStarted);
MSBuild\Logging\MSBuildDiagnosticLogger.cs (3)
27Debug.Assert(_projectFilePath != null); 33Debug.Assert(_projectFilePath != null); 39Debug.Assert(_eventSource == null);
Rpc\Contracts\ProjectFileReference.cs (1)
38Debug.Assert(!aliases.IsDefault);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConcurrentLruCache.cs (1)
102Debug.Assert(_capacity > 0);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\FileLockCheck.cs (1)
199Debug.Assert(rgAffectedApps != null);
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\JsonWriter.cs (2)
219Debug.Assert(_pending == Pending.NewLineAndIndent || _pending == Pending.CommaNewLineAndIndent); 302Debug.Assert(ShouldAppendAsUnicode(c));
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\InternalUtilities\ThreeState.cs (1)
33Debug.Assert(value != ThreeState.Unknown);
src\Compilers\Core\Portable\InternalUtilities\WeakList.cs (5)
27Debug.Assert(_size == _items.Length); 28Debug.Assert(_items.Length == 0 || _items.Length >= MinimalNonEmptySize); 64Debug.Assert(_size == _items.Length); 100Debug.Assert(_items[firstDead].IsNull()); 157Debug.Assert(_size < _items.Length);
src\Compilers\Core\Portable\InternalUtilities\XmlUtilities.cs (3)
34Debug.Assert(copy != node); 35Debug.Assert(copy.Parent == null); // Otherwise, when we give it one, it will be copied. 52Debug.Assert(sourceAttributes.Current.Name == targetAttributes.Current.Name);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (1)
714Debug.Assert(data.All(d => d.Count() == count));
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (3)
Fakes\TestOptionSet.cs (2)
20Debug.Assert(values.Values.All(IsInternalOptionValue)); 29Debug.Assert(IsInternalOptionValue(internalValue));
OptionsCollection.cs (1)
40Debug.Assert(optionKey.Option is IOption2 { Definition.StorageMapping: null });
Microsoft.CodeAnalysis.Workspaces.UnitTests (5)
Differencing\TestNode.cs (2)
25Debug.Assert(value is >= 0 and <= MaxValue); 26Debug.Assert(label is >= 0 and <= MaxLabel);
UtilityTest\SpecializedTasksTests.cs (3)
38Debug.Assert(whenAll.IsCompleted); 47Debug.Assert(whenAll.IsCompleted); 69Debug.Assert(whenAll.IsCompleted);
Microsoft.Data.Analysis (31)
DataFrame.cs (1)
688Debug.Assert(newColumn.NullCount == oldColumn.NullCount);
DataFrame.IDataView.cs (3)
77Debug.Assert(dataFrame != null); 78Debug.Assert(activeColumns != null); 88Debug.Assert(_getters[i] != null);
DataFrameColumn.cs (14)
527Debug.Assert(n >= 2); 554Debug.Assert(comparer != null); 555Debug.Assert(lo >= 0); 602Debug.Assert(comparer != null); 603Debug.Assert(lo >= 0); 604Debug.Assert(hi > lo); 660Debug.Assert(comparer != null); 661Debug.Assert(lo >= 0); 662Debug.Assert(hi > lo); 683Debug.Assert(comparer != null); 684Debug.Assert(lo >= 0); 715Debug.Assert(lo >= 0); 716Debug.Assert(hi >= lo); 753Debug.Assert(i != j);
DataFrameColumns\ArrowStringDataFrameColumn.cs (5)
83Debug.Assert(_nullBitMapBuffers.Count > bitMapIndex); 86Debug.Assert(bitMapBuffer.Length > bitMapBufferIndex); 99Debug.Assert(_nullBitMapBuffers.Count > bitMapIndex); 104Debug.Assert(bitMapBuffer.Length >= bitMapBufferIndex); 334Debug.Assert(indexInBuffer <= Int32.MaxValue);
DataFrameRow.cs (1)
24Debug.Assert(rowIndex < df.Columns.RowCount);
PrimitiveColumnContainer.cs (5)
295Debug.Assert(bitMapBufferSpan.Length >= bitMapBufferIndex); 315Debug.Assert(NullBitMapBuffers.Count > bitMapIndex); 321Debug.Assert(bitMapBuffer.Length >= bitMapBufferIndex); 335Debug.Assert(NullBitMapBuffers.Count > bitMapIndex); 341Debug.Assert(bitMapBuffer.Length > bitMapBufferIndex);
PrimitiveDataFrameColumn.cs (1)
306Debug.Assert(_columnContainer.NullCount >= 0);
Utils\BitUtility.cs (1)
151Debug.Assert(span.Length >= endByteIndex);
Microsoft.DotNet.Build.Tasks.VisualStudio (1)
Vsix\GetPkgDefAssemblyDependencyGuid.cs (1)
63Debug.Assert(reducedHash.Length == targetBlockSize);
Microsoft.DotNet.XliffTasks (1)
Release.cs (1)
13Debug.Assert(condition);
Microsoft.DotNet.XUnitExtensions (2)
src\Microsoft.DotNet.XUnitExtensions.Shared\DiscovererHelpers.cs (1)
67Debug.Assert(ctorArgs.Count() >= 2);
src\Microsoft.DotNet.XUnitExtensions.Shared\Discoverers\ConditionalClassDiscoverer.cs (1)
40Debug.Assert(conditionArguments.Count() == 2);
Microsoft.DotNet.XUnitV3Extensions (1)
src\Microsoft.DotNet.XUnitExtensions.Shared\DiscovererHelpers.cs (1)
67Debug.Assert(ctorArgs.Count() >= 2);
Microsoft.Extensions.AI.OpenAI (17)
src\Shared\ServerSentEvents\ArrayBuffer.cs (9)
41Debug.Assert(initialSize > 0 || usePool); 53Debug.Assert(buffer.Length > 0); 78Debug.Assert(_usePool); 79Debug.Assert(_bytes is not null); 118Debug.Assert(byteCount <= AvailableLength); 134Debug.Assert(AvailableLength < byteCount); 138Debug.Assert(_usePool && _activeStart == 0 && _availableStart == 0); 150Debug.Assert(byteCount <= AvailableLength); 179Debug.Assert(byteCount <= AvailableLength);
src\Shared\ServerSentEvents\Helpers.cs (4)
35Debug.Assert(buffer.Length >= MaxDecimalDigits); 38Debug.Assert(success); 53Debug.Assert(value.Length <= buffer.Length); 67Debug.Assert(maxByteCount <= buffer.Length);
src\Shared\ServerSentEvents\SseFormatter.cs (4)
104Debug.Assert(bufferWriter.WrittenCount is 0); 108Debug.Assert(!eventType.AsSpan().ContainsLineBreaks()); 120Debug.Assert(!eventId.AsSpan().ContainsLineBreaks()); 129Debug.Assert(retry >= TimeSpan.Zero);
Microsoft.Extensions.Logging.Generators (11)
LoggerMessageGenerator.Parser.cs (1)
798Debug.Assert(searchedBrace is '{' or '}');
src\libraries\Common\src\Roslyn\CSharpSyntaxHelper.cs (1)
42Debug.Assert(container != null);
src\libraries\Common\src\Roslyn\SyntaxValueProvider_ForAttributeWithMetadataName.cs (2)
109Debug.Assert(lastDotIndex > 0); 124Debug.Assert(syntaxNodes.All(n => n.SyntaxTree == syntaxTree));
src\libraries\Common\src\Roslyn\SyntaxValueProvider_ForAttributeWithSimpleName.cs (2)
161Debug.Assert(compilationUnit is ICompilationUnitSyntax); 198Debug.Assert(compilationUnit is ICompilationUnitSyntax);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (5)
31Debug.Assert(value >= 0); 32Debug.Assert(value <= _span.Length); 41Debug.Assert(index < _pos); 109Debug.Assert(length >= 0); 137Debug.Assert(_pos == _span.Length);
Microsoft.Extensions.ServiceDiscovery (4)
Http\HttpServiceEndpointResolver.cs (1)
258Debug.Assert(_onDisposed is not null);
ServiceEndpointResolver.cs (1)
250Debug.Assert(_onDisposed is not null);
ServiceEndpointWatcher.cs (2)
186Debug.Assert(error is null || newCacheState is CacheStatus.Invalid); 213Debug.Assert(newEndpoints is not null);
Microsoft.Extensions.ServiceDiscovery.Dns (5)
Resolver\DnsDataReader.cs (1)
25Debug.Assert(_position == 0);
Resolver\DnsResolver.cs (3)
40Debug.Assert(_options.Servers.Count > 0); 384Debug.Assert(response.Answers.Count > 0); 479Debug.Assert(cts.Token.IsCancellationRequested);
Resolver\DnsResolver.Telemetry.cs (1)
98Debug.Assert(answersArray is not null);
Microsoft.Extensions.Validation.ValidationsGenerator (2)
src\Shared\Diagnostics\AnalyzerDebug.cs (2)
12/// <inheritdoc cref="Debug.Assert(bool)"/> 14public static void Assert([DoesNotReturnIf(false)] bool b) => Debug.Assert(b);
Microsoft.Interop.ComInterfaceGenerator (8)
ComInterfaceContext.cs (1)
78Debug.Assert(baseContext.HasValue);
ComMethodInfo.cs (1)
89Debug.Assert(method is { IsStatic: false, MethodKind: MethodKind.Ordinary });
GeneratedComInterfaceAttributeData.cs (2)
57Debug.Assert(found); 63Debug.Assert(attr.AttributeClass.ToDisplayString() == TypeNames.GeneratedComInterfaceAttribute);
Marshallers\ManagedHResultExceptionGeneratorResolver.cs (1)
75Debug.Assert(info.MarshallingAttributeInfo is ManagedHResultExceptionMarshallingInfo);
Marshallers\ObjectUnwrapperResolver.cs (1)
36Debug.Assert(info.MarshallingAttributeInfo is ObjectUnwrapperInfo);
VirtualMethodPointerStubGenerator.cs (1)
86Debug.Assert(methodStub.TypeKeyOwner.Syntax is NameSyntax);
VtableIndexStubGenerator.cs (1)
231Debug.Assert(virtualMethodIndexAttr is not null);
Microsoft.Interop.JavaScript.JSImportGenerator (3)
JSExportGenerator.cs (1)
187Debug.Assert(jsExportAttr is not null);
JSGeneratorFactory.cs (1)
19Debug.Assert(context != null);
JSImportGenerator.cs (1)
170Debug.Assert(jsImportAttr is not null);
Microsoft.Interop.LibraryImportGenerator (2)
LibraryImportGenerator.cs (2)
267Debug.Assert(generatedDllImportAttr is not null); 499Debug.Assert(target.StringMarshalling == StringMarshalling.Utf16);
Microsoft.Interop.LibraryImportGenerator.Downlevel (2)
DownlevelLibraryImportGenerator.cs (2)
190Debug.Assert(generatedDllImportAttr is not null); 374Debug.Assert(target.StringMarshalling == StringMarshalling.Utf16);
Microsoft.Interop.SourceGeneration (13)
BoundGenerators.cs (3)
39Debug.Assert(managedExceptionInfo == null); 51Debug.Assert(managedReturnMarshaller == defaultBoundGenerator); 56Debug.Assert(nativeReturnMarshaller == defaultBoundGenerator);
DiagnosticOr.cs (3)
99Debug.Assert(value is not null); 108Debug.Assert(value is not null); 109Debug.Assert(diagnostics is not null);
Marshalling\BoolMarshaller.cs (1)
31Debug.Assert(info.ManagedType is SpecialTypeInfo { SpecialType: SpecialType.System_Boolean });
Marshalling\ByValueContentsMarshalKindValidator.cs (1)
38Debug.Assert(support == ByValueMarshalKindSupport.Supported || diagnostic is not null);
Marshalling\ByValueMarshalKindSupportDescriptor.cs (1)
91Debug.Assert(marshalKind is ByValueContentsMarshalKind.Default);
Marshalling\CharMarshaller.cs (1)
38Debug.Assert(info.ManagedType is SpecialTypeInfo {SpecialType: SpecialType.System_Char });
MarshalUsingAttributeParser.cs (1)
30Debug.Assert(attributeData.AttributeClass!.ToDisplayString() == TypeNames.MarshalUsingAttribute);
NativeMarshallingAttributeParser.cs (1)
24Debug.Assert(attributeData.AttributeClass!.ToDisplayString() == TypeNames.NativeMarshallingAttribute);
UnmanagedToManagedStubGenerator.cs (1)
56Debug.Assert(statements.CleanupCalleeAllocated.IsEmpty);
Microsoft.Maui.Controls (4)
Internals\ImageParser.cs (4)
53 global::System.Diagnostics.Debug.Assert(_stream.Position == _currentPosition); 101 Debug.Assert(toRead <= buffer.Length); 130 Debug.Assert(_currentBlockSize == bytesRead); 180 Debug.Assert(transparencyIndex < _colorTable.Length);
Microsoft.ML.AutoML.Samples (1)
Sweepable\SearchSpaceExample.cs (1)
37Debug.Assert(myParameterSearchSpace.GetHashCode() == myParameterSearchSpace2.GetHashCode());
Microsoft.ML.Core (8)
Utilities\ArrayUtils.cs (8)
51Debug.Assert(0 <= min && min <= lim && lim <= input.Length); 58Debug.Assert(minCur <= mid && mid < limCur); 65Debug.Assert(min <= minCur && minCur <= limCur && limCur <= lim); 66Debug.Assert(minCur == min || input[minCur - 1] < value); 67Debug.Assert(limCur == lim || input[limCur] >= value); 69Debug.Assert(min <= minCur && minCur == limCur && limCur <= lim); 70Debug.Assert(minCur == min || input[minCur - 1] < value); 71Debug.Assert(limCur == lim || input[limCur] >= value);
Microsoft.ML.Data (1)
Utilities\StreamUtils.cs (1)
213Debug.Assert(minimumBytes <= buffer.Length);
Microsoft.ML.DataView (46)
DataViewRowId.cs (2)
84Debug.Assert(0 < r && r < 64); 91Debug.Assert(0 < r && r < 64);
DataViewSchema.cs (9)
195Debug.Assert(schema != null); 196Debug.Assert(getters != null); 198Debug.Assert(schema.Count == getters.Length); 228Debug.Assert(_getters[column.Index] != null); 249Debug.Assert(0 <= index && index < Schema.Count); 363Debug.Assert(!string.IsNullOrEmpty(name)); 364Debug.Assert(type != null); 365Debug.Assert(getter != null); 456Debug.Assert(_columns[i].Index == i);
DataViewType.cs (7)
114Debug.Assert(!(other is TextDataViewType)); 276Debug.Assert(other == null || !(other is NumberDataViewType) || other.RawType != RawType); 312Debug.Assert(!(other is RowIdDataViewType)); 351Debug.Assert(!(other is BooleanDataViewType)); 390Debug.Assert(!(other is DateTimeDataViewType)); 426Debug.Assert(!(other is DateTimeOffsetDataViewType)); 462Debug.Assert(!(other is TimeSpanDataViewType));
src\Microsoft.ML.Core\Utilities\ArrayUtils.cs (8)
51Debug.Assert(0 <= min && min <= lim && lim <= input.Length); 58Debug.Assert(minCur <= mid && mid < limCur); 65Debug.Assert(min <= minCur && minCur <= limCur && limCur <= lim); 66Debug.Assert(minCur == min || input[minCur - 1] < value); 67Debug.Assert(limCur == lim || input[limCur] >= value); 69Debug.Assert(min <= minCur && minCur == limCur && limCur <= lim); 70Debug.Assert(minCur == min || input[minCur - 1] < value); 71Debug.Assert(limCur == lim || input[limCur] >= value);
Utils.cs (1)
34Debug.Assert(meth.ReturnType == typeof(TRet));
VBuffer.cs (19)
89Debug.Assert(_count <= Length); 161Debug.Assert(res >= 0 && cur < length); 203Debug.Assert(destination.IsDense); 236Debug.Assert(destination.IsDense); 245Debug.Assert(copyMin <= copyLim); 308Debug.Assert(slot >= iv); 311Debug.Assert(iv == slot); 473Debug.Assert(0 <= count && count <= ArrayUtils.Size(values)); 474Debug.Assert(count <= length); 475Debug.Assert(count == length || count <= ArrayUtils.Size(indices)); 493Debug.Assert(slotCur < slot && slot < length); 496Debug.Assert(slotCur == slot); 499Debug.Assert(slotCur < length); 507Debug.Assert(0 <= count && count <= ArrayUtils.Size(values)); 508Debug.Assert(count <= length); 509Debug.Assert(count == length || count <= ArrayUtils.Size(indices)); 522Debug.Assert(slotCur < slot && slot < length); 525Debug.Assert(slotCur == slot); 528Debug.Assert(slotCur < length);
Microsoft.ML.ImageAnalytics (6)
MLImage.cs (6)
105Debug.Assert(image.Info.BitsPerPixel == 32); 106Debug.Assert(image.RowBytes * image.Height == width * height * 4); 126Debug.Assert(_image is not null); 163Debug.Assert(_image.Info.BytesPerPixel == 4); 219Debug.Assert(_image.Info.BitsPerPixel == 32); 275Debug.Assert(_image.Info.ColorType != SKColorType.Bgra8888 && _image.Info.ColorType != SKColorType.Rgba8888);
Microsoft.ML.InternalCodeAnalyzer (3)
ContractsCheckNameofFixProvider.cs (1)
50Debug.Assert(nameArg.Parent.Parent.IsKind(SyntaxKind.InvocationExpression));
INamedTypeSymbolExtensions.cs (1)
23Debug.Assert(factAttribute is object);
NameFixProvider.cs (1)
94Debug.Assert(!Enum.IsDefined(typeof(NameType), desiredName));
Microsoft.ML.Tokenizers (108)
Model\BertTokenizer.cs (1)
32Debug.Assert(options is not null);
Model\BPETokenizer.cs (3)
1365Debug.Assert(mappingBuffer is not null); 1485Debug.Assert(mappingBuffer is not null); 1567Debug.Assert(mappingBuffer is not null);
Model\CodeGenTokenizer.cs (3)
478Debug.Assert(mappingBuffer is not null); 1162Debug.Assert(mappingBuffer is not null); 1226Debug.Assert(mappingBuffer is not null);
Model\EnglishRobertaTokenizer.cs (5)
917Debug.Assert(index + tokens[i].Value.Length <= indexMapping.Length); 959Debug.Assert(token[0] < charToString.Length); 967Debug.Assert(c < charToString.Length); 1150Debug.Assert(rank < _symbols.Count); 1248Debug.Assert(stream is not null);
Model\SentencePieceBaseModel.cs (9)
222Debug.Assert(bytesPoolArray is not null); 257Debug.Assert(sb[suffixIndex] == SentencePieceNormalizer.DummyPrefix); 258Debug.Assert(sb.Length > suffixIndex); 277Debug.Assert(bytesCount >= 1); 278Debug.Assert(bytesPoolArray is not null); 495Debug.Assert(bytesPoolArray is not null); 554Debug.Assert(destination[suffixIndex] == ' '); 615Debug.Assert(bytesCount >= 1); 616Debug.Assert(bytesPoolArray is not null);
Model\SentencePieceBpeModel.cs (10)
107Debug.Assert(SpecialTokensRegex is not null); 359Debug.Assert(SpecialTokensRegex is not null); 360Debug.Assert(maxTokens > 0); 637Debug.Assert(SpecialTokensRegex is not null); 638Debug.Assert(maxTokens > 0); 895Debug.Assert(SpecialTokensRegex is not null); 896Debug.Assert(maxTokens > 0); 897Debug.Assert(text.Length > 0); 1131Debug.Assert(text.Length > 0); 1132Debug.Assert(symbols.Length >= text.Length);
Model\SentencePieceUnigramModel.cs (31)
77Debug.Assert(modelProto.TrainerSpec.UnkId >= 0); 78Debug.Assert(modelProto.TrainerSpec.BosId >= 0); 79Debug.Assert(modelProto.TrainerSpec.EosId >= 0); 173Debug.Assert(res); 174Debug.Assert(bytesConsumed == utf8Bytes.Length); 175Debug.Assert(charsWritten == expectedCount); 203Debug.Assert(res); 217Debug.Assert(SpecialTokensRegex is not null); 294Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) * 3 <= buffer.Length * sizeof(int)); 302Debug.Assert(normalizationSpan.Length >= (byteCount << 1)); 431Debug.Assert(codepointLength > 0); 473Debug.Assert(normalized.Length > 0); 478Debug.Assert(bestPathEndsAt.Length >= size + 1); 615Debug.Assert(normalizedString is not null); 642Debug.Assert(SpecialTokensRegex is not null); 643Debug.Assert(maxTokenCount > 0); 728Debug.Assert(unknownTokensCount > 0); 729Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount); 732Debug.Assert(unknownTokensCount == 1 || unknownTokensTracking![0].IdsIndex > unknownTokensTracking![1].IdsIndex); 745Debug.Assert(ids[IdsIndex] == UnknownId); 827Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount); 844Debug.Assert(unknownTokensCount == 0 && unknownTokensTracking is null); 848Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount); 861Debug.Assert(normalizedString is null); 874Debug.Assert(unknownTokensCount > 0 && unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount); 885Debug.Assert(j < unknownTokensCount); 916Debug.Assert(unknownTokensTracking is not null && unknownTokensTracking.Length >= unknownTokensCount); 1013Debug.Assert(SpecialTokensRegex is not null); 1014Debug.Assert(maxTokenCount > 0); 1277Debug.Assert(SpecialTokensRegex is not null); 1278Debug.Assert(maxTokenCount > 0);
Model\TiktokenTokenizer.cs (14)
136Debug.Assert(_cache is not null); 137Debug.Assert(_decoder is not null); 301Debug.Assert(!text.IsEmpty); 328Debug.Assert(encodedLength < indexMappingSpan.Length); 338Debug.Assert(encodedTokens.Length > 0); 420Debug.Assert(maxTokenCount > 0); 445Debug.Assert(encodedLength < indexMappingSpan.Length); 586Debug.Assert(maxTokens > 0); 610Debug.Assert(encodedLength < indexMappingSpan.Length); 712Debug.Assert(maxTokens > 0); 736Debug.Assert(encodedLength < indexMappingSpan.Length); 908Debug.Assert(incompleteCharsWritten == 0); 909Debug.Assert(hangingIdsCount == 0); 910Debug.Assert(utf8BytesIncompleteIndex == 0);
Model\WordPieceTokenizer.cs (5)
37Debug.Assert(vocab is not null); 38Debug.Assert(vocabReverse is not null); 315Debug.Assert(!text.IsEmpty); 351Debug.Assert(_vocabReverse.ContainsKey(id)); 448Debug.Assert(maxTokenCount > 0);
Normalizer\BertNormalizer.cs (1)
86Debug.Assert(length > 0);
Normalizer\LowerCaseNormalizer.cs (1)
48Debug.Assert(length == original.Length);
Normalizer\SentencePieceNormalizer.cs (6)
55Debug.Assert(trieBlob is not null); 226Debug.Assert(bufferIndex < span.Length - 1); 259Debug.Assert(bufferIndex < span.Length); 275Debug.Assert(!input.IsEmpty); 319Debug.Assert(_normalized is not null); 351Debug.Assert(p > 0);
Normalizer\UpperCaseNormalizer.cs (1)
48Debug.Assert(length == original.Length);
Utils\Helpers.cs (11)
32Debug.Assert(span.Length <= newSize); 69Debug.Assert(!text.IsEmpty); 70Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) <= destination.Length); 71Debug.Assert(indexMapping.Length >= destination.Length); 123Debug.Assert(!text.IsEmpty); 124Debug.Assert(destination.Length >= 4); 161Debug.Assert(!text.IsEmpty); 162Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) <= destination.Length); 163Debug.Assert(indexMapping.Length >= destination.Length); 237Debug.Assert(utf16Chars.Length >= GetUtf16LengthFromUtf8Bytes(utf8Bytes)); 321Debug.Assert(input.Length > 0);
Utils\Helpers.netstandard.cs (2)
122Debug.Assert(source.Length <= destination.Length); 140Debug.Assert(textIndex < text.Length);
Utils\ValueStringBuilder.cs (5)
40Debug.Assert(value >= 0); 41Debug.Assert(value <= _chars.Length); 51Debug.Assert(capacity >= 0); 87Debug.Assert(index < _pos); 394Debug.Assert(additionalCapacityBeyondPos > 0);
Microsoft.ML.Tokenizers.Tests (14)
src\Microsoft.ML.Tokenizers\Utils\Helpers.cs (11)
32Debug.Assert(span.Length <= newSize); 69Debug.Assert(!text.IsEmpty); 70Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) <= destination.Length); 71Debug.Assert(indexMapping.Length >= destination.Length); 123Debug.Assert(!text.IsEmpty); 124Debug.Assert(destination.Length >= 4); 161Debug.Assert(!text.IsEmpty); 162Debug.Assert(Encoding.UTF8.GetMaxByteCount(text.Length) <= destination.Length); 163Debug.Assert(indexMapping.Length >= destination.Length); 237Debug.Assert(utf16Chars.Length >= GetUtf16LengthFromUtf8Bytes(utf8Bytes)); 321Debug.Assert(input.Length > 0);
src\Microsoft.ML.Tokenizers\Utils\Helpers.netcoreapp.cs (3)
45Debug.Assert(success); 46Debug.Assert(bytes.Length == bytesWritten); 81Debug.Assert(textIndex < text.Length);
Microsoft.ML.TorchSharp (7)
NasBert\Modules\MultiHeadAttention.cs (4)
243Debug.Assert(k.IsNotNull() && v.IsNotNull()); 248Debug.Assert(keyPaddingMaskPad.IsNull() || 265Debug.Assert(attentionWeights.size().SequenceEqual(new[] { batchSize * _numHeads, tgtLen, srcLen })); 294Debug.Assert(attention.size().SequenceEqual(new[] { batchSize * _numHeads, tgtLen, _headDim }));
Roberta\QATrainer.cs (1)
441Debug.Assert(robertaModel is not null);
Utils\MethodTable.cs (2)
145Debug.Assert(HasComponentSize); 157Debug.Assert(HasComponentSize);
Microsoft.VisualStudio.IntegrationTest.Setup (1)
TestExtensionManager.cs (1)
26Debug.Assert(exception is not OperationCanceledException);
Microsoft.VisualStudio.LanguageServices (83)
ChangeSignature\ChangeSignatureDialog.xaml.cs (1)
196Debug.Assert(addParameterViewModel.IsCallsiteRegularValue);
ChangeSignature\ChangeSignatureDialogViewModel.cs (2)
447Debug.Assert(CanMoveUp); 456Debug.Assert(CanMoveDown);
CodeMarkers\ManagedCodeMarkers.cs (2)
509Debug.Assert(end != default(int)); 536Debug.Assert(end != default(int));
ColorSchemes\ColorSchemeApplier.ColorScheme.cs (2)
71Debug.Assert(backgroundType == __VSCOLORTYPE.CT_INVALID || background.HasValue); 75Debug.Assert(foregroundType == __VSCOLORTYPE.CT_INVALID || foreground.HasValue);
DebuggerIntelliSense\DebuggerIntellisenseFilter.cs (1)
166Debug.Assert(_context == null);
DocumentOutline\DocumentOutlineViewModel.cs (1)
134Debug.Assert(field != value);
FindReferences\Contexts\AbstractTableDataSourceFindUsagesContext.cs (4)
144Debug.Assert(_findReferencesWindow.Manager.Sources.Count == 0); 336Debug.Assert(_tableDataSink == null); 654Debug.Assert(_findReferencesWindow.Manager.Sources.Count == 1); 655Debug.Assert(_findReferencesWindow.Manager.Sources[0] == this);
FindReferences\Contexts\WithReferencesFindUsagesContext.cs (1)
148Debug.Assert(addToEntriesWhenGroupingByDefinition || addToEntriesWhenNotGroupingByDefinition);
GenerateType\GenerateTypeDialogViewModel.cs (2)
186Debug.Assert(_generateTypeDialogOptions.TypeKindOptions != TypeKindOptions.None); 405Debug.Assert(this.AccessSelectIndex != -1);
Interactive\VsInteractiveWindowProvider.cs (2)
79Debug.Assert(_vsInteractiveWindow == null); 124Debug.Assert(instanceId == 0);
Interactive\VsResetInteractive.cs (3)
124Debug.Assert(!string.IsNullOrEmpty(projectDir)); 125Debug.Assert(!string.IsNullOrEmpty(outputFileName)); 126Debug.Assert(!string.IsNullOrEmpty(relativeOutputPath));
Interop\WeakComHandle.cs (1)
148Debug.Assert(_managedObjectWeakReference != null);
LanguageService\AbstractLanguageService`2.cs (1)
146Debug.Assert(!wpfTextView.Properties.ContainsProperty(typeof(AbstractVsTextViewFilter)));
LanguageService\AbstractLanguageService`2.IVsImmediateStatementCompletion2.cs (6)
128Debug.Assert(false); 135Debug.Assert(false); 142Debug.Assert(false); 148Debug.Assert(false); 154Debug.Assert(false); 160Debug.Assert(false);
Library\ObjectBrowser\AbstractListItemFactory.cs (23)
231Debug.Assert(parentListItem != null); 232Debug.Assert(parentListItem is TypeListItem); 233Debug.Assert(compilation != null); 247Debug.Assert(parentListItem != null); 248Debug.Assert(parentListItem is TypeListItem or 250Debug.Assert(compilation != null); 391Debug.Assert(parentListItem != null); 392Debug.Assert(parentListItem is TypeListItem); 393Debug.Assert(compilation != null); 407Debug.Assert(assemblySymbol != null); 440Debug.Assert(parentListItem != null); 441Debug.Assert(parentListItem is ProjectListItem or 443Debug.Assert(compilation != null); 640Debug.Assert(parentListItem != null); 641Debug.Assert(parentListItem is ProjectListItem); 642Debug.Assert(compilation != null); 720Debug.Assert(parentListItem != null); 721Debug.Assert(parentListItem is NamespaceListItem or 724Debug.Assert(compilation != null); 745Debug.Assert(assemblySymbol != null); 746Debug.Assert(compilation != null); 777Debug.Assert(assemblySymbol != null); 778Debug.Assert(compilation != null);
Library\ObjectBrowser\AbstractObjectBrowserLibraryManager.cs (1)
322Debug.Assert(listKind == ObjectListKind.Projects);
Library\ObjectBrowser\ObjectList.cs (1)
858Debug.Assert(data.type == VSCOMPONENTTYPE.VSCOMPONENTTYPE_Project);
Library\ObjectBrowser\ObjectListItem.cs (1)
36Debug.Assert(ParentList == null);
Options\VisualStudioOptionStorage.cs (1)
42Debug.Assert(!vbKey.Contains(LanguagePlaceholder));
Preview\TopLevelChange.cs (3)
117Debug.Assert(oldDocument != null || updatedDocumentIdOpt != null); 118Debug.Assert((updatedDocumentIdOpt != null) == (updateDocumentTextOpt != null)); 174Debug.Assert(oldDocument.Id == updatedDocumentIdOpt);
PreviewPane\PreviewPane.xaml.cs (1)
105Debug.Assert(_registerPriorityCommandTarget != null);
ProjectSystem\Extensions\ProjectExtensions.cs (1)
20Debug.Assert(containers.Any());
ProjectSystem\MetadataReferences\VisualStudioPortableExecutableReference.cs (1)
46Debug.Assert(Properties.Kind == MetadataImageKind.Assembly);
ProjectSystem\VisualStudioWorkspaceImpl.OpenFileTracker.cs (1)
174Debug.Assert(workspace.CurrentSolution.ContainsAnalyzerConfigDocument(documentId));
Remote\VisualStudioRemoteHostClientProvider.cs (1)
69Debug.Assert(workspaceServices.Workspace is VisualStudioWorkspace or PreviewWorkspace);
Snippets\SnippetExpansionClient.cs (8)
486Debug.Assert(TextView.IsClosed); 516Debug.Assert(_state.IsFullMethodCallSnippet); 524Debug.Assert(!_state.IsFullMethodCallSnippet); 560Debug.Assert(_state._expansionSession != null); 562Debug.Assert(_state._method == null); 819Debug.Assert(TextView.IsClosed); 928Debug.Assert(_state._expansionSession != null); 998Debug.Assert(TextView.IsClosed);
src\Compilers\Core\Portable\FileKey.cs (1)
31Debug.Assert(timestamp.Kind == DateTimeKind.Utc);
src\Compilers\Core\Portable\InternalUtilities\ConcurrentLruCache.cs (1)
102Debug.Assert(_capacity > 0);
StackTraceExplorer\StackFrameViewModel.cs (1)
158Debug.Assert(GetTrailingTrivia(className).IsEmpty);
StackTraceExplorer\StackTraceExplorerToolWindow.cs (1)
156Debug.Assert(result == S_OK);
TaskList\ExternalErrorDiagnosticUpdateSource.cs (1)
162Debug.Assert(diagnostics.All(d => d.IsBuildDiagnostic()));
Utilities\VisualStudioCommandHandlerHelpers.cs (1)
53Debug.Assert(hierarchy != null);
Utilities\VsCodeWindowViewTracker.cs (1)
138Debug.Assert(_trackedTextViews.Count == 0);
Venus\ContainedDocument.cs (2)
770Debug.Assert(ReferenceEquals(parsedDocument.Text, subjectBuffer.CurrentSnapshot.AsText())); 1019Debug.Assert(_hostType == HostType.Razor);
Venus\VenusCommandFilter.cs (1)
52Debug.Assert(WpfTextView.IsClosed);
Workspace\GlobalUndoServiceFactory.WorkspaceGlobalUndoTransaction.cs (1)
133Debug.Assert(!_transactionAlive);
Microsoft.VisualStudio.LanguageServices.CSharp (60)
CodeModel\CSharpCodeModelService.CodeModelEventCollector.cs (12)
79Debug.Assert(oldAttribute != null && newAttribute != null); 207Debug.Assert(oldParameter != null && newParameter != null); 234Debug.Assert(oldMember != null && newMember != null); 276Debug.Assert(oldEnumMember != null && newEnumMember != null); 303Debug.Assert(oldProperty != null && newProperty != null); 356Debug.Assert(oldVariableDeclarator != null && newVariableDeclarator != null); 373Debug.Assert(oldField != null && newField != null); 415Debug.Assert(oldMethod != null && newMethod != null); 477Debug.Assert(oldNamespace != null && newNamespace != null); 514Debug.Assert(oldMember != null && newMember != null); 515Debug.Assert(oldMember is BaseTypeDeclarationSyntax or DelegateDeclarationSyntax); 516Debug.Assert(newMember is BaseTypeDeclarationSyntax or DelegateDeclarationSyntax);
CodeModel\CSharpCodeModelService.cs (38)
1271Debug.Assert(node is MemberDeclarationSyntax); 1345Debug.Assert(node is MemberDeclarationSyntax); 1392Debug.Assert(node is MemberDeclarationSyntax); 1513Debug.Assert(parentNode is BasePropertyDeclarationSyntax); 1604Debug.Assert(attributeNode is AttributeSyntax); 1638Debug.Assert(attributeNode is AttributeSyntax); 1659Debug.Assert(attributeArgumentNode is AttributeArgumentSyntax); 1670Debug.Assert(attributeNode is AttributeSyntax); 1678Debug.Assert(attributeNode is AttributeSyntax); 1692Debug.Assert(attributeNode is AttributeListSyntax); 1709Debug.Assert(attributeNode is AttributeSyntax); 1723Debug.Assert(attributeNode is AttributeSyntax); 1812Debug.Assert(attributeArgumentNode is AttributeArgumentSyntax); 2009Debug.Assert(memberNode is MemberDeclarationSyntax); 2028Debug.Assert(memberNode is MemberDeclarationSyntax); 2061Debug.Assert(typeNode is ClassDeclarationSyntax); 2073Debug.Assert(typeNode is ClassDeclarationSyntax); 2124Debug.Assert(variableNode is FieldDeclarationSyntax or 2157Debug.Assert(typeNode is BaseTypeDeclarationSyntax); 2169Debug.Assert(typeNode is BaseTypeDeclarationSyntax); 2220Debug.Assert(typeNode is ClassDeclarationSyntax); 2247Debug.Assert(memberNode is MemberDeclarationSyntax); 2266Debug.Assert(memberNode is MethodDeclarationSyntax or 2383Debug.Assert(typeNode is ClassDeclarationSyntax); 2416Debug.Assert(memberNode is BaseMethodDeclarationSyntax or 2457Debug.Assert(memberNode is BaseMethodDeclarationSyntax or 2515Debug.Assert(memberNode is MemberDeclarationSyntax); 2524Debug.Assert(memberNode is MemberDeclarationSyntax); 2547Debug.Assert(variableNode is MemberDeclarationSyntax or 2566Debug.Assert(variableNode is MemberDeclarationSyntax); 2604Debug.Assert(propertyNode is BasePropertyDeclarationSyntax); 2622Debug.Assert(memberNode is MemberDeclarationSyntax); 2634Debug.Assert(eventNode is EventFieldDeclarationSyntax or 2642Debug.Assert(memberNode is MemberDeclarationSyntax or 2655Debug.Assert(memberNode is MemberDeclarationSyntax); 2678Debug.Assert(memberNode is BasePropertyDeclarationSyntax); 2720Debug.Assert(node is MemberDeclarationSyntax or 3665Debug.Assert(externalLocation != null);
CodeModel\CSharpCodeModelService.NodeLocator.cs (4)
137Debug.Assert(!openBrace.IsMissing); 149Debug.Assert(!openBrace.IsMissing); 150Debug.Assert(!closeBrace.IsMissing); 151Debug.Assert(memberStartColumn >= 0);
CodeModel\CSharpCodeModelService.NodeNameGenerator.cs (2)
156Debug.Assert(node != null); 157Debug.Assert(IsNameableNode(node));
CodeModel\CSharpCodeModelService_Prototype.cs (1)
23Debug.Assert(symbol != null);
ObjectBrowser\DescriptionBuilder.cs (1)
33Debug.Assert(typeSymbol.TypeKind == TypeKind.Delegate);
SemanticSearch\SemanticSearchDocumentNavigationService.cs (2)
30Debug.Assert(workspace is SemanticSearchWorkspace); 31Debug.Assert(documentId == window.SemanticSearchService.GetQueryDocumentId(workspace.CurrentSolution));
Microsoft.VisualStudio.LanguageServices.Implementation (35)
CodeModel\AbstractCodeModelObject.cs (1)
30Debug.Assert(state != null);
CodeModel\AbstractCodeModelService.AbstractCodeModelEventCollector.cs (3)
142Debug.Assert(oldChildren.Count == newChildren.Count); 195Debug.Assert(oldChildren.Count + delta == newChildren.Count); 246Debug.Assert(oldChildren.Count - delta == newChildren.Count);
CodeModel\AbstractCodeModelService.AbstractNodeNameGenerator.cs (1)
42Debug.Assert(IsNameableNode(node));
CodeModel\AbstractCodeModelService.cs (1)
995Debug.Assert(insertionIndex >= 0 && insertionIndex <= childNodes.Length);
CodeModel\CodeModelState.cs (4)
35Debug.Assert(threadingContext != null); 36Debug.Assert(serviceProvider != null); 37Debug.Assert(languageServices != null); 38Debug.Assert(workspace != null);
CodeModel\Collections\AbstractCodeElementCollection.cs (1)
22Debug.Assert(parent != null);
CodeModel\Collections\BasesCollection.cs (1)
47Debug.Assert(fileCodeModel != null);
CodeModel\Collections\InheritsImplementsCollection.cs (1)
42Debug.Assert(fileCodeModel != null);
CodeModel\Collections\NamespaceCollection.cs (1)
42Debug.Assert(fileCodeModel != null);
CodeModel\Collections\TypeCollection.cs (1)
42Debug.Assert(fileCodeModel != null);
CodeModel\ExternalElements\AbstractExternalCodeElement.cs (2)
27Debug.Assert(projectId != null); 28Debug.Assert(symbol != null);
CodeModel\ExternalElements\ExternalCodeAccessorFunction.cs (1)
30Debug.Assert(symbol.MethodKind is MethodKind.EventAdd or
CodeModel\FileCodeModel.cs (4)
285Debug.Assert(_invisibleEditor == null); 294Debug.Assert(_editCount >= 1); 337Debug.Assert(_invisibleEditor != null); 361Debug.Assert(_invisibleEditor != null);
CodeModel\FileCodeModel_CodeGen.cs (1)
196Debug.Assert(baseArray.Length is 0 or 1);
CodeModel\FileCodeModel_Events.cs (1)
174Debug.Assert(codeModelEvent.Type != CodeModelEventType.Remove || parentElement != null);
CodeModel\InternalElements\AbstractCodeElement.cs (1)
32Debug.Assert(fileCodeModel != null);
CodeModel\InternalElements\AbstractKeyedCodeElement.cs (1)
64Debug.Assert(syntaxPath != null);
CodeModel\InternalElements\CodeAccessorFunction.cs (1)
32Debug.Assert(kind is MethodKind.EventAdd or
CodeModel\InternalElements\CodeAttributeArgument.cs (2)
23Debug.Assert(parent != null); 24Debug.Assert(index >= 0);
Options\OptionPageSearchHandler.cs (1)
31Debug.Assert(_originalContent.Split('_').Length <= 2);
Options\OptionStore.cs (2)
64Debug.Assert(option.IsPerLanguage == language is not null); 93Debug.Assert(option.IsPerLanguage == language is not null);
Options\Style\EnumCodeStyleOptionViewModel.cs (2)
48Debug.Assert(preferences.Count == enumValues.Length); 49Debug.Assert(previews.Length == enumValues.Length);
SolutionExplorer\AnalyzersCommandHandler.cs (1)
211Debug.Assert(_initialized);
Replay (2)
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (2)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
Roslyn.Diagnostics.Analyzers (493)
src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (11)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 309Debug.Assert(this.Count >= 1); 343Debug.Assert(_count >= 1);
src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
27Debug.Assert(childrenCount != 0);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
503Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 515Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (6)
211Debug.Assert(isInsideAnonymousObjectInitializer == 289Debug.Assert(success); 290Debug.Assert(cfg != null); 334Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 496Debug.Assert(parameterIndex >= 0); 497Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
47Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
74Debug.Assert(!string.IsNullOrEmpty(sectionName)); 91Debug.Assert(!string.IsNullOrEmpty(key)); 92Debug.Assert(key == key.Trim()); 93Debug.Assert(value == value.Trim());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.cs (1)
313Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
79Debug.Assert(expectedValueText == actualValueText); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 219Debug.Assert(char.IsSurrogate(ch));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
104Debug.Assert(index + 1 >= data.Length ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
196Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 197Debug.Assert(_span.End == virtualChars._span.Start); 208Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 215Debug.Assert(branch.Destination == null); 220Debug.Assert(branch.Destination == null); 226Debug.Assert(branch.Destination != null); 257Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 261Debug.Assert(enclosing.NestedRegions[0] == region); 262Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 279Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 324Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 325Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 347Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 349Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 373Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(startAt > 0); 375Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 389Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 390Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 144Debug.Assert(cfg.Parent != null); 145Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 146Debug.Assert(parentAnalysisData != null); 303Debug.Assert(lambdaOrLocalFunctionCfg != null); 313Debug.Assert(anonymousFunctionCfg != null); 322Debug.Assert(localFunction.IsLocalFunction()); 330Debug.Assert(localFunctionCfg != null); 346Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 487Debug.Assert(localFunction.IsLocalFunction()); 488Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 578Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (3)
92Debug.Assert(BitConverter.IsLittleEndian); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (17)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1082Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1083Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1168Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (3)
85Debug.Assert(current < length); 107Debug.Assert(current < length); 126Debug.Assert(char.IsUpper(identifier[current - 1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
134Debug.Assert(similarityWeight <= _threshold);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
342Debug.Assert(desiredGroupIndex >= 0); 343Debug.Assert(desiredGroupIndex <= declarationList.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
42Debug.Assert(!isInitOnly || methodKind == MethodKind.PropertySet);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (3)
49Debug.Assert(diagnostic != null); 103Debug.Assert(analyzerConfigPath != null); 104Debug.Assert(PathUtilities.IsAbsolute(analyzerConfigPath));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
74Debug.Assert(!semanticModel.IsSpeculativeSemanticModel);
SymbolDeclaredEventMustBeGeneratedForSourceSymbols.cs (1)
97Debug.Assert(symbolDeclaredEvent.GetParameters().HasExactly(1));
Roslyn.Diagnostics.CSharp.Analyzers (57)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (9)
59Debug.Assert(!token.ContainsDiagnostics); 354Debug.Assert(char.IsSurrogate(ch)); 364Debug.Assert(tokenText[index] == '\\'); 377Debug.Assert(tokenText[index] == '\\'); 411Debug.Assert(tokenText[index] == '\\'); 430Debug.Assert(tokenText[index] == '\\'); 475Debug.Assert(uintChar is > 0x0000FFFF and <= 0x0010FFFF); 515Debug.Assert(character == 'x'); 547Debug.Assert(IsHexDigit(c));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SimpleNameSyntaxExtensions.cs (1)
16Debug.Assert(name.IsSimpleMemberAccessExpressionName() || name.IsMemberBindingExpressionName() || name.IsRightSideOfQualifiedName() || name.IsParentKind(SyntaxKind.NameMemberCref));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (2)
155Debug.Assert(trivia.Kind() == SyntaxKind.WhitespaceTrivia); 156Debug.Assert(trivia.Width() == trivia.FullWidth());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (3)
48Debug.Assert(trivia.ToString() == trivia.ToFullString()); 138Debug.Assert(trivia.ToString() == trivia.ToFullString()); 323Debug.Assert(trivia.HasStructure);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
74Debug.Assert(this.SecondTokenIsFirstTokenOnLine);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (11)
34Debug.Assert(this.TreeInfo.GetTextBetween(default, token).All(IsCSharpWhitespace)); 42Debug.Assert(this.TreeInfo.GetTextBetween(default, token).All(IsCSharpWhitespace)); 54Debug.Assert(this.TreeInfo.GetTextBetween(token, default).All(IsCSharpWhitespace)); 62Debug.Assert(this.TreeInfo.GetTextBetween(token, default).All(IsCSharpWhitespace)); 74Debug.Assert(string.IsNullOrWhiteSpace(this.TreeInfo.GetTextBetween(token1, token2))); 82Debug.Assert(string.IsNullOrWhiteSpace(this.TreeInfo.GetTextBetween(token1, token2))); 140Debug.Assert(result.Tab >= 0); 141Debug.Assert(result.LineBreaks >= 0); 165Debug.Assert(Options.UseTabs); 178Debug.Assert((indentation / Options.TabSize) == result.Tab); 179Debug.Assert((indentation % Options.TabSize) == result.Space);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\IndentBlockFormattingRule.cs (1)
98Debug.Assert(_options.Indentation.HasFlag(IndentationPlacement.SwitchCaseContents) != _options.Indentation.HasFlag(IndentationPlacement.SwitchCaseContentsWhenBlock));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\SuppressFormattingRule.cs (1)
334Debug.Assert(!startToken.IsKind(SyntaxKind.None) && !endToken.IsKind(SyntaxKind.None));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SemanticFacts\CSharpSemanticFacts.cs (1)
117Debug.Assert(oldNode.Kind() == newNode.Kind());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Services\SyntaxFacts\CSharpSyntaxFacts.cs (2)
854Debug.Assert(memberDeclaration.Kind() == SyntaxKind.IncompleteMember); 895Debug.Assert(topLevel || methodLevel);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (5)
803Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 1251Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1307Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1337Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1517Debug.Assert(!rewrittenType.IsReferenceType && !IsIntrinsicOrEnum(rewrittenType));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\SpeculationAnalyzer.cs (11)
73Debug.Assert(expression != null); 128Debug.Assert(semanticModel.ParentModel != null); 129Debug.Assert(!semanticModel.ParentModel.IsSpeculativeSemanticModel); 181Debug.Assert(nodeToSpeculate is ExpressionSyntax); 212Debug.Assert(originalParams.Count == replacedParams.Count); 277Debug.Assert(originalIdentifierNodes.Any()); 278Debug.Assert(originalIdentifierNodes.Count() == replacedIdentifierNodes.Count()); 297Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 298Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 372Debug.Assert(newExpression.WhenTrue == previousReplacedNode); 378Debug.Assert(newExpression.WhenFalse == previousReplacedNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\TypeStyle\CSharpTypeStyleHelper.cs (1)
83Debug.Assert(node.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\MethodGenerator.cs (1)
245Debug.Assert(method.ExplicitInterfaceImplementations.Any() || method.IsOverride);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\CompilationUnitSyntaxExtensions.cs (1)
130Debug.Assert(!endOfLine.IsKind(SyntaxKind.None));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpRemoveUnnecessaryImportsService.Rewriter.cs (1)
132Debug.Assert(oldUsings.Count == newUsings.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpReplaceDiscardDeclarationsWithAssignmentsService.cs (1)
242Debug.Assert(IsDiscardDeclaration(variable));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxFactsService.cs (1)
77Debug.Assert(_seenContextNode);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (1)
1704Debug.Assert(expressionOpt != null);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\InitializeParameter\InitializeParameterHelpers.cs (2)
205Debug.Assert(block.Statements.Count == 0); 240Debug.Assert(IsExpressionBody(body));
RulesetToEditorconfigConverter (2)
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
Stress.ApiService (3)
Program.cs (3)
331Debug.Assert(activity is not null); 335Debug.Assert(innerActivity is not null); 354Debug.Assert(innerActivity2 is not null);
System.Private.CoreLib.Generators (5)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (5)
31Debug.Assert(value >= 0); 32Debug.Assert(value <= _span.Length); 41Debug.Assert(index < _pos); 109Debug.Assert(length >= 0); 137Debug.Assert(_pos == _span.Length);
System.Text.RegularExpressions.Generator (157)
RegexGenerator.cs (1)
96Debug.Assert(state is DiagnosticData);
RegexGenerator.Emitter.cs (42)
495Debug.Assert(chars.Length > 3); 837Debug.Assert(minRequiredLength >= 0); 1110Debug.Assert(!string.IsNullOrEmpty(substring)); 1117Debug.Assert(!string.IsNullOrEmpty(substring)); 1121Debug.Assert(!string.IsNullOrEmpty(regexTree.FindOptimizations.FixedDistanceLiteral.String)); 1190Debug.Assert(opts.FindMode is FindNextStartingPositionMode.LeadingStrings_LeftToRight or FindNextStartingPositionMode.LeadingStrings_OrdinalIgnoreCase_LeftToRight); 1236Debug.Assert(regexTree.FindOptimizations.FixedDistanceSets is { Count: > 0 }); 1285Debug.Assert(primarySet.Chars.Length > 0); 1383Debug.Assert(setIndex is 0 or 1); 1389Debug.Assert(needLoop); 1424Debug.Assert(regexTree.FindOptimizations.FixedDistanceSets is { Count: > 0 }); 1427Debug.Assert(set.Distance == 0); 1434Debug.Assert(!set.Negated); 1458Debug.Assert(regexTree.FindOptimizations.LiteralAfterLoop is not null); 1461Debug.Assert(target.LoopNode.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setlazy or RegexNodeKind.Setloopatomic); 1462Debug.Assert(target.LoopNode.N == int.MaxValue); 1732Debug.Assert(requiredLength > 0); 1768Debug.Assert(childCount >= 2); 1775Debug.Assert(node.Parent is not null); 1837Debug.Assert(startingLiteralNode.IsSetFamily); 1908Debug.Assert(numChars != 0); 2207Debug.Assert(sliceStaticPos == 0); 3034Debug.Assert(rm.Analysis.MayBacktrack(node.Child(0))); 3233Debug.Assert(!rtl || offset is null); 3234Debug.Assert(!rtl || !clauseOnly); 3315Debug.Assert((node.Options & RegexOptions.RightToLeft) == 0 || sliceStaticPos == 0); 3316Debug.Assert(sliceStaticPos >= 0); 3381Debug.Assert(node.Str is not null); 3387Debug.Assert(str.Length >= 2); 3388Debug.Assert(!clauseOnly || (!emitLengthCheck && !rightToLeft)); 3392Debug.Assert(emitLengthCheck); 3449Debug.Assert(node.M < node.N); 3590Debug.Assert(node.M < node.N); 3909Debug.Assert(sliceStaticPos == 0); 3975Debug.Assert(entriesPerIteration >= 1); 4250Debug.Assert(node.N > node.M); 4367Debug.Assert(node.M == 0 && node.N == 1); 4542Debug.Assert(sliceStaticPos == 0); 4675Debug.Assert(startingStackpos is not null); 4806Debug.Assert(args.Length is >= 1); 4858Debug.Assert(args.Length is >= 1); 5294Debug.Assert(rangeLower.LowInclusive != rangeUpper.LowInclusive);
RegexGenerator.Parser.cs (1)
128Debug.Assert(regexMemberSymbol is IPropertySymbol);
src\libraries\Common\src\System\HexConverter.cs (2)
187Debug.Assert(utf8Destination.Length >= (source.Length * 2)); 204Debug.Assert(destination.Length >= (source.Length * 2));
src\libraries\Common\src\System\Text\ValueStringBuilder.cs (5)
38Debug.Assert(value >= 0); 39Debug.Assert(value <= _chars.Length); 49Debug.Assert(capacity >= 0); 85Debug.Assert(index < _pos); 281Debug.Assert(additionalCapacityBeyondPos > 0);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (5)
31Debug.Assert(value >= 0); 32Debug.Assert(value <= _span.Length); 41Debug.Assert(index < _pos); 109Debug.Assert(length >= 0); 137Debug.Assert(_pos == _span.Length);
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexCaseEquivalences.cs (4)
81Debug.Assert(cultureName[0] is >= 'a' and <= 'z'); 82Debug.Assert(cultureName[1] is >= 'a' and <= 'z'); 133Debug.Assert((c / CharactersPerRange) < 0xFF); 145Debug.Assert(((c % CharactersPerRange) + firstLevelLookupValue) < 0xFFFF);
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexCharClass.cs (14)
340Debug.Assert(whitespaceSet.Contains((char)i) == char.IsWhiteSpace((char)i)); 429Debug.Assert(!set.IsEmpty); 721Debug.Assert(c != 0); 889Debug.Assert(count <= evaluated); 933Debug.Assert(set1Negated == set2Negated); 1012Debug.Assert(!IsNegated(set1) && !IsNegated(set2)); 1063Debug.Assert((uint)comparison <= char.MaxValue); 1128Debug.Assert(twoChars.Length >= 2); 1214Debug.Assert(!hasSubtraction); 1395Debug.Assert(ch < 128); 1413Debug.Assert(ch < 128); 1584Debug.Assert(curcat < 0); 1669Debug.Assert(chars[index] < chars[index + 1]); 1749Debug.Assert(i == span.Length);
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexFindOptimizations.cs (4)
142Debug.Assert(!RegexCharClass.IsNegated(charClass)); 149Debug.Assert(!RegexCharClass.IsNegated(charClass) || chars is null); 202Debug.Assert(fixedDistanceSets is null || fixedDistanceSets.Count != 0); 384Debug.Assert(chars is { Length: 1 });
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexNode.cs (60)
89Debug.Assert(Kind is RegexNodeKind.Onelazy or RegexNodeKind.Oneloop or RegexNodeKind.Oneloopatomic or 92Debug.Assert(M > 0); 115Debug.Assert(culture is not null); 372Debug.Assert(rootNode.Kind == RegexNodeKind.Capture); 373Debug.Assert(rootNode.Parent is null); 374Debug.Assert(rootNode.ChildCount() == 1); 542Debug.Assert(node.Kind is RegexNodeKind.Atomic or RegexNodeKind.Empty or RegexNodeKind.Loop or RegexNodeKind.Lazyloop); 547Debug.Assert(node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop); 612Debug.Assert(Kind is RegexNodeKind.Alternate or RegexNodeKind.Concatenate); 629Debug.Assert(Kind == RegexNodeKind.Group); 634Debug.Assert(u.ChildCount() == 1); 657Debug.Assert(Kind == RegexNodeKind.Atomic); 658Debug.Assert(ChildCount() == 1); 699Debug.Assert(branches is not null && branches.Count != 0); 826Debug.Assert(Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop); 958Debug.Assert(Kind is RegexNodeKind.Set or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy); 959Debug.Assert(!string.IsNullOrEmpty(Str)); 1018Debug.Assert(Kind == RegexNodeKind.Alternate); 1195Debug.Assert(alternation.Kind == RegexNodeKind.Alternate); 1196Debug.Assert(alternation.Children is List<RegexNode> { Count: >= 2 }); 1216Debug.Assert(children[startingIndex].Children is List<RegexNode> { Count: >= 2 }); 1294Debug.Assert(node.Kind == RegexNodeKind.Alternate); 1295Debug.Assert(node.ChildCount() >= 2); 1337Debug.Assert(alternation.Kind == RegexNodeKind.Alternate); 1338Debug.Assert(alternation.Children is List<RegexNode> { Count: >= 2 }); 1369Debug.Assert(startingSpan.Length > 0); 1398Debug.Assert(startingNode.Kind == RegexNodeKind.Multi); 1399Debug.Assert(startingNode.Str!.Length > 0); 1422Debug.Assert(startingSpan.Length > 0); 1445Debug.Assert(startingSpan.Length == 1); 1446Debug.Assert(startingSpan[0] == node.Ch); 1452Debug.Assert(node.Kind == RegexNodeKind.Multi); 1453Debug.Assert(node.Str.AsSpan().StartsWith(startingSpan, StringComparison.Ordinal)); 1507Debug.Assert(Kind is RegexNodeKind.One or RegexNodeKind.Multi || (IsOneFamily && M > 0)); 1508Debug.Assert((Options & RegexOptions.RightToLeft) == 0); 1567Debug.Assert(lowInclusive < highInclusive); 1603Debug.Assert(@string is not null); 1609Debug.Assert(setChars is not null); 1622Debug.Assert(Kind == RegexNodeKind.Concatenate); 1664Debug.Assert(Kind == RegexNodeKind.Concatenate); 1665Debug.Assert(Children is List<RegexNode>); 1747Debug.Assert(Kind == RegexNodeKind.Concatenate); 1748Debug.Assert(Children is List<RegexNode>); 1858Debug.Assert(matchingCharsInMulti < nextNode.Str.Length); 1956Debug.Assert(Children is List<RegexNode>); 2095Debug.Assert(Kind is RegexNodeKind.PositiveLookaround or RegexNodeKind.NegativeLookaround); 2096Debug.Assert(ChildCount() == 1); 2211Debug.Assert(Kind == RegexNodeKind.BackreferenceConditional); 2212Debug.Assert(ChildCount() is 1 or 2); 2229Debug.Assert(Kind == RegexNodeKind.ExpressionConditional); 2230Debug.Assert(ChildCount() is 2 or 3); 2619Debug.Assert(childCount >= 2); 2652Debug.Assert(ChildCount() == 1); 2736Debug.Assert(childCount >= 2); 2790Debug.Assert(ChildCount() == 1); 3004Debug.Assert(max >= 2); 3049Debug.Assert(Children is List<RegexNode>); 3060Debug.Assert(Children != null); 3061Debug.Assert(index < ChildCount()); 3091Debug.Assert(Children is RegexNode);
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (7)
247Debug.Assert(childCount >= 2); // otherwise it would have been optimized out 266Debug.Assert(alternateBranchResults.Count > 0); 773Debug.Assert(sameDistance.HasValue); 813Debug.Assert(!s2Negated); 1153Debug.Assert(node.ChildCount() >= 2); 1199Debug.Assert( 1429Debug.Assert(leading);
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexTree.cs (9)
47Debug.Assert(captureNumberSparseMapping is null || captureNames is not null); 48Debug.Assert((captureNames is null) == (captureNameToNumberMapping is null)); 49Debug.Assert(captureNames is null || captureCount == captureNames.Length); 50Debug.Assert(captureNumberSparseMapping is null || captureCount == captureNumberSparseMapping.Count); 51Debug.Assert(captureNameToNumberMapping is null || captureCount == captureNameToNumberMapping.Count); 54Debug.Assert(captureNameToNumberMapping is not null); 60Debug.Assert(captureNumber is not null); 65Debug.Assert(captureNumber is not null); 68Debug.Assert(captureNumber == i);
UpgradeToGeneratedRegexAnalyzer.cs (2)
112Debug.Assert(syntaxNodeForDiagnostic != null); 144Debug.Assert(syntaxNodeForDiagnostic is not null);
UpgradeToGeneratedRegexCodeFixer.cs (1)
151Debug.Assert(typeDeclarationOrCompilationUnit is not null);
Test.Utilities (2)
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (2)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
Text.Analyzers (494)
src\Compilers\Core\Portable\Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (11)
69Debug.Assert(instance.IsEmpty); 100Debug.Assert(valueSet.Count >= 1); 116Debug.Assert(valueSet.Count >= 1); 149Debug.Assert(valueSet.Count >= 1); 161Debug.Assert(valueSet.Count >= 1); 211Debug.Assert(this.Count >= 1); 234Debug.Assert(this.Count >= 1); 263Debug.Assert(this.Count >= 1); 274Debug.Assert(this.Count >= 1); 309Debug.Assert(this.Count >= 1); 343Debug.Assert(_count >= 1);
src\Compilers\Core\Portable\Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
src\Compilers\Core\Portable\FileSystem\FileUtilities.cs (15)
49Debug.Assert(baseDirectory == null || searchPaths != null || PathUtilities.IsAbsolute(baseDirectory)); 62Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 73Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 86Debug.Assert(PathUtilities.IsAbsolute(combinedPath)); 103Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 109Debug.Assert(PathUtilities.GetPathKind(path) == kind); 174Debug.Assert(PathUtilities.IsDirectorySeparator(path![0])); 175Debug.Assert(path.Length == 1 || !PathUtilities.IsDirectorySeparator(path[1])); 200Debug.Assert(PathUtilities.IsAbsolute(resolvedBasePath)); 250Debug.Assert(PathUtilities.IsAbsolute(path)); 294Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 312Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 396Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 414Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 437Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
src\Compilers\Core\Portable\FileSystem\RelativePathResolver.cs (4)
29Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute)); 30Debug.Assert(baseDirectory == null || PathUtilities.GetPathKind(baseDirectory) == PathKind.Absolute); 49Debug.Assert(fullPath != null); 50Debug.Assert(PathUtilities.IsAbsolute(fullPath));
src\Compilers\Core\Portable\Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
src\Compilers\Core\Portable\Hashing\XxHash128.cs (6)
259Debug.Assert(length >= 1 && length <= 3); 284Debug.Assert(length >= 4 && length <= 8); 310Debug.Assert(length >= 9 && length <= 16); 336Debug.Assert(length >= 17 && length <= 128); 362Debug.Assert(length >= 129 && length <= 240); 395Debug.Assert(length > 240);
src\Compilers\Core\Portable\Hashing\XxHashShared.cs (45)
122Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret)); 125Debug.Assert(InternalBufferLengthBytes % StripeLengthBytes == 0); 128Debug.Assert(ReadLE64(defaultSecretUInt64[0]) == DefaultSecretUInt64_0); 129Debug.Assert(ReadLE64(defaultSecretUInt64[1]) == DefaultSecretUInt64_1); 130Debug.Assert(ReadLE64(defaultSecretUInt64[2]) == DefaultSecretUInt64_2); 131Debug.Assert(ReadLE64(defaultSecretUInt64[3]) == DefaultSecretUInt64_3); 132Debug.Assert(ReadLE64(defaultSecretUInt64[4]) == DefaultSecretUInt64_4); 133Debug.Assert(ReadLE64(defaultSecretUInt64[5]) == DefaultSecretUInt64_5); 134Debug.Assert(ReadLE64(defaultSecretUInt64[6]) == DefaultSecretUInt64_6); 135Debug.Assert(ReadLE64(defaultSecretUInt64[7]) == DefaultSecretUInt64_7); 136Debug.Assert(ReadLE64(defaultSecretUInt64[8]) == DefaultSecretUInt64_8); 137Debug.Assert(ReadLE64(defaultSecretUInt64[9]) == DefaultSecretUInt64_9); 138Debug.Assert(ReadLE64(defaultSecretUInt64[10]) == DefaultSecretUInt64_10); 139Debug.Assert(ReadLE64(defaultSecretUInt64[11]) == DefaultSecretUInt64_11); 140Debug.Assert(ReadLE64(defaultSecretUInt64[12]) == DefaultSecretUInt64_12); 141Debug.Assert(ReadLE64(defaultSecretUInt64[13]) == DefaultSecretUInt64_13); 142Debug.Assert(ReadLE64(defaultSecretUInt64[14]) == DefaultSecretUInt64_14); 143Debug.Assert(ReadLE64(defaultSecretUInt64[15]) == DefaultSecretUInt64_15); 146Debug.Assert(ReadLE64(defaultSecret3UInt64[0]) == DefaultSecret3UInt64_0); 147Debug.Assert(ReadLE64(defaultSecret3UInt64[1]) == DefaultSecret3UInt64_1); 148Debug.Assert(ReadLE64(defaultSecret3UInt64[2]) == DefaultSecret3UInt64_2); 149Debug.Assert(ReadLE64(defaultSecret3UInt64[3]) == DefaultSecret3UInt64_3); 150Debug.Assert(ReadLE64(defaultSecret3UInt64[4]) == DefaultSecret3UInt64_4); 151Debug.Assert(ReadLE64(defaultSecret3UInt64[5]) == DefaultSecret3UInt64_5); 152Debug.Assert(ReadLE64(defaultSecret3UInt64[6]) == DefaultSecret3UInt64_6); 153Debug.Assert(ReadLE64(defaultSecret3UInt64[7]) == DefaultSecret3UInt64_7); 154Debug.Assert(ReadLE64(defaultSecret3UInt64[8]) == DefaultSecret3UInt64_8); 155Debug.Assert(ReadLE64(defaultSecret3UInt64[9]) == DefaultSecret3UInt64_9); 156Debug.Assert(ReadLE64(defaultSecret3UInt64[10]) == DefaultSecret3UInt64_10); 157Debug.Assert(ReadLE64(defaultSecret3UInt64[11]) == DefaultSecret3UInt64_11); 158Debug.Assert(ReadLE64(defaultSecret3UInt64[12]) == DefaultSecret3UInt64_12); 159Debug.Assert(ReadLE64(defaultSecret3UInt64[13]) == DefaultSecret3UInt64_13); 213Debug.Assert(length > 240); 229Debug.Assert(stripes <= stripesPerBlock); // can handle max 1 scramble per invocation 230Debug.Assert(stripesSoFar < stripesPerBlock); 251Debug.Assert(state.BufferedCount <= InternalBufferLengthBytes); 281Debug.Assert(sourceIndex < source.Length); 287Debug.Assert(NumStripesPerBlock >= state.StripesProcessedInCurrentBlock); 291Debug.Assert(stripesToEnd <= stripes); 310Debug.Assert(sourceIndex < source.Length); // at least some bytes left 332Debug.Assert(sourceIndex < source.Length); 333Debug.Assert(remaining.Length <= InternalBufferLengthBytes); 334Debug.Assert(state.BufferedCount == 0); 371Debug.Assert(state.BufferedCount > 0); 787Debug.Assert(shift >= 0 && shift < 64);
src\Compilers\Core\Portable\InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
src\Compilers\Core\Portable\InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
src\Compilers\Core\Portable\InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
17/// <inheritdoc cref="Debug.Assert(bool)"/> 19public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 43/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Core\Portable\InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
src\Compilers\Core\Portable\InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
src\Compilers\Core\Portable\InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
src\Compilers\Core\Portable\InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
src\Compilers\Core\Portable\InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
src\Compilers\Core\Portable\SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
src\Compilers\Core\Portable\Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
714Debug.Assert(data.All(d => d.Count() == count)); 1083Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 455Debug.Assert(self.Length == other.Length); 475Debug.Assert(self.Length == other.Length); 506Debug.Assert(!array.IsDefault); 507Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 526Debug.Assert(i > 0); 542Debug.Assert(i > 0); 545Debug.Assert(builder == null); 558Debug.Assert(!all); 559Debug.Assert(!none); 568Debug.Assert(none); 841Debug.Assert(builder.Count > 1); 885Debug.Assert(members.Length > 0); 900Debug.Assert(count < members.Length); 912Debug.Assert(builder.Count == count); 1190Debug.Assert(!array.IsDefault);
src\Dependencies\Collections\Internal\ArraySortHelper.cs (41)
112Debug.Assert(i != j); 125Debug.Assert(i != j); 134Debug.Assert(comparer != null); 147Debug.Assert(keys.Length > 0); 148Debug.Assert(depthLimit >= 0); 149Debug.Assert(comparer != null); 192Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 193Debug.Assert(comparer != null); 237Debug.Assert(comparer != null); 238Debug.Assert(keys.Length > 0); 255Debug.Assert(comparer != null); 415Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 427Debug.Assert(keys.Length > 0); 428Debug.Assert(depthLimit >= 0); 474Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 537Debug.Assert(keys.Length > 0); 693Debug.Assert(comparer != null); 694Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 695Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 696Debug.Assert(i != j); 713Debug.Assert(i != j); 726Debug.Assert(comparer != null); 727Debug.Assert(keys.Length == values.Length); 737Debug.Assert(keys.Length > 0); 738Debug.Assert(values.Length == keys.Length); 739Debug.Assert(depthLimit >= 0); 740Debug.Assert(comparer != null); 783Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 784Debug.Assert(comparer != null); 828Debug.Assert(comparer != null); 829Debug.Assert(keys.Length > 0); 846Debug.Assert(comparer != null); 873Debug.Assert(comparer != null); 946Debug.Assert(i != j); 964Debug.Assert(i != j); 977Debug.Assert(keys.Length > 0); 978Debug.Assert(values.Length == keys.Length); 979Debug.Assert(depthLimit >= 0); 1022Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1081Debug.Assert(keys.Length > 0); 1235Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
src\Dependencies\Collections\Internal\BitHelper.cs (2)
34Debug.Assert(bitPosition >= 0); 48Debug.Assert(bitPosition >= 0);
src\Dependencies\Collections\Internal\HashHelpers.cs (2)
113Debug.Assert(divisor <= int.MaxValue); 119Debug.Assert(highbits == value % divisor);
src\Dependencies\Collections\OneOrMany.cs (1)
200Debug.Assert(HasOneItem == other.HasOneItem);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
24Debug.Assert(dictionary is not null);
src\Dependencies\Collections\Segmented\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
120Debug.Assert(other is not ValueBuilder);
src\Dependencies\Collections\Segmented\SegmentedArray.cs (5)
114Debug.Assert(length > 0); 115Debug.Assert(sourceIndex >= 0); 116Debug.Assert(destinationIndex >= 0); 117Debug.Assert((uint)(sourceIndex + length) <= array.Length); 118Debug.Assert((uint)(destinationIndex + length) <= array.Length);
src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (11)
168Debug.Assert(_entries.Length >= source.Count); 169Debug.Assert(_count == 0); 260Debug.Assert(modified); 267Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 447Debug.Assert(comparer is not null); 518Debug.Assert(_buckets.Length > 0); 524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType)); 574Debug.Assert(comparer is not null); 649Debug.Assert(newSize >= _entries.Length); 711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null); 788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (6)
189Debug.Assert(Count == source.Count); 258Debug.Assert(comparer is not null); 302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null); 902Debug.Assert(newSize >= _entries.Length); 1023Debug.Assert(_buckets.Length > 0); 1063Debug.Assert(comparer is not null);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (2)
270Debug.Assert(_size == _items.Length); 520Debug.Assert(_items.Length < capacity);
src\Dependencies\Collections\TemporaryArray`1.cs (2)
173Debug.Assert(_count == InlineCapacity); 336Debug.Assert(_builder is null);
src\Dependencies\PooledObjects\ArrayBuilder.cs (8)
507Debug.Assert(builder.Count == 0); 623Debug.Assert(start >= 0 && length >= 0); 624Debug.Assert(start + length <= items.Count); 643Debug.Assert(start >= 0 && length >= 0); 644Debug.Assert(start + length <= items.Length); 658Debug.Assert(start >= 0 && length >= 0); 659Debug.Assert(start + length <= items.Length); 683Debug.Assert(limit <= Count);
src\Dependencies\PooledObjects\ObjectPool`1.cs (2)
118Debug.Assert(size >= 1); 126Debug.Assert(size >= 1);
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
58Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
47Debug.Assert(instance.Count == 0);
src\Dependencies\PooledObjects\PooledStringBuilder.cs (2)
30Debug.Assert(pool != null); 95Debug.Assert(builder.Builder.Length == 0);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Threading\ParallelExtensions.NetFramework.cs (7)
111Debug.Assert(source != null); 112Debug.Assert(scheduler != null); 113Debug.Assert(body != null); 276Debug.Assert(source != null); 277Debug.Assert(scheduler != null); 278Debug.Assert(body != null); 540Debug.Assert(!Cancellation.IsCancellationRequested);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (3)
60Debug.Assert(child.Symbol.Kind == SymbolKind.Namespace); 61Debug.Assert(!child.Children.IsEmpty); 62Debug.Assert(child.Children.All(grandChild => grandChild.Symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.cs (2)
35Debug.Assert( 43Debug.Assert(depthOfInheritance.HasValue == (symbol.Kind == SymbolKind.Assembly || symbol.Kind == SymbolKind.Namespace || symbol.Kind == SymbolKind.NamedType));
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
27Debug.Assert(childrenCount != 0);
src\RoslynAnalyzers\Utilities\Compiler\DiagnosticDescriptorHelper.cs (2)
33Debug.Assert(!isDataflowRule || ruleLevel == RuleLevel.Disabled || ruleLevel == RuleLevel.CandidateForRemoval); 36Debug.Assert(isEnabledByDefaultInAggressiveMode || ruleLevel == RuleLevel.Disabled || ruleLevel == RuleLevel.CandidateForRemoval);
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IMethodSymbolExtensions.cs (2)
503Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 515Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked));
src\RoslynAnalyzers\Utilities\Compiler\Extensions\IOperationExtensions.cs (6)
211Debug.Assert(isInsideAnonymousObjectInitializer == 289Debug.Assert(success); 290Debug.Assert(cfg != null); 334Debug.Assert(operation is IAnonymousFunctionOperation anonymousFunction && anonymousFunction.Symbol.OriginalDefinition.ReturnTypeAndParametersAreSame(lambdaOrLocalFunction.OriginalDefinition) || 496Debug.Assert(parameterIndex >= 0); 497Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
46Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
38Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
32Debug.Assert(typeof(MSBuildPropertyOptionNames).GetFields().Single(f => f.Name == propertyOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\SymbolNamesWithValueOption.cs (3)
66Debug.Assert(!names.IsEmpty || !symbols.IsEmpty || !wildcardNamesBySymbolKind.IsEmpty); 144Debug.Assert(parts.SymbolName[^1] == WildcardChar); 145Debug.Assert(parts.SymbolName.Length >= 2);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledConcurrentDictionary.cs (2)
72Debug.Assert(instance.IsEmpty); 82Debug.Assert(added);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledDictionary.cs (1)
47Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\PooledObjects\PooledSortedSet.cs (1)
69Debug.Assert(instance.Count == 0);
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
428Debug.Assert(unbalanced != currentNode); 434Debug.Assert(n.HashCode != hashCode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleHelpers.cs (1)
185Debug.Assert(s_unusedExpressionAssignmentPreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOptions2.cs (7)
193Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); 215Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsKey(value)); 223Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); 261Debug.Assert(s_parenthesesPreferenceMap.ContainsKey(value)); 269Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); 313Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsKey(value)); 322Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (1)
79Debug.Assert(values.IsSorted(Comparer<T>.Create((t1, t2) => localIntrospector.GetSpan(t1).Start - localIntrospector.GetSpan(t2).Start)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.cs (2)
102Debug.Assert(rightBalance == 1); 115Debug.Assert(leftBalance == -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (2)
295Debug.Assert(lastEnd < span1.End); 306Debug.Assert(lastEnd < span2.Start);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\EditorConfigParser.cs (4)
74Debug.Assert(!string.IsNullOrEmpty(sectionName)); 91Debug.Assert(!string.IsNullOrEmpty(key)); 92Debug.Assert(key == key.Trim()); 93Debug.Assert(value == value.Trim());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EditorConfig\Parsing\Sections\SectionMatcher.cs (1)
313Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (4)
45Debug.Assert(NodesAndTokens[i].IsNode); 46Debug.Assert(NodesAndTokens[i].Node is EmbeddedSyntaxNode<TSyntaxKind, TSyntaxNode>); 51Debug.Assert(!NodesAndTokens[i].IsNode); 68Debug.Assert(nodeOrToken.IsNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
46Debug.Assert((int)(object)kind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNodeOrToken.cs (2)
26Debug.Assert((int)(object)token.Kind != 0); 34Debug.Assert(Node == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxToken.cs (4)
36Debug.Assert(!leadingTrivia.IsDefault); 37Debug.Assert(!virtualChars.IsDefault); 38Debug.Assert(!trailingTrivia.IsDefault); 39Debug.Assert(!diagnostics.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxTrivia.cs (1)
28Debug.Assert(virtualChars.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\AbstractVirtualCharService.cs (5)
79Debug.Assert(expectedValueText == actualValueText); 135Debug.Assert(!token.ContainsDiagnostics); 139Debug.Assert(startDelimiter == ""); 140Debug.Assert(endDelimiter == ""); 219Debug.Assert(char.IsSurrogate(ch));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.Chunks.cs (1)
104Debug.Assert(index + 1 >= data.Length ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualCharSequence.cs (3)
196Debug.Assert(_leafCharacters == virtualChars._leafCharacters); 197Debug.Assert(_span.End == virtualChars._span.Start); 208Debug.Assert(chars1._leafCharacters == chars2._leafCharacters);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowGraphExtensions.cs (2)
16Debug.Assert(firstBlock.Kind == BasicBlockKind.Entry); 23Debug.Assert(lastBlock.Kind == BasicBlockKind.Exit);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\DiagnosticDescriptorExtensions.cs (2)
25Debug.Assert(descriptor.CustomTags is ImmutableArray<string>); 51Debug.Assert(reportDiagnostic != ReportDiagnostic.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
43Debug.Assert(loc1.IsInSource && loc2.IsInSource);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\OperationExtensions.cs (1)
153Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (3)
79Debug.Assert(tabSize > 0); 80Debug.Assert(endPosition >= 0 && endPosition <= textSnippet.Length); 254Debug.Assert(builder.KeyComparer == StringComparer.Ordinal || builder.KeyComparer == StringComparer.OrdinalIgnoreCase);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SymbolUsageInfo.cs (1)
33Debug.Assert(valueUsageInfoOpt.HasValue ^ typeOrNamespaceUsageInfoOpt.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs (18)
59Debug.Assert(unreachableBlocksToVisit.Count == 0); 215Debug.Assert(branch.Destination == null); 220Debug.Assert(branch.Destination == null); 226Debug.Assert(branch.Destination != null); 257Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 261Debug.Assert(enclosing.NestedRegions[0] == region); 262Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 279Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 324Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 325Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 336Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 347Debug.Assert(enclosing.Kind == ControlFlowRegionKind.FilterAndHandler); 349Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 373Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 374Debug.Assert(startAt > 0); 375Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 389Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 390Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.AnalysisData.cs (2)
93Debug.Assert(localFunction.IsLocalFunction()); 245Debug.Assert(newBlockAnalysisData != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.cs (1)
57Debug.Assert(localFunctionOrLambda.IsLocalFunction() || localFunctionOrLambda.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.DataFlowAnalyzer.FlowGraphAnalysisData.cs (13)
101Debug.Assert(LValueFlowCapturesInGraph.Values.All(kind => kind is FlowCaptureKind.LValueCapture or FlowCaptureKind.LValueAndRValueCapture)); 121Debug.Assert(cfg.Parent == null); 144Debug.Assert(cfg.Parent != null); 145Debug.Assert(lambdaOrLocalFunction.IsAnonymousFunction() || lambdaOrLocalFunction.IsLocalFunction()); 146Debug.Assert(parentAnalysisData != null); 303Debug.Assert(lambdaOrLocalFunctionCfg != null); 313Debug.Assert(anonymousFunctionCfg != null); 322Debug.Assert(localFunction.IsLocalFunction()); 330Debug.Assert(localFunctionCfg != null); 346Debug.Assert(_analysisDataByBasicBlockMap[basicBlock] != null); 487Debug.Assert(localFunction.IsLocalFunction()); 488Debug.Assert(localFunction.Equals(localFunction.OriginalDefinition)); 578Debug.Assert(localFunctionTarget.Method.IsLocalFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\SymbolUsageAnalysis\SymbolUsageAnalysis.Walker.cs (11)
53Debug.Assert(_currentContainingSymbol == null); 54Debug.Assert(_currentAnalysisData == null); 55Debug.Assert(_currentRootOperation == null); 56Debug.Assert(_pendingWritesMap == null); 109Debug.Assert(symbol != null); 161Debug.Assert(symbolOpt != null || operation.Kind == OperationKind.FlowCaptureReference); 197Debug.Assert(symbolOpt != null); 207Debug.Assert(symbolOpt == null); 210Debug.Assert(_currentAnalysisData.IsLValueFlowCapture(captureReference.Id)); 346Debug.Assert(localFunction.IsLocalFunction()); 499Debug.Assert(operation.Type.IsDelegateType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (2)
191Debug.Assert(scratch.Count == 0); 205Debug.Assert(scratch.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (10)
65Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 92Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 107Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 130Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 148Debug.Assert(operation.Option == AdjustNewLinesOption.ForceLinesIfOnSingleLine); 178Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 195Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 209Debug.Assert(!context.IsFormattingDisabled(new TextSpan(context.TokenStream.GetToken(pairIndex + 1).SpanStart, 0))); 461Debug.Assert(!context.IsFormattingDisabled(pairIndex)); 464Debug.Assert(!previousChangesMap.ContainsKey(currentToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (12)
63Debug.Assert(this.TokenCount > 0); 85Debug.Assert(previousToken.FullSpan.End <= currentToken.FullSpan.Start); 388Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 389Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 390Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 413Debug.Assert(token1.Token.Span.End <= token2.Token.SpanStart); 414Debug.Assert(token1.IndexInStream < 0 || token2.IndexInStream < 0 || (token1.IndexInStream + 1 == token2.IndexInStream)); 415Debug.Assert((token1.IndexInStream >= 0 && token2.IndexInStream >= 0) || token1.Token.Equals(token2.Token.GetPreviousToken(includeZeroWidth: true)) || token2.Token.LeadingTrivia.Span.Contains(token1.Token.Span)); 433Debug.Assert(_treeData.IsFirstToken(this.FirstTokenInStream.Token)); 445Debug.Assert(_treeData.IsLastToken(this.LastTokenInStream.Token)); 493Debug.Assert(tokenData2 == tokenData1.GetNextTokenData()); 517Debug.Assert(token.FullSpan.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
19Debug.Assert(!tokens.IsEmpty());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (2)
750Debug.Assert(!_firstLineBlank); 856Debug.Assert(IsWhitespaceOrEndOfLine(trivia2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Indentation\AbstractIndentation.Indenter.cs (1)
84Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
161Debug.Assert(spanToCheck.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.WordSpanEnumerator.cs (1)
21Debug.Assert(nameSpan.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\Option2.cs (3)
69Debug.Assert(LanguageName is null == (Definition.ConfigName.StartsWith(OptionDefinition.LanguageAgnosticConfigNamePrefix, StringComparison.Ordinal) || 71Debug.Assert(LanguageName is LanguageNames.CSharp == Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 72Debug.Assert(LanguageName is LanguageNames.VisualBasic == Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionDefinition.cs (1)
59Debug.Assert(IsSupportedOptionType(Type));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\OptionKey2.cs (3)
22Debug.Assert(option.IsPerLanguage == language is not null); 30Debug.Assert(option.IsPerLanguage); 42Debug.Assert(!option.IsPerLanguage);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PerLanguageOption2.cs (2)
60Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.CSharpConfigNamePrefix, StringComparison.Ordinal)); 61Debug.Assert(!Definition.ConfigName.StartsWith(OptionDefinition.VisualBasicConfigNamePrefix, StringComparison.Ordinal));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (2)
45Debug.Assert(BitConverter.IsLittleEndian); 242Debug.Assert(code is >= TypeCode.FirstWellKnownTextEncoding and <= TypeCode.LastWellKnownTextEncoding);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (3)
92Debug.Assert(BitConverter.IsLittleEndian); 470Debug.Assert(id >= 0); 542Debug.Assert(kind is >= EncodingExtensions.FirstTextEncodingKind and <= EncodingExtensions.LastTextEncodingKind);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\TextEncodingKind.cs (5)
62Debug.Assert(HasPreamble(Encoding.Unicode)); 67Debug.Assert(HasPreamble(Encoding.BigEndianUnicode)); 72Debug.Assert(HasPreamble(Encoding.UTF32)); 77Debug.Assert(HasPreamble(Encoding.UTF32)); 82Debug.Assert(HasPreamble(Encoding.UTF8));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\FileBannerFacts\AbstractFileBannerFacts.cs (2)
168Debug.Assert(root.FullSpan.Start == 0); 174Debug.Assert(firstToken.FullSpan.Start == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\HeaderFacts\AbstractHeaderFacts.cs (1)
40Debug.Assert(ownerOfHeader.FullSpan.Contains(lastTokenOrNodeOfHeader.Span));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousFunctionOrDelegateSymbolKey.cs (1)
23Debug.Assert(symbol.IsAnonymousDelegateType() || symbol.IsAnonymousFunction());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.AnonymousTypeSymbolKey.cs (1)
19Debug.Assert(symbol.IsAnonymousType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
198Debug.Assert(reader.Position == symbolKey.Length);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.MethodSymbolKey.cs (3)
17Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 129Debug.Assert(symbol.Equals(symbol.ConstructedFrom)); 262Debug.Assert(method != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamespaceSymbolKey.cs (3)
36Debug.Assert(symbol.IsGlobalNamespace); 94Debug.Assert(metadataName == string.Empty); 98Debug.Assert(metadataName == string.Empty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.PropertySymbolKey.cs (1)
104Debug.Assert(property != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (8)
65Debug.Assert(Data[Position] == c); 87Debug.Assert(char.IsNumber(Data[Position])); 102Debug.Assert(start != Position); 116Debug.Assert(val is 0 or 1); 202Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null); 288Debug.Assert(_skipString == false); 293Debug.Assert(_skipString == true); 547Debug.Assert((SymbolKeyType)Data[Position] != SymbolKeyType.Null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (3)
109Debug.Assert(_nestingCount == 0); 255Debug.Assert(location.Kind is LocationKind.None or 307Debug.Assert(!array.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TupleTypeSymbolKey.cs (1)
20Debug.Assert(symbol.IsTupleType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AbstractSpeculationAnalyzer.cs (17)
262Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 264Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 286Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 288Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 298Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 300Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 308Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 310Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 320Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 322Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 573Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 574Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 628Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 630Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1082Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1083Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1168Debug.Assert(parameter1.HasExplicitDefaultValue == parameter2.HasExplicitDefaultValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\Base64Utilities.cs (4)
98Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false. 127Debug.Assert(chars.Length != 0 && !chars[0].IsSpace()); 175Debug.Assert(tempBuffer.Length != 0); // We only bound-check after writing a character to the tempBuffer. 316Debug.Assert((consumed % 4) == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BidirectionalMap.cs (1)
100Debug.Assert(_forwardMap.Count == _backwardMap.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (4)
163Debug.Assert(spilledEdges.Count == (edgeCount - CompactEdgeAllocationSize)); 173Debug.Assert(currentEdgeIndex == edges.Capacity); 174Debug.Assert(currentEdgeIndex == edges.Count); 278Debug.Assert(currentNode.SpilloverEdges.Count == (currentNode.EdgeCount - CompactEdgeAllocationSize));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (8)
182Debug.Assert(source.Length <= target.Length); 219Debug.Assert(minimumEditCount >= 0); 485Debug.Assert(offset >= 0); 577Debug.Assert(v1 >= 0); 578Debug.Assert(v2 >= 0); 579Debug.Assert(v3 >= 0); 580Debug.Assert(v4 >= 0); 598Debug.Assert(min >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SerializableBytes.cs (1)
239Debug.Assert(count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\StringBreaker.cs (3)
85Debug.Assert(current < length); 107Debug.Assert(current < length); 126Debug.Assert(char.IsUpper(identifier[current - 1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\WordSimilarityChecker.cs (1)
134Debug.Assert(similarityWeight <= _threshold);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Compilation\CompilationExtensions.cs (1)
336Debug.Assert(type is null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\IMethodSymbolExtensions.cs (2)
25Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); 30Debug.Assert(!Equals(method.PartialImplementationPart, method));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
92Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 179Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 217Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 254Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 379Debug.Assert(current.IsDefinition); 413Debug.Assert(within is INamedTypeSymbol or IAssemblySymbol); 439Debug.Assert(current.IsDefinition);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
533Debug.Assert(isTypeParameter2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
166Debug.Assert(_assemblyComparer == null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.EquivalenceVisitor.cs (7)
78Debug.Assert(!x.IsDefault && !y.IsDefault); 114Debug.Assert(x.Kind == y.Kind && x.Kind == k); 332Debug.Assert(GetTypeKind(x) == GetTypeKind(y)); 371Debug.Assert(y.Kind == SymbolKind.ErrorType); 420Debug.Assert(y.IsTupleType); 619Debug.Assert( 623Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
342Debug.Assert(desiredGroupIndex >= 0); 343Debug.Assert(desiredGroupIndex <= declarationList.Count);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationMethodSymbol.cs (1)
42Debug.Assert(!isInitOnly || methodKind == MethodKind.PropertySet);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ProjectExtensions.cs (3)
49Debug.Assert(diagnostic != null); 103Debug.Assert(analyzerConfigPath != null); 104Debug.Assert(PathUtilities.IsAbsolute(analyzerConfigPath));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
74Debug.Assert(!semanticModel.IsSpeculativeSemanticModel);