20581 references to Assert
aspire (16)
Backchannel\ExtensionBackchannel.cs (2)
83Debug.Assert(endpoint is not null); 484Debug.Assert(!string.IsNullOrEmpty(serverCertificate));
Interaction\ExtensionInteractionService.cs (14)
47Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.ShowStatusAsync(statusText.RemoveSpectreFormatting(), _cancellationToken))); 50Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.ShowStatusAsync(null, _cancellationToken))); 56Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.ShowStatusAsync(statusText.RemoveSpectreFormatting(), _cancellationToken))); 58Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.ShowStatusAsync(null, _cancellationToken))); 163Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.DisplayIncompatibleVersionErrorAsync(ex.RequiredCapability, appHostHostingSdkVersion, _cancellationToken))); 169Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.DisplayErrorAsync(errorMessage.RemoveSpectreFormatting(), _cancellationToken))); 175Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.DisplayMessageAsync(emoji, message.RemoveSpectreFormatting(), _cancellationToken))); 181Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.DisplaySuccessAsync(message.RemoveSpectreFormatting(), _cancellationToken))); 187Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.DisplaySubtleMessageAsync(message.RemoveSpectreFormatting(), _cancellationToken))); 193Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.DisplayDashboardUrlsAsync(dashboardUrls, _cancellationToken))); 199Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.DisplayLinesAsync(lines.Select(line => new DisplayLineState(line.Stream.RemoveSpectreFormatting(), line.Line.RemoveSpectreFormatting())), _cancellationToken))); 205Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.DisplayCancellationMessageAsync(_cancellationToken))); 211Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.DisplayEmptyLineAsync(_cancellationToken))); 217Debug.Assert(_extensionTaskChannel.Writer.TryWrite(() => _backchannel.OpenProjectAsync(projectPath, _cancellationToken)));
Aspire.Azure.Npgsql (2)
AspireAzureNpgsqlExtensions.cs (2)
38Debug.Assert(azureSettings != null); 67Debug.Assert(azureSettings != null);
Aspire.Azure.Npgsql.EntityFrameworkCore.PostgreSQL (2)
AspireAzureEFPostgreSqlExtensions.cs (2)
59Debug.Assert(azureSettings != null); 84Debug.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)
241Debug.Assert(_isMaskAllChecked != null);
Components\Pages\ConsoleLogs.razor.cs (2)
259Debug.Assert(_resources is not null); 722Debug.Assert(pause is not null);
Components\Pages\TraceDetail.razor.cs (1)
91Debug.Assert(_spanWaterfallViewModels != null);
Model\ResourceViewModel.cs (2)
164Debug.Assert(x != null); 165Debug.Assert(y != null);
src\Shared\ConsoleLogs\LogEntries.cs (1)
211Debug.Assert(BaseLineNumber is not null);
Aspire.Hosting (6)
ApplicationModel\ResourceLoggerService.cs (3)
471Debug.Assert(Monitor.IsEntered(_lock)); 482Debug.Assert(Monitor.IsEntered(_lock)); 497Debug.Assert(Monitor.IsEntered(_lock));
Dcp\DcpExecutor.cs (1)
1428Debug.Assert(ea.IsProxied);
src\Shared\ConsoleLogs\LogEntries.cs (1)
211Debug.Assert(BaseLineNumber is not null);
Utils\PasswordGenerator.cs (1)
84Debug.Assert(destination.Length >= minValues);
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)
src\Components\Aspire.RabbitMQ.Client\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] != '\\');
BuildValidator (11)
CompilationDiff.cs (8)
77Debug.Assert(_message is object); 236Debug.Assert(_localReferenceResolver is object); 257Debug.Assert(Result == RebuildResult.BinaryDifference); 258Debug.Assert(_originalPortableExecutableBytes is object); 259Debug.Assert(_originalPdbReader is object); 260Debug.Assert(_rebuildPortableExecutableBytes is object); 261Debug.Assert(_rebuildPdbReader is object); 262Debug.Assert(_rebuildCompilation is object);
PEReaderExtensions.cs (2)
20Debug.Assert(peReader.PEHeaders is object); 21Debug.Assert(peReader.PEHeaders.PEHeader is object);
Util.cs (1)
74Debug.Assert(memberRef.Parent.Kind == HandleKind.TypeReference);
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);
csc (9)
src\Compilers\Core\CommandLine\BuildProtocol.cs (1)
504Debug.Assert(reason is object);
src\Compilers\Shared\BuildClient.cs (4)
158Debug.Assert(serverResult.Value.RanOnServer); 239Debug.Assert(buildResponse != null); 274Debug.Assert(false); 354Debug.Assert(PlatformInformation.IsWindows);
src\Compilers\Shared\BuildServerConnection.cs (4)
68Debug.Assert(workingDirectory is object); 179Debug.Assert(pipeName is object); 708Debug.Assert(Stream is null); 746Debug.Assert(Stream is not null);
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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 41/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
GetDocument.Insider (1)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-preview.7.25327.102\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (1)
294Debug.Assert(_hostTcs.Task.IsCompleted);
ILLink.RoslynAnalyzer (75)
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)
82Debug.Assert(Context.OwningSymbol is not IMethodSymbol methodSymbol || 91Debug.Assert(!oldInterproceduralState.Methods.IsUnknown());
DataFlow\LocalDataFlowVisitor.cs (17)
178Debug.Assert(assemblyType != null); 182Debug.Assert(method != null); 356Debug.Assert(operation.Target is not IFlowCaptureReferenceOperation); 410Debug.Assert(IsLValueFlowCapture(flowCaptureReference.Id)); 411Debug.Assert(flowCaptureReference.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Write)); 413Debug.Assert(!capturedReferences.IsUnknown()); 452Debug.Assert(addMethod != null); 460Debug.Assert(removeMethod != null); 530Debug.Assert(operation.Value is not IFlowCaptureReferenceOperation); 554Debug.Assert(!capturedReferences.IsUnknown()); 606Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction); 657Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Read)); 672Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Reference)); 707Debug.Assert(operation.GetValueUsageInfo(OwningSymbol).HasFlag(ValueUsageInfo.Read)); 751Debug.Assert(operation.Symbol.ContainingSymbol is IMethodSymbol or IFieldSymbol); 753Debug.Assert(lambda.MethodKind == MethodKind.LambdaMethod); 866Debug.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)
74Debug.Assert((int)first < (int)last);
IOperationExtensions.cs (1)
125Debug.Assert(parenthesizedOperation.Language == LanguageNames.VisualBasic);
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); 321Debug.Assert(isPredecessorInFinally); 389Debug.Assert(result); 401Debug.Assert(exceptionState != null); 402Debug.Assert(oldExceptionState != null); 409Debug.Assert(enclosingTryOrCatch.Kind != RegionKind.Filter); 439Debug.Assert(finallyExit != null); 442Debug.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 (3)
161Debug.Assert(parameterMethod != null); 172Debug.Assert(property != null); 192Debug.Assert(property != null);
TrimAnalysis\HandleCallAction.cs (1)
315Debug.Assert(property != null);
TrimAnalysis\ReflectionAccessAnalyzer.cs (2)
116Debug.Assert(member is IMethodSymbol or IFieldSymbol); 123Debug.Assert(_typeHierarchyType is not null);
TrimAnalysis\TrimAnalysisAssignmentPattern.cs (2)
44Debug.Assert(Operation == other.Operation); 45Debug.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)
371Debug.Assert(OwningSymbol is IMethodSymbol); 387Debug.Assert(OwningSymbol is IMethodSymbol);
Metrics (483)
Program.cs (1)
280Debug.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\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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count));
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\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)
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 517Debug.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) || 507Debug.Assert(parameterIndex >= 0); 508Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
48Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
42Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
36Debug.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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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\RoslynParallel.NetFramework.cs (7)
115Debug.Assert(source != null); 116Debug.Assert(scheduler != null); 117Debug.Assert(body != null); 280Debug.Assert(source != null); 281Debug.Assert(scheduler != null); 282Debug.Assert(body != null); 544Debug.Assert(!Cancellation.IsCancellationRequested);
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)
330Debug.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 (483)
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\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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count));
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\RoslynAnalyzers\Tools\Metrics\Program.cs (1)
280Debug.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)
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 517Debug.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) || 507Debug.Assert(parameterIndex >= 0); 508Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
48Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
42Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
36Debug.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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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\RoslynParallel.NetFramework.cs (7)
115Debug.Assert(source != null); 116Debug.Assert(scheduler != null); 117Debug.Assert(body != null); 280Debug.Assert(source != null); 281Debug.Assert(scheduler != null); 282Debug.Assert(body != null); 544Debug.Assert(!Cancellation.IsCancellationRequested);
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)
330Debug.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.Arcade.Test.Common (2)
DiffUtil.cs (2)
198Debug.Assert(lengthA >= 0 && lengthB >= 0); 212Debug.Assert(lcsLength <= max);
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 (56)
BackEnd\BuildManager\BuildManager.cs (20)
701Debug.Assert(Monitor.IsEntered(_syncLock)); 1418Debug.Assert(!Monitor.IsEntered(_syncLock)); 1432Debug.Assert(Monitor.IsEntered(_syncLock)); 1534Debug.Assert(Monitor.IsEntered(_syncLock)); 1725Debug.Assert(!Monitor.IsEntered(_syncLock)); 1746Debug.Assert(!Monitor.IsEntered(_syncLock)); 1827Debug.Assert(!Monitor.IsEntered(_syncLock)); 2281Debug.Assert(Monitor.IsEntered(_syncLock)); 2314Debug.Assert(Monitor.IsEntered(_syncLock)); 2322Debug.Assert(Monitor.IsEntered(_syncLock)); 2439Debug.Assert(Monitor.IsEntered(_syncLock)); 2465Debug.Assert(Monitor.IsEntered(_syncLock)); 2542Debug.Assert(Monitor.IsEntered(_syncLock)); 2634Debug.Assert(Monitor.IsEntered(_syncLock)); 2683Debug.Assert(Monitor.IsEntered(_syncLock)); 2809Debug.Assert(Monitor.IsEntered(_syncLock)); 2835Debug.Assert(Monitor.IsEntered(_syncLock)); 2978Debug.Assert(Monitor.IsEntered(_syncLock)); 3261Debug.Assert(Monitor.IsEntered(_syncLock)); 3342Debug.Assert(Monitor.IsEntered(_syncLock));
BackEnd\Components\RequestBuilder\TaskHost.cs (1)
844Debug.Assert(coresAcquired >= 1);
BuildCheck\Infrastructure\EditorConfig\EditorConfigFile.cs (4)
92Debug.Assert(!string.IsNullOrEmpty(sectionName)); 105Debug.Assert(!string.IsNullOrEmpty(key)); 106Debug.Assert(key == key.Trim()); 107Debug.Assert(value == value?.Trim());
BuildCheck\Infrastructure\EditorConfig\EditorConfigGlobsMatcher.cs (2)
33Debug.Assert(regex.GetGroupNumbers().Length - 1 == numberRangePairs.Length); 51Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
Collections\RetrievableEntryHashSet\RetrievableEntryHashSet.cs (4)
238Debug.Assert(String.Equals(name, value.Key, StringComparison.Ordinal)); 287Debug.Assert(String.Equals(entry.Key, entry.Value.Key, StringComparison.Ordinal)); 401Debug.Assert(String.Equals(entry.Key, entry.Value.Key, StringComparison.Ordinal)); 607Debug.Assert(String.Equals(entry.Key, entry.Value.Key, StringComparison.Ordinal));
Definition\BuiltInMetadata.cs (1)
76Debug.Assert(FileUtilities.ItemSpecModifiers.IsItemSpecModifier(name));
Definition\ProjectCollection.cs (2)
1659Debug.Assert(_locker.IsWriteLockHeld); 1677Debug.Assert(_locker.IsWriteLockHeld);
Evaluation\Conditionals\Scanner.cs (1)
111Debug.Assert(-1 != _errorPosition); // We should have set it
Evaluation\LazyItemEvaluator.cs (1)
211Debug.Assert(_cache == null);
FileMatcher.cs (3)
1978Debug.Assert(projectDirectoryUnescaped != null); 1979Debug.Assert(filespecUnescaped != null); 1980Debug.Assert(Path.IsPathRooted(projectDirectoryUnescaped));
FileUtilities.cs (2)
742Debug.Assert(allowedExtensions?.Length > 0); 750Debug.Assert(!String.IsNullOrEmpty(extension) && extension[0] == '.');
Graph\ProjectGraph.cs (1)
840Debug.Assert(_evaluationContext is not null);
Utilities\FileSpecMatchTester.cs (4)
23Debug.Assert(!string.IsNullOrEmpty(unescapedFileSpec)); 24Debug.Assert(currentDirectory != null); 58Debug.Assert(!string.IsNullOrEmpty(fileToMatch)); 78Debug.Assert(!string.IsNullOrEmpty(normalizedFileToMatch));
Utilities\SimpleVersion.cs (1)
181Debug.Assert(value >= 0);
WindowsFileSystem.cs (2)
138Debug.Assert(hr != WindowsNative.ErrorFileNotFound); 200Debug.Assert(hr != WindowsNative.ErrorSuccess);
WindowsNative.cs (3)
158Debug.Assert(Status == EnumerateDirectoryStatus.UnknownError); 168Debug.Assert(Status != EnumerateDirectoryStatus.UnknownError && 178Debug.Assert(Status != EnumerateDirectoryStatus.Success);
Xml\ProjectXmlUtilities.XmlElementChildIterator.cs (4)
33Debug.Assert(element != null); 43Debug.Assert(_state > -1); 60Debug.Assert(_state == -1); 70Debug.Assert(_state == 1 && _current != null);
Microsoft.Build.Framework (65)
ArraySortHelper.cs (49)
108Debug.Assert(i != j); 121Debug.Assert(i != j); 130Debug.Assert(comparer != null); 140Debug.Assert(keys.Length > 0); 141Debug.Assert(depthLimit >= 0); 142Debug.Assert(comparer != null); 185Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 186Debug.Assert(comparer != null); 230Debug.Assert(comparer != null); 231Debug.Assert(keys.Length > 0); 248Debug.Assert(comparer != null); 249Debug.Assert(lo >= 0); 250Debug.Assert(lo < keys.Length); 410Debug.Assert(!Unsafe.AreSame(ref i, ref j)); 419Debug.Assert(keys.Length > 0); 420Debug.Assert(depthLimit >= 0); 466Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 529Debug.Assert(keys.Length > 0); 546Debug.Assert(lo >= 0); 547Debug.Assert(lo < keys.Length); 689Debug.Assert(comparer != null); 690Debug.Assert(0 <= i && i < keys.Length && i < values.Length); 691Debug.Assert(0 <= j && j < keys.Length && j < values.Length); 692Debug.Assert(i != j); 709Debug.Assert(i != j); 722Debug.Assert(comparer != null); 723Debug.Assert(keys.Length == values.Length); 733Debug.Assert(keys.Length > 0); 734Debug.Assert(values.Length == keys.Length); 735Debug.Assert(depthLimit >= 0); 736Debug.Assert(comparer != null); 779Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 780Debug.Assert(comparer != null); 824Debug.Assert(comparer != null); 825Debug.Assert(keys.Length > 0); 842Debug.Assert(comparer != null); 843Debug.Assert(lo >= 0); 844Debug.Assert(lo < keys.Length); 871Debug.Assert(comparer != null); 944Debug.Assert(i != j); 962Debug.Assert(i != j); 975Debug.Assert(keys.Length > 0); 976Debug.Assert(values.Length == keys.Length); 977Debug.Assert(depthLimit >= 0); 1020Debug.Assert(keys.Length >= SegmentedArrayHelper.IntrosortSizeThreshold); 1079Debug.Assert(keys.Length > 0); 1096Debug.Assert(lo >= 0); 1097Debug.Assert(lo < keys.Length); 1237Debug.Assert(typeof(TKey) == typeof(double) || typeof(TKey) == typeof(float));
BinaryTranslator.cs (1)
630Debug.Assert(count == 2);
EnvironmentUtilities.cs (2)
44Debug.Assert(processId != 0); 75Debug.Assert(processPath != null);
HashHelpers.cs (2)
111Debug.Assert(divisor <= int.MaxValue); 117Debug.Assert(highbits == value % divisor);
ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (1)
22Debug.Assert(dictionary is not null);
ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (1)
22Debug.Assert(dictionary is not null);
SegmentedArray.cs (5)
106Debug.Assert(length > 0); 107Debug.Assert(sourceIndex >= 0); 108Debug.Assert(destinationIndex >= 0); 109Debug.Assert((uint)(sourceIndex + length) <= array.Length); 110Debug.Assert((uint)(destinationIndex + length) <= array.Length);
SegmentedDictionary`2.cs (4)
195Debug.Assert(modified); 202Debug.Assert(modified); // If there was an existing key and the Add failed, an exception will already have been thrown. 479Debug.Assert(_buckets.Length > 0); 651Debug.Assert(newSize >= _entries.Length);
Microsoft.Build.Tasks.CodeAnalysis (11)
src\Compilers\Core\CommandLine\BuildProtocol.cs (1)
504Debug.Assert(reason is object);
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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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\BuildServerConnection.cs (4)
68Debug.Assert(workingDirectory is object); 179Debug.Assert(pipeName is object); 708Debug.Assert(Stream is null); 746Debug.Assert(Stream is not null);
Microsoft.Build.Tasks.CodeAnalysis.Sdk (11)
src\Compilers\Core\CommandLine\BuildProtocol.cs (1)
504Debug.Assert(reason is object);
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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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\BuildServerConnection.cs (4)
68Debug.Assert(workingDirectory is object); 179Debug.Assert(pipeName is object); 708Debug.Assert(Stream is null); 746Debug.Assert(Stream is not null);
Microsoft.Build.Tasks.CodeAnalysis.UnitTests (1)
TestUtilities\DotNetSdkTestBase.cs (1)
149Debug.Assert(s_dotnetInstallDir is object);
Microsoft.Build.Tasks.Core (18)
FileMatcher.cs (3)
1978Debug.Assert(projectDirectoryUnescaped != null); 1979Debug.Assert(filespecUnescaped != null); 1980Debug.Assert(Path.IsPathRooted(projectDirectoryUnescaped));
FileUtilities.cs (2)
742Debug.Assert(allowedExtensions?.Length > 0); 750Debug.Assert(!String.IsNullOrEmpty(extension) && extension[0] == '.');
GenerateApplicationManifest.cs (2)
395Debug.Assert(!String.IsNullOrEmpty(manifest.Product)); 413Debug.Assert(!String.IsNullOrEmpty(manifest.Publisher));
GenerateDeploymentManifest.cs (2)
138Debug.Assert(!String.IsNullOrEmpty(manifest.Product)); 150Debug.Assert(!String.IsNullOrEmpty(manifest.Publisher));
GenerateResource.cs (1)
3365Debug.Assert(_logger.HasLoggedErrors);
RedistList.cs (2)
895Debug.Assert(firstEntry != null && secondEntry != null); 1084Debug.Assert(name != null && frameworkDirectory != null);
ResolveManifestFiles.cs (1)
963Debug.Assert(!String.IsNullOrEmpty(targetPath));
WindowsFileSystem.cs (2)
138Debug.Assert(hr != WindowsNative.ErrorFileNotFound); 200Debug.Assert(hr != WindowsNative.ErrorSuccess);
WindowsNative.cs (3)
158Debug.Assert(Status == EnumerateDirectoryStatus.UnknownError); 168Debug.Assert(Status != EnumerateDirectoryStatus.UnknownError && 178Debug.Assert(Status != EnumerateDirectoryStatus.Success);
Microsoft.Build.Utilities.Core (11)
FileMatcher.cs (3)
1978Debug.Assert(projectDirectoryUnescaped != null); 1979Debug.Assert(filespecUnescaped != null); 1980Debug.Assert(Path.IsPathRooted(projectDirectoryUnescaped));
FileUtilities.cs (2)
742Debug.Assert(allowedExtensions?.Length > 0); 750Debug.Assert(!String.IsNullOrEmpty(extension) && extension[0] == '.');
TrackedDependencies\FileTracker.cs (1)
291Debug.Assert(path[pathLength - 1] == Path.DirectorySeparatorChar);
WindowsFileSystem.cs (2)
138Debug.Assert(hr != WindowsNative.ErrorFileNotFound); 200Debug.Assert(hr != WindowsNative.ErrorSuccess);
WindowsNative.cs (3)
158Debug.Assert(Status == EnumerateDirectoryStatus.UnknownError); 168Debug.Assert(Status != EnumerateDirectoryStatus.UnknownError && 178Debug.Assert(Status != EnumerateDirectoryStatus.Success);
Microsoft.CodeAnalysis (2235)
AssemblyUtilities.cs (2)
26Debug.Assert(PathUtilities.IsAbsolute(filePath)); 100Debug.Assert(PathUtilities.IsAbsolute(assemblyPath));
Binding\AbstractLookupSymbolsInfo.cs (8)
132Debug.Assert((uniqueSymbol != null) || (arity == 0)); 139Debug.Assert(arity == _arityBitVectorOrUniqueArity); 148Debug.Assert(_uniqueSymbolOrArities is TSymbol); 163Debug.Assert(!this.HasUniqueSymbol); 205Debug.Assert(!this.HasUniqueSymbol); 213Debug.Assert(!this.HasUniqueSymbol); 265Debug.Assert(pair.UniqueSymbol == null || pair.UniqueSymbol == symbol); 286Debug.Assert(CanBeAdded(name));
Binding\BindingDiagnosticBag.cs (8)
43Debug.Assert(DiagnosticBag is object); 49Debug.Assert(DiagnosticBag is object); 67Debug.Assert(diagnosticBag?.GetType().IsValueType != true); 110Debug.Assert(allowMismatchInDependencyAccumulation || other.Dependencies.IsDefaultOrEmpty || this.AccumulatesDependencies || !this.AccumulatesDiagnostics); 119Debug.Assert(allowMismatchInDependencyAccumulation || !other.AccumulatesDependencies || this.AccumulatesDependencies); 186Debug.Assert(allowMismatchInDependencyAccumulation || !dependencies.AccumulatesDependencies || this.AccumulatesDependencies); 201Debug.Assert(!useSiteInfo.AccumulatesDependencies || this.AccumulatesDependencies); 261Debug.Assert(!useSiteInfo.AccumulatesDependencies || this.AccumulatesDependencies);
Binding\UseSiteInfo.cs (30)
60Debug.Assert(diagnosticInfo?.Severity != DiagnosticSeverity.Error || (primaryDependency is null && secondaryDependencies?.IsEmpty != false)); 61Debug.Assert(primaryDependency is null || primaryDependency != primaryDependency.CorLibrary); 62Debug.Assert(secondaryDependencies?.IsEmpty != false || !secondaryDependencies.Any(dependency => dependency == dependency.CorLibrary)); 81Debug.Assert(DiagnosticInfo?.Severity != DiagnosticSeverity.Error); 126Debug.Assert(assemblyBeingBuilt is object); 127Debug.Assert(assemblyBeingBuilt is ISourceAssemblySymbolInternal); 135Debug.Assert(assemblyBeingBuilt is object); 136Debug.Assert(assemblyBeingBuilt is ISourceAssemblySymbolInternal); 164Debug.Assert(discardLevel != DiscardLevel.None); 179Debug.Assert(_diagnostics is null); 180Debug.Assert(_dependencies is null); 181Debug.Assert(!_hasErrors); 185Debug.Assert(_dependencies is null); 201Debug.Assert(AccumulatesDiagnostics); 210Debug.Assert(_discardLevel switch { DiscardLevel.None => true, DiscardLevel.Dependencies => true, DiscardLevel.DiagnosticsAndDependencies => true, _ => false }); 211Debug.Assert(_hasErrors == (_diagnostics?.Any(d => d.Severity == DiagnosticSeverity.Error) ?? false)); 212Debug.Assert(!_hasErrors || (_dependencies is null)); 221Debug.Assert(AccumulatesDependencies); 231Debug.Assert(AccumulatesDiagnostics); 280Debug.Assert(_diagnostics is not null); 354Debug.Assert(!info.AccumulatesDependencies || this.AccumulatesDependencies); 390Debug.Assert(other.AccumulatesDiagnostics); 391Debug.Assert(other._discardLevel != DiscardLevel.None || _discardLevel == DiscardLevel.None); 395Debug.Assert(!AccumulatesDependencies); 438Debug.Assert(!AccumulatesDependencies); 474Debug.Assert(diagnosticInfo is null || diagnosticInfo.Severity == DiagnosticSeverity.Error); 486Debug.Assert(primaryDependency is object || (useSiteInfo.PrimaryDependency is null && secondaryDependencies.IsEmpty)); 487Debug.Assert(primaryDependency == useSiteInfo.PrimaryDependency || useSiteInfo.DiagnosticInfo?.Severity == DiagnosticSeverity.Error); 549Debug.Assert(info is object); 603Debug.Assert(!dependencies.IsEmpty);
CodeGen\BasicBlock.cs (15)
105Debug.Assert((this.FirstILMarker < 0) == (this.LastILMarker < 0)); 106Debug.Assert((this.LastILMarker < 0) || (this.LastILMarker + 1 == marker)); 119Debug.Assert(this.FirstILMarker >= 0); 120Debug.Assert(this.LastILMarker >= 0); 121Debug.Assert(this.LastILMarker == marker); 210Debug.Assert(this.BranchCode.IsConditionalBranch() == newBranchCode.IsConditionalBranch()); 211Debug.Assert(newBranchCode.IsBranch() == (_branchLabel != null)); 232Debug.Assert(newLabel != null); 271Debug.Assert(delta <= 0); 284Debug.Assert(BranchBlock?.EnclosingHandler == null); 461Debug.Assert(toRemove == next || toRemove.TotalSize == 0); 633Debug.Assert(BranchCode.Size() == 1); 730Debug.Assert(BranchLabels != null); 741Debug.Assert(BranchesCount > 0); 742Debug.Assert(branchBlocksBuilder != null);
CodeGen\CompilationTestData.cs (1)
49Debug.Assert(MetadataWriter == null);
CodeGen\DebugId.cs (2)
35Debug.Assert(ordinal >= 0 || ordinal == UndefinedOrdinal); 36Debug.Assert(generation >= 0);
CodeGen\EmitState.cs (2)
47Debug.Assert(value >= 0 && value <= ushort.MaxValue); 63Debug.Assert(value >= 0 && value <= ushort.MaxValue);
CodeGen\ILBuilder.cs (33)
91Debug.Assert(!_pendingBlockCreate || (_currentBlock == null)); 104Debug.Assert(_currentBlock == null); 124Debug.Assert(_lastCompleteBlock != null); 125Debug.Assert(_lastCompleteBlock.NextBlock == null); 137Debug.Assert(_currentBlock == null); 140Debug.Assert(_currentBlock != null); 141Debug.Assert(!_pendingBlockCreate); 166Debug.Assert(_allocatedILMarkers != null); 176Debug.Assert((startMarker < 0) || (startMarker == (_lastCompleteBlock.LastILMarker + 1))); 269Debug.Assert(AllBlocks(block => (block.Reachability == Reachability.NotReachable))); 442Debug.Assert(handlerBlock != null); 448Debug.Assert(handlerBlock.NextExceptionHandler == null); 470Debug.Assert(handlerBlock.Type == BlockType.Catch || handlerBlock.Type == BlockType.Fault || handlerBlock.Type == BlockType.Filter); 481Debug.Assert(block.EnclosingHandler.LastFilterConditionBlock.BranchCode == ILOpCode.Endfilter); 531Debug.Assert(targetBlock != null && !IsSpecialEndHandlerBlock(targetBlock)); 591Debug.Assert(targetBlock != null && !IsSpecialEndHandlerBlock(targetBlock)); 703Debug.Assert(AllBlocks(block => (block.Reachability == Reachability.Reachable) || (block.Reachability == Reachability.BlockedByFinally))); 747Debug.Assert(current.Reachability != Reachability.BlockedByFinally || 768Debug.Assert(AllBlocks(block => !IsSpecialEndHandlerBlock(block))); 783Debug.Assert(block.BranchBlock == block); 910Debug.Assert(blockLastMarker >= blockFirstMarker); 913Debug.Assert(_allocatedILMarkers != null); 963Debug.Assert(btOffset == offset); 1001Debug.Assert(lastOffset < offset); 1004Debug.Assert((lastOffset >= 0) || (offset == 0)); 1042Debug.Assert(this.SeqPointsOpt.Count == 0); 1085Debug.Assert(_initialHiddenSequencePointMarker < 0); 1090Debug.Assert(_initialHiddenSequencePointMarker == 0); 1106Debug.Assert(_emitState.CurStack == 0); 1112Debug.Assert(_emitState.InstructionsEmitted >= _instructionCountAtLastLabel); 1142Debug.Assert(!_pendingBlockCreate); 1150Debug.Assert(!_pendingBlockCreate); 1253Debug.Assert(curBlock != null);
CodeGen\ILBuilderConversions.cs (2)
227Debug.Assert(fromPredefTypeKind.IsFloatingPoint()); 264Debug.Assert(fromPredefTypeKind.IsFloatingPoint());
CodeGen\ILBuilderEmit.cs (10)
169Debug.Assert(validOpCode); 170Debug.Assert(revOpCode == ILOpCode.Nop || revOpCode.IsBranch()); 171Debug.Assert(!code.HasVariableStackBehavior()); 191Debug.Assert((code != ILOpCode.Nop) || (block == _labelInfos[label].bb)); 231Debug.Assert(caseLabels.Length > 0); 263Debug.Assert(caseLabels.Length > 0); 264Debug.Assert(keyTypeCode != Cci.PrimitiveTypeCode.String); 306Debug.Assert(!this.InExceptionHandler); 803Debug.Assert(alignment is 1 or 2 or 4); 849Debug.Assert(size == 2);
CodeGen\ILOpCodeExtensions.cs (3)
19Debug.Assert(code < 0xf0); 24Debug.Assert((code & 0xff00) == 0xfe00); 185Debug.Assert(!opcode.HasVariableStackBehavior());
CodeGen\LambdaDebugInfo.cs (1)
37Debug.Assert(closureOrdinal >= MinClosureOrdinal);
CodeGen\LocalDebugId.cs (2)
44Debug.Assert(isNone); 52Debug.Assert(ordinal >= 0);
CodeGen\LocalScopeManager.cs (24)
47Debug.Assert(_enclosingExceptionHandler == GetEnclosingExceptionHandler()); 71Debug.Assert(_enclosingExceptionHandler == GetEnclosingExceptionHandler()); 214Debug.Assert(scopeType == ScopeType.Variable || scopeType == ScopeType.StateMachineVariable); 261Debug.Assert(scopes.Count > 0); 285Debug.Assert(scopes.Count > 0); 346Debug.Assert(variable.Name != null); 358Debug.Assert(constant.Name != null); 370Debug.Assert(slotIndex >= 0); 561Debug.Assert((type == ScopeType.Try) || (type == ScopeType.Catch) || (type == ScopeType.Filter) || (type == ScopeType.Finally) || (type == ScopeType.Fault)); 562Debug.Assert((type == ScopeType.Catch) == (exceptionType != null)); 600Debug.Assert(_type == ScopeType.Filter); 601Debug.Assert(_lastFilterConditionBlock == null); 622Debug.Assert(endLabel != null); 631Debug.Assert(LeaderBlock != null); 636Debug.Assert(builder.EnclosingExceptionHandler == this); 699Debug.Assert(((_handlers.Count == 0) && (scopeType == ScopeType.Try)) || 702Debug.Assert(currentExceptionHandler == _containingHandler); 711Debug.Assert(_handlers.Count > 1); 732Debug.Assert(builder._currentBlock == builder._labelInfos[_endLabel].bb); 749Debug.Assert(_handlers.Count > 1); 768Debug.Assert(handlerScope.Type == ScopeType.Try); 774Debug.Assert((reachability == Reachability.Reachable) || (reachability == Reachability.NotReachable)); 777Debug.Assert(_handlers.All(h => (h.LeaderBlock.Reachability == reachability))); 867Debug.Assert(begin >= 0 && end >= 0);
CodeGen\LocalSlotManager.cs (1)
247Debug.Assert(slot.Name == null);
CodeGen\MetadataConstant.cs (1)
34Debug.Assert(value == null || value is string || value is DateTime || value is decimal || value.GetType().GetTypeInfo().IsEnum || (value.GetType().GetTypeInfo().IsPrimitive && !(value is IntPtr) && !(value is UIntPtr)));
CodeGen\MethodBody.cs (4)
77Debug.Assert(!locals.IsDefault); 78Debug.Assert(!exceptionHandlers.IsDefault); 79Debug.Assert(!localScopes.IsDefault); 113Debug.Assert(debugDocumentProvider != null);
CodeGen\PermissionSetAttribute.cs (8)
71Debug.Assert(namedArgs.Length == 1); 75Debug.Assert(fileArg.ArgumentName == FilePropertyName); 76Debug.Assert(context.Module.IsPlatformType(fileArg.Type, Cci.PlatformType.SystemString)); 79Debug.Assert(fileArg.ArgumentValue is MetadataConstant); 81Debug.Assert(!String.IsNullOrEmpty(fileName)); 85Debug.Assert(((INamedTypeSymbol)iSymbol).GetMembers(HexPropertyName).Any( 135Debug.Assert(b < 0x10); 151Debug.Assert(_sourceAttribute.NamedArgumentCount == 1);
CodeGen\PrivateImplementationDetails.cs (26)
205Debug.Assert(!IsFrozen); 209Debug.Assert(typeCode is 229Debug.Assert(!IsFrozen); 231Debug.Assert(typeCode is not Cci.PrimitiveTypeCode.Reference); 249Debug.Assert(!IsFrozen); 250Debug.Assert(alignment is 1 or 2 or 4 or 8); 251Debug.Assert(length != 1 || alignment == 1); 392Debug.Assert(method is not null); 411Debug.Assert(!IsFrozen); 415Debug.Assert(_mvidField.Type == mvidType); 423Debug.Assert(!IsFrozen); 427Debug.Assert(_moduleCancellationTokenField.Type == cancellationTokenType); 436Debug.Assert(!IsFrozen); 440Debug.Assert(payloadRootField.Type == payloadRootType); 447Debug.Assert(IsFrozen); 454Debug.Assert(!IsFrozen); 462Debug.Assert(IsFrozen); 468Debug.Assert(IsFrozen); 474Debug.Assert(IsFrozen); 502Debug.Assert(!IsFrozen); 503Debug.Assert(type.Name is { }); 515Debug.Assert(IsFrozen); 521Debug.Assert(IsFrozen); 554Debug.Assert(context.Module == ModuleBuilder); 575Debug.Assert(bytesWritten == hash.Length); 973Debug.Assert(!block.IsDefault);
CodeGen\SequencePointList.cs (1)
97Debug.Assert(ilOffset >= 0);
CodeGen\SwitchIntegralJumpTableEmitter.cs (13)
69Debug.Assert(caseLabels.Length > 0); 107Debug.Assert(!_sortedCaseLabels.IsEmpty); 152Debug.Assert(SwitchConstantValueHelper.IsValidSwitchCaseLabelConstant(firstConstant) 156Debug.Assert(SwitchConstantValueHelper.IsValidSwitchCaseLabelConstant(secondConstant) 187Debug.Assert(startLabelIndex >= 0 && startLabelIndex <= endLabelIndex); 188Debug.Assert(_sortedCaseLabels.Length > endLabelIndex); 227Debug.Assert(!switchBucketsStack.IsEmpty); 260Debug.Assert(startLabelIndex >= 0 && startLabelIndex <= endLabelIndex); 389Debug.Assert(i == bucketSize - 1); 397Debug.Assert(nextCaseLabelValue > startConstant.Int64Value); 403Debug.Assert(nextCaseLabelValue > startConstant.UInt64Value); 413Debug.Assert(nextCaseIndex >= switchBucket.LabelsCount); 423Debug.Assert(branchCode.IsBranch());
CodeGen\SwitchIntegralJumpTableEmitter.SwitchBucket.cs (9)
64Debug.Assert((uint)startIndex < (uint)endIndex); 74Debug.Assert((uint)startIndex <= (uint)endIndex); 75Debug.Assert((uint)startIndex != (uint)endIndex || isDegenerate); 183Debug.Assert(!BucketOverflowUInt64Limit(startConstant, endConstant)); 184Debug.Assert(endConstant.Discriminator == startConstant.Discriminator); 190Debug.Assert(endConstant.Int64Value >= startConstant.Int64Value); 195Debug.Assert(endConstant.UInt64Value >= startConstant.UInt64Value); 205Debug.Assert(IsValidSwitchBucketConstantPair(startConstant, endConstant)); 306Debug.Assert(prevBucket._endLabelIndex + 1 == _startLabelIndex);
CodeGen\SwitchStringJumpTableEmitter.cs (5)
81Debug.Assert(caseLabels.Length > 0); 96Debug.Assert(_keyHash == null || ShouldGenerateHashTableSwitch(_caseLabels.Length)); 111Debug.Assert(_keyHash != null); 201Debug.Assert(stringConstant.IsNull || stringConstant.IsString); 212Debug.Assert(!bucket.Contains(kvPair));
CodeGen\SynthesizedLocalOrdinalsDispenser.cs (1)
59Debug.Assert(ordinal == 0 || localKind != SynthesizedLocalKind.UserDefined);
CodeGen\TokenMap.cs (2)
65Debug.Assert(referenceAdded); 98Debug.Assert(token < (uint)_count && _count <= _items.Length);
Collections\BitVector.cs (3)
34Debug.Assert(requiredWords == 0 || requiredWords <= bits.Length); 92Debug.Assert(_capacity == 0 || WordsForCapacity(_capacity) <= _bits.Length); 190Debug.Assert(numTrailingBits <= BitsPerWord);
Collections\ByteSequenceComparer.cs (1)
103Debug.Assert(!x.IsDefault);
Collections\CachingDictionary.cs (3)
216Debug.Assert(IsNotFullyPopulatedMap(existingMap)); 220Debug.Assert(_comparer == allKeys.Comparer); 237Debug.Assert(elements != s_emptySentinel);
Collections\CachingFactory.cs (2)
117Debug.Assert(result != 0); 244Debug.Assert(size > 0);
Collections\ImmutableMemoryStream.cs (1)
19Debug.Assert(!array.IsDefault);
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);
Collections\SmallConcurrentSetOfInts.cs (3)
50Debug.Assert(i != unoccupied); 80Debug.Assert(i != unoccupied); 126Debug.Assert(!added);
Collections\SmallDictionary.cs (2)
315Debug.Assert(unbalanced != currentNode); 321Debug.Assert(n.HashCode != hashCode);
Collections\TopologicalSort.cs (1)
75Debug.Assert(count != 0);
Collections\UnionCollection.cs (3)
33Debug.Assert(coll1.IsReadOnly && coll2.IsReadOnly); 51Debug.Assert(collections.All(c => selector(c).IsReadOnly)); 68Debug.Assert(!collections.IsDefault);
CommandLine\AnalyzerConfig.cs (4)
227Debug.Assert(!string.IsNullOrEmpty(sectionName)); 241Debug.Assert(!string.IsNullOrEmpty(key)); 242Debug.Assert(key == key.Trim()); 243Debug.Assert(value == value?.Trim());
CommandLine\AnalyzerConfig.SectionNameMatching.cs (2)
32Debug.Assert(regex.GetGroupNumbers().Length - 1 == numberRangePairs.Length); 49Debug.Assert(match.Groups.Count - 1 == _numberRangePairs.Length);
CommandLine\AnalyzerConfigOptionsResult.cs (2)
37Debug.Assert(treeOptions != null); 38Debug.Assert(analyzerOptions != null);
CommandLine\AnalyzerConfigSet.cs (6)
154Debug.Assert(builder.Count == config.NamedSections.Length); 159Debug.Assert(allMatchers.Count == _analyzerConfigs.Length); 554Debug.Assert(_values is object); 563Debug.Assert(_values is object); 564Debug.Assert(_duplicates is object); 621Debug.Assert(originalEntry.globalLevel == globalLevel);
CommandLine\CommandLineArguments.cs (1)
439Debug.Assert((diagnosticsOpt == null) == (messageProviderOpt == null));
CommandLine\CommandLineParser.cs (7)
65Debug.Assert(PathUtilities.IsAbsolute(directory)); 131Debug.Assert(false); 468Debug.Assert(outputDirectory is object); 597Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 981Debug.Assert(i < arg.Length); 1000Debug.Assert(slashCount >= 0); 1152Debug.Assert(IsScriptCommandLineParser || !arg.StartsWith('-') && !arg.StartsWith('@'));
CommandLine\CommandLineReference.cs (1)
22Debug.Assert(!string.IsNullOrEmpty(reference));
CommandLine\CommandLineResource.cs (2)
40Debug.Assert(!resourceName.IsEmpty()); 41Debug.Assert(PathUtilities.IsAbsolute(fullPath));
CommandLine\CommandLineSourceFile.cs (1)
21Debug.Assert(!string.IsNullOrEmpty(path));
CommandLine\CommonCompiler.CompilerEmitStreamProvider.cs (1)
51Debug.Assert(_streamToDispose == null);
CommandLine\CommonCompiler.cs (20)
129Debug.Assert(null == responseFile || PathUtilities.IsAbsolute(responseFile)); 317Debug.Assert(normalizedPath is object); 426Debug.Assert(compilation.Options.SourceReferenceResolver is object); 465Debug.Assert(text != null); 470Debug.Assert(text != null || diagnostics.HasAnyErrors()); 720Debug.Assert(Arguments.ErrorLogOptions?.Path != null); 732Debug.Assert(diagnostics.HasAnyErrors()); 822Debug.Assert(generatedFilesBaseDirectory is not null); 855Debug.Assert(!string.IsNullOrWhiteSpace(Arguments.OutputFileName)); 881Debug.Assert(!Arguments.IsScriptRunner); 926Debug.Assert(hadErrors); 1032Debug.Assert(existing.GetOptions(syntaxTree) == DictionaryAnalyzerConfigOptions.Empty); 1047Debug.Assert(existing.GetOptions(additionalFiles[i]) == DictionaryAnalyzerConfigOptions.Empty); 1066Debug.Assert(analyzerConfigSet is object); 1161Debug.Assert(!string.IsNullOrWhiteSpace(tree.FilePath)); 1177Debug.Assert(path.StartsWith(explicitGeneratedOutDir!)); 1186Debug.Assert(tree.Encoding is object); 1554Debug.Assert(touchedFilesLogger != null); 1589Debug.Assert(filePath != null); 1605Debug.Assert(PathUtilities.IsAbsolute(file.Path));
CommandLine\CommonCompiler.ExistingReferencesResolver.cs (2)
30Debug.Assert(resolver != null); 31Debug.Assert(availableReferences != null);
CommandLine\CommonCompiler.LoggingMetadataFileReferenceResolver.cs (2)
21Debug.Assert(pathResolver != null); 22Debug.Assert(provider != null);
CommandLine\CommonCompiler.SuppressionDiagnostic.cs (4)
37Debug.Assert(originalDiagnostic != null); 38Debug.Assert(originalDiagnostic.ProgrammaticSuppressionInfo != null); 39Debug.Assert(!string.IsNullOrEmpty(suppressionId)); 40Debug.Assert(suppressionJustification != null);
CommandLine\ReportAnalyzerUtil.cs (1)
67Debug.Assert(analyzerDriver.AnalyzerExecutionTimes != null);
CommandLine\SarifErrorLogger.cs (8)
29Debug.Assert(stream != null); 30Debug.Assert(stream!.Position == 0); 78Debug.Assert(false); 88Debug.Assert(diagnostic.CustomTags.SequenceEqual(diagnostic.Descriptor.ImmutableCustomTags)); 89Debug.Assert(diagnostic.Category == diagnostic.Descriptor.Category); 90Debug.Assert(diagnostic.DefaultSeverity == diagnostic.Descriptor.DefaultSeverity); 91Debug.Assert(diagnostic.IsEnabledByDefault == diagnostic.Descriptor.IsEnabledByDefault); 127Debug.Assert(!string.IsNullOrEmpty(path));
CommandLine\SarifV1ErrorLogger.cs (4)
138Debug.Assert(HasPath(location)); 286Debug.Assert(Count > 0); 292Debug.Assert(list.Capacity > list.Count); 296Debug.Assert(list.Capacity == list.Count);
CommandLine\SarifV2ErrorLogger.cs (7)
172Debug.Assert(HasPath(diagnosticLocation)); 276Debug.Assert(reportAnalyzerExecutionTime || descriptorInfo.ExecutionTime == 0); 277Debug.Assert(reportAnalyzerExecutionTime || descriptorInfo.ExecutionPercentage == 0); 387Debug.Assert(!severities.IsEmpty); 498Debug.Assert(Count > 0); 504Debug.Assert(list.Capacity > list.Count); 508Debug.Assert(list.Capacity == list.Count);
Compilation\CommonModuleCompilationState.cs (3)
19Debug.Assert(!_frozen); 44Debug.Assert(!Frozen); 59Debug.Assert(Frozen);
Compilation\Compilation.cs (18)
684Debug.Assert(reference is UnresolvedMetadataReference || reference is CompilationReference); 1077Debug.Assert(tree.Options.Kind != SourceCodeKind.Script); 1216Debug.Assert(result 1247Debug.Assert(result 2516Debug.Assert(!string.IsNullOrEmpty(text.FilePath)); 2634Debug.Assert(IsSubmission); 2665Debug.Assert(this.CommonAnonymousTypeManager.AreTemplatesSealed); 2947Debug.Assert(!embedPdb || pdbStream == null); 2948Debug.Assert(metadataPEStream == null || !options.IncludePrivateMembers); // you may not use a secondary stream and include private members together 3246Debug.Assert(moduleBeingBuilt.DebugInformationFormat != DebugInformationFormat.Embedded || pdbStreamProvider == null); 3280Debug.Assert(!deterministic || moduleBeingBuilt.PdbChecksumAlgorithm.Name != null); 3315Debug.Assert(nativePdbStream != null || metadataDiagnostics.HasAnyErrors()); 3373Debug.Assert(auxStream != null || metadataDiagnostics.HasAnyErrors()); 3415Debug.Assert(!metadataOnly); 3416Debug.Assert(!includePrivateMembers); 3619Debug.Assert(this.ContainsSyntaxTree(tree1)); 3620Debug.Assert(this.ContainsSyntaxTree(tree2)); 3855Debug.Assert(!found); // only one required language version in a given diagnostic
Compilation\IImportScope.cs (5)
132Debug.Assert(!aliases.IsDefault); 133Debug.Assert(!externAliases.IsDefault); 134Debug.Assert(!imports.IsDefault); 135Debug.Assert(!xmlNamespaces.IsDefault); 136Debug.Assert(aliases.Length + externAliases.Length + imports.Length + xmlNamespaces.Length > 0);
Compilation\SymbolInfo.cs (2)
70Debug.Assert(symbol is null || symbol.Kind != SymbolKind.Namespace || ((INamespaceSymbol)symbol).NamespaceKind != NamespaceKindNamespaceGroup); 73Debug.Assert(item.Kind != SymbolKind.Namespace || ((INamespaceSymbol)item).NamespaceKind != NamespaceKindNamespaceGroup);
Compilation\TypeInfo.cs (2)
43Debug.Assert(type is null || type.NullableAnnotation == nullability.FlowState.ToAnnotation()); 44Debug.Assert(convertedType is null || convertedType.NullableAnnotation == convertedNullability.FlowState.ToAnnotation());
ConstantValue.cs (2)
358Debug.Assert(discriminator != ConstantValueTypeDiscriminator.Bad); 402Debug.Assert(discriminator != ConstantValueTypeDiscriminator.Bad);
ConstantValueSpecialized.cs (1)
187Debug.Assert(constantValue != null);
CryptographicHashProvider.cs (1)
258Debug.Assert(bits.Length == 4);
CvtRes.cs (13)
549System.Diagnostics.Debug.Assert(resStream.Position - startPos == dataSize + headerSize); 710Debug.Assert((startPos & 3) == 0); 718Debug.Assert((writer.BaseStream.Position & 3) == 0); 723System.Diagnostics.Debug.Assert(cbBlock == writer.BaseStream.Position - startPos); 812System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 819System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 825System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 828System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 835System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 841System.Diagnostics.Debug.Assert((writer.BaseStream.Position & 3) == 0); 843System.Diagnostics.Debug.Assert(writer.BaseStream.Position - debugPos == dataSize - GetStringsSize()); 853System.Diagnostics.Debug.Assert(entry.Value != null); 857System.Diagnostics.Debug.Assert(writer.BaseStream.Position - debugPos == GetStringsSize());
Desktop\DesktopAssemblyIdentityComparer.Fx.cs (1)
164Debug.Assert(value.VersionHigh == default(AssemblyVersion));
Diagnostic\DiagnosticBag.cs (2)
210Debug.Assert(diagnostic.Severity != InternalDiagnosticSeverity.Unknown); //Info access should have forced resolution. 257Debug.Assert(diagnostic.Severity != InternalDiagnosticSeverity.Unknown); //Info access should have forced resolution.
Diagnostic\DiagnosticDescriptor.cs (2)
73Debug.Assert(CustomTags is ImmutableArray<string>); 162Debug.Assert(!customTags.IsDefault);
Diagnostic\DiagnosticInfo.cs (5)
146Debug.Assert(expectedLength == actualLength); 147Debug.Assert(bits == BitVector.AllSet(actualLength)); 155Debug.Assert(!isWarningAsError || _defaultSeverity == DiagnosticSeverity.Warning); 170Debug.Assert(this.GetType() == result.GetType()); 171Debug.Assert(severity == result.Severity);
Diagnostic\DiagnosticWithInfo.cs (1)
145Debug.Assert(HasLazyInfo);
Diagnostic\SourceLocation.cs (4)
39Debug.Assert(nodeOrToken.SyntaxTree is object); 45Debug.Assert(trivia.SyntaxTree is object); 87Debug.Assert(!result.IsValid); 101Debug.Assert(!result.IsValid);
Diagnostic\SuppressionInfo.cs (1)
36Debug.Assert(programmaticSuppressions.All(suppression => id == suppression.SuppressedDiagnostic.Id));
Diagnostic\XmlLocation.cs (1)
39Debug.Assert(xmlLineInfo.LinePosition != 0);
DiagnosticAnalyzer\AnalysisContextInfo.cs (2)
64Debug.Assert(node == null || file?.SourceTree != null); 65Debug.Assert(operation == null || file?.SourceTree != null);
DiagnosticAnalyzer\AnalysisResultBuilder.cs (4)
97Debug.Assert(_analyzerExecutionTimeOpt != null); 257Debug.Assert(!analysisScope.FilterSpanOpt.HasValue); 412Debug.Assert(getLocalDiagnostics || getNonLocalDiagnostics); 488Debug.Assert(diagnostics != null);
DiagnosticAnalyzer\AnalysisScope.cs (5)
142Debug.Assert(!isSyntacticSingleFileAnalysis || filterFile.HasValue); 160Debug.Assert(!filterSpan.HasValue || filterFile.HasValue); 164Debug.Assert(filterFile.HasValue); 185Debug.Assert(_lazyAnalyzersSet.Value.Contains(analyzer)); 203Debug.Assert(compilationWithAnalyzers.Analyzers.Contains(analyzer));
DiagnosticAnalyzer\AnalysisValueProvider.cs (1)
55Debug.Assert(value is object);
DiagnosticAnalyzer\AnalyzerAssemblyLoader.cs (1)
193Debug.Assert(GeneratedPathComparer.Equals(_originalPathInfoMap[originalPath].ResolvedPath, resolvedPath));
DiagnosticAnalyzer\AnalyzerDriver.cs (58)
73Debug.Assert(_lazyAnalyzerExecutor != null); 83Debug.Assert(_lazyCurrentCompilationData != null); 101Debug.Assert(_lazyUnsuppressedAnalyzers != null); 118Debug.Assert(_lazyPerSymbolAnalyzerActionsCache != null); 137Debug.Assert(_lazyCompilationEndAnalyzers != null); 159Debug.Assert(_lazyAnalyzerGateMap != null); 173Debug.Assert(!_lazyGeneratedCodeAnalysisFlagsMap.IsDefault); 193Debug.Assert(_lazyNonConfigurableAndCustomConfigurableAnalyzers != null); 207Debug.Assert(_lazySymbolStartAnalyzers != null); 221Debug.Assert(_lazyTreatAllCodeAsNonGeneratedCode.HasValue); 240Debug.Assert(_lazyGeneratedCodeFilesMap != null); 254Debug.Assert(_lazyGeneratedCodeSymbolsForTreeMap != null); 268Debug.Assert(_lazySuppressedAnalyzersForTreeMap != null); 284Debug.Assert(_lazySuppressedDiagnosticIdsForUnsuppressedAnalyzers != null); 298Debug.Assert(_lazyIsGeneratedCodeSymbolMap != null); 343Debug.Assert(_lazyCompilationEventQueue != null); 357Debug.Assert(_lazyDiagnosticQueue != null); 371Debug.Assert(!severityFilter.Contains(ReportDiagnostic.Suppress)); 372Debug.Assert(!severityFilter.Contains(ReportDiagnostic.Default)); 399Debug.Assert(_lazyInitializeTask == null); 468Debug.Assert(_lazyInitializeTask == null); 469Debug.Assert(compilation.SemanticModelProvider != null); 694Debug.Assert(analysisScope != null); 716Debug.Assert(faultedTask.IsFaulted); 981Debug.Assert(severity != ReportDiagnostic.Default); 1005Debug.Assert(compilation.ContainsSyntaxTree(tree)); 1012Debug.Assert(!reportedDiagnostics.IsEmptyWithoutResolution); 1036Debug.Assert(HasDiagnosticSuppressors); 1037Debug.Assert(!reportedDiagnostics.IsEmpty); 1038Debug.Assert(_programmaticSuppressions != null); 1039Debug.Assert(_diagnosticsProcessedForProgrammaticSuppressions != null); 1069Debug.Assert(suppressableDiagnostics.Contains(diagnostic)); 1070Debug.Assert(!diagnostic.IsSuppressed); 1072Debug.Assert(suppressedDiagnostic.IsSuppressed); 1250Debug.Assert(location.SourceTree != null); 1270Debug.Assert(declaredSymbols != null); 1287Debug.Assert(GeneratedCodeSymbolsForTreeMap != null); 1288Debug.Assert(_lazyGeneratedCodeAttribute != null); 1310Debug.Assert(existingGeneratedCodeSymbols.SetEquals(generatedCodeSymbols)); 1431Debug.Assert(_lazyInitializeTask != null); 1443Debug.Assert(_lazyPrimaryTask != null); 1777Debug.Assert(!subsetProcessedAnalyzers.IsDefault); 1815Debug.Assert(AnalyzerActions.SymbolStartActionsCount > 0); 1866Debug.Assert(completedAnalyzers.Count < analysisScope.Analyzers.Length); 1942Debug.Assert(compilationEvent is CompilationStartedEvent || compilationEvent is CompilationCompletedEvent); 2142Debug.Assert(AnalyzerActions.SymbolStartActionsCount > 0); 2143Debug.Assert(SymbolStartAnalyzers.Contains(analyzer)); 2233Debug.Assert(!IsDiagnosticAnalyzerSuppressed(analyzer, analyzerExecutor.Compilation.Options, analyzerManager, analyzerExecutor, analysisScope, severityFilter, cancellationToken)); 2258Debug.Assert(!IsDiagnosticAnalyzerSuppressed(analyzer, analyzerExecutor.Compilation.Options, analyzerManager, analyzerExecutor, analysisScope, severityFilter, cancellationToken)); 2323Debug.Assert(_lazyDoNotAnalyzeGeneratedCode.HasValue); 2578Debug.Assert(shouldExecuteSyntaxNodeActions || shouldExecuteOperationActions || shouldExecuteCodeBlockActions || shouldExecuteOperationBlockActions); 2579Debug.Assert(!isInGeneratedCode || !DoNotAnalyzeGeneratedCode); 2973Debug.Assert(!operationBlock.Parent.IsImplicit); 2980Debug.Assert(operationBlock.Kind is OperationKind.Invocation or OperationKind.Invalid); 2981Debug.Assert(operationBlock.Parent.IsImplicit); 2982Debug.Assert(operationBlock.Parent.Parent is IConstructorBodyOperation ctorBody && 2984Debug.Assert(!operationBlock.Parent.Parent.IsImplicit); 3002Debug.Assert(operationsToAnalyze.ToImmutableHashSet().Count == operationsToAnalyze.Count);
DiagnosticAnalyzer\AnalyzerDriver.GroupedAnalyzerActions.cs (3)
48Debug.Assert(isEmpty || !GroupedActionsByAnalyzer.IsEmpty); 68Debug.Assert(!analyzers.IsDefaultOrEmpty); 85Debug.Assert(intersected.IsEmpty());
DiagnosticAnalyzer\AnalyzerDriver.GroupedAnalyzerActionsForAnalyzer.cs (2)
30Debug.Assert(!analyzerActions.IsEmpty); 45Debug.Assert(action.Analyzer == analyzer);
DiagnosticAnalyzer\AnalyzerExecutor.AnalyzerDiagnosticReporter.cs (3)
104Debug.Assert(_addNonCategorizedDiagnostic != null); 109Debug.Assert(_addNonCategorizedDiagnostic == null); 110Debug.Assert(_addCategorizedNonLocalDiagnostic != null);
DiagnosticAnalyzer\AnalyzerExecutor.cs (40)
119Debug.Assert((addNonCategorizedDiagnostic != null) ^ (addCategorizedLocalDiagnostic != null)); 120Debug.Assert((addCategorizedLocalDiagnostic != null) == (addCategorizedNonLocalDiagnostic != null)); 184Debug.Assert(_analyzerExecutionTimeMap != null); 268Debug.Assert(startAction.Analyzer == symbolScope.Analyzer); 287Debug.Assert(_addSuppression != null); 327Debug.Assert(compilationEvent is CompilationStartedEvent || compilationEvent is CompilationCompletedEvent); 373Debug.Assert(getTopMostNodeForAnalysis != null); 374Debug.Assert(!filterSpan.HasValue || filterTree != null); 487Debug.Assert(getTopMostNodeForAnalysis != null); 488Debug.Assert(!isGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(analyzer)); 489Debug.Assert(!IsAnalyzerSuppressedForSymbol(analyzer, symbolDeclaredEvent.Symbol, cancellationToken)); 490Debug.Assert(!filterSpan.HasValue || filterTree != null); 586Debug.Assert(file.SourceTree != null); 637Debug.Assert(file.AdditionalFile != null); 676Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(syntaxNodeAction.Analyzer)); 677Debug.Assert(!IsAnalyzerSuppressedForTree(syntaxNodeAction.Analyzer, node.SyntaxTree, cancellationToken)); 699Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(operationAction.Analyzer)); 700Debug.Assert(!IsAnalyzerSuppressedForTree(operationAction.Analyzer, executionData.SemanticModel.SyntaxTree, cancellationToken)); 747Debug.Assert(!executableCodeBlocks.IsEmpty); 849Debug.Assert(!operationBlocks.IsEmpty); 928Debug.Assert(declaredNode != null); 929Debug.Assert(executionData.DeclaredSymbol != null); 930Debug.Assert(CanHaveExecutableCodeBlock(executionData.DeclaredSymbol)); 931Debug.Assert(startActions.Any() || endActions.Any() || actions.Any()); 1041Debug.Assert(nodeActionsByKind.Any()); 1042Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(executionData.Analyzer)); 1043Debug.Assert(!IsAnalyzerSuppressedForTree(executionData.Analyzer, executionData.SemanticModel.SyntaxTree, cancellationToken)); 1138Debug.Assert(operationActionsByKind != null); 1139Debug.Assert(operationActionsByKind.Any()); 1140Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(executionData.Analyzer)); 1141Debug.Assert(!IsAnalyzerSuppressedForTree(executionData.Analyzer, executionData.SemanticModel.SyntaxTree, cancellationToken)); 1181Debug.Assert(((IFieldSymbol)symbol).AssociatedSymbol == null); 1240Debug.Assert(false); 1392Debug.Assert(IsAnalyzerExceptionDiagnostic(exceptionDiagnostic)); 1442Debug.Assert(addNonCategorizedDiagnostic != null); 1447Debug.Assert(addNonCategorizedDiagnostic == null); 1448Debug.Assert(addCategorizedNonLocalDiagnostic != null); 1481Debug.Assert(_addNonCategorizedDiagnostic != null); 1537Debug.Assert(_analyzerExecutionTimeMap != null); 1548Debug.Assert(operation.Parent == null);
DiagnosticAnalyzer\AnalyzerFileReference.cs (1)
610Debug.Assert(type != null);
DiagnosticAnalyzer\AnalyzerManager.AnalyzerExecutionContext.cs (6)
120Debug.Assert(sessionScope.Analyzer == _analyzer); 416Debug.Assert(pendingMemberSymbols != null); 434Debug.Assert(!symbolEndActions.IsEmpty); 439Debug.Assert(_lazyPendingMemberSymbolsMap != null); 482Debug.Assert(_lazyPendingMemberSymbolsMap == null || _lazyPendingMemberSymbolsMap.Count == 0); 483Debug.Assert(_lazyPendingSymbolEndActionsMap == null || _lazyPendingSymbolEndActionsMap.Count == 0);
DiagnosticAnalyzer\AsyncQueue.cs (5)
98Debug.Assert(_data.Count == 0); 102Debug.Assert(waiter.Task.CreationOptions.HasFlag(TaskCreationOptions.RunContinuationsAsynchronously)); 200Debug.Assert(tcs.Task.CreationOptions.HasFlag(TaskCreationOptions.RunContinuationsAsynchronously)); 205Debug.Assert(_whenCompleted.Task.CreationOptions.HasFlag(TaskCreationOptions.RunContinuationsAsynchronously)); 316Debug.Assert(taskCompletionSource.Task.CreationOptions.HasFlag(TaskCreationOptions.RunContinuationsAsynchronously));
DiagnosticAnalyzer\CompilationUnitCompletedEvent.cs (1)
16Debug.Assert(compilation.ContainsSyntaxTree(compilationUnit));
DiagnosticAnalyzer\CompilationWithAnalyzers.cs (12)
709Debug.Assert(analysisScope != null); 732Debug.Assert(driver.IsInitialized); 733Debug.Assert(!driver.WhenInitializedTask.IsCanceled); 778Debug.Assert(!analysisScope.IsSyntacticSingleFileAnalysis); 779Debug.Assert(hasAnyActionsRequiringCompilationEvents); 782Debug.Assert(!symbolStartAnalyzers.IsEmpty); 836Debug.Assert(driver.IsInitialized); 958Debug.Assert(compilationEvents.Count(e => e is CompilationUnitCompletedEvent c && !c.FilterSpan.HasValue) == 1); 961Debug.Assert(!compilationEvents.HasDuplicates()); 994Debug.Assert(analysisScope.IsSingleFileAnalysis); 1045Debug.Assert(analysisScope.IsSingleFileAnalysis); 1046Debug.Assert(!analysisScope.IsSyntacticSingleFileAnalysis);
DiagnosticAnalyzer\DiagnosticAnalysisContext.cs (2)
831Debug.Assert(!filterSpan.HasValue || filterTree != null); 911Debug.Assert(!filterSpan.HasValue || filterTree != null);
DiagnosticAnalyzer\DiagnosticAnalysisContextHelpers.cs (1)
95Debug.Assert(location.SourceTree != null);
DiagnosticAnalyzer\DiagnosticQueue.cs (2)
111Debug.Assert(diagnostic.Location.Kind == LocationKind.SourceFile || diagnostic.Location.Kind == LocationKind.ExternalFile); 176Debug.Assert(diag != null);
DiagnosticAnalyzer\ProgramFilesAnalyzerPathResolver.cs (2)
43Debug.Assert(IsAnalyzerPathHandled(originalAnalyzerPath)); 49Debug.Assert(IsAnalyzerPathHandled(originalAnalyzerPath));
DiagnosticAnalyzer\ShadowCopyAnalyzerPathResolver.cs (1)
222Debug.Assert(AnalyzerAssemblyLoader.GeneratedPathComparer.Equals(shadowCopyPath, task.Result));
DiagnosticAnalyzer\Suppression.cs (1)
21Debug.Assert(suppressedDiagnostic.ProgrammaticSuppressionInfo == null);
DiagnosticAnalyzer\SuppressMessageAttributeState.cs (3)
75Debug.Assert(symbol != null); 171Debug.Assert(declaredSymbols != null); 313Debug.Assert(symbol is IAssemblySymbol || symbol is IModuleSymbol);
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);
DiaSymReader\Metadata\SymWriterMetadataAdapter.cs (7)
23Debug.Assert(metadataProvider != null); 43Debug.Assert(baseType == null); 96Debug.Assert(attributes == null); 97Debug.Assert(signature == null); 98Debug.Assert(signatureLength == null); 99Debug.Assert(relativeVirtualAddress == null); 100Debug.Assert(implAttributes == null);
DiaSymReader\SymUnmanagedFactory.cs (1)
158System.Diagnostics.Debug.Assert(OperatingSystem.IsWindows());
DiaSymReader\Utilities\InteropUtilities.cs (2)
36Debug.Assert(nameStr != null); 85Debug.Assert(dst <= dstEndPtr);
DiaSymReader\Writer\SymUnmanagedWriterFactory.cs (1)
50Debug.Assert(loadException != null);
DiaSymReader\Writer\SymUnmanagedWriterImpl.cs (5)
34Debug.Assert(pdbStream != null); 35Debug.Assert(symWriter != null); 36Debug.Assert(symWriterModuleName != null); 366Debug.Assert(OperatingSystem.IsWindows()); 377Debug.Assert(value != null);
DocumentationCommentId.cs (4)
657Debug.Assert(symbol.ContainingSymbol is null or INamedTypeSymbol or IMethodSymbol); 660Debug.Assert(!declarer.Failed); 976System.Diagnostics.Debug.Assert(PeekNextChar(id, index) == '`'); 1455System.Diagnostics.Debug.Assert(typeParameterContext != null);
DocumentationComments\XmlDocumentationCommentTextReader.XmlStream.cs (2)
135Debug.Assert(charCount > 0); 140Debug.Assert(destCount >= 0);
EmbeddedText.cs (4)
54Debug.Assert(filePath.Length > 0); 55Debug.Assert(SourceHashAlgorithms.IsSupportedAlgorithm(checksumAlgorithm)); 56Debug.Assert(!blob.IsDefault && blob.Length >= sizeof(int)); 218Debug.Assert(longLength >= 0);
Emit\AnonymousTypeKey.cs (1)
35Debug.Assert(name != null);
Emit\AnonymousTypeValue.cs (2)
18Debug.Assert(!string.IsNullOrEmpty(name)); 19Debug.Assert(uniqueIndex >= 0);
Emit\AsyncMoveNextBodyDebugInfo.cs (3)
40Debug.Assert(!yieldOffsets.IsDefault); 41Debug.Assert(!resumeOffsets.IsDefault); 42Debug.Assert(yieldOffsets.Length == resumeOffsets.Length);
Emit\CommonPEModuleBuilder.cs (32)
64Debug.Assert(manifestResources != null); 65Debug.Assert(serializationProperties != null); 66Debug.Assert(compilation != null); 127Debug.Assert(_encDeletedMethodDefinitions == null); 138Debug.Assert(_encDeletedMethodDefinitions != null); 376Debug.Assert(ReferenceEquals(context.Module, this)); 398Debug.Assert(methodSymbol.ContainingModule == CommonSourceModule); 399Debug.Assert(methodSymbol.IsDefinition); 400Debug.Assert(((IMethodSymbol)methodSymbol.GetISymbol()).PartialDefinitionPart == null); // Must be definition. 415Debug.Assert(methodSymbol.ContainingModule == CommonSourceModule); 416Debug.Assert(methodSymbol.IsDefinition); 417Debug.Assert(((IMethodSymbol)methodSymbol.GetISymbol()).PartialDefinitionPart == null); // Must be definition. 418Debug.Assert(body == null || (object)methodSymbol == body.MethodDefinition.GetInternalSymbol()); 425Debug.Assert(method == null || IsSourceDefinition(method)); 426Debug.Assert(OutputKind.IsApplication()); 433Debug.Assert(method == null || IsSourceDefinition(method)); 606Debug.Assert(value != null); 613Debug.Assert(TestData == null); 676Debug.Assert(sourceModule != null); 677Debug.Assert(serializationProperties != null); 740Debug.Assert(names != null); 770Debug.Assert(_namesOfTopLevelTypes == null); 847Debug.Assert(((ISynthesizedGlobalMethodSymbol)cctor.GetInternalSymbol()).ContainingPrivateImplementationDetailsType == (object)details); 875Debug.Assert(NestedTypes is null || 967Debug.Assert(container.IsDefinition); 973Debug.Assert(method != null); 986Debug.Assert(property != null); 999Debug.Assert(field != null); 1012Debug.Assert(nestedType != null); 1020Debug.Assert(typeOrNamespace != null); 1157Debug.Assert(_lazyPrivateImplementationDetails?.IsFrozen != false); 1167Debug.Assert((object)this == context.Module);
Emit\Context.cs (5)
39Debug.Assert(rebuildData is null || !metadataOnly); 41Debug.Assert(module != null); 42Debug.Assert(diagnostics != null); 43Debug.Assert(includePrivateMembers || metadataOnly); 44Debug.Assert(syntaxNode is null || syntaxReference is null);
Emit\EditAndContinue\AddedOrChangedMethodInfo.cs (5)
41Debug.Assert(methodId.Generation >= 0); 44Debug.Assert(stateMachineAwaiterSlotsOpt.IsDefault == stateMachineTypeName is null); 47Debug.Assert(stateMachineHoistedLocalSlotsOpt.IsDefault || stateMachineTypeName is not null); 74Debug.Assert(!info.IsDefault); 77Debug.Assert(info.Signature != null);
Emit\EditAndContinue\DefinitionMap.cs (12)
54Debug.Assert(edits != null); 89Debug.Assert(edit.NewSymbol != null); 90Debug.Assert(edit.OldSymbol != null); 95Debug.Assert(oldMethod != null); 96Debug.Assert(newMethod != null); 181Debug.Assert(peMethod != null); 182Debug.Assert(peMethod.MetadataName == oldMethod.MetadataName); 590Debug.Assert(!containingDisplayClassId.HasValue); 604Debug.Assert(hasDebugIds); 614Debug.Assert(containingDisplayClassId.HasValue); 624Debug.Assert(hasDebugIds); 688Debug.Assert(peMethod != null);
Emit\EditAndContinue\DeletedPEMethodDefinition.cs (1)
23Debug.Assert(oldMethod.MetadataToken != 0);
Emit\EditAndContinue\DeltaMetadataWriter.cs (33)
86Debug.Assert(previousGeneration != null); 87Debug.Assert(encId != default); 88Debug.Assert(encId != previousGeneration.EncId); 89Debug.Assert(context.Module.DebugInformationFormat != DebugInformationFormat.Embedded); 90Debug.Assert(context.Module.EncSymbolChanges != null); 135Debug.Assert(changes != null); 201Debug.Assert(module.EncSymbolChanges is not null); 743Debug.Assert(!methodDef.IsEncDeleted); 804Debug.Assert(ok); 826Debug.Assert(def is INestedTypeDefinition or IPropertyDefinition or IEventDefinition); 989Debug.Assert(xOrdinal == int.MaxValue && yOrdinal == int.MaxValue); 1002Debug.Assert(xOrdinal == int.MaxValue && yOrdinal == int.MaxValue); 1017Debug.Assert(_customAttributeRowIds.IsSorted()); 1029Debug.Assert(_customAttributeRowIds.IsSorted()); 1083Debug.Assert(typeSystemRowCounts[(int)TableIndex.EncLog] == 0); 1084Debug.Assert(typeSystemRowCounts[(int)TableIndex.EncMap] == 0); 1319Debug.Assert(tokens.IsSorted(HandleComparer.Default)); 1338Debug.Assert(debugTokens.Distinct().Count() == debugTokens.Count); 1394Debug.Assert(rowCounts[i] == 0); 1524Debug.Assert(prev < next); 1574Debug.Assert(!_map.TryGetValue(index, out var other) || ((object)other == (object)item) || other is DeletedSourceTypeDefinition || item is DeletedSourceTypeDefinition); 1589Debug.Assert(!this.IsFrozen); 1603Debug.Assert(!this.IsFrozen); 1655Debug.Assert(index > 0); 1748Debug.Assert(!this.IsFrozen); 1786Debug.Assert(!this.IsFrozen); 1822Debug.Assert(!this.IsFrozen); 1854Debug.Assert(this.ShouldVisit(eventDefinition)); 1860Debug.Assert(this.ShouldVisit(fieldDefinition)); 1874Debug.Assert(this.ShouldVisit(method)); 1893Debug.Assert(this.ShouldVisit(namespaceTypeDefinition)); 1899Debug.Assert(this.ShouldVisit(nestedTypeDefinition)); 1905Debug.Assert(this.ShouldVisit(propertyDefinition));
Emit\EditAndContinue\EmitBaseline.cs (30)
33Debug.Assert(implementingMethod > 0); 34Debug.Assert(index > 0); 323Debug.Assert(module != null); 324Debug.Assert(ordinal is 0 == (encId == default)); 325Debug.Assert(ordinal is 0 == initialBaseline is null); 326Debug.Assert(synthesizedTypes.IsEmpty || ordinal > 0); 327Debug.Assert(encId != module.GetModuleVersionId()); 328Debug.Assert(debugInformationProvider != null); 329Debug.Assert(localSignatureProvider != null); 330Debug.Assert(typeToEventMap != null); 331Debug.Assert(typeToPropertyMap != null); 332Debug.Assert(moduleVersionId != default); 333Debug.Assert(moduleVersionId == module.GetModuleVersionId()); 334Debug.Assert(synthesizedMembers != null); 335Debug.Assert(deletedMembers != null); 337Debug.Assert(tableEntriesAdded.Length == MetadataTokens.TableCount); 343Debug.Assert(tableEntriesAdded[(int)TableIndex.TypeDef] >= typesAdded.Count); 344Debug.Assert(tableEntriesAdded[(int)TableIndex.Event] >= eventsAdded.Count); 345Debug.Assert(tableEntriesAdded[(int)TableIndex.Field] >= fieldsAdded.Count); 346Debug.Assert(tableEntriesAdded[(int)TableIndex.MethodDef] >= methodsAdded.Count); 347Debug.Assert(tableEntriesAdded[(int)TableIndex.Property] >= propertiesAdded.Count); 348Debug.Assert(tableEntriesAdded[(int)TableIndex.EventMap] >= eventMapAdded.Count); 349Debug.Assert(tableEntriesAdded[(int)TableIndex.PropertyMap] >= propertyMapAdded.Count); 419Debug.Assert(synthesizedTypes.AnonymousTypes.Count >= _synthesizedTypes.AnonymousTypes.Count); 420Debug.Assert(synthesizedTypes.AnonymousDelegates.Count >= _synthesizedTypes.AnonymousDelegates.Count); 421Debug.Assert(synthesizedTypes.AnonymousDelegatesWithIndexedNames.Count >= _synthesizedTypes.AnonymousDelegatesWithIndexedNames.Count); 422Debug.Assert(customAttributesAdded.All(entry => !entry.Value.IsDefaultOrEmpty && entry.Value.IsSorted())); 469Debug.Assert(LazyMetadataSymbols is object); 508Debug.Assert(!parentType.IsNil); 523Debug.Assert(!parentType.IsNil);
Emit\EditAndContinue\EncHoistedLocalMetadata.cs (3)
17Debug.Assert(name != null); 18Debug.Assert(type != null); 19Debug.Assert(synthesizedKind.IsLongLived());
Emit\EditAndContinue\EncLocalInfo.cs (2)
23Debug.Assert(signature.Length > 0); 57Debug.Assert(Type != null);
Emit\EditAndContinue\EncVariableSlotAllocator.cs (3)
64Debug.Assert(!previousLocals.IsDefault); 87Debug.Assert(!localInfo.IsDefault); 333Debug.Assert(closureOrdinal >= LambdaDebugInfo.MinClosureOrdinal);
Emit\EditAndContinue\SymbolChanges.cs (8)
324Debug.Assert(symbol != null); 326Debug.Assert(result != null); 381Debug.Assert(edit.OldSymbol is IMethodSymbol or IPropertySymbol or IEventSymbol); 396Debug.Assert(!deletedMembersPerType.Contains(oldSymbol)); 422Debug.Assert(newMethod.PartialImplementationPart == null); 423Debug.Assert(edit.OldSymbol == null || ((IMethodSymbol)edit.OldSymbol).PartialImplementationPart == null); 445Debug.Assert(newProperty.PartialImplementationPart == null); 446Debug.Assert(edit.OldSymbol == null || ((IPropertySymbol)edit.OldSymbol).PartialImplementationPart == null);
Emit\EditAndContinue\SymbolMatcher.cs (3)
115Debug.Assert(type != null); 129Debug.Assert(delegateTypeDef != null); 214Debug.Assert(isDeletedMemberMapping || newSynthesizedMembers.Contains(mappedMember));
Emit\EditAndContinueMethodDebugInformation.cs (6)
34Debug.Assert(methodOrdinal >= -1); 165Debug.Assert(kind <= SynthesizedLocalKind.MaxValidValueForLocalVariableSerializedToDebugInformation); 174Debug.Assert((b & (1 << 7)) == 0); 263Debug.Assert(MethodOrdinal >= -1); 296Debug.Assert(info.ClosureOrdinal >= LambdaDebugInfo.MinClosureOrdinal); 297Debug.Assert(info.LambdaId.Generation == 0);
Emit\NoPia\CommonEmbeddedEvent.cs (3)
48Debug.Assert(adder != null || remover != null); 86Debug.Assert(!isUsedForComAwareEventBinding || _isUsedForComAwareEventBinding != 0); 91Debug.Assert(!isUsedForComAwareEventBinding || _isUsedForComAwareEventBinding != 0);
Emit\NoPia\CommonEmbeddedProperty.cs (1)
47Debug.Assert(getter != null || setter != null);
Emit\NoPia\CommonEmbeddedType.cs (5)
225Debug.Assert(_lazyAssemblyRefIndex >= 0); 248Debug.Assert(TypeManager.IsFrozen); 277Debug.Assert(TypeManager.IsFrozen); 446Debug.Assert(TypeManager.IsFrozen); 496Debug.Assert(TypeManager.IsFrozen);
Emit\NoPia\EmbeddedTypesManager.cs (1)
114Debug.Assert(_frozen[i - 1] == prev);
Emit\StateMachineMoveNextDebugInfo.cs (1)
23Debug.Assert(kickoffMethod != null);
EnumConstantHelper.cs (4)
22Debug.Assert(!constantValue.IsBad); 23Debug.Assert(offset > 0); 119Debug.Assert(maxOffset >= previous); 125Debug.Assert(maxOffset >= previous);
ExtendedSpecialType.cs (1)
21Debug.Assert(value >= sbyte.MinValue && value <= sbyte.MaxValue);
FileKey.cs (2)
30Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 31Debug.Assert(timestamp.Kind == DateTimeKind.Utc);
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));
FileSystem\PathUtilities.cs (3)
385Debug.Assert(!IsUnixLikePlatform); 403Debug.Assert(IsAbsolute(root)); 855Debug.Assert(parts[toSkip - 1] == string.Empty);
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));
Hashing\NonCryptographicHashAlgorithm.cs (1)
329Debug.Assert(destination.Length == HashLengthInBytes);
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);
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);
InternalUtilities\ArrayExtensions.cs (2)
16Debug.Assert(start >= 0); 17Debug.Assert(start <= array.Length);
InternalUtilities\BitArithmeticUtilities.cs (3)
53Debug.Assert(CountBits(alignment) == 1); 66Debug.Assert(position >= 0 && alignment > 0); 67Debug.Assert(CountBits(alignment) == 1);
InternalUtilities\BlobBuildingStream.cs (1)
100Debug.Assert(disposing);
InternalUtilities\ConcurrentLruCache.cs (1)
102Debug.Assert(_capacity > 0);
InternalUtilities\ConsList`1.cs (4)
38Debug.Assert(_tail != null); 89Debug.Assert(tail != null); 100Debug.Assert(this != Empty); 110Debug.Assert(this != Empty);
InternalUtilities\Debug.cs (3)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
InternalUtilities\FileLockCheck.cs (1)
199Debug.Assert(rgAffectedApps != null);
InternalUtilities\InterlockedOperations.cs (2)
140Debug.Assert((object?)initializedValue != uninitializedValue); 156Debug.Assert(!initializedValue.IsDefault);
InternalUtilities\JsonWriter.cs (2)
219Debug.Assert(_pending == Pending.NewLineAndIndent || _pending == Pending.CommaNewLineAndIndent); 302Debug.Assert(ShouldAppendAsUnicode(c));
InternalUtilities\MultiDictionary.cs (3)
49Debug.Assert(_count > 1); 52Debug.Assert(_count == v.Count); 154Debug.Assert(_value != null);
InternalUtilities\ReflectionUtilities.cs (1)
131Debug.Assert(e.InnerException is object);
InternalUtilities\StreamExtensions.cs (1)
35Debug.Assert(count > 0);
InternalUtilities\StringExtensions.cs (1)
32Debug.Assert(number >= 0);
InternalUtilities\ThreeState.cs (1)
33Debug.Assert(value != ThreeState.Unknown);
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);
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);
MemberDescriptor.cs (2)
56Debug.Assert(_declaringTypeId < (int)InternalSpecialType.NextAvailable); 65Debug.Assert(_declaringTypeId >= (int)WellKnownType.First);
MetadataReader\MetadataDecoder.cs (21)
87Debug.Assert(type != null); 129Debug.Assert(module != null); 142Debug.Assert(!token.IsNil); 168Debug.Assert(type != null); 400Debug.Assert(!refersToNoPiaLocalType || generic.TypeKind == TypeKind.Error); 514Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(name)); 528Debug.Assert(result != null); 534Debug.Assert(result1.Equals(result, TypeCompareKind.ConsiderEverything)); 560Debug.Assert(fullName.NamespaceName.Length == 0); 637Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(name)); 702Debug.Assert((object)result != null); 719Debug.Assert(!isNoPiaLocalType); 862Debug.Assert(typeParameterCount == 0); 884Debug.Assert(signatureReader.Offset <= start); 1486Debug.Assert(type != null); 1993Debug.Assert(!typeDef.IsNil); 2012Debug.Assert(typeSymbol != null); 2149Debug.Assert(type.TypeKind == TypeKind.Array); 2258Debug.Assert( 2284Debug.Assert(type == HandleKind.MethodDefinition || type == HandleKind.MemberReference); 2294Debug.Assert(type == HandleKind.FieldDefinition ||
MetadataReader\MetadataHelpers.cs (29)
143Debug.Assert(!isTypeArgumentWithAssemblyName || isTypeArgument); 167Debug.Assert(decodedString != null); 295Debug.Assert(topLevelType == null); 315Debug.Assert(i == _input.Length || s_typeNameDelimiters.Contains(_input[i])); 424Debug.Assert(Current == '['); 484Debug.Assert(arity > 0); 547Debug.Assert(intArity > 0); 574Debug.Assert(suffixStartsAt == -1); 578Debug.Assert(suffixStartsAt > 0 && suffixStartsAt < emittedTypeName.Length - 1); 584Debug.Assert(arity > 0); 589Debug.Assert(suffixStartsAt > 0 && suffixStartsAt < emittedTypeName.Length - 1); 611Debug.Assert(!nameMemory.Equals(default(ReadOnlyMemory<char>))); 676Debug.Assert(pstrName != null); 704Debug.Assert(angleBracketDepth == 0); 728Debug.Assert(name != null); 782Debug.Assert(typesByNS != null); 783Debug.Assert(namespaceNameLength >= 0); 784Debug.Assert(!isGlobalNamespace || namespaceNameLength == 0); 845Debug.Assert((object?)typesInLastChildNamespace != null); 856Debug.Assert(lastChildNamespaceName != null); 863Debug.Assert(lastChildNamespaceName != null); 864Debug.Assert(typesInLastChildNamespace.Count != 0); 881Debug.Assert(lastChildNamespaceName != null); 882Debug.Assert(typesInLastChildNamespace.Count != 0); 914Debug.Assert(keyIndex < i); 922Debug.Assert(removed > 0); 928Debug.Assert(types != null); 929Debug.Assert(namespaces != null); 1096Debug.Assert(value <= 0x1fffffff);
MetadataReader\MetadataTypeName.cs (16)
94Debug.Assert(fullName != null); 95Debug.Assert(forcedArity >= -1 && forcedArity < short.MaxValue); 124Debug.Assert(namespaceName != null); 125Debug.Assert(typeName != null); 126Debug.Assert(forcedArity >= -1 && forcedArity < short.MaxValue); 127Debug.Assert(!typeName.Contains(MetadataHelpers.DotDelimiterString)); 153Debug.Assert(typeName != null); 154Debug.Assert(!typeName.Contains(MetadataHelpers.DotDelimiterString) || typeName.IndexOf(MetadataHelpers.MangledNameRegionStartChar) >= 0); 155Debug.Assert(forcedArity >= -1 && forcedArity < short.MaxValue); 188Debug.Assert(_namespaceName != null); 189Debug.Assert(_typeName != null); 204Debug.Assert(_fullName != null); 224Debug.Assert(_fullName != null); 244Debug.Assert(_inferredArity == -1); 279Debug.Assert(_unmangledTypeNameMemory.Equals(default(ReadOnlyMemory<char>))); 280Debug.Assert(_unmangledTypeName == null);
MetadataReader\MetadataTypeName.Key.cs (2)
46Debug.Assert(mdTypeName._namespaceName != null); 47Debug.Assert(mdTypeName._typeName != null);
MetadataReader\PEAssembly.cs (2)
62Debug.Assert(!modules.IsDefault); 63Debug.Assert(modules.Length > 0);
MetadataReader\PEModule.cs (48)
150Debug.Assert((peReader == null) ^ (metadataOpt == IntPtr.Zero && metadataSizeOpt == 0)); 151Debug.Assert(metadataOpt == IntPtr.Zero || metadataSizeOpt > 0); 174Debug.Assert(peReader != null); 248Debug.Assert(_peReaderOpt != null); 345Debug.Assert(_hashesOpt != null); 531Debug.Assert(name.Length == 0 || MetadataHelpers.IsValidMetadataIdentifier(name)); // Obfuscated assemblies can have types with empty names. 739Debug.Assert(left.IsEmpty() && right.IsEmpty()); 744Debug.Assert(result != 0); 1115Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1); 1135Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1); 1167Debug.Assert(info.SignatureIndex == 0); 1183Debug.Assert(info.SignatureIndex == 0); 1198Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1); 1297Debug.Assert(attributeInfo.HasValue); 1470Debug.Assert(AttributeDescription.InterpolatedStringHandlerArgumentAttribute.Signatures.Length == 2); 1471Debug.Assert(targetAttribute.SignatureIndex is 0 or 1); 1481Debug.Assert(!paramNames.IsDefault); 1491Debug.Assert(description.Namespace == "System.Diagnostics.CodeAnalysis"); 1492Debug.Assert(description.Name == "MaybeNullWhenAttribute" || description.Name == "NotNullWhenAttribute" || description.Name == "DoesNotReturnIfAttribute"); 1532Debug.Assert(info.SignatureIndex == 0); 1640Debug.Assert(info.SignatureIndex == 0); 1773Debug.Assert(attributeInfo.HasValue); 1813Debug.Assert(!handle.IsNil); 1840Debug.Assert(attributeInfo.HasValue); 1859Debug.Assert(attributeInfo.HasValue); 1873Debug.Assert(attributeInfo.HasValue); 1924Debug.Assert(info.HasValue); 2020Debug.Assert(!handle.IsNil); 2503Debug.Assert(signatureIndex >= 0 && signatureIndex <= byte.MaxValue); 2624Debug.Assert(rid > 0); 2690Debug.Assert(rid > 0); 2771Debug.Assert(namespaceName != null); 2772Debug.Assert(typeName != null); 2806Debug.Assert(assemblyName != null); 2845Debug.Assert(!resolutionScope.IsNil); 2846Debug.Assert(namespaceName != null); 2847Debug.Assert(typeName != null); 2892Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(name)); 2951Debug.Assert(targetSignature.Length >= 3); 3104Debug.Assert(!ctorType.IsNil); 3190Debug.Assert(_lazyContainsNoPiaLocalTypes != ThreeState.True); 3228Debug.Assert(!info.HasValue || info.SignatureIndex == 0); 3242Debug.Assert(!info.HasValue || info.SignatureIndex == 0 || info.SignatureIndex == 1); 3263Debug.Assert(!info.HasValue || info.SignatureIndex == 0); 3396Debug.Assert(rva >= 0); 3600Debug.Assert(!param.IsNil); 3617Debug.Assert(!fieldDef.IsNil); 3984Debug.Assert(_peReaderOpt != null);
MetadataReader\TypeNameDecoder.cs (3)
157Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(fullName.TopLevelType)); 173Debug.Assert(MetadataHelpers.IsValidMetadataIdentifier(fullName.NestedTypes[i])); 211Debug.Assert(rank >= 0);
MetadataReference\AssemblyIdentity.cs (11)
59Debug.Assert((object)other != null); 60Debug.Assert((object)version != null); 164Debug.Assert(name != null); 165Debug.Assert(IsValid(version)); 166Debug.Assert(IsValidCultureName(cultureName)); 167Debug.Assert((hasPublicKey && MetadataHelpers.IsValidPublicKey(publicKeyOrToken)) || (!hasPublicKey && (publicKeyOrToken.IsDefaultOrEmpty || publicKeyOrToken.Length == PublicKeyTokenSize))); 188Debug.Assert(name != null); 189Debug.Assert((hasPublicKey && MetadataHelpers.IsValidPublicKey(publicKeyOrToken)) || (!hasPublicKey && (publicKeyOrToken.IsDefaultOrEmpty || publicKeyOrToken.Length == PublicKeyTokenSize))); 190Debug.Assert(noThrow); 343Debug.Assert(HasPublicKey || !_lazyPublicKeyToken.IsDefault); 437Debug.Assert(hash.Length == CryptographicHashProvider.Sha1HashSize);
MetadataReference\AssemblyIdentity.DisplayName.cs (4)
450Debug.Assert(displayName.IndexOf('\0') == -1); 552Debug.Assert(i == displayName.Length || IsNameTokenTerminator(displayName[i])); 602Debug.Assert(str.Length > 0); 603Debug.Assert(str.IndexOf('\0') < 0);
MetadataReference\AssemblyIdentityComparer.cs (2)
89Debug.Assert((reference is not null) ^ (referenceDisplayName != null)); 113Debug.Assert(reference.ContentType == definition.ContentType);
MetadataReference\AssemblyMetadata.cs (6)
36Debug.Assert(!modules.IsDefaultOrEmpty && assembly != null); 93Debug.Assert(!modules.IsDefaultOrEmpty); 100Debug.Assert(manifestModule != null); 101Debug.Assert(moduleFactory != null); 325Debug.Assert(_initialModules.Length == 1); 393Debug.Assert(_initialModules.Length == 1 || _initialModules.Length == previousData.Modules.Length);
MetadataReference\CompilationReference.cs (1)
24Debug.Assert(properties.Kind != MetadataImageKind.Module);
MetadataReference\ModuleMetadata.cs (2)
115Debug.Assert(metadata != IntPtr.Zero); 116Debug.Assert(size > 0);
MetadataReference\ReferenceDirective.cs (2)
20Debug.Assert(file != null); 21Debug.Assert(location != null);
NativePdbWriter\PdbWriter.cs (24)
67Debug.Assert(_metadataWriter != null); 93Debug.Assert(emitAllDebugInfo || !emitExternNamespaces); 174Debug.Assert(import.AliasOpt != null); 175Debug.Assert(import.TargetAssemblyOpt == null); 249Debug.Assert(import.TargetAssemblyOpt == null); 250Debug.Assert(declaredExternAliasesOpt == null); 254Debug.Assert(import.TargetNamespaceOpt == null); 255Debug.Assert(import.TargetAssemblyOpt == null); 289Debug.Assert(import.AliasOpt != null); 290Debug.Assert(import.TargetXmlNamespaceOpt != null); 295Debug.Assert(import.TargetXmlNamespaceOpt == null); 299Debug.Assert(import.TargetNamespaceOpt == null); 300Debug.Assert(import.TargetAssemblyOpt == null); 327Debug.Assert(import.AliasOpt != null); 328Debug.Assert(import.TargetAssemblyOpt == null); 366Debug.Assert(!(typeReference is IArrayTypeReference)); 367Debug.Assert(!(typeReference is IPointerTypeReference)); 368Debug.Assert(!typeReference.IsTypeSpecification()); 391Debug.Assert(namespaceType != null); 519Debug.Assert(scopeLocal.SlotIndex >= 0); 574Debug.Assert(age == Age); 671Debug.Assert(sequencePoint.Document != null); 708Debug.Assert(!handle.IsNil); 730Debug.Assert(token != 0);
Operations\BasicBlock.cs (9)
79Debug.Assert(_successorsAreSealed); 96Debug.Assert(_successorsAreSealed); 112Debug.Assert(_predecessorsAreSealed); 137Debug.Assert(!_successorsAreSealed); 138Debug.Assert(_lazySuccessor == null); 139Debug.Assert(_lazyConditionalSuccessor == null); 153Debug.Assert(!_predecessorsAreSealed); 154Debug.Assert(_lazyPredecessors.IsDefault); 155Debug.Assert(!predecessors.IsDefault);
Operations\CaptureId.cs (1)
17Debug.Assert(value >= 0);
Operations\ControlFlowBranch.cs (3)
88Debug.Assert(source.Kind != ControlFlowRegionKind.Root); 89Debug.Assert(source.EnclosingRegion != null); 150Debug.Assert(builder.Last().Kind == ControlFlowRegionKind.Finally);
Operations\ControlFlowGraph.cs (23)
40Debug.Assert(parent != null == (originalOperation.Kind == OperationKind.LocalFunction || originalOperation.Kind == OperationKind.AnonymousFunction)); 41Debug.Assert(captureIdDispenser != null); 42Debug.Assert(!blocks.IsDefault); 43Debug.Assert(blocks.First().Kind == BasicBlockKind.Entry); 44Debug.Assert(blocks.Last().Kind == BasicBlockKind.Exit); 45Debug.Assert(root != null); 46Debug.Assert(root.Kind == ControlFlowRegionKind.Root); 47Debug.Assert(root.FirstBlockOrdinal == 0); 48Debug.Assert(root.LastBlockOrdinal == blocks.Length - 1); 49Debug.Assert(!localFunctions.IsDefault); 50Debug.Assert(localFunctionsMap != null); 51Debug.Assert(localFunctionsMap.Count == localFunctions.Length); 52Debug.Assert(localFunctions.Distinct().Length == localFunctions.Length); 53Debug.Assert(anonymousFunctionsMap != null); 57Debug.Assert(method.MethodKind == MethodKind.LocalFunction); 58Debug.Assert(localFunctionsMap.ContainsKey(method)); 191Debug.Assert(controlFlowGraph.OriginalOperation == operation); 252Debug.Assert(localFunction == LocalFunctions[info.ordinal]); 262Debug.Assert(localFunction == info.operation.Symbol); 264Debug.Assert(graph.OriginalOperation == info.operation); 269Debug.Assert(controlFlowGraph.Parent == this); 311Debug.Assert(graph.OriginalOperation == anonymous.Original); 316Debug.Assert(controlFlowGraph!.Parent == this);
Operations\ControlFlowGraphBuilder.BasicBlockBuilder.cs (19)
51Debug.Assert(operation != null); 81Debug.Assert(Region != null); 99Debug.Assert(_predecessor1 == null); 100Debug.Assert(_predecessor2 == null); 116Debug.Assert(!result || BranchValue != null); 125Debug.Assert(_predecessor1 == null); 126Debug.Assert(_predecessor2 == null); 145Debug.Assert(predecessor != null); 149Debug.Assert(_predecessor1 == null); 150Debug.Assert(_predecessor2 == null); 175Debug.Assert(_predecessors.Count == 3); 183Debug.Assert(predecessor != null); 187Debug.Assert(_predecessor1 == null); 188Debug.Assert(_predecessor2 == null); 205Debug.Assert(_predecessor1 == null); 206Debug.Assert(_predecessor2 == null); 242Debug.Assert(_predecessor1 == null); 243Debug.Assert(_predecessor2 == null); 292Debug.Assert(predecessor.FallThroughSuccessor != null);
Operations\ControlFlowGraphBuilder.ConditionalAccessOperationTracker.cs (1)
30Debug.Assert(operations != null && whenNull != null);
Operations\ControlFlowGraphBuilder.Context.cs (2)
26Debug.Assert(!anonymousTypePropertyValues.IsDefault); 27Debug.Assert(implicitInstance == null || anonymousType == null);
Operations\ControlFlowGraphBuilder.cs (326)
65Debug.Assert(compilation != null); 77Debug.Assert(_currentRegion != null); 89Debug.Assert(body != null); 90Debug.Assert(((Operation)body).OwningSemanticModel != null); 95Debug.Assert(body.Parent == null); 104Debug.Assert(parent == null); 108Debug.Assert(body.Kind == OperationKind.LocalFunction || body.Kind == OperationKind.AnonymousFunction); 109Debug.Assert(parent != null); 127Debug.Assert(captureIdDispenser != null); 131Debug.Assert(captureIdDispenser != null); 145Debug.Assert(builder._currentRegion == null); 162Debug.Assert(builder._evalStack.Count == 0); 260Debug.Assert(outOfRangeBlocksToVisit != null); 305Debug.Assert(current.Region != null); 323Debug.Assert(branch.Destination == null); 328Debug.Assert(branch.Destination != null); 329Debug.Assert(current.Region != null); 349Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 350Debug.Assert(region.EnclosingRegion != null); 354Debug.Assert(enclosing.NestedRegions[0] == region); 355Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 372Debug.Assert(@finally.Kind == ControlFlowRegionKind.Finally); 413Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 414Debug.Assert(enclosing.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 423Debug.Assert(enclosing.NestedRegions[0] == fromRegion); 434Debug.Assert(enclosing!.Kind == ControlFlowRegionKind.FilterAndHandler); 435Debug.Assert(enclosing.EnclosingRegion != null); 437Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 461Debug.Assert(tryAndCatch.Kind == ControlFlowRegionKind.TryAndCatch); 462Debug.Assert(startAt > 0); 463Debug.Assert(startAt <= tryAndCatch.NestedRegions.Length); 477Debug.Assert(@catch.NestedRegions[0].Kind == ControlFlowRegionKind.Filter); 478Debug.Assert(entryBlock.Ordinal == @catch.NestedRegions[0].FirstBlockOrdinal); 517Debug.Assert(!region.IsEmpty); 555Debug.Assert(region.Kind != ControlFlowRegionKind.Root); 576Debug.Assert(subRegion.FirstBlock != null); 581Debug.Assert(!subRegion.HasCaptureIds); 584Debug.Assert(regionMap[block] == subRegion); 616Debug.Assert(subRegion.Kind != ControlFlowRegionKind.Root); 617Debug.Assert(subRegion.Enclosing != null); 626Debug.Assert(canHaveEmptyRegion); 627Debug.Assert(!subRegion.HasRegions); 640Debug.Assert(!r.IsEmpty); 643Debug.Assert(regionMap[blocks[i]] == subRegion); 659Debug.Assert(regionMap[blocks[i]] == subRegion); 704Debug.Assert(predecessor.BranchValue == null); 705Debug.Assert(predecessor.FallThrough.Kind == ControlFlowBranchSemantics.Regular); 718Debug.Assert((block.BranchValue != null && !block.HasCondition) == (next.Kind == ControlFlowBranchSemantics.Return || next.Kind == ControlFlowBranchSemantics.Throw)); 719Debug.Assert((next.Destination == null) == 730Debug.Assert(currentRegion.Kind == ControlFlowRegionKind.Filter || 732Debug.Assert(block == currentRegion.LastBlock); 748Debug.Assert(currentRegion.FirstBlock == block); 749Debug.Assert(!currentRegion.HasRegions); 757Debug.Assert(currentRegion.Enclosing != null); 759Debug.Assert(tryAndFinally.Kind == ControlFlowRegionKind.TryAndFinally); 760Debug.Assert(tryAndFinally.Regions!.Count == 2); 763Debug.Assert(@try.Kind == ControlFlowRegionKind.Try); 764Debug.Assert(tryAndFinally.Regions.Last() == currentRegion); 769Debug.Assert(@try.FirstBlock != null); 781Debug.Assert(tryAndFinally.Enclosing != null); 786Debug.Assert(regionMap[block] == tryAndFinallyEnclosing); 797Debug.Assert(block.HasCondition || block.BranchValue == null); 798Debug.Assert(next.Destination == null); 828Debug.Assert(next.Kind == ControlFlowBranchSemantics.Regular || 835Debug.Assert(!block.HasCondition); // This is ensured by an "if" above. 850Debug.Assert(implicitEntryRegion.LastBlock!.Ordinal >= next.Destination.Ordinal); 858Debug.Assert(next.Destination != null); 882Debug.Assert(predecessor.FallThrough.Destination == block); 921Debug.Assert(predecessor.BranchValue == null); 928Debug.Assert(value == null); 949Debug.Assert(next.Kind == ControlFlowBranchSemantics.Regular || 976Debug.Assert(predecessor != block); 977Debug.Assert(predecessor.BranchValue == null); 1040Debug.Assert(!region.IsEmpty); 1041Debug.Assert(region.FirstBlock.Ordinal >= 0); 1042Debug.Assert(region.FirstBlock.Ordinal <= region.LastBlock.Ordinal); 1043Debug.Assert(region.FirstBlock.Ordinal <= block.Ordinal); 1044Debug.Assert(block.Ordinal <= region.LastBlock.Ordinal); 1050Debug.Assert(region.Enclosing != null); 1055Debug.Assert(enclosing.Enclosing != null); 1063Debug.Assert(region.Enclosing != null); 1068Debug.Assert(enclosing.Enclosing != null); 1073Debug.Assert(region.FirstBlock.Ordinal <= region.LastBlock.Ordinal); 1076Debug.Assert(removed); 1077Debug.Assert(blocks[block.Ordinal] == block); 1097Debug.Assert(predecessorBranch.Kind == ControlFlowBranchSemantics.Regular); 1226Debug.Assert(branch.Kind == ControlFlowBranchSemantics.Regular); 1237Debug.Assert(stackDepth == 0 || _evalStack.Peek().frameOpt != null); 1251Debug.Assert(_evalStack.Count == stackDepth); 1252Debug.Assert(stackDepth == 0 || _evalStack.Peek().frameOpt != null); 1278Debug.Assert(spillingTheStack || _evalStack.All( 1297Debug.Assert(block != null); 1298Debug.Assert(_currentRegion != null); 1329Debug.Assert(_evalStack.Count == _startSpillingAt); 1342Debug.Assert(_currentRegion != null); 1354Debug.Assert((frameOpt == null) != (operationOpt == null)); 1358Debug.Assert(enclosed != frameOpt.RegionBuilderOpt); 1363Debug.Assert(enclosed.LastBlock != null); 1370Debug.Assert(prevBlock.HasCondition || prevBlock.BranchValue == null); 1371Debug.Assert(prevBlock.FallThrough.Destination == null); 1395Debug.Assert(_currentStatement == operation); 1396Debug.Assert(_evalStack.Count == 0 || _evalStack.Peek().frameOpt != null); 1404Debug.Assert(_currentStatement == originalOperation); 1405Debug.Assert(_evalStack.Count == 0 || _evalStack.Peek().frameOpt != null); 1500Debug.Assert(captureIdForResult is null); 1507Debug.Assert(_currentStatement == operation); 1568Debug.Assert(whenFalse is { }); 1607Debug.Assert(operation is { WhenTrue: not null, WhenFalse: not null }); 1622Debug.Assert(rewrittenThrow!.Kind == OperationKind.None); 1623Debug.Assert(rewrittenThrow.ChildOperations.IsEmpty()); 1640Debug.Assert(rewrittenThrow.Kind == OperationKind.None); 1641Debug.Assert(rewrittenThrow.ChildOperations.IsEmpty()); 1686Debug.Assert(_startSpillingAt == _evalStack.Count); 1715Debug.Assert(_lazyRegionBuilder == null); 1716Debug.Assert(value != null); 1731Debug.Assert(frame != null); 1733Debug.Assert(_startSpillingAt <= stackDepth); 1741Debug.Assert(frame == frameOpt); 1742Debug.Assert(operationOpt == null); 1748Debug.Assert(_currentRegion != null); 1750Debug.Assert(toMerge.Enclosing != null); 1753Debug.Assert(toMerge.IsStackSpillRegion); 1754Debug.Assert(!toMerge.HasLocalFunctions); 1755Debug.Assert(toMerge.Locals.IsEmpty); 1783Debug.Assert(_currentRegion!.IsStackSpillRegion); 1807Debug.Assert(owner != null); 1815Debug.Assert(_startSpillingAt <= _evalStack.Count); 1827Debug.Assert(frameOpt.RegionBuilderOpt != null); 1835Debug.Assert((frameOpt == null) != (operationOpt == null)); 1840Debug.Assert(frameOpt.RegionBuilderOpt == null); 1846Debug.Assert(operationOpt != null); 1862Debug.Assert(currentFrame != null); 1864Debug.Assert(currentSpillRegion != null); 1895Debug.Assert(candidate.IsStackSpillRegion); 1902Debug.Assert(candidate.Enclosing != null); 1922Debug.Assert(CurrentRegionRequired.IsStackSpillRegion); 1939Debug.Assert(operationOpt == null); 1940Debug.Assert(frameOpt.RegionBuilderOpt != null); 1944Debug.Assert(operationOpt != null); 1952Debug.Assert(_evalStack.Count != 0); 1953Debug.Assert(_evalStack.First().frameOpt != null); 1954Debug.Assert(_evalStack.First().operationOpt == null); 1955Debug.Assert(_startSpillingAt <= _evalStack.Count); 1956Debug.Assert(operation != null); 1963Debug.Assert(_startSpillingAt <= stackDepth); 1971Debug.Assert(frameOpt == null); 1972Debug.Assert(operationOpt != null); 1979Debug.Assert(_startSpillingAt <= _evalStack.Count); 1982Debug.Assert(frameOpt == null); 1983Debug.Assert(operationOpt != null); 1990Debug.Assert(unwrapper != null || typeof(T) == typeof(IOperation)); 1999Debug.Assert(wrapper != null || typeof(T) == typeof(IOperation)); 2029Debug.Assert(stackSizeBefore == _evalStack.Count); 2062Debug.Assert(interpolatedStringBuilder != null); 2092Debug.Assert(index >= 0 && index < args.Length); 2451Debug.Assert(binOp.Type is not null); 2465Debug.Assert(binOp.Type is not null); 2490Debug.Assert(unaryOperatorMethod == null); 2564Debug.Assert(binOp.OperatorMethod is not null); 2593Debug.Assert(unaryOperatorMethod == null || !ITypeSymbolHelpers.IsNullableType(unaryOperatorMethod.Parameters[0].Type)); 2654Debug.Assert(IsBooleanConditionalOperator(condition)); 2704Debug.Assert(ITypeSymbolHelpers.IsBooleanType(condition.Type)); 2766Debug.Assert(current == _currentRegion); 2783Debug.Assert(_startSpillingAt == _evalStack.Count); 2870Debug.Assert(conditional.WhenFalse is not null); 2928Debug.Assert(rewrittenThrow != null); 2929Debug.Assert(rewrittenThrow.Kind == OperationKind.None); 2930Debug.Assert(rewrittenThrow.ChildOperations.IsEmpty()); 2966Debug.Assert(previous.BranchValue == null); 2967Debug.Assert(!previous.HasCondition); 2968Debug.Assert(condition != null); 2969Debug.Assert(branch.Destination != null); 2983Debug.Assert(_evalStack.Last().frameOpt != null); 2984Debug.Assert(_startSpillingAt >= _evalStack.Count - 1); 3068Debug.Assert(conversion is not null); 3070Debug.Assert(rewrittenThrow != null); 3071Debug.Assert(rewrittenThrow.Kind == OperationKind.None); 3072Debug.Assert(rewrittenThrow.ChildOperations.IsEmpty()); 3103Debug.Assert(operation.Parent != null); 3105Debug.Assert(captureIdForResult == null || !isStatement); 3119Debug.Assert(valueFrame.RegionBuilderOpt != null); 3181Debug.Assert(intermediateFrame.RegionBuilderOpt != null); 3196Debug.Assert(intermediateFrame != null); 3217Debug.Assert(whenNullFrame.RegionBuilderOpt != null); 3314Debug.Assert(ITypeSymbolHelpers.IsBooleanType(booleanType)); 3325Debug.Assert(nullableMember == SpecialMember.System_Nullable_T_GetValueOrDefault || 3332Debug.Assert(ITypeSymbolHelpers.IsNullableType(valueType)); 3355Debug.Assert(ITypeSymbolHelpers.IsNullableType(value.Type)); 3408Debug.Assert(captureIdForResult == null); 3415Debug.Assert(_currentStatement is not null); 3427Debug.Assert(expressionFrame != null); 3454Debug.Assert(operation.Type is not null); 3470Debug.Assert(!_currentConditionalAccessTracker.IsDefault); 3471Debug.Assert(_currentConditionalAccessTracker.Operations.Count == 0); 3521Debug.Assert(!_currentConditionalAccessTracker.IsDefault && _currentConditionalAccessTracker.Operations.Count > 0); 3529Debug.Assert(!_currentConditionalAccessTracker.IsDefault); 3562Debug.Assert(operation.Operation.Kind == OperationKind.ConditionalAccess || operation.Operation.Kind == OperationKind.CoalesceAssignment); 3599Debug.Assert(operation.Condition is not null); 3639Debug.Assert(_currentRegion == locals); 3678Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 3711Debug.Assert(!filterRegion.IsEmpty); 3712Debug.Assert(filterRegion.LastBlock.FallThrough.Destination == null); 3713Debug.Assert(!filterRegion.FirstBlock.HasPredecessors); 3732Debug.Assert(!handlerRegion.IsEmpty); 3735Debug.Assert(CurrentRegionRequired == filterAndHandlerRegion); 3738Debug.Assert(filterAndHandlerRegion.Regions![0].LastBlock!.FallThrough.Destination == null); 3743Debug.Assert(predecessors.All(p => filterAndHandlerRegion.Regions[0].FirstBlock!.Ordinal <= p.Ordinal && 3751Debug.Assert(!handlerRegion.FirstBlock.HasPredecessors); 3755Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndCatch); 3761Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 3772Debug.Assert(_currentRegion == tryAndFinallyRegion); 3774Debug.Assert(!finallyRegion.IsEmpty); 3775Debug.Assert(finallyRegion.LastBlock.FallThrough.Destination == null); 3776Debug.Assert(!finallyRegion.FirstBlock.HasPredecessors); 3780Debug.Assert(tryAndFinallyRegion?.Regions![1].LastBlock!.FallThrough.Destination == null); 3842Debug.Assert(current.BranchValue == null); 3843Debug.Assert(!current.HasCondition); 3939Debug.Assert(current.BranchValue == null); 3940Debug.Assert(!current.HasCondition); 3941Debug.Assert(current.FallThrough.Destination == null); 3942Debug.Assert(current.FallThrough.Kind == ControlFlowBranchSemantics.None); 3967Debug.Assert(visitResource is null); 3985Debug.Assert(resources.Kind != OperationKind.VariableDeclaration); 3986Debug.Assert(resources.Kind != OperationKind.VariableDeclarator); 4005Debug.Assert(_currentRegion == usingRegion); 4092Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 4099Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndFinally); 4104Debug.Assert(_currentRegion == resourceRegion); 4114Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndFinally); 4115Debug.Assert(resource.Type is not null); 4126Debug.Assert(!isNotNullableValueType(resource.Type)); 4131Debug.Assert(resource.Type is not null); 4162Debug.Assert(_currentRegion == finallyRegion); 4168Debug.Assert((disposeMethod is object && !disposeArguments.IsDefault) || 4212Debug.Assert(iDisposable.SpecialType == SpecialType.System_IDisposable || 4332Debug.Assert(lockStatement.LockTakenSymbol == null); 4366Debug.Assert(lockStatement.LockTakenSymbol is not null); 4367Debug.Assert(enterMethod is not null); 4394Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.Try); 4408Debug.Assert(lockStatement.LockTakenSymbol is not null); 4442Debug.Assert(CurrentRegionRequired.Kind == ControlFlowRegionKind.TryAndFinally); 4493Debug.Assert(regionForCollection == _currentRegion); 4521Debug.Assert(localsRegion == _currentRegion); 4531Debug.Assert(_currentRegion.Kind == ControlFlowRegionKind.Try); 4548Debug.Assert(_currentRegion.Kind == ControlFlowRegionKind.TryAndFinally); 4554Debug.Assert(_currentRegion == enumeratorCaptureRegion); 4680Debug.Assert(info?.ElementConversion?.ToCommonConversion().IsIdentity != false); 4702Debug.Assert(method.IsStatic == (instanceOpt == null)); 4780Debug.Assert(isObjectLoop && loopObject is not null); 4801Debug.Assert(builder.All(o => o != null)); 4831Debug.Assert(builder.All(op => op is not null)); 4894Debug.Assert(_forToLoopBinaryOperatorLeftOperand == null); 4895Debug.Assert(_forToLoopBinaryOperatorRightOperand == null); 5038Debug.Assert(_forToLoopBinaryOperatorLeftOperand == null); 5039Debug.Assert(_forToLoopBinaryOperatorRightOperand == null); 5050Debug.Assert(positiveFlag is not null); 5089Debug.Assert(value.Discriminator != ConstantValueTypeDiscriminator.Bad); 5286Debug.Assert(_forToLoopBinaryOperatorLeftOperand == null); 5287Debug.Assert(_forToLoopBinaryOperatorRightOperand == null); 5355Debug.Assert(controlVariableReferenceForAssignment.Kind == OperationKind.FlowCaptureReference); 5380Debug.Assert(ITypeSymbolHelpers.IsNullableType(controlVariableReferenceForIncrement.Type)); 5404Debug.Assert(controlVariableReferenceForAssignment.Type != null); 5435Debug.Assert(!_forceImplicit); 5481Debug.Assert(_currentRegion == switchRegion); 5512Debug.Assert(section.Clauses.All(c => c.Label == null)); 5513Debug.Assert(_currentSwitchOperationExpression == null); 5568Debug.Assert(compareWith.Type != null); 5574Debug.Assert(operation.Value.Type != null); 5664Debug.Assert(ITypeSymbolHelpers.IsNullableType(type)); 5665Debug.Assert(ITypeSymbolHelpers.GetNullableUnderlyingType(type).Equals(operand.Type)); 5705Debug.Assert(current.BranchValue == null); 5706Debug.Assert(!current.HasCondition); 5707Debug.Assert(current.FallThrough.Destination == null); 5708Debug.Assert(current.FallThrough.Kind == ControlFlowBranchSemantics.None); 5869Debug.Assert(initializer != null && assignmentSyntax != null); 5872Debug.Assert((afterInitialization, localSymbol.IsStatic) is (null, false) or (not null, true)); 6066Debug.Assert(validKinds.Contains(innerInitializer.Kind)); 6220Debug.Assert(instance.Kind == OperationKind.Invalid || instance.Kind == OperationKind.None); 6307Debug.Assert(array.Initializer is not null); 6378Debug.Assert(operation.Type is not null); 6380Debug.Assert(_currentImplicitInstance.AnonymousTypePropertyValues is not null); 6392Debug.Assert(propertyReference != null); 6393Debug.Assert(propertyReference.Arguments.IsEmpty); 6394Debug.Assert(propertyReference.Instance != null); 6395Debug.Assert(propertyReference.Instance.Kind == OperationKind.InstanceReference); 6396Debug.Assert(((IInstanceReferenceOperation)propertyReference.Instance).ReferenceKind == InstanceReferenceKind.ImplicitReceiver); 6444Debug.Assert(owner.Enclosing != null); 6454Debug.Assert(_currentStatement == null); 6586Debug.Assert(operation.IsImplicit); 6725Debug.Assert(left != null); 6726Debug.Assert(right != null); 6759Debug.Assert(_currentStatement == operation); 6779Debug.Assert(_evalStack[maxStackDepth + 1].frameOpt != null); 6786Debug.Assert(_evalStack[i].frameOpt == null); 6787Debug.Assert(_evalStack[i].operationOpt != null); 6811Debug.Assert(operation.HandlerCreation is IObjectCreationOperation); 6825Debug.Assert(outParameterArgument is { Parameter: { RefKind: RefKind.Out, Type.SpecialType: SpecialType.System_Boolean } }); 6837Debug.Assert(resultBlock != null); 6838Debug.Assert(outParameterPlaceholder != null); 6839Debug.Assert(outParameterFlowCapture != -1); 6860Debug.Assert(resultBlock != null); 6975Debug.Assert(_currentInterpolatedStringHandlerArgumentContext != null); 6978Debug.Assert(receiverCapture is IFlowCaptureReferenceOperation); 6988Debug.Assert(_currentInterpolatedStringHandlerArgumentContext != null); 6991Debug.Assert(argumentCapture is IFlowCaptureReferenceOperation or IDiscardOperation); 7013Debug.Assert(_evalStack.Count > _currentInterpolatedStringHandlerCreationContext.MaximumStackDepth); 7056Debug.Assert(interpolation.FormatString is ILiteralOperation or IConversionOperation { Operand: ILiteralOperation }); 7069Debug.Assert(interpolatedStringText.Text is ILiteralOperation or IConversionOperation { Operand: ILiteralOperation }); 7098Debug.Assert(operation.GetConstantValue() != null); 7146Debug.Assert(_currentImplicitInstance.AnonymousTypePropertyValues is not null); 7312Debug.Assert(operation.EventReference != null); 7494Debug.Assert(_currentStatement == invalidOperation); 7857Debug.Assert(operation == null || ((Operation)operation).OwningSemanticModel!.Compilation == _compilation); 7865Debug.Assert(operation == null || ((Operation)operation).OwningSemanticModel!.Compilation == _compilation); 7867Debug.Assert((result == null) == (operation == null)); 7878Debug.Assert((result == null) == (operation == null)); 7944Debug.Assert(operation.Type!.IsAnonymousType); 7989Debug.Assert(simpleAssignment.Target is InvalidOperation); 7996Debug.Assert(propertyReference != null); 7997Debug.Assert(propertyReference.Arguments.IsEmpty); 7998Debug.Assert(propertyReference.Instance != null); 7999Debug.Assert(propertyReference.Instance.Kind == OperationKind.InstanceReference); 8000Debug.Assert(((IInstanceReferenceOperation)propertyReference.Instance).ReferenceKind == InstanceReferenceKind.ImplicitReceiver); 8030Debug.Assert(oldValueCaptureId >= 0); 8082Debug.Assert(simpleAssignment.Target is InvalidOperation); 8087Debug.Assert(properties.Contains(propertyReference.Property, SymbolEqualityComparer.IgnoreAll));
Operations\ControlFlowGraphBuilder.ImplicitInstanceInfo.cs (3)
37Debug.Assert(currentImplicitInstance != null); 45Debug.Assert(currentInitializedAnonymousType.IsAnonymousType); 54Debug.Assert(context.ImplicitInstance == null || context.AnonymousType == null);
Operations\ControlFlowGraphBuilder.InterpolatedStringContext.cs (6)
49Debug.Assert(_currentInterpolatedStringHandlerCreationContext != null); 50Debug.Assert(placeholderOperation is IInstanceReferenceOperation { ReferenceKind: InstanceReferenceKind.InterpolatedStringHandler } or IInterpolatedStringHandlerArgumentPlaceholderOperation); 58Debug.Assert(operation != null); 59Debug.Assert(_currentInterpolatedStringHandlerCreationContext.ApplicableCreationOperation == operation); 63Debug.Assert(_currentInterpolatedStringHandlerArgumentContext != null); 64Debug.Assert(_currentInterpolatedStringHandlerArgumentContext.ApplicableCreationOperations.Contains((IInterpolatedStringHandlerCreationOperation)operation));
Operations\ControlFlowGraphBuilder.RegionBuilder.cs (40)
33Debug.Assert(!isStackSpillRegion || (kind == ControlFlowRegionKind.LocalLifetime && locals.IsDefaultOrEmpty)); 45Debug.Assert((FirstBlock == null) == (LastBlock == null)); 66Debug.Assert(Kind != ControlFlowRegionKind.Root); 78Debug.Assert(Kind != ControlFlowRegionKind.Root); 96Debug.Assert(!IsStackSpillRegion); 97Debug.Assert(Kind != ControlFlowRegionKind.Root); 98Debug.Assert(symbol.MethodKind == MethodKind.LocalFunction); 110Debug.Assert(Kind != ControlFlowRegionKind.Root); 117Debug.Assert(others.All(((IMethodSymbol m, ILocalFunctionOperation _) tuple) => tuple.m.MethodKind == MethodKind.LocalFunction)); 136Debug.Assert(region.Enclosing == null || (region.Enclosing._aboutToFree && region.Enclosing.Enclosing == this)); 146Debug.Assert(Regions.Count <= 2); 147Debug.Assert(lastKind == (Regions.Count < 2 ? ControlFlowRegionKind.Filter : ControlFlowRegionKind.Catch)); 153Debug.Assert(lastKind == ControlFlowRegionKind.Try); 157Debug.Assert(lastKind == ControlFlowRegionKind.Catch || lastKind == ControlFlowRegionKind.FilterAndHandler); 162Debug.Assert(Regions.Count <= 2); 165Debug.Assert(lastKind == ControlFlowRegionKind.Try); 169Debug.Assert(lastKind == ControlFlowRegionKind.Finally); 174Debug.Assert(lastKind != ControlFlowRegionKind.Filter); 175Debug.Assert(lastKind != ControlFlowRegionKind.Catch); 176Debug.Assert(lastKind != ControlFlowRegionKind.Finally); 177Debug.Assert(lastKind != ControlFlowRegionKind.Try); 185Debug.Assert(region.Enclosing == this); 186Debug.Assert(Regions != null); 190Debug.Assert(Regions[0] == region); 203Debug.Assert(toReplace.Enclosing == this); 204Debug.Assert(toReplace.FirstBlock!.Ordinal <= replaceWith.First().FirstBlock!.Ordinal); 205Debug.Assert(toReplace.LastBlock!.Ordinal >= replaceWith.Last().LastBlock!.Ordinal); 206Debug.Assert(Regions != null); 212Debug.Assert(Regions[0] == toReplace); 250Debug.Assert(block != null); 251Debug.Assert((Kind != ControlFlowRegionKind.FilterAndHandler && 258Debug.Assert(LastBlock == null); 268Debug.Assert(FirstBlock != null); 269Debug.Assert(Regions.Count == 1 && Regions.First().LastBlock == block); 273Debug.Assert(LastBlock!.Ordinal < block.Ordinal); 274Debug.Assert(!HasRegions || Regions.Last().LastBlock!.Ordinal <= block.Ordinal); 283Debug.Assert(_aboutToFree); 303Debug.Assert(!_aboutToFree); 305Debug.Assert(!IsEmpty); 377Debug.Assert(block.Region == null);
Operations\ControlFlowRegion.cs (17)
71Debug.Assert(firstBlockOrdinal >= 0); 72Debug.Assert(lastBlockOrdinal >= firstBlockOrdinal); 86Debug.Assert(r.EnclosingRegion == null && r.Kind != ControlFlowRegionKind.Root); 96Debug.Assert(NestedRegions.Length == 2); 97Debug.Assert(NestedRegions[0].Kind == (kind == ControlFlowRegionKind.TryAndFinally ? ControlFlowRegionKind.Try : ControlFlowRegionKind.Filter)); 98Debug.Assert(NestedRegions[1].Kind == (kind == ControlFlowRegionKind.TryAndFinally ? ControlFlowRegionKind.Finally : ControlFlowRegionKind.Catch)); 99Debug.Assert(NestedRegions[0].FirstBlockOrdinal == firstBlockOrdinal); 100Debug.Assert(NestedRegions[1].LastBlockOrdinal == lastBlockOrdinal); 101Debug.Assert(NestedRegions[0].LastBlockOrdinal + 1 == NestedRegions[1].FirstBlockOrdinal); 105Debug.Assert(NestedRegions.Length >= 2); 106Debug.Assert(NestedRegions[0].Kind == ControlFlowRegionKind.Try); 107Debug.Assert(NestedRegions[0].FirstBlockOrdinal == firstBlockOrdinal); 113Debug.Assert(previousLast + 1 == r.FirstBlockOrdinal); 116Debug.Assert(r.Kind == ControlFlowRegionKind.FilterAndHandler || r.Kind == ControlFlowRegionKind.Catch); 119Debug.Assert(previousLast == lastBlockOrdinal); 134Debug.Assert(previousLast < r.FirstBlockOrdinal); 138Debug.Assert(previousLast <= lastBlockOrdinal);
Operations\IOperation.OperationList.cs (1)
126Debug.Assert(_operation != null && _currentSlot >= 0 && _currentIndex >= 0);
Operations\IOperation.OperationList.Reversed.cs (2)
106Debug.Assert(_operation != null && _currentSlot is >= 0 and not int.MaxValue && _currentIndex is >= 0 and not int.MaxValue); 113Debug.Assert((_currentSlot == int.MaxValue) == (_currentIndex == int.MaxValue));
Operations\Loops\ForEachLoopOperationInfo.cs (1)
61Debug.Assert(!collectionIsInlineArrayValue || inlineArrayConversion is { });
Operations\Operation.cs (8)
32Debug.Assert(semanticModel.ContainingPublicModelOrSelf != null); 33Debug.Assert(semanticModel.ContainingPublicModelOrSelf != semanticModel); 34Debug.Assert(semanticModel.ContainingPublicModelOrSelf.ContainingPublicModelOrSelf == semanticModel.ContainingPublicModelOrSelf); 139Debug.Assert(_parentDoNotAccessDirectly == s_unset); 140Debug.Assert(parent != s_unset); 144Debug.Assert(parent == null || ((Operation)parent).OwningSemanticModel == OwningSemanticModel); 178Debug.Assert((object?)child.Parent == parent); 185Debug.Assert(!children.IsDefault);
Operations\OperationExtensions.cs (1)
334Debug.Assert(operation != null);
Operations\OperationMapBuilder.cs (1)
21Debug.Assert(dictionary.Count == 0);
Operations\OperationNodes.cs (4)
91Debug.Assert(children.All(o => o != null)); 652Debug.Assert(value != null); 661Debug.Assert(operand != null); 699Debug.Assert(statements.All(s => s.Parent != this && s.Parent!.Kind is OperationKind.Block or OperationKind.SwitchCase));
PEWriter\CustomDebugInfoWriter.cs (4)
33Debug.Assert(pdbWriter != null); 175Debug.Assert(local.SlotIndex >= 0); 188Debug.Assert(localConstant.SlotIndex < 0); 271Debug.Assert(!ReferenceEquals(_previousMethodBodyWithUsingInfo, methodBody));
PEWriter\ExceptionHandlerRegion.cs (8)
42Debug.Assert(tryStartOffset < tryEndOffset); 43Debug.Assert(tryEndOffset <= handlerStartOffset); 44Debug.Assert(handlerStartOffset < handlerEndOffset); 45Debug.Assert(tryStartOffset >= 0); 46Debug.Assert(tryEndOffset >= 0); 47Debug.Assert(handlerStartOffset >= 0); 48Debug.Assert(handlerEndOffset >= 0); 157Debug.Assert(filterDecisionStartOffset >= 0);
PEWriter\ExtendedPEBuilder.cs (2)
76Debug.Assert(_withMvidSection); 98Debug.Assert(mvidWriter.RemainingBytes == 0);
PEWriter\LocalScope.cs (4)
32Debug.Assert(!locals.Any(l => l.Name == null)); 33Debug.Assert(!constants.Any(c => c.Name == null)); 34Debug.Assert(offset >= 0); 35Debug.Assert(endOffset > offset);
PEWriter\Members.cs (1)
116Debug.Assert((compare & ~(CallingConvention)SignatureCallingConventionMask) == 0);
PEWriter\MetadataVisitor.cs (3)
105Debug.Assert((constant != null) == fieldDefinition.IsCompileTimeConstant); 106Debug.Assert((marshalling != null || !fieldDefinition.MarshallingDescriptor.IsDefaultOrEmpty) == fieldDefinition.IsMarshalledExplicitly); 437Debug.Assert((marshalling != null || !parameterDefinition.MarshallingDescriptor.IsDefaultOrEmpty) == parameterDefinition.IsMarshalledExplicitly);
PEWriter\MetadataWriter.cs (48)
104Debug.Assert(metadata != debugMetadataOpt); 661Debug.Assert(namespaceTypeReference.AsGenericTypeInstanceReference == null); 668Debug.Assert(!_tableIndicesAreComplete); 677Debug.Assert(!_tableIndicesAreComplete); 846Debug.Assert(!_tableIndicesAreComplete); 1130Debug.Assert((methodReference.CallingConvention & CallingConvention.Generic) != 0 == (methodReference.GenericParameterCount > 0)); 1190Debug.Assert(!(signature is IMethodReference)); 1427Debug.Assert(str != null); // No need to handle in an internal utility. 1689Debug.Assert(nativePdbWriterOpt == null ^ portablePdbStreamOpt == null); 1707Debug.Assert(module.SerializationProperties.PersistentIdentifier != default(Guid)); 1718Debug.Assert(typeSystemRowCounts[(int)TableIndex.EncLog] == 0); 1719Debug.Assert(typeSystemRowCounts[(int)TableIndex.EncMap] == 0); 1722Debug.Assert(managedResourceDataBuilder == null); 1723Debug.Assert(mvidFixup.IsDefault); 1724Debug.Assert(mvidStringFixup.IsDefault); 1984Debug.Assert(sourceAssembly != null); 2056Debug.Assert(this.IsFullMetadata); // parentToken is not relative 2094Debug.Assert(this.IsFullMetadata); 2259Debug.Assert(exportedType.ParentIndex != -1); 2431Debug.Assert(propDef.DefaultValue != null); 2559Debug.Assert(resourceDataWriter == null || (resourceDataWriter.Count % ManagedPEBuilder.ManagedResourcesDataAlignment) == 0); 2918Debug.Assert(MetadataOnly); 2947Debug.Assert(!MetadataOnly); 2973Debug.Assert(body != null); 3055Debug.Assert(!_tableIndicesAreComplete); 3235Debug.Assert(pseudoToken <= 0xffffff); 3276Debug.Assert(ReadByte(generatedIL, offset - 1) == (byte)ILOpCode.Ldtoken); 3284Debug.Assert(handle.Kind is HandleKind.MethodDefinition); 3292Debug.Assert(handle.Kind is HandleKind.FieldDefinition); 3331Debug.Assert(guidStringLength == default(Guid).ToString().Length); 3426Debug.Assert(parameterTypeInformation.RefCustomModifiers.Length == 0 || parameterTypeInformation.IsByReference); 3437Debug.Assert(fieldReference.RefCustomModifiers.Length == 0 || fieldReference.IsByReference); 3479Debug.Assert(parameters.Length == arguments.Length); 3535Debug.Assert(this.module.IsPlatformType(targetType, PlatformType.SystemObject)); 3595Debug.Assert(!module.IsPlatformType(c.Type, PlatformType.SystemType) || c.Value == null); 3611Debug.Assert(marshallingInformation.NumberOfElements >= 0); 3650Debug.Assert(marshallingInformation.ElementType >= 0); 3748Debug.Assert(identity.ContentType == AssemblyContentType.Default); 3795Debug.Assert(!signature.ReturnValueIsByRef); 3796Debug.Assert(signature.RefCustomModifiers.IsEmpty); 3803Debug.Assert(signature.RefCustomModifiers.IsEmpty || signature.ReturnValueIsByRef); 4027Debug.Assert(arrayTypeReference.IsSZArray); 4030Debug.Assert(!(elementType is IModifiedTypeReference)); 4061Debug.Assert(typeReference.IsEnum); 4240Debug.Assert(!_writer._tableIndicesAreComplete); 4243Debug.Assert(!this.TryGetValue(item, out i)); 4266Debug.Assert(index.Count == 0); 4293Debug.Assert(index.Count == 0);
PEWriter\MetadataWriter.DynamicAnalysis.cs (3)
159Debug.Assert(previousStartColumn < 0); 182Debug.Assert(deltaLines != 0 || deltaColumns != 0); 230Debug.Assert(name != null);
PEWriter\MetadataWriter.PortablePdb.cs (16)
107Debug.Assert(local.SlotIndex >= 0); 120Debug.Assert(mdConstant != null); 247Debug.Assert(!value.GetType().GetTypeInfo().IsEnum); 336Debug.Assert(import.TargetNamespaceOpt == null); 337Debug.Assert(import.TargetAssemblyOpt == null); 338Debug.Assert(import.TargetTypeOpt == null); 347Debug.Assert(import.TargetNamespaceOpt == null); 348Debug.Assert(import.TargetAssemblyOpt == null); 404Debug.Assert(import.AliasOpt != null); 405Debug.Assert(import.TargetAssemblyOpt == null); 433Debug.Assert(rid == ModuleImportScopeHandle); 580Debug.Assert(asyncInfo.ResumeOffsets.Length == asyncInfo.YieldOffsets.Length); 581Debug.Assert(asyncInfo.CatchHandlerOffset >= -1); 688Debug.Assert(previousNonHiddenStartColumn < 0); 725Debug.Assert(deltaLines != 0 || deltaColumns != 0 || sequencePoint.IsHidden); 762Debug.Assert(result);
PEWriter\ModifiedTypeReference.cs (1)
24Debug.Assert(!customModifiers.IsDefault);
PEWriter\PeWriter.cs (11)
60Debug.Assert(ManagedResourceBlobBuilder == null || ManagedResourceBlobBuilder.Count > 0); 61Debug.Assert(MappedFieldDataBlobBuilder == null || MappedFieldDataBlobBuilder.Count > 0); 94Debug.Assert(nativePdbWriterOpt == null || pdbPathOpt != null); 107Debug.Assert(properties.PersistentIdentifier == default(Guid)); 204Debug.Assert(!isDeterministic || context.Module.PdbChecksumAlgorithm.Name != null); 299Debug.Assert(strongNameProvider != null); 341Debug.Assert(writer.RemainingBytes == 0); 348Debug.Assert(writer.RemainingBytes == 0); 355Debug.Assert(writer.RemainingBytes == 0); 405Debug.Assert(resourceSection != null); 421Debug.Assert(resources.Any());
PEWriter\ReferenceIndexer.cs (3)
74Debug.Assert(!this.typeReferenceNeedsToken); 109Debug.Assert(body != null); 148Debug.Assert(!this.typeReferenceNeedsToken);
PEWriter\ReferenceIndexerBase.cs (5)
47Debug.Assert(!this.typeReferenceNeedsToken); 54Debug.Assert(!this.typeReferenceNeedsToken); 280Debug.Assert(!this.typeReferenceNeedsToken); 321Debug.Assert(!this.typeReferenceNeedsToken); 339Debug.Assert(!this.typeReferenceNeedsToken);
PEWriter\RootModuleType.cs (1)
32Debug.Assert(_methods is null);
PEWriter\TypeNameSerializer.cs (3)
92Debug.Assert(uninstantiatedTypeReference != typeReference); 215Debug.Assert(needsEscaping.All(c => !fileIdentifier.Contains(c))); 268Debug.Assert(@namespace != null);
PEWriter\Units.cs (4)
38Debug.Assert(startLine >= 0); 39Debug.Assert(startColumn >= 0); 40Debug.Assert(endLine >= 0); 41Debug.Assert(endColumn >= 0);
RealParser.cs (6)
229Debug.Assert((DenormalMantissaMask & (1UL << DenormalMantissaBits)) == 0); 231Debug.Assert((shiftedExponent & DenormalMantissaMask) == 0); 232Debug.Assert((mantissa & ~DenormalMantissaMask) == 0); 233Debug.Assert((shiftedExponent & ~(((1UL << this.ExponentBits) - 1) << DenormalMantissaBits)) == 0); // exponent fits in its place 466Debug.Assert(!fractionalNumerator.IsZero); 548Debug.Assert(integerBitsOfPrecision < 60); // we can use BigInteger's built-in conversion
ReferenceManager\AssemblyDataForAssemblyBeingBuilt.cs (3)
32Debug.Assert(identity != null); 33Debug.Assert(!referencedAssemblyData.IsDefault); 89Debug.Assert(assemblies[_referencedAssemblyData[i].Identity.Name].Contains((_referencedAssemblyData[i], i + 1)));
ReferenceManager\AssemblyReferenceBinding.cs (6)
27Debug.Assert(referenceIdentity != null); 39Debug.Assert(referenceIdentity != null); 40Debug.Assert(definitionIndex >= 0); 41Debug.Assert(versionDifference >= -1 && versionDifference <= +1); 78Debug.Assert(IsBound); 91Debug.Assert(IsBound);
ReferenceManager\CommonReferenceManager.Binding.cs (31)
110Debug.Assert(explicitAssemblies[0] is AssemblyDataForAssemblyBeingBuilt); 111Debug.Assert(explicitReferences.Length == explicitReferenceMap.Length); 159Debug.Assert(referenceBindings.Count == allAssemblies.Length); 225Debug.Assert(explicitAssemblies[0] is AssemblyDataForAssemblyBeingBuilt); 226Debug.Assert(referenceBindings.Count == explicitAssemblies.Length); 227Debug.Assert(explicitReferences.Length == explicitReferenceMap.Length); 265Debug.Assert(binding.ReferenceIdentity is object); 320Debug.Assert(lazyAliasMap == null); 360Debug.Assert(binding.ReferenceIdentity is object); 397Debug.Assert(result.Count == 0); 417Debug.Assert(bindingIndex == bindingsOfAssemblyBeingBuilt.Length); 435Debug.Assert(result.Count == explicitModules.Length + totalReferencedAssemblyCount); 559Debug.Assert(resolvedAssembly is object); 580Debug.Assert(assembly is object); 675Debug.Assert(GetCorLibrary(candidateInputAssemblySymbols[j]) == null); 683Debug.Assert(corLibraryIndex != 0); 689Debug.Assert(candidateInputAssemblySymbols[corLibraryIndex] == null); 702Debug.Assert(candidateInputAssemblySymbols[j] != null); 771Debug.Assert(candidate.DefinitionIndex >= 0); 772Debug.Assert(candidate.AssemblySymbol is object); 777Debug.Assert(boundInputs[candidateIndex].AssemblySymbol == null || 810Debug.Assert(candidateInputAssemblySymbols[candidateIndex] == null); 822Debug.Assert(candidateReferenceBinding is object); 823Debug.Assert(candidateReferenceBinding.Length == candidateReferencedSymbols.Count); 912Debug.Assert(corLibraryIndex != 0); 914Debug.Assert(ReferenceEquals(candidateCorLibrary, GetCorLibrary(candidateCorLibrary))); 931Debug.Assert(!assemblies[corLibraryIndex].ContainsNoPiaLocalTypes); 932Debug.Assert(!assemblies[corLibraryIndex].IsLinked); 933Debug.Assert(!IsLinked(candidateCorLibrary)); 948Debug.Assert(boundInputs[k].AssemblySymbol == null); 988Debug.Assert(value.Identity is object);
ReferenceManager\CommonReferenceManager.Resolution.cs (24)
69Debug.Assert(index >= 0); 82Debug.Assert(!aliasesOpt.IsDefault || !recursiveAliasesOpt.IsDefault); 83Debug.Assert(!mergedReferences.IsDefault); 101Debug.Assert(!IsUninitialized); 115Debug.Assert(!IsUninitialized); 124Debug.Assert(!IsUninitialized); 144Debug.Assert(!IsSkipped); 156Debug.Assert(!IsSkipped); 323Debug.Assert(metadata != null || diagnostics.HasAnyErrors()); 336Debug.Assert(assembly is object); 531Debug.Assert(existing is Metadata || existing is Diagnostic); 549Debug.Assert(metadata != null || diagnostics.HasAnyErrors()); 686Debug.Assert(other.Identity is object); 716Debug.Assert(other.Identity is object); 731Debug.Assert(other.Identity is object); 750Debug.Assert(equivalent.Identity.IsStrongName); 771Debug.Assert(!equivalent.Identity.IsStrongName); 785Debug.Assert(equivalent.Reference != null); 804Debug.Assert(referenceDirective.Location is object); 813Debug.Assert(referenceDirective.File is object); 814Debug.Assert(referenceDirective.Location.SourceTree is object); 875Debug.Assert(compilation.Options.MetadataReferenceResolver != null); 963Debug.Assert(reference.Version > definition.Version); 1054Debug.Assert(definitionData.Identity.PublicKeyToken.IsEmpty);
ReferenceManager\CommonReferenceManager.State.cs (47)
197Debug.Assert(simpleAssemblyName != null); 198Debug.Assert(identityComparer != null); 329Debug.Assert(_lazyMergedAssemblyReferencesMap != null); 351Debug.Assert(_isBound == 0); 352Debug.Assert(_lazyHasCircularReference == ThreeState.Unknown); 353Debug.Assert(_lazyReferencedAssembliesMap == null); 354Debug.Assert(_lazyReferencedModuleIndexMap == null); 355Debug.Assert(_lazyReferenceDirectiveMap == null); 356Debug.Assert(_lazyDirectiveReferences.IsDefault); 357Debug.Assert(_lazyImplicitReferenceResolutions == null); 358Debug.Assert(_lazyExplicitReferences.IsDefault); 359Debug.Assert(_lazyReferencedModules.IsDefault); 360Debug.Assert(_lazyReferencedModulesReferences.IsDefault); 361Debug.Assert(_lazyReferencedAssemblies.IsDefault); 362Debug.Assert(_lazyAliasesOfReferencedAssemblies.IsDefault); 363Debug.Assert(_lazyMergedAssemblyReferencesMap == null); 364Debug.Assert(_lazyUnifiedAssemblies.IsDefault); 365Debug.Assert(_lazyCorLibraryOpt == null); 372Debug.Assert(_isBound != 0); 373Debug.Assert(_lazyHasCircularReference != ThreeState.Unknown); 374Debug.Assert(_lazyReferencedAssembliesMap != null); 375Debug.Assert(_lazyReferencedModuleIndexMap != null); 376Debug.Assert(_lazyReferenceDirectiveMap != null); 377Debug.Assert(!_lazyDirectiveReferences.IsDefault); 378Debug.Assert(_lazyImplicitReferenceResolutions != null); 379Debug.Assert(!_lazyExplicitReferences.IsDefault); 380Debug.Assert(!_lazyReferencedModules.IsDefault); 381Debug.Assert(!_lazyReferencedModulesReferences.IsDefault); 382Debug.Assert(!_lazyReferencedAssemblies.IsDefault); 383Debug.Assert(!_lazyAliasesOfReferencedAssemblies.IsDefault); 384Debug.Assert(_lazyMergedAssemblyReferencesMap != null); 385Debug.Assert(!_lazyUnifiedAssemblies.IsDefault); 388Debug.Assert(_lazyReferencedAssemblies.Length == 0 || _lazyCorLibraryOpt != null); 394Debug.Assert(compilation.MakeSourceAssemblySimpleName() == this.SimpleAssemblyName); 427Debug.Assert(referencedModules.Length == referencedModulesReferences.Length); 428Debug.Assert(referencedModules.Length == referencedModulesMap.Count); 429Debug.Assert(referencedAssemblies.Length == aliasesOfReferencedAssemblies.Length); 496Debug.Assert(aliasesOfReferencedAssembliesBuilder.Count == assemblyIndex); 516Debug.Assert(!aliasesOfReferencedAssembliesBuilder.Any(a => a.IsDefault)); 544Debug.Assert(originalIdentities.Length == symbols.Length); 555Debug.Assert(versionPattern.Build == ushort.MaxValue || versionPattern.Revision == ushort.MaxValue); 572Debug.Assert(originalIdentity == symbolIdentity); 590Debug.Assert(versionPattern is null || versionPattern.Build == ushort.MaxValue || versionPattern.Revision == ushort.MaxValue); 622Debug.Assert(bindingResult.Length == aliasesOfReferencedAssembliesBuilder.Count + 1); 630Debug.Assert(reference.Kind == MetadataImageKind.Assembly); 633Debug.Assert(assemblyIndicesToProcess.Count == 0); 647Debug.Assert(referenceBinding is object);
ReferenceManager\ModuleReferences.cs (4)
46Debug.Assert(!identities.IsDefault); 47Debug.Assert(!symbols.IsDefault); 48Debug.Assert(identities.Length == symbols.Length); 49Debug.Assert(!unifiedAssemblies.IsDefault);
ReferenceManager\UnifiedAssembly.cs (2)
29Debug.Assert(originalReference != null); 30Debug.Assert(targetAssembly != null);
RuleSet\RuleSet.cs (2)
146Debug.Assert(effectiveRuleset is object); 301Debug.Assert(resolvedPath != null);
RuleSet\RuleSetProcessor.cs (1)
83Debug.Assert(nodeList[0].Name == RuleSetNodeName);
SignatureComparer.cs (3)
35Debug.Assert(!result || position == signature.Length); 79Debug.Assert(position == signature.Length); 124Debug.Assert(position == signature.Length);
SourceGeneration\AdditionalSourcesCollection.cs (1)
31Debug.Assert(fileExtension.Length > 0 && fileExtension[0] == '.');
SourceGeneration\GeneratorAdaptor.cs (2)
38Debug.Assert(_sourceExtension != DummySourceExtension); 89Debug.Assert(ParseOptions is object && ConfigOptions is object);
SourceGeneration\GeneratorDriver.cs (3)
33Debug.Assert(state.Generators.GroupBy(s => s.GetGeneratorType()).Count() == state.Generators.Length); // ensure we don't have duplicate generator types 343Debug.Assert(false); 356Debug.Assert(outputKind != IncrementalGeneratorOutputKind.None);
SourceGeneration\GeneratorDriverState.cs (2)
37Debug.Assert(Generators.Length == GeneratorStates.Length); 38Debug.Assert(IncrementalGenerators.Length == GeneratorStates.Length);
SourceGeneration\GeneratorSyntaxWalker.cs (2)
25Debug.Assert(model is not null 30Debug.Assert(model.Value.SyntaxTree == child.SyntaxTree);
SourceGeneration\IncrementalGeneratorRunStep.cs (2)
18Debug.Assert(!inputs.IsDefault); 19Debug.Assert(!outputs.IsDefault);
SourceGeneration\Nodes\BatchNode.cs (3)
87Debug.Assert(indexInPrevious == previousItems.Length); 106Debug.Assert(builder.Count == entryCount); 127Debug.Assert(!tableBuilder.TrackIncrementalSteps || (sourceTable.HasTrackedSteps || sourceTable.IsEmpty));
SourceGeneration\Nodes\CombineNode.cs (3)
81Debug.Assert(tableBuilder.Count == totalEntryItemCount); 90Debug.Assert(input1Table.HasTrackedSteps && input2Table.IsCached); 98Debug.Assert(usedCachedEntry);
SourceGeneration\Nodes\GeneratorRunStateTable.cs (4)
41Debug.Assert(RecordingExecutedSteps); 42Debug.Assert(table.HasTrackedSteps); 76Debug.Assert(RecordingExecutedSteps); 95Debug.Assert(step.Name is not null);
SourceGeneration\Nodes\HostOutputNode.cs (1)
70Debug.Assert(context.TableBuilder is not null);
SourceGeneration\Nodes\InputNode.cs (4)
60Debug.Assert(added); 78Debug.Assert(usedCache); 87Debug.Assert(modified); 93Debug.Assert(removed);
SourceGeneration\Nodes\NodeStateTable.cs (16)
70Debug.Assert(!hasTrackedSteps || steps.Length == states.Length); 172Debug.Assert(compacted.Count == nonRemovedCount); 180Debug.Assert((_states.Length == 1 || _states.Length == 2 && _states[0].IsRemovedDueToInputRemoval) && _states[^1].Count == 1); 189Debug.Assert(inputTable.HasTrackedSteps && inputTable.IsCached); 195Debug.Assert(usedCachedEntry); 305Debug.Assert(previousEntries.IsCached); 338Debug.Assert(previousEntry.Count == 1); 478Debug.Assert(stepInputs.IsDefault == !TrackIncrementalSteps); 482Debug.Assert(_steps.Count + 1 == _states.Count); 521Debug.Assert(!TrackIncrementalSteps || _states.Count == _steps.Count); 533Debug.Assert(_requestedTableCapacity == null || _states.Count <= _requestedTableCapacity); 598Debug.Assert(!states.IsDefault); 599Debug.Assert(states.Length == 1 || states.Distinct().Length > 1); 651Debug.Assert(itemBuilder.Count < this.Count); 765Debug.Assert(_items.Count == _requestedCapacity); 766Debug.Assert(_states == null || _states.Count == _requestedCapacity);
SourceGeneration\Nodes\PredicateSyntaxStrategy.cs (1)
80Debug.Assert(model is object);
SourceGeneration\Nodes\SourceOutputNode.cs (2)
33Debug.Assert(outputKind == IncrementalGeneratorOutputKind.Source || outputKind == IncrementalGeneratorOutputKind.Implementation); 101Debug.Assert(context.TableBuilder is not null);
SourceGeneration\Nodes\SyntaxReceiverStrategy.cs (1)
75Debug.Assert(model is not null);
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithMetadataName.cs (1)
97Debug.Assert(syntaxNodes.All(n => n.SyntaxTree == syntaxTree));
SourceGeneration\Nodes\SyntaxValueProvider_ForAttributeWithSimpleName.cs (2)
116Debug.Assert(compilationUnit is ICompilationUnitSyntax); 160Debug.Assert(compilationUnit is ICompilationUnitSyntax);
SourceGeneration\RunResults.cs (1)
91Debug.Assert(exception is null || (generatedSources.IsEmpty && diagnostics.Length == 1));
SourceGeneration\SyntaxStore.cs (2)
51Debug.Assert(_syntaxInputNodes.Contains(syntaxInputNode)); 130Debug.Assert(_tableBuilder.Contains(node));
SpecialTypeExtensions.cs (1)
373Debug.Assert(value.GetType().IsPrimitive);
SpecialTypes.cs (1)
95Debug.Assert(name.IndexOf('+') < 0); // Compilers aren't prepared to lookup for a nested special type.
src\Compilers\Core\AnalyzerDriver\DeclarationComputer.cs (1)
61Debug.Assert(assemblyScopedNamespaceSymbol.ConstituentNamespaces.Length == 1);
src\Compilers\Core\AnalyzerDriver\DeclarationInfo.cs (2)
17Debug.Assert(declaredNode != null); 18Debug.Assert(!executableCodeBlocks.IsDefault);
src\Dependencies\CodeAnalysis.Debugging\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));
src\Dependencies\CodeAnalysis.Debugging\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\CodeAnalysis.Debugging\StateMachineHoistedLocalScope.cs (2)
26Debug.Assert(startOffset >= 0); 27Debug.Assert(endOffset > startOffset || startOffset == 0 && endOffset == 0);
src\Dependencies\CodeAnalysis.Debugging\TupleElementNamesInfo.cs (1)
22Debug.Assert(!elementNames.IsDefault);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (1)
648Debug.Assert(data.All(d => d.Count() == count));
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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);
StrongName\DesktopStrongNameProvider.cs (3)
81Debug.Assert(PathUtilities.IsAbsolute(resolvedKeyFile)); 134Debug.Assert(combinedPath == null || PathUtilities.IsAbsolute(combinedPath)); 164Debug.Assert(string.IsNullOrEmpty(keys.KeyFilePath) != string.IsNullOrEmpty(keys.KeyContainer));
StrongName\StrongNameFileSystem.cs (2)
33Debug.Assert(PathUtilities.IsAbsolute(fullPath)); 39Debug.Assert(fullPath == null || PathUtilities.IsAbsolute(fullPath));
StrongName\StrongNameKeys.cs (5)
71Debug.Assert(diagnostic != null); 77Debug.Assert(keyContainerName == null || keyPair.IsDefault); 78Debug.Assert(keyPair.IsDefault || keyFilePath != null); 90Debug.Assert(!publicKey.IsDefaultOrEmpty); 212Debug.Assert(keyFilePath is object);
SwitchConstantValueHelper.cs (1)
89Debug.Assert(second.IsString);
SymbolDisplay\AbstractSymbolDisplayVisitor.cs (9)
77Debug.Assert(format != null); 135Debug.Assert(constantValue != null); 154Debug.Assert(enumType.EnumUnderlyingType is not null); 183Debug.Assert(typeSymbol != null); 236Debug.Assert(enumType.EnumUnderlyingType is not null); 300Debug.Assert(zeroField.IdentityOpt is not null); 315Debug.Assert(enumType.EnumUnderlyingType is not null); 335Debug.Assert(enumType.EnumUnderlyingType is not null); 346Debug.Assert(match.IdentityOpt is not null);
SymbolDisplay\AbstractSymbolDisplayVisitor_Minimal.cs (1)
23Debug.Assert(IsMinimizing);
SymbolDisplay\FormattedSymbol.cs (1)
27Debug.Assert(symbol != null && symbolDisplayFormat != null);
SymbolDisplay\FormattedSymbolList.cs (1)
23Debug.Assert(symbols != null);
Symbols\Attributes\AttributeDescription.cs (1)
48Debug.Assert(signature[0] == (byte)SignatureAttributes.Instance);
Symbols\Attributes\CommonAssemblyWellKnownAttributeData.cs (3)
460Debug.Assert(value != null); 461Debug.Assert(!value.IsUninitialized); 462Debug.Assert(value.Kind == ObsoleteAttributeKind.Experimental);
Symbols\Attributes\CommonAttributeData.cs (22)
67Debug.Assert(AttributeClass is not null); 203Debug.Assert(AttributeConstructor is object); 207Debug.Assert(parameters.Length == 5); 208Debug.Assert(parameters[0].Type.SpecialType == SpecialType.System_Byte); 209Debug.Assert(parameters[1].Type.SpecialType == SpecialType.System_Byte); 218Debug.Assert(parameters[2].Type.SpecialType == SpecialType.System_Int32); 219Debug.Assert(parameters[3].Type.SpecialType == SpecialType.System_Int32); 220Debug.Assert(parameters[4].Type.SpecialType == SpecialType.System_Int32); 228Debug.Assert(parameters[2].Type.SpecialType == SpecialType.System_UInt32); 229Debug.Assert(parameters[3].Type.SpecialType == SpecialType.System_UInt32); 230Debug.Assert(parameters[4].Type.SpecialType == SpecialType.System_UInt32); 275Debug.Assert(this.CommonConstructorArguments.Length == 1); 323Debug.Assert(args.Length <= 2); 328Debug.Assert(args[1].ValueInternal is object); 381Debug.Assert(args[1].ValueInternal is object); 395Debug.Assert(this.CommonConstructorArguments.Length == 0); 406Debug.Assert(arguments.AttributeSyntaxOpt is object); 412Debug.Assert(attribute.AttributeConstructor is object); 443Debug.Assert(attribute.AttributeClass is object); 467Debug.Assert(arguments.AttributeSyntaxOpt is object); 470Debug.Assert(attribute.AttributeClass is object); 578Debug.Assert(positionalArg.ValueInternal is object);
Symbols\Attributes\CommonAttributeDataComparer.cs (3)
27Debug.Assert(attr1 != null); 28Debug.Assert(attr2 != null); 40Debug.Assert(attr != null);
Symbols\Attributes\CommonEventEarlyWellKnownAttributeData.cs (2)
32Debug.Assert(value != null); 33Debug.Assert(!value.IsUninitialized);
Symbols\Attributes\CommonFieldEarlyWellKnownAttributeData.cs (2)
32Debug.Assert(value != null); 33Debug.Assert(!value.IsUninitialized);
Symbols\Attributes\CommonFieldWellKnownAttributeData.cs (2)
29Debug.Assert(offset >= 0); 56Debug.Assert(_constValue == ConstantValue.Unset);
Symbols\Attributes\CommonMethodEarlyWellKnownAttributeData.cs (2)
48Debug.Assert(value != null); 49Debug.Assert(!value.IsUninitialized);
Symbols\Attributes\CommonMethodWellKnownAttributeData.cs (3)
49Debug.Assert(attributeIndex >= 0); 58Debug.Assert(attributeIndex >= 0); 68Debug.Assert(attributeIndex >= 0);
Symbols\Attributes\CommonModuleWellKnownAttributeData.cs (5)
45Debug.Assert(HasDefaultCharSetAttribute); 51Debug.Assert(IsValidCharSet(value)); 80Debug.Assert(value != null); 81Debug.Assert(!value.IsUninitialized); 82Debug.Assert(value.Kind == ObsoleteAttributeKind.Experimental);
Symbols\Attributes\CommonParameterEarlyWellKnownAttributeData.cs (1)
28Debug.Assert(_defaultParameterValue == ConstantValue.Unset);
Symbols\Attributes\CommonPropertyEarlyWellKnownAttributeData.cs (2)
28Debug.Assert(value != null); 29Debug.Assert(!value.IsUninitialized);
Symbols\Attributes\CommonTypeEarlyWellKnownAttributeData.cs (4)
28Debug.Assert(_attributeUsageInfo.IsNull); 29Debug.Assert(!value.IsNull); 86Debug.Assert(value != null); 87Debug.Assert(!value.IsUninitialized);
Symbols\Attributes\CommonTypeWellKnownAttributeData.cs (4)
162Debug.Assert(value != null); 178Debug.Assert(charSet == CharSet.Ansi || charSet == CharSet.Unicode || charSet == Cci.Constants.CharSet_Auto); 199Debug.Assert(HasStructLayoutAttribute); 209Debug.Assert(HasStructLayoutAttribute);
Symbols\Attributes\CustomAttributesBag.cs (7)
72Debug.Assert(!IsPartComplete(CustomAttributeBagCompletionPart.DecodedWellKnownAttributeData) || IsPartComplete(CustomAttributeBagCompletionPart.EarlyDecodedWellKnownAttributeData)); 87Debug.Assert(IsPartComplete(CustomAttributeBagCompletionPart.EarlyDecodedWellKnownAttributeData)); 100Debug.Assert(!newCustomAttributes.IsDefault); 114Debug.Assert(IsPartComplete(CustomAttributeBagCompletionPart.Attributes)); 115Debug.Assert(!_customAttributes.IsDefault); 128Debug.Assert(IsPartComplete(CustomAttributeBagCompletionPart.DecodedWellKnownAttributeData)); 141Debug.Assert(IsPartComplete(CustomAttributeBagCompletionPart.EarlyDecodedWellKnownAttributeData));
Symbols\Attributes\DecodeWellKnownAttributeArguments.cs (1)
65Debug.Assert(this.HasDecodedData);
Symbols\Attributes\EarlyDecodeWellKnownAttributeArguments.cs (1)
69Debug.Assert(this.HasDecodedData);
Symbols\Attributes\MarshalAsAttributeDecoder.cs (6)
22Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 116Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 176Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 209Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 298Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 368Debug.Assert((object)arguments.AttributeSyntaxOpt != null);
Symbols\Attributes\MarshalPseudoCustomAttributeData.cs (17)
47Debug.Assert(parameterIndex == null || parameterIndex >= 0 && parameterIndex <= MaxMarshalInteger); 55Debug.Assert(elementCount == null || elementCount >= 0 && elementCount <= MaxMarshalInteger); 56Debug.Assert(parameterIndex == null || parameterIndex >= 0); 66Debug.Assert(elementCount == null || elementCount >= 0 && elementCount <= MaxMarshalInteger); 67Debug.Assert(elementType == null || elementType >= 0 && (int)elementType <= MaxMarshalInteger); 76Debug.Assert(elementType == null || elementType >= 0 && (int)elementType <= MaxMarshalInteger); 85Debug.Assert(elementCount >= 0 && elementCount <= MaxMarshalInteger); 93Debug.Assert(type >= 0 && (int)type <= MaxMarshalInteger); 108Debug.Assert( 119Debug.Assert(_marshalType == Cci.Constants.UnmanagedType_CustomMarshaler); 127Debug.Assert(_marshalTypeNameOrSymbol == null || _marshalTypeNameOrSymbol is string); 136Debug.Assert(_marshalType == Cci.Constants.UnmanagedType_CustomMarshaler); 145Debug.Assert(_marshalType == UnmanagedType.ByValTStr || _marshalType == UnmanagedType.LPArray || _marshalType == Cci.Constants.UnmanagedType_SafeArray || _marshalType == UnmanagedType.ByValArray); 154Debug.Assert(_marshalType == UnmanagedType.LPArray && _marshalParameterIndex <= short.MaxValue); 163Debug.Assert(_marshalType == UnmanagedType.LPArray || _marshalType == UnmanagedType.ByValArray); 172Debug.Assert(_marshalType == Cci.Constants.UnmanagedType_SafeArray); 179Debug.Assert(_marshalType == Cci.Constants.UnmanagedType_SafeArray);
Symbols\Attributes\SecurityWellKnownAttributeData.cs (10)
32Debug.Assert(attributeIndex >= 0 && attributeIndex < totalSourceAttributes); 33Debug.Assert(action != 0); 40Debug.Assert(_lazySecurityActions.Length == totalSourceAttributes); 46Debug.Assert(attributeIndex >= 0 && attributeIndex < totalSourceAttributes); 47Debug.Assert(resolvedFilePath != null); 54Debug.Assert(_lazyPathsForPermissionSetFixup.Length == totalSourceAttributes); 64Debug.Assert(!customAttributes.IsDefault); 65Debug.Assert(_lazyPathsForPermissionSetFixup == null || _lazySecurityActions != null && _lazyPathsForPermissionSetFixup.Length == _lazySecurityActions.Length); 69Debug.Assert(_lazySecurityActions != null); 70Debug.Assert(_lazySecurityActions.Length == customAttributes.Length);
Symbols\Attributes\WellKnownAttributeData.cs (4)
44Debug.Assert(_isSealed == expected); 52Debug.Assert(_anyDataStored == expected); 70Debug.Assert(!data._isSealed); 71Debug.Assert(data._anyDataStored);
Symbols\INamedTypeSymbolInternal.cs (1)
38Debug.Assert(type.EnumUnderlyingType is not null);
Symbols\ISymbolExtensions.cs (2)
26Debug.Assert(reducedFrom is object); 40Debug.Assert(typeParameter.ReducedFrom is object);
Symbols\ITypeSymbol.cs (1)
226Debug.Assert(IsNullableType(type));
Symbols\SymbolKind.cs (1)
132Debug.Assert(!EnumUtilities.ContainsValue(FunctionType));
Symbols\TypedConstant.cs (3)
25Debug.Assert(kind == TypedConstantKind.Array || !(value is ImmutableArray<TypedConstant>)); 26Debug.Assert(!(value is ISymbol) || value is ISymbolInternal); 27Debug.Assert(type is object || kind == TypedConstantKind.Error);
Symbols\TypedConstantValue.cs (2)
25Debug.Assert(value == null || value is string || value.GetType().GetTypeInfo().IsEnum || (value.GetType().GetTypeInfo().IsPrimitive && !(value is System.IntPtr) && !(value is System.UIntPtr)) || value is ITypeSymbol); 57Debug.Assert(!(_value is ImmutableArray<TypedConstant>));
Symbols\TypeKind.cs (1)
107Debug.Assert(!EnumUtilities.ContainsValue(FunctionType));
Symbols\TypeLayout.cs (2)
23Debug.Assert(size >= 0 && (int)kind >= 0 && (int)kind <= 3); 26Debug.Assert(LayoutKind.Sequential == 0);
Syntax\AbstractWarningStateMap.cs (1)
56Debug.Assert(_warningStateMapEntries != null && _warningStateMapEntries.Length > 0);
Syntax\ChildSyntaxList.cs (5)
140Debug.Assert(idx >= 0); 225Debug.Assert(node.FullSpan.Contains(targetPosition)); 231Debug.Assert(!green.IsList); 311Debug.Assert(idx >= 0); 409Debug.Assert(_node is object);
Syntax\ChildSyntaxList.Enumerator.cs (2)
50Debug.Assert(_node != null); 63Debug.Assert(_node is object);
Syntax\ChildSyntaxList.Reversed.cs (2)
30Debug.Assert(_node is object); 93Debug.Assert(_node is object);
Syntax\CommonSyntaxNodeRemover.cs (1)
36Debug.Assert(node is object);
Syntax\GreenNode.cs (7)
160Debug.Assert(value <= byte.MaxValue); 224Debug.Assert(0 <= offset && offset < FullWidth); 230Debug.Assert(i < SlotCount); 980Debug.Assert(this.IsCacheable); 998Debug.Assert(this.IsCacheable); 1008Debug.Assert(this.IsCacheable); 1019Debug.Assert(this.IsCacheable);
Syntax\GreenNode.NodeEnumerable.cs (1)
43Debug.Assert(_started);
Syntax\GreenNode.NodeFlagsAndSlotCount.cs (2)
44Debug.Assert(shifted <= SlotCountTooLarge); 67Debug.Assert((ushort)value <= NodeFlagsMask);
Syntax\InternalSyntax\SyntaxList.cs (1)
77Debug.Assert(node is object);
Syntax\InternalSyntax\SyntaxList.WithLotsOfChildren.cs (1)
44Debug.Assert(offset >= 0 && offset < FullWidth);
Syntax\InternalSyntax\SyntaxList`1.cs (3)
41Debug.Assert(index >= 0); 42Debug.Assert(index <= _node.SlotCount); 73Debug.Assert(index == 0);
Syntax\InternalSyntax\SyntaxListBuilder.cs (2)
94Debug.Assert(_nodes[i].Value != null); 145Debug.Assert(newSize >= requiredSize);
Syntax\InternalSyntax\SyntaxListBuilder`1.cs (1)
50Debug.Assert(result != null);
Syntax\InternalSyntax\SyntaxListPool.cs (2)
40Debug.Assert(!_allocated.Contains(item)); 72Debug.Assert(_allocated.Contains(item));
Syntax\InternalSyntax\SyntaxNodeCache.cs (1)
137Debug.Assert(node.GetCacheHash() == hash);
Syntax\LineDirectiveMap.cs (5)
41Debug.Assert(directives != null); 160Debug.Assert(entries[i].CompareTo(entries[i + 1]) < 0); 174Debug.Assert(Entries.Length > 1); 179Debug.Assert( 190Debug.Assert(unmappedEndLine >= current.UnmappedLine - 1);
Syntax\LineDirectiveMap.LineMappingEntry.cs (1)
94Debug.Assert(state != PositionState.RemappedSpan);
Syntax\SeparatedSyntaxList.cs (3)
154Debug.Assert(green.IsToken); 443Debug.Assert(node is object); 456Debug.Assert(tr.UnderlyingNode is object);
Syntax\SeparatedSyntaxListBuilder.cs (1)
78Debug.Assert(separatorToken.Node is object);
Syntax\SyntaxDiffer.cs (13)
197System.Diagnostics.Debug.Assert(count >= 0); 445Debug.Assert(tr.UnderlyingNode is object); 451Debug.Assert(tr.UnderlyingNode is object); 457Debug.Assert(tr.UnderlyingNode is object); 466Debug.Assert(tr.UnderlyingNode is object); 477Debug.Assert(n1.UnderlyingNode is object); 488Debug.Assert(n2.UnderlyingNode is object); 588Debug.Assert(change.Range.Span.Start >= last.Range.Span.End); 611Debug.Assert(textChangeRange.Span.Start >= last.Range.Span.End); 644Debug.Assert(start >= 0); 645Debug.Assert(end >= 0); 669Debug.Assert(start >= 0); 670Debug.Assert(end >= 0);
Syntax\SyntaxList`1.cs (2)
151Debug.Assert(index == 0); 406Debug.Assert(_node == null || Count != 0);
Syntax\SyntaxListBuilder.cs (1)
144Debug.Assert(list.Node is object);
Syntax\SyntaxNavigator.cs (10)
123Debug.Assert(child.IsNode); 170Debug.Assert(child.IsNode); 190Debug.Assert(stepInto != null); 211Debug.Assert(stepInto != null); 454Debug.Assert(child.IsNode); 504Debug.Assert(child.IsNode); 532Debug.Assert(searchInsideCurrentTokenTrailingTrivia == false || stepInto != null); 562Debug.Assert(child.IsNode); 586Debug.Assert(searchInsideCurrentTokenLeadingTrivia == false || stepInto != null); 616Debug.Assert(child.IsNode);
Syntax\SyntaxNode.cs (6)
108Debug.Assert(width >= 0); 214Debug.Assert(this.IsList); 234Debug.Assert(this.IsList); 1469Debug.Assert(Eof.EndPosition == position); 1486Debug.Assert(curNode.RawKind != 0); 1487Debug.Assert(curNode.FullSpan.Contains(position));
Syntax\SyntaxNode.Iterators.cs (19)
71Debug.Assert(_stack is object); 86Debug.Assert(_stack is object); 102Debug.Assert(_stack is object); 218Debug.Assert(_discriminatorStack is object); 229Debug.Assert(_discriminatorStack is object); 241Debug.Assert(_discriminatorStack is object); 250Debug.Assert(_discriminatorStack is object); 258Debug.Assert(_discriminatorStack is object); 265Debug.Assert(_discriminatorStack is object); 313Debug.Assert(_discriminatorStack is object); 324Debug.Assert(_discriminatorStack is object); 336Debug.Assert(_discriminatorStack is object); 343Debug.Assert(_discriminatorStack is object); 344Debug.Assert(_tokenStack is object); 353Debug.Assert(_discriminatorStack is object); 361Debug.Assert(_discriminatorStack is object); 368Debug.Assert(_discriminatorStack is object); 375Debug.Assert(_discriminatorStack is object); 376Debug.Assert(_tokenStack is object);
Syntax\SyntaxNodeExtensions_Tracking.cs (3)
161Debug.Assert(node is object); 186Debug.Assert(node is object); 206Debug.Assert(node is object);
Syntax\SyntaxNodeOrToken.cs (2)
137Debug.Assert(UnderlyingNode is not null); 703Debug.Assert(
Syntax\SyntaxNodeOrTokenList.cs (1)
43Debug.Assert(node != null || index == 0);
Syntax\SyntaxToken.cs (1)
84Debug.Assert(Node is object);
Syntax\SyntaxTokenList.cs (7)
31Debug.Assert(tokenOrList != null || (position == 0 && index == 0 && parent == null)); 32Debug.Assert(position >= 0); 33Debug.Assert(tokenOrList == null || (tokenOrList.IsToken) || (tokenOrList.IsList)); 103Debug.Assert(token.Node is object); 258Debug.Assert(this.Count >= offset + count); 271Debug.Assert(Node is object); 280Debug.Assert(node.IsList || (i == 0 && !node.IsList));
Syntax\SyntaxTokenList.Enumerator.cs (2)
95Debug.Assert(_singleNodeOrList is object); 97Debug.Assert(_current is object);
Syntax\SyntaxTokenList.Reversed.cs (2)
111Debug.Assert(_singleNodeOrList is object); 113Debug.Assert(_current is object);
Syntax\SyntaxTokenListBuilder.cs (6)
36Debug.Assert(item.Node is object); 98Debug.Assert(_nodes[0] is object); 99Debug.Assert(_nodes[1] is object); 102Debug.Assert(_nodes[0] is object); 103Debug.Assert(_nodes[1] is object); 104Debug.Assert(_nodes[2] is object);
Syntax\SyntaxTree.cs (2)
380Debug.Assert(!_lazyChecksum.IsDefault); 381Debug.Assert(_lazyHashAlgorithm != default(SourceHashAlgorithm));
Syntax\SyntaxTrivia.cs (2)
34Debug.Assert(this.RawKind != 0 || this.Equals(default(SyntaxTrivia))); 64Debug.Assert(node is object);
Syntax\SyntaxTriviaList.cs (2)
453Debug.Assert(Node is object); 459Debug.Assert(node.IsList || (i == 0 && !node.IsList));
Syntax\SyntaxTriviaList.Enumerator.cs (5)
57Debug.Assert(token.Node is object); 59Debug.Assert(node is object); 68Debug.Assert(token.Node is object); 83Debug.Assert(trailingGreen is object); 104Debug.Assert(_singleNodeOrList is object);
Syntax\SyntaxTriviaList.Reversed.cs (2)
108Debug.Assert(_singleNodeOrList is object); 112Debug.Assert(_current is object);
Syntax\TranslationSyntaxReference.cs (1)
37Debug.Assert(node.SyntaxTree == _reference.SyntaxTree);
Text\ChangedText.cs (4)
23Debug.Assert(newText is CompositeText || newText is SubText || newText is StringText || newText is LargeText); 25Debug.Assert(oldText != newText); 26Debug.Assert(!changeRanges.IsDefault); 254Debug.Assert(changeSets.Count > 1);
Text\CompositeText.cs (10)
31Debug.Assert(!segments.IsDefaultOrEmpty); 32Debug.Assert(segments.Length > 0); 44Debug.Assert(_segments[i].Length > 0); 441Debug.Assert(compositeText.Segments.Length > 0); 452Debug.Assert(segment.Length > 0); 455Debug.Assert(i == compositeText.Segments.Length - 1 || segment[^1] != '\r' || compositeText.Segments[i + 1][0] != '\n'); 497Debug.Assert(firstSegmentIndexInclusive <= lastSegmentIndexInclusive); 514Debug.Assert((nextSegment.Lines.Count == 1) || 525Debug.Assert(lastSegment.Lines.Count >= 1); 533Debug.Assert(resultLine.ToString().All(static c => !TextUtilities.IsAnyLineBreakCharacter(c)));
Text\LargeText.cs (1)
66Debug.Assert(longLength > 0 && longLength <= int.MaxValue); // GetMaxCharCountOrThrowIfHuge should have thrown.
Text\SourceText.cs (7)
68Debug.Assert(embeddedTextBlob.IsDefault || !checksum.IsDefault); 488Debug.Assert(0 <= span.Start && span.Start <= span.End); 633Debug.Assert(charBuffer.Length == CharBufferSize); 1187Debug.Assert(buffer1.Length == buffer2.Length); 1188Debug.Assert(buffer1.Length == CharBufferSize); 1221Debug.Assert(length <= source.Length); 1291Debug.Assert(stream.CanSeek);
Text\SourceTextStream.cs (1)
33Debug.Assert(source.Encoding != null || useDefaultEncodingIfNull);
Text\SubText.cs (3)
123Debug.Assert(_subText.UnderlyingText[underlyingSpanStart - 1] == '\r' && _subText.UnderlyingText[underlyingSpanStart] == '\n'); 131Debug.Assert(_subText.UnderlyingText[underlyingSpanEnd - 1] == '\r' && _subText.UnderlyingText[underlyingSpanEnd] == '\n'); 192Debug.Assert(resultLine.ToString().All(static c => !TextUtilities.IsAnyLineBreakCharacter(c)));
Text\TextChange.cs (1)
91Debug.Assert(change.NewText is object);
Text\TextChangeRangeExtensions.cs (1)
232Debug.Assert(newChange.SpanStart == oldChange.Span.Start + oldDelta);
Text\TextLine.cs (2)
90Debug.Assert(span.Start == 0 || TextUtilities.IsAnyLineBreakCharacter(text[span.Start - 1])); 91Debug.Assert(span.End == text.Length || TextUtilities.IsAnyLineBreakCharacter(text[span.End - 1]));
VersionHelper.cs (2)
55Debug.Assert(!allowWildcard || maxValue < ushort.MaxValue); 188Debug.Assert(revision < ushort.MaxValue);
WellKnownMembers.cs (1)
5833Debug.Assert(!descriptor.IsSpecialTypeMember); // Members of types from core library should be in the SpecialMember set instead.
WellKnownTypes.cs (5)
776Debug.Assert(typeId != WellKnownType.ExtSentinel); 782Debug.Assert(typeId != WellKnownType.ExtSentinel); 805Debug.Assert(WellKnownType.First != 0); 812Debug.Assert(invokeArgumentCount >= 0); 821Debug.Assert(invokeArgumentCount >= 0);
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);
XmlFileResolver.cs (2)
59Debug.Assert(resolvedPath == null || PathUtilities.IsAbsolute(resolvedPath)); 69Debug.Assert(resolvedPath == null || PathUtilities.IsAbsolute(resolvedPath));
Microsoft.CodeAnalysis.Analyzers (505)
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)
694Debug.Assert(diagnostic.Id is DiagnosticIds.DefineDiagnosticTitleCorrectlyRuleId or 964Debug.Assert(IsMultiSentences(s)); 974Debug.Assert(EndsWithPeriod(s)); 983Debug.Assert(ContainsLineReturn(s)); 1024Debug.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\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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\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)
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 517Debug.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) || 507Debug.Assert(parameterIndex >= 0); 508Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
48Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
42Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
36Debug.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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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\RoslynParallel.NetFramework.cs (7)
115Debug.Assert(source != null); 116Debug.Assert(scheduler != null); 117Debug.Assert(body != null); 280Debug.Assert(source != null); 281Debug.Assert(scheduler != null); 282Debug.Assert(body != null); 544Debug.Assert(!Cancellation.IsCancellationRequested);
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)
330Debug.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)
341Debug.Assert(desiredGroupIndex >= 0); 342Debug.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 (869)
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\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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\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)
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 517Debug.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) || 507Debug.Assert(parameterIndex >= 0); 508Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
48Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
42Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
36Debug.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)); 99Debug.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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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\RoslynParallel.NetFramework.cs (7)
115Debug.Assert(source != null); 116Debug.Assert(scheduler != null); 117Debug.Assert(body != null); 280Debug.Assert(source != null); 281Debug.Assert(scheduler != null); 282Debug.Assert(body != null); 544Debug.Assert(!Cancellation.IsCancellationRequested);
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)
330Debug.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 (491)
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\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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\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)
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 517Debug.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) || 507Debug.Assert(parameterIndex >= 0); 508Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
48Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
42Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
36Debug.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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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\RoslynParallel.NetFramework.cs (7)
115Debug.Assert(source != null); 116Debug.Assert(scheduler != null); 117Debug.Assert(body != null); 280Debug.Assert(source != null); 281Debug.Assert(scheduler != null); 282Debug.Assert(body != null); 544Debug.Assert(!Cancellation.IsCancellationRequested);
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)
330Debug.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)
341Debug.Assert(desiredGroupIndex >= 0); 342Debug.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 (498)
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)
70Debug.Assert(customTags.Length == tags.Length); 74Debug.Assert(customTags[i] == tags[i]); 80Debug.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\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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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\RoslynParallel.NetFramework.cs (7)
115Debug.Assert(source != null); 116Debug.Assert(scheduler != null); 117Debug.Assert(body != null); 280Debug.Assert(source != null); 281Debug.Assert(scheduler != null); 282Debug.Assert(body != null); 544Debug.Assert(!Cancellation.IsCancellationRequested);
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)
330Debug.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 (18)
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\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 (6)
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); 726Debug.Assert(removeAssignments);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
341Debug.Assert(desiredGroupIndex >= 0); 342Debug.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 (2)
49Debug.Assert(diagnostic != null); 103Debug.Assert(analyzerConfigPath != null);
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 (7029)
Binder\Binder.CapturedParametersFinder.cs (2)
58Debug.Assert(syntaxNode is not null); 165Debug.Assert(lookupResult.SingleSymbolOrDefault == (object)parameter);
Binder\Binder.cs (2)
93Debug.Assert(Next is not null); 773Debug.Assert(syntax.GetLocation() != null);
Binder\Binder.IdentifierUsedAsValueFinder.cs (7)
123Debug.Assert(targetNode.Parent is not null); 196Debug.Assert(_lookupResult?.IsClear != false); 259Debug.Assert(!type.IsDynamic()); 260Debug.Assert(lookupResult.IsClear); 269Debug.Assert(lookupResult.Symbols.Any()); 277Debug.Assert(members.Count > 0); 290Debug.Assert(symbol.Kind != SymbolKind.Method);
Binder\Binder.NamespaceOrTypeOrAliasSymbolWithAnnotations.cs (3)
22Debug.Assert(typeWithAnnotations.HasType); 30Debug.Assert(!(symbol is TypeSymbol)); 47Debug.Assert(_symbol?.Kind == SymbolKind.Alias); // Not meaningful to use this property otherwise
Binder\Binder.QueryTranslationState.cs (2)
78Debug.Assert(identifier.Parent is { }); 126Debug.Assert(nextInvokedMethodName is null);
Binder\Binder.ValueChecks.cs (77)
146Debug.Assert(parameter.RefKind.IsWritableReference() && parameter.Type.IsRefLikeOrAllowsRefLikeType()); 147Debug.Assert(GetParameterValEscapeLevel(parameter).HasValue); 188Debug.Assert(!isArgList || parameter is null); 446Debug.Assert(parameters.Length == indexerAccess.Indexer.Parameters.Length); 526Debug.Assert(expr.Syntax.Kind() != SyntaxKind.Argument || valueKind == BindValueKind.RefOrOut); 531Debug.Assert(valueKind == BindValueKind.RefOrOut); 619Debug.Assert(!resolution.IsNonMethodExtensionMember(out _)); 638Debug.Assert(methodGroup.ResultKind != LookupResultKind.Viable); 702Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 873Debug.Assert(!RequiresRefAssignableVariable(valueKind)); 1137Debug.Assert(!RequiresAssignableVariable(BindValueKind.AddressOf)); 1156Debug.Assert(parameterSymbol.RefKind != RefKind.None || !RequiresRefAssignableVariable(valueKind)); 1164Debug.Assert(backingField.RefKind == RefKind.None); 1165Debug.Assert(!RequiresRefAssignableVariable(valueKind)); 1169Debug.Assert(backingField.RefKind == RefKind.None); 1202Debug.Assert(valueKind != BindValueKind.AddressOf); // If this assert fails, we probably should report ErrorCode.ERR_InvalidAddrOp 1306Debug.Assert(parameterSymbol.RefKind == RefKind.None || isRefScoped || refSafeToEscape.IsReturnOnly); 1388Debug.Assert(valueKind == BindValueKind.RefAssignable); 1399Debug.Assert(fieldAccess.ReceiverOpt is null or BoundTypeExpression); 1404Debug.Assert(fieldAccess.ReceiverOpt is not null); 1538Debug.Assert(fieldAccess.ReceiverOpt is { }); 1594Debug.Assert(!RequiresVariableReceiver(receiver, eventSymbol)); 1641Debug.Assert(receiver != null); 1721Debug.Assert((object)propertySymbol != null); 1722Debug.Assert(propertySyntax != null); 1734Debug.Assert(propertySymbol.TypeWithAnnotations.HasType); 1936Debug.Assert(member.Kind != SymbolKind.Property); 1937Debug.Assert(member.Kind != SymbolKind.Event); 2004Debug.Assert(AllParametersConsideredInEscapeAnalysisHaveArguments(argsOpt, parameters, argsToParamsOpt)); 2160Debug.Assert(extensionParameter is not null); 2163Debug.Assert(receiver is not null); 2212Debug.Assert(AllParametersConsideredInEscapeAnalysisHaveArguments(argsOpt, parameters, argsToParamsOpt)); 2387Debug.Assert(receiver.Type is { }); 2388Debug.Assert(receiverIsSubjectToCloning != ThreeState.Unknown); 2392Debug.Assert(receiver is not BoundValuePlaceholderBase && method is not null && receiver.Type?.IsReferenceType == false); 2416Debug.Assert(argIndex == argsOpt.Length - 1); 2492Debug.Assert(!getArgument.RefKind.IsWritableReference()); 2854Debug.Assert(symbol is null or SourceLocalSymbol or GlobalExpressionVariable); 3098Debug.Assert(underlyingParameter.IsThis); 3099Debug.Assert(underlyingParameter.RefKind != RefKind.Out); // Shouldn't get here for a constructor 3100Debug.Assert(underlyingParameter.ContainingSymbol is MethodSymbol); 3173Debug.Assert((object)local != null); 3174Debug.Assert(kind != BindValueKind.RValue); 3332Debug.Assert((object)field != null); 3333Debug.Assert(field.RefKind == RefKind.None ? RequiresAssignableVariable(kind) : RequiresRefAssignableVariable(kind)); 3334Debug.Assert(field.Type != (object)null); 3338Debug.Assert(kind != BindValueKind.AddressOf); // If this assert fails, we probably should report ErrorCode.ERR_InvalidAddrOp 3368Debug.Assert((object)symbol != null); 3369Debug.Assert(RequiresAssignableVariable(kind)); 3405Debug.Assert(expr.Type is not null); 3487Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything)); 3640Debug.Assert(GetInlineArrayAccessEquivalentSignatureMethod(elementAccess, out _, out _).RefKind == RefKind.None); 3648Debug.Assert(equivalentSignatureMethod.RefKind != RefKind.None); 3689Debug.Assert(expr is BoundConversion conversion && 3696Debug.Assert(expr is BoundUnaryOperator unaryOperator && 3703Debug.Assert(expr is BoundBinaryOperator binaryOperator && 3710Debug.Assert(expr is BoundUserDefinedConditionalLogicalOperator logicalOperator && 3716Debug.Assert(expr is BoundCompoundAssignmentOperator compoundAssignmentOperator && 3738Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 3813Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything)); 3961Debug.Assert(GetInlineArrayAccessEquivalentSignatureMethod(elementAccess, out _, out _).RefKind == RefKind.None); 3969Debug.Assert(equivalentSignatureMethod.RefKind != RefKind.None); 4060Debug.Assert(!conversion.Conversion.IsUserDefined || 4066Debug.Assert(expr is BoundUnaryOperator unaryOperator && 4073Debug.Assert(expr is BoundBinaryOperator binaryOperator && 4080Debug.Assert(expr is BoundUserDefinedConditionalLogicalOperator logicalOperator && 4086Debug.Assert(expr is BoundCompoundAssignmentOperator compoundAssignmentOperator && 4157Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything)); 4464Debug.Assert(operatorMethod is not null); 4645Debug.Assert(elementType.Type is { }); 4660Debug.Assert(constructMethod.ReturnType.Equals(expr.Type, TypeCompareKind.AllIgnoreOptions)); 4661Debug.Assert(parameter.Type.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions)); 4744Debug.Assert(expr.AccessorKind != AccessorKind.Unknown); 4831Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter()); 4863Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything)); 5257Debug.Assert(operatorMethod is not null); 5626Debug.Assert(conversion.Conversion.IsInlineArray);
Binder\Binder.WithQueryLambdaParametersBinder.cs (4)
39Debug.Assert(!qv.IsTransparent); 49Debug.Assert(value.Count == 1); 56Debug.Assert(base.lambdaSymbol.Parameters[0].Name.StartsWith(transparentIdentifierPrefix, StringComparison.Ordinal)); 107Debug.Assert(result.IsClear);
Binder\Binder_Attributes.cs (31)
35Debug.Assert(binders.Any()); 36Debug.Assert(attributesToBind.Any()); 37Debug.Assert((object)ownerSymbol != null); 38Debug.Assert(binders.Length == attributesToBind.Length); 81Debug.Assert(binders.Any()); 82Debug.Assert(attributesToBind.Any()); 83Debug.Assert(boundAttributeTypes.Any()); 84Debug.Assert(binders.Length == attributesToBind.Length); 85Debug.Assert(boundAttributeTypes.Length == attributesToBind.Length); 105Debug.Assert(boundAttributeArray is null || boundAttributeArray[i] is not null); 112Debug.Assert(!attribute.HasErrors); 113Debug.Assert(attribute.AttributeClass is object); 157Debug.Assert(binder.SkipSemanticModelBinder() == binder.GetRequiredBinder(node).SkipSemanticModelBinder()); 257Debug.Assert(boundConstructorArguments.All(a => !a.NeedsToBeConverted())); 265Debug.Assert(boundNamedArguments.All(arg => !arg.Right.NeedsToBeConverted())); 288Debug.Assert(boundAttribute.Syntax.Kind() == SyntaxKind.Attribute); 295Debug.Assert(hasErrors); 326Debug.Assert(rewrittenArguments.Length == attributeConstructor.ParameterCount); 352Debug.Assert(arguments.Count(a => a.IsParamsArrayOrCollection) == (boundAttribute.ConstructorExpanded ? 1 : 0)); 377Debug.Assert(argsToParamsOpt.IsDefault 384Debug.Assert(!arguments[argIndex].IsParamsArrayOrCollection || arguments[argIndex] is BoundArrayCreation); 401Debug.Assert(paramType.HasType); 420Debug.Assert((object)attributeType != null); 421Debug.Assert(!attributeType.IsErrorType()); 426Debug.Assert(conditionalSymbols != null); 516Debug.Assert(namedArgument.NameEquals is not null); 547Debug.Assert(resultKind == LookupResultKind.Viable || wasError); 705Debug.Assert(!constructorArgsArray.IsDefault); 706Debug.Assert(!hasErrors); 741Debug.Assert(hasErrors || reorderedArguments.All(arg => arg.Kind != TypedConstantKind.Error)); 917Debug.Assert(type.IsSZArray());
Binder\Binder_Await.cs (2)
262Debug.Assert(TypeSymbol.Equals(expression.Type, getAwaiterArgument.Type, TypeCompareKind.ConsiderEverything)); 424Debug.Assert(conversion.IsValid);
Binder\Binder_Constraints.cs (10)
33Debug.Assert(this.Flags.Includes(BinderFlags.GenericConstraintsClause)); 35Debug.Assert((containingSymbol.Kind == SymbolKind.NamedType) || (containingSymbol.Kind == SymbolKind.Method)); 36Debug.Assert(typeParameters.Length > 0); 37Debug.Assert(clauses.Count > 0); 66Debug.Assert(ordinal >= 0); 67Debug.Assert(ordinal < n); 125Debug.Assert(!InExecutableBinder); // Cannot eagerly report diagnostics handled by LazyMissingNonNullTypesContextDiagnosticInfo 345Debug.Assert(!isForOverride || 392Debug.Assert(typeParameters.Length > 0); 469Debug.Assert(possibleFileType?.IsDefinition != false);
Binder\Binder_Conversions.cs (104)
67Debug.Assert(result is BoundConversion || (conversion.IsIdentity && ((object)result == source) || source.NeedsToBeConverted()) || hasErrors); 72Debug.Assert(filterConversion(conversion)); 73Debug.Assert(BoundNode.GetConversion(result, placeholder1) == conversion); 79Debug.Assert(BoundNode.GetConversion(result2, placeholder2) == conversion); 191Debug.Assert(destination.SpecialType != SpecialType.System_String); 214Debug.Assert(!conversion.Exists); 233Debug.Assert(conversion.IsCollectionExpression 255Debug.Assert(source.Type is null); 256Debug.Assert(!conversion.Exists); 303Debug.Assert(!conversion.IsMethodGroup); 318Debug.Assert(conversion.UnderlyingConversions.Length == 1); 378Debug.Assert(elementConversions.Length == sourceTypes.Length); 400Debug.Assert(conversion.UnderlyingConversions.IsDefault); 409Debug.Assert(syntax.SyntaxTree is object); 417Debug.Assert(conversion.ConstrainedToTypeOpt is TypeParameterSymbol); 446Debug.Assert(source.Type is { }); 449Debug.Assert(elementField is { }); 468Debug.Assert(destination.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Span_T), TypeCompareKind.AllIgnoreOptions)); 485Debug.Assert(source.Type is not null); 486Debug.Assert(destination.IsSpan() || destination.IsReadOnlySpan()); 507Debug.Assert(destination.IsReadOnlySpan()); 519Debug.Assert(destination.IsReadOnlySpan()); 576Debug.Assert(type.IsSpan() || type.IsReadOnlySpan()); 577Debug.Assert(type.IsDefinition); 586Debug.Assert(spanType.IsSpan() && readonlySpanType.IsReadOnlySpan()); 587Debug.Assert(spanType.IsDefinition && readonlySpanType.IsDefinition); 609Debug.Assert(source.IsSpan() || source.IsReadOnlySpan()); 610Debug.Assert(destination.IsReadOnlySpan()); 611Debug.Assert(!source.IsDefinition && !destination.IsDefinition); 618Debug.Assert(!source.IsReadOnlySpan() || !sameElementTypes); 626Debug.Assert(source.IsReadOnlySpan() && destination.IsReadOnlySpan()); 627Debug.Assert(source.IsDefinition && destination.IsDefinition); 654Debug.Assert(readOnlySpanType.IsReadOnlySpan()); 655Debug.Assert(!readOnlySpanType.IsDefinition); 656Debug.Assert(((NamedTypeSymbol)readOnlySpanType).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].SpecialType is SpecialType.System_Char); 709Debug.Assert(destination.Equals(Compilation.GetWellKnownType(WellKnownType.System_IFormattable), TypeCompareKind.ConsiderEverything) || 749Debug.Assert(expr is BoundObjectCreationExpressionBase { WasTargetTyped: true } or 754Debug.Assert(expr is not BoundBadExpression { ChildBoundNodes: var children } || !children.Any((child, node) => child.Syntax == node.Syntax, node)); 824Debug.Assert(conversion.Kind is ConversionKind.NoConversion); 853Debug.Assert(elementType is { }); 888Debug.Assert(inProgressConstructor is not null); 895Debug.Assert((collectionCreation is BoundNewT && !isExpanded && constructor is null) || 945Debug.Assert(elementType is { }); 946Debug.Assert(elements.Length == elementConversions.Length); 947Debug.Assert(elementConversions.All(c => c.Exists)); 989Debug.Assert(enumeratorInfo is { }); 990Debug.Assert(enumeratorInfo.ElementType is { }); // ElementType is set always, even for IEnumerable. 1040Debug.Assert(result); 1044Debug.Assert(result); 1057Debug.Assert(collectionBuilderReturnTypeConversion.Exists); 1062Debug.Assert(parameterType.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions)); 1072Debug.Assert(!collectionBuilderMethod.GetIsNewExtensionMember()); 1109Debug.Assert(!isParamsModifierValidation || syntax is ParameterSyntax); 1241Debug.Assert(!targetType.IsDynamic()); 1317Debug.Assert(boundExpression.HasErrors); 1357Debug.Assert(methodGroup.ReceiverOpt is not null); 1358Debug.Assert(methodGroup.ReceiverOpt.Type is not null); 1374Debug.Assert(false); // Should not get here given the 'acceptOnlyMethods' argument value used in 'ResolveMethodGroup' call above 1398Debug.Assert(resolution.AnalyzedArguments.HasDynamicArgument); 1414Debug.Assert(finalApplicableCandidates.Length != 1 || finalApplicableCandidates[0].IsApplicable); 1434Debug.Assert(!IsDisallowedExtensionInOlderLangVer(addMethods[0])); 1440Debug.Assert(!resolution.OverloadResolutionResult.Succeeded); 1463Debug.Assert(methodGroup.ReceiverOpt is not null); 1479Debug.Assert(receiverType is not null); 1540Debug.Assert(constructed is not null); 1573Debug.Assert(node != null); 1574Debug.Assert(methodGroup != null); 1575Debug.Assert(methodGroup.Error == null); 1634Debug.Assert(!method.IsRuntimeFinalizer()); 1669Debug.Assert(call.HasErrors); 1670Debug.Assert(call.Method.Name == "Add"); 1673Debug.Assert(false); // Add test if we hit this assert. 1701Debug.Assert(false); 1769Debug.Assert(elementTypeWithAnnotations.Type is null); // GetCollectionExpressionTypeKind() does not set elementType for these cases. 1781Debug.Assert(elementTypeWithAnnotations.HasType); 1791Debug.Assert(elementType is { }); 1838Debug.Assert(reportedErrors); 1948Debug.Assert(targetTyped || destination.IsErrorType() || destination.Equals(source.Type, TypeCompareKind.ConsiderEverything)); 1987Debug.Assert(targetTyped || destination.IsErrorType() || destination.Equals(source.Type, TypeCompareKind.ConsiderEverything)); 2020Debug.Assert(conversionGroup != null); 2021Debug.Assert(conversion.IsUserDefined); 2069Debug.Assert(conversion.BestUserDefinedConversionAnalysis is object); // All valid user-defined conversions have this populated 2129Debug.Assert(toConversion.Exists); 2183Debug.Assert(conversion.Kind == ConversionKind.FunctionType); 2184Debug.Assert(source.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda); 2185Debug.Assert(syntax.IsFeatureEnabled(MessageID.IDS_FeatureInferredDelegateType)); 2189Debug.Assert(delegateType is { }); 2272Debug.Assert(conversion.UnderlyingConversions.IsDefault); 2329Debug.Assert(delegateType is not null); 2333Debug.Assert(lambdaSymbol.ParameterCount == delegateParameters.Length); 2416Debug.Assert(conversion.IsStackAlloc); 2446Debug.Assert(conversion.IsNullable == destination.IsNullableType()); 2458Debug.Assert(conversionWithoutNullable.IsTupleLiteralConversion); 2674Debug.Assert(memberSymbol is not MethodSymbol { MethodKind: not MethodKind.Constructor } || 2685Debug.Assert(!invokedAsExtensionMethod); 2689Debug.Assert(!invokedAsExtensionMethod || (receiverOpt != null)); 2839Debug.Assert(!isExtensionMethod || (receiverOpt != null)); 2846Debug.Assert(methodParameters.Length == numParams + (isExtensionMethod ? 1 : 0)); 2995Debug.Assert(method.GetIsNewExtensionMember()); 3019Debug.Assert(Conversions.IsAssignableFromMulticastDelegate(delegateOrFuncPtrType, ref discardedUseSiteInfo) || delegateOrFuncPtrType.TypeKind == TypeKind.Delegate || delegateOrFuncPtrType.TypeKind == TypeKind.FunctionPointer); 3020Debug.Assert(conversion.Method is object); 3101Debug.Assert(conversion.IsValid); // i.e. if it exists, then it is valid. 3216Debug.Assert(!sourceValue.IsBad); 3223Debug.Assert(underlyingType.SpecialType != SpecialType.None);
Binder\Binder_Crefs.cs (21)
84Debug.Assert(Flags.Includes(BinderFlags.Cref)); 96Debug.Assert((object)namespaceOrTypeSymbol != null); 164Debug.Assert((object?)containerOpt == null); 210Debug.Assert(sortedSymbols.All(SymbolExtensions.IsIndexer)); 256Debug.Assert(sortedSymbols.All(s => s.GetIsNewExtensionMember())); 262Debug.Assert(name is not null); 264Debug.Assert(syntax.Parameters is not null); 529Debug.Assert(memberName == memberNameText); 619Debug.Assert(builder != null); 644Debug.Assert(!symbols.IsEmpty); 830Debug.Assert(!symbols.IsEmpty); 849Debug.Assert(!best.IsNone); 850Debug.Assert(!secondBest.IsNone); 1044Debug.Assert(typeArgumentListSyntax is object); 1051Debug.Assert(unusedDiagnostics.DiagnosticBag is object); 1080Debug.Assert(symbol is NamedTypeSymbol); 1101Debug.Assert(parameterListSyntax.Parent is object); 1119Debug.Assert(InCrefButNotParameterOrReturnType); 1125Debug.Assert(!this.Compilation.ContainsSyntaxTree(typeSyntax.SyntaxTree) || 1131Debug.Assert(localDiagnostics.DiagnosticBag is object); 1139Debug.Assert(typeSyntax.Parent is object);
Binder\Binder_Deconstruct.cs (17)
96Debug.Assert(locals.NestedVariables is object); 120Debug.Assert(diagnostics.DiagnosticBag is object); 158Debug.Assert(hasErrors || lhsTuple.Type is object); 184Debug.Assert(parent.Kind() == SyntaxKind.SimpleAssignmentExpression); 210Debug.Assert(diagnostics.DiagnosticBag is object); 250Debug.Assert((object)type != null); 308Debug.Assert(nestedConversion.Kind == ConversionKind.Deconstruction); 320Debug.Assert(single is object); 321Debug.Assert(single.Type is not null); 379Debug.Assert((object?)pending.Type == null); 403Debug.Assert(variable.Single is object); 421Debug.Assert((object?)variables[i].Single!.Type != null); 461Debug.Assert(NestedVariables is object); 501Debug.Assert(variable.Single is object); 564Debug.Assert(variable.Single is object); 753Debug.Assert(isVar == !declType.HasType); 951Debug.Assert(TypeSymbol.Equals(declTypeWithAnnotations.Type, fieldType.Type, TypeCompareKind.ConsiderEverything2));
Binder\Binder_Expressions.cs (242)
201Debug.Assert(expr != null); 202Debug.Assert(resultKind != LookupResultKind.Viable); 315Debug.Assert(op.NoCommonTypeError != 0); 416Debug.Assert(expr.Kind is BoundKind.UnboundLambda or BoundKind.MethodGroup); 446Debug.Assert((object)this.ContainingMemberOrLambda == field); 454Debug.Assert(initializerBinder != null); 504Debug.Assert(this.InParameterDefaultValue); 505Debug.Assert(this.ContainingMemberOrLambda.Kind == SymbolKind.Method 511Debug.Assert(defaultValueBinder != null); 529Debug.Assert(initializerBinder != null); 597Debug.Assert(node != null); 1447Debug.Assert(ContainingType is { }); 1465Debug.Assert((this.Flags & BinderFlags.InContextualAttributeBinder) != 0); 1509Debug.Assert(symbol is null or LocalSymbol or LocalFunctionSymbol or RangeVariableSymbol or TypeParameterSymbol); 1587Debug.Assert(node != null); 1625Debug.Assert(node.Arity == typeArgumentList.Count); 1676Debug.Assert(isError); // Should have been reported by GetSymbolOrMethodOrPropertyGroup. 1750Debug.Assert(SyntaxFacts.IsInvoked(id) == invoked); 1813Debug.Assert(!isError); 1814Debug.Assert(!primaryConstructor.GetCapturedParameters().ContainsKey(shadowedParameter)); // How could we capture a shadowed parameter? 1841Debug.Assert((options & LookupOptions.NamespacesOrTypesOnly) == 0); 1870Debug.Assert(node.Identifier.IsUnderscoreToken()); 1978Debug.Assert(!symbol.ContainingSymbol.Equals(containingMethod)); 2135Debug.Assert(primaryCtor is null || 2154Debug.Assert(parameter.Type.IsRefLikeOrAllowsRefLikeType()); 2177Debug.Assert(parameter.Type.IsRefLikeOrAllowsRefLikeType()); 2500Debug.Assert(node != null); 2528Debug.Assert(location is not null); 2538Debug.Assert(this.ContainingMemberOrLambda is not null); 2602Debug.Assert(node.OperatorToken.IsKind(SyntaxKind.CaretToken)); 2801Debug.Assert(conversion.IsUserDefined); 2886Debug.Assert((object)operand.Type != null); 2927Debug.Assert(targetTypeWithAnnotations.HasType && targetTypeWithAnnotations.IsNullableType()); 2928Debug.Assert((object)operand.Type != null && !operand.Type.IsNullableType()); 3177Debug.Assert(isVar != declType.HasType); 3193Debug.Assert(declarationExpression.IsOutVarDeclaration()); 3217Debug.Assert(localSymbol.DeclarationKind == LocalDeclarationKind.OutVariable); 3335Debug.Assert(argumentSyntax is ArgumentSyntax || argumentSyntax is AttributeArgumentSyntax); 3447Debug.Assert(result.ConversionForArg(arg).IsIdentity); 3448Debug.Assert(!argument.NeedsToBeConverted()); 3449Debug.Assert(!expanded || result.ParameterFromArgument(arg) != parameters.Length - 1); 3458Debug.Assert(paramsArgsBuilder is null); 3498Debug.Assert(argument is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true }); 3519Debug.Assert(parameterTypeWithAnnotations.HasType); 3524Debug.Assert(kind.IsIdentity); 3552Debug.Assert(arguments[arg].Kind is not 3581Debug.Assert(methodResult.Result.ParamsElementTypeOpt.HasType); 3582Debug.Assert(methodResult.Result.ParamsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel); 3604Debug.Assert(collectionArgs.Length != 0); 3609Debug.Assert(firstParamsArgument != -1); 3623Debug.Assert(argsToParamsBuilder is not null || argsToParamsOpt.IsDefault); 3673Debug.Assert(unconvertedString is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true }); 3675Debug.Assert(interpolatedStringConversion.IsInterpolatedStringHandler); 3676Debug.Assert(handlerType is NamedTypeSymbol { IsInterpolatedStringHandlerType: true }); 3683Debug.Assert(handlerParameterIndexes.IsEmpty); 3696Debug.Assert(arguments is not null); 3727Debug.Assert(handlerParameterIndexes.All((index, paramLength) => index >= BoundInterpolatedStringArgumentPlaceholder.InstanceParameter && index < paramLength, 3746Debug.Assert(handlerArgumentIndexesBuilder[handlerParameterIndex] is BoundInterpolatedStringArgumentPlaceholder.UnspecifiedParameter); 3779Debug.Assert(argumentIndex != interpolatedStringArgNum); 3786Debug.Assert(receiver!.Type is not null); 3839Debug.Assert(receiver != null); 3903Debug.Assert(!available); 3916Debug.Assert(argNumber > 0); 3928Debug.Assert(argNumber >= 0); // can be 0 for receiver of extension method 3937Debug.Assert(argNumber > 0); 4197Debug.Assert(rank > 0); 4198Debug.Assert(dimension > 0 && dimension <= rank); 4199Debug.Assert(exprBuilder != null); 4270Debug.Assert(!boundInitExpr.IsDefault); 4280Debug.Assert(boundInitExprIndex >= 0 && boundInitExprIndex < boundInitExpr.Length); 4305Debug.Assert(boundInitExprIndex >= 0 && boundInitExprIndex < boundInitExpr.Length); 4308Debug.Assert(init.HasAnyErrors); 4309Debug.Assert(init.Type.IsErrorType()); 4418Debug.Assert(creationSyntax == null || 4421Debug.Assert(initSyntax != null); 4422Debug.Assert((object)type != null); 4423Debug.Assert(boundInitExprOpt.IsDefault || creationSyntax.Kind() == SyntaxKind.ImplicitArrayCreationExpression); 4575Debug.Assert(node is StackAllocArrayCreationExpressionSyntax || node is ImplicitStackAllocArrayCreationExpressionSyntax); 4626Debug.Assert(node != null); 4665Debug.Assert(node.IsKind(SyntaxKind.ImplicitStackAllocArrayCreationExpression) || node.IsKind(SyntaxKind.StackAllocArrayCreationExpression)); 4711Debug.Assert(expression != null); 4729Debug.Assert(expression != null); 4755Debug.Assert(type == SpecialType.System_UInt32 || type == SpecialType.System_UInt64); 4790Debug.Assert(argumentListBinder.IsSemanticModelBinder); 4822Debug.Assert((object)constructor != null); 4823Debug.Assert(constructor.MethodKind == MethodKind.Constructor || 4825Debug.Assert(diagnostics != null); 4839Debug.Assert(constructorReturnType.IsVoidType()); //true of all constructors 4858Debug.Assert((object)initializerType != null || 4894Debug.Assert(initializerArgumentListOpt.Parent.Kind() == SyntaxKind.ThisConstructorInitializer); 5000Debug.Assert(initializerType.IsErrorType() || 5187Debug.Assert(result is not BoundBadExpression { ChildBoundNodes: var children } || !children.Any((child, node) => child.Syntax == node, node)); 5294Debug.Assert(expression.Type is { }); 5301Debug.Assert(conversion.IsValid); 5310Debug.Assert(length > 0); 5396Debug.Assert(!type.IsGenericOrNonGenericExpressionType(out _)); 5483Debug.Assert(!conv.IsExtensionMethod); 5484Debug.Assert(conv.IsValid); // i.e. if it exists, then it is valid. 5551Debug.Assert(type.TypeKind is TypeKind.Class or TypeKind.Struct); 5595Debug.Assert(typeSyntax is not null); 5614Debug.Assert(syntax != null); 5615Debug.Assert((object)type != null); 5646Debug.Assert(syntax != null); 5647Debug.Assert((object)type != null); 5653Debug.Assert(syntax.Parent.Parent.Kind() != SyntaxKind.WithInitializerExpression); 5654Debug.Assert(rhsValueKind == BindValueKind.RValue); 5674Debug.Assert(initializerSyntax.Kind() == SyntaxKind.ObjectInitializerExpression || 5676Debug.Assert((object)initializerType != null); 5732Debug.Assert(objectInitializerMemberBinder != null); 5738Debug.Assert((object)boundLeft.Type != null); 5766Debug.Assert(objectInitializerMemberBinder != null); 6070Debug.Assert(!boundMember.NeedsToBeConverted()); 6092Debug.Assert(boundMember.HasAnyErrors); 6106Debug.Assert(memberNameMap != null); 6116Debug.Assert(memberInitializerSyntax.Kind() == SyntaxKind.SimpleAssignmentExpression); 6250Debug.Assert(initializerSyntax.Kind() == SyntaxKind.CollectionInitializerExpression); 6251Debug.Assert(initializerSyntax.Expressions.Any()); 6252Debug.Assert((object)initializerType != null); 6405Debug.Assert(node.Kind() == SyntaxKind.ComplexElementInitializerExpression); 6436Debug.Assert(!boundElementInitializerExpressions.IsEmpty); 6455Debug.Assert(collectionInitializerAddMethodBinder.HasCollectionExpressionApplicableAddMethod(elementInitializer, implicitReceiver.Type, addMethods: out _, d)); 6469Debug.Assert(collectionInitializerAddMethodBinder != null); 6470Debug.Assert(collectionInitializerAddMethodBinder.Flags.Includes(BinderFlags.CollectionInitializerAddMethod)); 6471Debug.Assert(implicitReceiver != null); 6472Debug.Assert((object)implicitReceiver.Type != null); 6538Debug.Assert(addMethodInvocation.Kind == BoundKind.BadExpression); 6584Debug.Assert(enumeratorInfo.ElementType is { }); // ElementType is set always, even for IEnumerable. 6631Debug.Assert((object)constructor != null); 6632Debug.Assert(constructor.MethodKind == MethodKind.Constructor || constructor.MethodKind == MethodKind.StaticConstructor); 6659Debug.Assert((object)this.Compilation.Assembly != null); 6709Debug.Assert(finalApplicableCandidates[0].IsApplicable); 6930Debug.Assert((object)type != null); 6956Debug.Assert((object)interfaceType != null); 6957Debug.Assert(interfaceType.IsInterfaceType()); 6958Debug.Assert((object)coClassType != null); 6959Debug.Assert(TypeSymbol.Equals(interfaceType.ComImportCoClass, coClassType, TypeCompareKind.ConsiderEverything2)); 6960Debug.Assert(coClassType.TypeKind == TypeKind.Class || coClassType.TypeKind == TypeKind.Error); 7370Debug.Assert( 7391Debug.Assert(node.Kind() == SyntaxKind.Utf8StringLiteralExpression); 7392Debug.Assert(node.Token.Kind() is SyntaxKind.Utf8StringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken); 7422Debug.Assert(node != null); 7423Debug.Assert(invoked == SyntaxFacts.IsInvoked(node)); 7435Debug.Assert(node.Kind() == SyntaxKind.PointerMemberAccessExpression); 7484Debug.Assert((left.Parent is MemberAccessExpressionSyntax { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression } memberAccess && memberAccess.Expression == left) || 7521Debug.Assert((object)leftType != null); 7530Debug.Assert(!leftType.IsDynamic()); 7531Debug.Assert(IsPotentialColorColorReceiver(left, leftType)); 7542Debug.Assert(!IsPotentialColorColorReceiver(left, leftType)); 7659Debug.Assert(node != null); 7660Debug.Assert(boundLeft != null); 7694Debug.Assert((object)leftType == null); 7836Debug.Assert(sym.Kind == SymbolKind.NamedType); 7852Debug.Assert(symbols[0].Kind == SymbolKind.NamedType); 7862Debug.Assert(lookupResult.Error == null); 7887Debug.Assert(boundLeft is BoundTypeExpression); 7888Debug.Assert((object)leftType != null); 7963Debug.Assert(!resolution.IsNonMethodExtensionMember(out _)); 7971Debug.Assert(!resolution.IsEmpty); 8016Debug.Assert(typeArgumentsOpt.IsDefault); 8039Debug.Assert(propertySymbol.ContainingType.ExtensionParameter is not null); 8071Debug.Assert(rightArity == (typeArgumentsWithAnnotations.IsDefault ? 0 : typeArgumentsWithAnnotations.Length)); 8350Debug.Assert(receiver != null); 8380Debug.Assert(receiver != null); 8405Debug.Assert(node != null); 8406Debug.Assert(left != null); 8407Debug.Assert(lookupResult.IsMultiViable); 8408Debug.Assert(lookupResult.Symbols.Any()); 8443Debug.Assert(symbol.Kind != SymbolKind.Method); 8525Debug.Assert(left.Type is not null); 8526Debug.Assert(!left.Type.IsDynamic()); 8527Debug.Assert((options & ~(OverloadResolution.Options.IsMethodGroupConversion | 8618Debug.Assert(left.Type is not null); 8639Debug.Assert(arity == 0 || lookupResult.Symbols.All(s => s.Kind != SymbolKind.Property)); 8686Debug.Assert(propertyResult?.HasAnyApplicableMember == true); 8728Debug.Assert(receiverType is not null); 8870Debug.Assert(lookupResult.Symbols.Any()); 8874Debug.Assert((object)symbol == null); 9035Debug.Assert((object)underlyingType != null); 9085Debug.Assert(symbol is not TypeSymbol); 9237Debug.Assert(!methodOrPropertyGroup.Any()); 9242Debug.Assert(result.Kind != LookupResultKind.Empty); 9243Debug.Assert(!result.Symbols.Any(s => s.IsIndexer())); 9289Debug.Assert(methodOrPropertyGroup.Any() || ((object)other != null)); 9324Debug.Assert(members.All(m => m.Kind == member.Kind)); 9332Debug.Assert(members.All(m => !m.IsIndexer())); 9370Debug.Assert(propertyGroup.ReceiverOpt is not null); 9420Debug.Assert(expr.Type.TryGetInlineArrayElementField() is not null); 9436Debug.Assert(tryInlineArrayAccess); 9437Debug.Assert(diagnosticsForBindElementAccessCore.DiagnosticBag is { }); 9664Debug.Assert(node != null); 9665Debug.Assert(expr != null); 9666Debug.Assert((object)expr.Type != null); 9667Debug.Assert(arguments != null); 9695Debug.Assert(node != null); 9696Debug.Assert(expr != null); 9697Debug.Assert(arguments != null); 9756Debug.Assert(convertedArguments.Length == 1); 9778Debug.Assert(index != null); 9883Debug.Assert(expr != null); 9884Debug.Assert((object)targetType != null); 9900Debug.Assert(result != null); // If this ever fails (it shouldn't), then put a null-check around the diagnostics update. 9907Debug.Assert(node != null); 9908Debug.Assert(expr != null); 9909Debug.Assert(analyzedArguments != null); 9923Debug.Assert(expr.Type.IsPointerType()); 9968Debug.Assert(node != null); 9969Debug.Assert(expr != null); 9970Debug.Assert((object)expr.Type != null); 9971Debug.Assert(analyzedArguments != null); 10003Debug.Assert(symbol.IsIndexer()); 10022Debug.Assert(property.ParameterCount > 0); 10040Debug.Assert(receiver is not null); 10068Debug.Assert(receiver is not null); 10130Debug.Assert(receiver is not null); 10152Debug.Assert(finalApplicableCandidates[0].IsApplicable); 10277Debug.Assert(receiver is not null); 10297Debug.Assert(receiver.Type is not null); 10311Debug.Assert(lengthOrCountAccess is BoundPropertyAccess); 10312Debug.Assert(indexerOrSliceAccess is BoundIndexerAccess or BoundCall); 10313Debug.Assert(indexerOrSliceAccess.Type is not null); 10396Debug.Assert(receiver.Type is not null); 10444Debug.Assert(!argIsIndex); 10456Debug.Assert(!argIsIndex); 10536Debug.Assert(receiverPlaceholder.Type is not null); 10560Debug.Assert(lookupResult.IsClear); 10635Debug.Assert((options & ~(OverloadResolution.Options.IsMethodGroupConversion | 10727Debug.Assert(!methodResolution.HasAnyApplicableMethod); 10728Debug.Assert(!extensionMethodResolution.HasAnyApplicableMethod); 10729Debug.Assert(!methodResolution.IsEmpty); 10730Debug.Assert(!extensionMethodResolution.IsEmpty); 10744Debug.Assert(!extensionMethodResolution.IsEmpty); 10762Debug.Assert((options & ~(OverloadResolution.Options.IsMethodGroupConversion | 11066Debug.Assert(node.ReceiverOpt!.Type is not null); // extensions are only considered on member access 11202Debug.Assert(ContainingMemberOrLambda is { }); 11203Debug.Assert(parameterRefKinds.IsDefault || parameterRefKinds.Length == parameterTypes.Length); 11205Debug.Assert(returnType.Type is { }); // Expecting System.Void rather than null return type. 11206Debug.Assert(!hasParams || parameterTypes.Length != 0); 11295Debug.Assert((location == null) ^ (node == null)); 11349Debug.Assert((object)receiverType != null); 11465Debug.Assert(node != null); 11466Debug.Assert(node.Expression != null); 11472Debug.Assert(receiver != null);
Binder\Binder_Flags.cs (6)
23Debug.Assert(containingMemberOrLambda != null); 31Debug.Assert(containingMemberOrLambda != null); 53Debug.Assert(receiverExpression != null); 80Debug.Assert((object)containing != null); 90Debug.Assert((object)containing != null); 116Debug.Assert(!this.Flags.Includes(BinderFlags.UncheckedRegion | BinderFlags.CheckedRegion));
Binder\Binder_Initializers.cs (5)
89Debug.Assert((object)fieldSymbol != null); 147Debug.Assert((ContainingMemberOrLambda is TypeSymbol containing && TypeSymbol.Equals(containing, fieldSymbol.ContainingType, TypeCompareKind.ConsiderEverything2)) || //should be the binder for the type 195Debug.Assert(syntaxTree.Options.Kind != SourceCodeKind.Regular); 207Debug.Assert(scriptClassBinder.ContainingMemberOrLambda is NamedTypeSymbol { IsScriptClass: true }); 289Debug.Assert(!fieldSymbol.IsMetadataConstant);
Binder\Binder_InterpolatedString.cs (18)
188Debug.Assert(isResultConstant == (resultConstant != null)); 219Debug.Assert(unconvertedInterpolatedString.Type?.SpecialType == SpecialType.System_String); 245Debug.Assert(unconvertedInterpolatedString.Parts.All(static part => part.Type is null or { SpecialType: SpecialType.System_String })); 387Debug.Assert(fillin.Alignment.ConstantValueOpt is { }); 392Debug.Assert(fillin.Format.ConstantValueOpt is { }); 407Debug.Assert(part is BoundLiteral && part.ConstantValueOpt?.StringValue != null); 442Debug.Assert(binaryOperator.IsUnconvertedInterpolatedStringAddition); 510Debug.Assert(count <= 4); 530Debug.Assert(arg.AppendCalls.Length > i); 590Debug.Assert(appendCalls.Length == 1); 608Debug.Assert(binaryOperator.IsUnconvertedInterpolatedStringAddition); 641Debug.Assert(additionalConstructorArguments.IsDefault 669Debug.Assert(appendCallsArray.Select(a => a.Length).SequenceEqual(partsArray.Select(a => a.Length))); 670Debug.Assert(appendCallsArray.All(appendCalls => appendCalls.All(a => a is { HasErrors: true } or BoundCall { Arguments: { Length: > 0 } } or BoundDynamicInvocation))); 799Debug.Assert(constructorCall.HasErrors || constructorCall is BoundObjectCreationExpression or BoundDynamicObjectCreationExpression); 887Debug.Assert(part is BoundLiteral { Type: { SpecialType: SpecialType.System_String }, ConstantValueOpt.IsString: true }); 920Debug.Assert(part is BoundLiteral or BoundStringInsert); 979Debug.Assert(call is BoundCall or BoundDynamicInvocation or { HasErrors: true });
Binder\Binder_Invocation.cs (34)
100Debug.Assert(receiver != null); 101Debug.Assert(names.IsDefault || names.Length == args.Length); 124Debug.Assert(allowFieldsAndProperties || boundExpression.Kind is (BoundKind.MethodGroup or BoundKind.BadExpression)); 129Debug.Assert(!args.Any(static e => e.Kind == BoundKind.OutVariablePendingInference || 225Debug.Assert(node.Expression.Kind() is SyntaxKind.SimpleMemberAccessExpression); 427Debug.Assert(ContainingType is not null); 558Debug.Assert(receiver.Type is not null); 610Debug.Assert((object?)arg.Type != null); 728Debug.Assert(extensionMemberAccess.Kind != BoundKind.MethodGroup); 812Debug.Assert(finalApplicableCandidates[0].IsApplicable); 824Debug.Assert(finalApplicableCandidates.Length > 0); 833Debug.Assert(methodGroup.ReceiverOpt != null && (object)methodGroup.ReceiverOpt.Type != null); 994Debug.Assert(overloadResolutionResult.HasAnyApplicableMember); 1052Debug.Assert(diagnostics != null); 1134Debug.Assert(node != null); 1135Debug.Assert(methodGroup != null); 1136Debug.Assert(methodGroup.Error == null); 1144Debug.Assert(!invokedAsExtensionMethod || ((object)delegateTypeOpt == null)); 1223Debug.Assert(methodResult.Result.ConversionForArg(0).Exists); 1260Debug.Assert(argsToParams.IsDefault || argsToParams[0] == 0); 1284Debug.Assert(analyzedArguments.RefKind(0) == RefKind.None); 1343Debug.Assert(args.IsDefaultOrEmpty || (object)receiver != (object)args[0]); 1424Debug.Assert(parameterType.IsDynamic() || parameterType.SpecialType == SpecialType.System_Object); 1505Debug.Assert(argumentOrdinal < argsToParamsOpt.Length); 1588Debug.Assert(InAttributeArgument || (attributedMember is null && containingMember is not null)); 1594Debug.Assert(!expanded || parameters[^1].IsParams); 1603Debug.Assert(parameter.IsOptional); 1678Debug.Assert((object?)defaultConstantValue != ConstantValue.Unset); 1806Debug.Assert(false); // Add test if this code path is reachable 1812Debug.Assert(conversion.IsCollectionExpression); 1828Debug.Assert(collection.IsParamsArrayOrCollection); 2340Debug.Assert(!syntaxIsOk); 2341Debug.Assert(indexerAccess.AccessorKind == AccessorKind.Unknown); 2357Debug.Assert(!resolution.IsNonMethodExtensionMember(out _));
Binder\Binder_Lambda.cs (6)
43Debug.Assert(syntax != null); 44Debug.Assert(syntax.IsAnonymousFunction()); 295Debug.Assert(syntax is not ScopedTypeSyntax); 360Debug.Assert(syntax != null); 361Debug.Assert(syntax.IsAnonymousFunction()); 429Debug.Assert(s_lambdaBindings is null);
Binder\Binder_Lookup.cs (33)
69Debug.Assert(options.AreValid()); 73Debug.Assert((binder != null) || result.IsClear); 80Debug.Assert(binder == otherBinder); 83Debug.Assert(result.IsMultiViable || result.IsClear || result.Error != null); 90Debug.Assert(result.IsClear); 91Debug.Assert(options.AreValid()); 156Debug.Assert(options.AreValid()); 167Debug.Assert(result.IsMultiViable || result.IsClear || result.Error != null); 172Debug.Assert(options.AreValid()); 174Debug.Assert(arity >= 0); 432Debug.Assert(result.Symbols.All(IsMethodOrIndexer)); 572Debug.Assert(result.IsClear); 573Debug.Assert(options.AreValid()); 574Debug.Assert(options.IsAttributeTypeLookup()); 626Debug.Assert(resultWithSuffix != null); 702Debug.Assert(!best.IsNone); 703Debug.Assert(!secondBest.IsNone); 761Debug.Assert((object)symbol != null); 771Debug.Assert((object)symbol != null); 787Debug.Assert(!diagnose || useSiteInfo.AccumulatesDiagnostics); 893Debug.Assert((object)type != null); 894Debug.Assert(!type.IsInterfaceType() && type.TypeKind != TypeKind.TypeParameter); 1112Debug.Assert((object)type != null); 1113Debug.Assert(type.IsInterface); 1240Debug.Assert((object)type != null); 1241Debug.Assert(type.IsInterface); 1258Debug.Assert((object)typeParameter != null); 1277Debug.Assert(!TypeSymbol.Equals(baseType, derivedType, TypeCompareKind.ConsiderEverything2)); 1475Debug.Assert((options & LookupOptions.MustBeAbstractOrVirtual) == 0 || (options & LookupOptions.MustNotBeInstance) != 0); 1634Debug.Assert(symbol.MustCallMethodsDirectly()); 1674Debug.Assert(aliasSymbol == null || aliasSymbol.GetAliasTarget(basesBeingResolved: null) == symbol); 1675Debug.Assert(options.AreValid()); 1866Debug.Assert(object.ReferenceEquals(namedType.ConstructedFrom, namedType));
Binder\Binder_Operators.cs (112)
65Debug.Assert(left.Type is { }); 129Debug.Assert(ordinaryInstanceOperatorName is not null); 257Debug.Assert(leftType is { }); 272Debug.Assert(finalConversion.HasErrors || (object)finalConversion == finalPlaceholder); 301Debug.Assert(left.Kind != BoundKind.EventAccess || hasError); 328Debug.Assert(!left.HasDynamicType()); 370Debug.Assert(leftType is not null); 398Debug.Assert(analyzedArguments is not null); 415Debug.Assert(!methods.IsEmpty); 420Debug.Assert(leftType is not null); 471Debug.Assert(method.ContainingType.ExtensionParameter is not null); 486Debug.Assert(conversion.Kind is ConversionKind.ImplicitReference); 487Debug.Assert(leftType.IsReferenceType); 583Debug.Assert(ordinaryInstanceOperatorName is not null); 653Debug.Assert(opKind == BinaryOperatorKind.Addition || opKind == BinaryOperatorKind.Subtraction); 738Debug.Assert(operand != null); 768Debug.Assert((object)left.Type != null && left.Type.IsDynamic() || (object)right.Type != null && right.Type.IsDynamic()); 798Debug.Assert(left.Type is not TypeParameterSymbol); 850Debug.Assert(IsSimpleBinaryOperator(node.Kind())); 950Debug.Assert(right.Type.SpecialType == SpecialType.System_String); 1030Debug.Assert((object)signature.LeftType != null); 1031Debug.Assert((object)signature.RightType != null); 1044Debug.Assert(conversionDiagnostics != diagnostics); 1048Debug.Assert(sourceBag is not null); 1179Debug.Assert(current.IsUnconvertedInterpolatedStringAddition); 1201Debug.Assert(left != null); 1233Debug.Assert(!conversion.IsImplicit); 1257Debug.Assert(!right.Type.IsReferenceType); 1261Debug.Assert(!left.Type.IsReferenceType); 1303Debug.Assert(node.Kind() == SyntaxKind.LogicalOrExpression || node.Kind() == SyntaxKind.LogicalAndExpression); 1342Debug.Assert(kind == BinaryOperatorKind.LogicalAnd || kind == BinaryOperatorKind.LogicalOr); 1437Debug.Assert(trueOperator != null && falseOperator != null); 1447Debug.Assert(conversion.IsImplicit); 1477Debug.Assert(bothBool); 1478Debug.Assert(!(signature.Method?.ContainingType?.IsInterface ?? false)); 1527Debug.Assert(left.IsLiteralNull()); 1558Debug.Assert(userDefinedOperator is not null); 1564Debug.Assert(implicitConversion.IsImplicit); 1581Debug.Assert(signature.Kind.OperandTypes() == BinaryOperatorKind.UserDefined); 1582Debug.Assert(signature.Method is not null); 1821Debug.Assert(bestTrue is { HasValue: true }); 1822Debug.Assert(bestFalse is { HasValue: true }); 1823Debug.Assert(!bestTrue.GetValueOrDefault().Signature.Kind.IsLifted()); 1824Debug.Assert(!bestFalse.GetValueOrDefault().Signature.Kind.IsLifted()); 2258Debug.Assert(valueLeft != null); 2259Debug.Assert(valueRight != null); 2289Debug.Assert(valueLeft != null); 2290Debug.Assert(valueRight != null); 2332Debug.Assert(valueLeft != null); 2333Debug.Assert(valueRight != null); 2388Debug.Assert(valueLeft != null); 2389Debug.Assert(valueRight != null); 2484Debug.Assert(left != null); 2485Debug.Assert(right != null); 2486Debug.Assert(kind.IsEnum()); 2487Debug.Assert(!kind.IsLifted()); 2530Debug.Assert(resultTypeSymbol.SpecialType == SpecialType.System_Boolean); 2559Debug.Assert(left != null); 2560Debug.Assert(right != null); 2743Debug.Assert(valueLeft != null); 2744Debug.Assert(valueRight != null); 2975Debug.Assert(valueLeft != null); 2976Debug.Assert(valueRight != null); 3066Debug.Assert(operandType is not null); 3093Debug.Assert(ordinaryInstanceOperatorName is not null); 3168Debug.Assert(hasErrors || (object)resultConversion == resultPlaceholder); 3209Debug.Assert(operandType is not null); 3210Debug.Assert(!operandType.IsDynamic()); 3211Debug.Assert(kind is (UnaryOperatorKind.PrefixIncrement or UnaryOperatorKind.PrefixDecrement or UnaryOperatorKind.PostfixIncrement or UnaryOperatorKind.PostfixDecrement)); 3254Debug.Assert(operand.Type is not null); 3255Debug.Assert(mode != InstanceUserDefinedIncrementUsageMode.None); 3276Debug.Assert(analyzedArguments is not null); 3294Debug.Assert(!methods.IsEmpty); 3297Debug.Assert(operandType is not null); 3347Debug.Assert(method.ContainingType.ExtensionParameter is not null); 3362Debug.Assert(conversion.Kind is ConversionKind.ImplicitReference); 3363Debug.Assert(operandType.IsReferenceType); 3442Debug.Assert(operand.Type is not null); 3462Debug.Assert(ordinaryInstanceOperatorName is not null); 3505Debug.Assert(mode != InstanceUserDefinedIncrementUsageMode.None); 3525Debug.Assert(parameterCount is 0 or 1); 3531Debug.Assert(SyntaxFacts.IsCheckedOperator(checkedName)); 3589Debug.Assert(parameterCount is 0 or 1); 3600Debug.Assert(parameterCount is 0 or 1); 3605Debug.Assert(SyntaxFacts.IsCheckedOperator(checkedName)); 3645Debug.Assert(extensionDeclaration.IsExtension); 3685Debug.Assert(!x.IsOverride); 3686Debug.Assert(!x.IsStatic); 3688Debug.Assert(!y.IsOverride); 3689Debug.Assert(!y.IsStatic); 3698Debug.Assert(!method.IsOverride); 3699Debug.Assert(!method.IsStatic); 3757Debug.Assert((methodOpt.Name == WellKnownMemberNames.UnsignedRightShiftOperatorName) == isUnsignedRightShift); 3794Debug.Assert(node.Operand.SkipParens().GetLastToken().Kind() == SyntaxKind.ExclamationToken); 3864Debug.Assert(hasErrors); 4190Debug.Assert(operand != null); 4468Debug.Assert(valueRight != null); 4662Debug.Assert((object)operandType != null); 4711Debug.Assert(constantValue == ConstantValue.True || constantValue == ConstantValue.False); 4733Debug.Assert((object)targetType != null); 4774Debug.Assert((object)operandType != null); 4874Debug.Assert(operandType is TypeParameterSymbol { AllowsRefLikeType: false }); 4882Debug.Assert(targetType is TypeParameterSymbol { AllowsRefLikeType: false }); 4951Debug.Assert(operandType.IsNullableType()); 5008Debug.Assert(targetType.IsNullableType()); 5123Debug.Assert(operand.Type is null); 5139Debug.Assert((object)operandType != null); 5270Debug.Assert(constantValue.IsNull); 5527Debug.Assert((object)leftType != null); 5703Debug.Assert(type is { }); 5704Debug.Assert(Conversions.HasIdentityConversion(trueType, type)); 5705Debug.Assert(Conversions.HasIdentityConversion(falseType, type));
Binder\Binder_Patterns.cs (20)
38Debug.Assert(expression.Type is { }); 66Debug.Assert(expression.Type is object); 83Debug.Assert(expression.Type is object); 241Debug.Assert(indexerAccess is BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess or BoundBadExpression or BoundDynamicIndexerAccess); 249Debug.Assert(indexerAccess.Type is not null); 323Debug.Assert(indexerAccess!.Type is not null); 358Debug.Assert(!inputType.IsDynamic()); 390Debug.Assert(indexerAccess is BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess or BoundBadExpression or BoundDynamicIndexerAccess); 516Debug.Assert(expression is { Kind: BoundKind.TypeExpression, Type: { } }); 581Debug.Assert(hasErrors); 832Debug.Assert(!conversion.IsUserDefined || result == ConstantValue.False || result == ConstantValue.Bad); 860Debug.Assert(declType.HasType); 907Debug.Assert(designation.SyntaxTree.Options.Kind != SourceCodeKind.Regular); 1244Debug.Assert(!declType.IsTupleType); 1245Debug.Assert(!IsZeroElementTupleType(declType)); 1365Debug.Assert(node.Parent is { }); 1590Debug.Assert(boundMember.HasAnyErrors); 1635Debug.Assert(type is { }); 1787Debug.Assert(!permitDesignations); 1821Debug.Assert(spoiler.Equals(bestSoFar, TypeCompareKind.ConsiderEverything));
Binder\Binder_Query.cs (9)
300Debug.Assert(state.fromExpression.Type is { }); 689Debug.Assert(LambdaUtilities.IsQueryPairLambda(node)); 741Debug.Assert(yExpression.Type is { }); 836Debug.Assert(lambdaSymbol != null); 867Debug.Assert(node is ExpressionSyntax || LambdaUtilities.IsQueryPairLambda(node)); 920Debug.Assert(expectedMethodName is null || expectedMethodName == methodName); 928Debug.Assert(receiver.Type is object || ultimateReceiver.Type is null); 931Debug.Assert(ultimateReceiver.Kind != BoundKind.MethodGroup || ultimateReceiver.HasAnyErrors); 1019Debug.Assert(receiver == originalUltimateReceiver);
Binder\Binder_QueryErrors.cs (1)
215Debug.Assert(methodName == "SelectMany");
Binder\Binder_Statements.cs (83)
59Debug.Assert(node != null); 189Debug.Assert(fixedBinder != null); 203Debug.Assert(!declarations.IsEmpty); 298Debug.Assert(lockBinder != null); 310Debug.Assert(usingBinder != null); 339Debug.Assert(binder != null); 348Debug.Assert(binder != null); 354Debug.Assert(binder != null); 593Debug.Assert(blockBody != null || expressionBody != null || (localSymbol.IsExtern && localSymbol.IsStatic) || hasErrors); 703Debug.Assert(usingDeclaration is BoundUsingLocalDeclarations); 758Debug.Assert(expr is object); 759Debug.Assert(expr.Type is object); 760Debug.Assert(expr.Type.IsRefLikeType || hasAwait); // pattern dispose lookup is only valid on ref structs or asynchronous usings 788Debug.Assert( 798Debug.Assert(typeSyntax is not ScopedTypeSyntax); 800Debug.Assert(declType.HasType || isVar); 960Debug.Assert(declarator != null); 986Debug.Assert(declarator != null); 987Debug.Assert(declTypeOpt.HasType || isVar); 988Debug.Assert(typeSyntax != null); 1071Debug.Assert(declTypeOpt.HasType); 1224Debug.Assert(!ReferenceEquals(declType, null)); 1225Debug.Assert(declType.IsPointerType()); 1361Debug.Assert(initializer != null); 1404Debug.Assert(node != null); 1405Debug.Assert(node.Left != null); 1406Debug.Assert(node.Right != null); 1480Debug.Assert(op1 != null); 1481Debug.Assert(op2 != null); 1487Debug.Assert(!op1.NeedsToBeConverted() 1549Debug.Assert(op1 != null); 1550Debug.Assert(op2 != null); 1554Debug.Assert(op1.Type is { }); 1587Debug.Assert(leftEscape.Equals(rightEscape) || op1.Type.IsRefLikeOrAllowsRefLikeType()); 1595Debug.Assert(op1.Kind != BoundKind.Parameter); // If the assert fails, add a corresponding test. 1629Debug.Assert(false); 1830Debug.Assert((object)receiver.Type != null); 1841Debug.Assert(node != null); 1886Debug.Assert(binder != null); 1937Debug.Assert((object)targetType != null); 1938Debug.Assert(expression != null); 2017Debug.Assert((object)targetType != null); 2018Debug.Assert(anonymousFunction != null); 2074Debug.Assert(targetType.IsExpressionTree()); 2081Debug.Assert(targetType.IsGenericOrNonGenericExpressionType(out _)); 2119Debug.Assert(delegateType is not null); 2177Debug.Assert(diagnostics.DiagnosticBag?.Count is not 0); 2200Debug.Assert(anonymousFunction.HasExplicitlyTypedParameterList); 2204Debug.Assert(anonymousFunction.ParameterCount == delegateParameters.Length); 2210Debug.Assert(!lambdaParameterType.IsErrorType()); 2232Debug.Assert(ErrorFacts.PreventsSuccessfulDelegateConversion(bindingResult.Diagnostics.Diagnostics)); 2250Debug.Assert(!conversion.IsImplicit || !conversion.IsValid); 2284Debug.Assert(conversion.IsUserDefined); 2322Debug.Assert(operand != null); 2323Debug.Assert((object)targetType != null); 2414Debug.Assert(reportedError); 2434Debug.Assert(reportedError); 2574Debug.Assert(b != null); 2754Debug.Assert(node != null); 2771Debug.Assert(node != null); 2774Debug.Assert(loopBinder != null); 2786Debug.Assert(loopBinder != null); 2799Debug.Assert(loopBinder != null); 2817Debug.Assert(typeSyntax is not ScopedTypeSyntax || localKind is LocalDeclarationKind.RegularVariable or LocalDeclarationKind.UsingVariable); 2837Debug.Assert(declType.HasType || isVar); 2841Debug.Assert(count > 0); 3154Debug.Assert(returnRefKind == RefKind.None); 3216Debug.Assert(node != null); 3264Debug.Assert((object)type != null); 3300Debug.Assert(((object)type == null) || !type.IsErrorType()); 3342Debug.Assert(binder != null); 3350Debug.Assert(local.Type.IsErrorType() || (TypeSymbol.Equals(local.Type, type, TypeCompareKind.ConsiderEverything2))); 3492Debug.Assert(expressionSyntax != null || !IsValidExpressionBody(expressionSyntax, expression)); 3582Debug.Assert(bodyBinder != null); 3603Debug.Assert(bodyBinder != null); 3615Debug.Assert(bodyBinder != null); 3617Debug.Assert(body.Kind() != SyntaxKind.RefExpression); 3695Debug.Assert(typeDecl.ParameterList is object); 3696Debug.Assert(typeDecl.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.StructDeclaration); 3703Debug.Assert(initializerBinder != null); 3737Debug.Assert(bodyBinder != null); 3790Debug.Assert(!this.ContainingMember().IsImplicitlyDeclared); 3833Debug.Assert(sourceConstructor?.SyntaxNode is TypeDeclarationSyntax
Binder\Binder_Symbols.cs (34)
40Debug.Assert(isVar == symbol.IsDefault); 60Debug.Assert((keyword != ConstraintContextualKeyword.None) == symbol.IsDefault); 81Debug.Assert(isVar == symbol.IsDefault); 274Debug.Assert(UnwrapAliasNoDiagnostics(symbol) is NamespaceSymbol); 322Debug.Assert(diagnostics != null); 396Debug.Assert(!result.IsDefault); 1132Debug.Assert(syntax != null); 1133Debug.Assert(diagnostics != null); 1314Debug.Assert(lookupResult.Error != null); 1347Debug.Assert(typeArguments.Count > 0); 1447Debug.Assert(colorColorValueReceiver is null || (methodGroupFlags & BoundMethodGroupFlags.SearchExtensions) != 0); 1482Debug.Assert(haveStaticCandidates); 1537Debug.Assert(lookupResult?.IsClear != false); 1540Debug.Assert(haveStaticCandidates || haveInstanceCandidates); 1584Debug.Assert(!typeArguments.IsEmpty); 1738Debug.Assert(symbol.IsDefinition); 1830Debug.Assert((syntax != null) ^ (location != null)); 1950Debug.Assert(where != null); 1951Debug.Assert(diagnostics != null); 1973Debug.Assert(!best.IsNone); 1974Debug.Assert(!secondBest.IsNone); 1989Debug.Assert(best.IsFromAddedModule); 2084Debug.Assert(!best.IsFromCorLibrary); 2096Debug.Assert(best.IsFromCompilation); 2132Debug.Assert(secondBest.IsFromAddedModule); 2143Debug.Assert(best.IsFromAddedModule); 2167Debug.Assert(arg2.ContainingAssembly == Compilation.Assembly); 2447Debug.Assert(location != BestSymbolLocation.None); 2474Debug.Assert(secondLocation != 0); 2521Debug.Assert(!first.IsNone); 2522Debug.Assert(!second.IsNone); 2584Debug.Assert(qualifierOpt.IsNamespace); 2590Debug.Assert(aliasOpt == null || aliasOpt == SyntaxFacts.GetText(SyntaxKind.GlobalKeyword)); 2687Debug.Assert(false);
Binder\Binder_TupleOperators.cs (7)
56Debug.Assert(length == multiple.Operators.Length); 185Debug.Assert((object)left.Type != null && left.Type.IsDynamic() || (object)right.Type != null && right.Type.IsDynamic()); 219Debug.Assert((object)left.Type != null || left.Kind == BoundKind.TupleLiteral); 220Debug.Assert((object)right.Type != null || right.Kind == BoundKind.TupleLiteral); 236Debug.Assert(length == rightParts.Length); 286Debug.Assert(leftNoNames || rightNoNames || leftNames.Length == rightNames.Length); 334Debug.Assert(targetType.StrippedType().IsTupleType);
Binder\Binder_XmlNameAttribute.cs (3)
41Debug.Assert(lookupResult.IsMultiViable); 45Debug.Assert(lookupSymbols[0].Kind == SymbolKind.TypeParameter || lookupSymbols[0].Kind == SymbolKind.Parameter); 46Debug.Assert(lookupSymbols.All(sym => sym.Kind == lookupSymbols[0].Kind));
Binder\BinderFactory.BinderFactoryVisitor.cs (21)
29Debug.Assert((memberDeclarationOpt == null) == (memberOpt == null)); 423Debug.Assert(!accessor.IsIterator); 440Debug.Assert(containingSymbol is NamespaceSymbol); 526Debug.Assert(basePropertyDeclarationSyntax.Kind() == SyntaxKind.PropertyDeclaration || basePropertyDeclarationSyntax.Kind() == SyntaxKind.IndexerDeclaration); 562Debug.Assert(kind is SymbolKind.Method or SymbolKind.Property or SymbolKind.Event); 633Debug.Assert(syntaxTree != null); 642Debug.Assert(syntaxTree != null); 900Debug.Assert(name is not QualifiedNameSyntax); 911Debug.Assert(outer is SimpleProgramUnitBinder); 924Debug.Assert(!inUsing); 957Debug.Assert((object)compilation.ScriptClass != null); 1035Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 1072Debug.Assert(token == this.syntaxTree.GetRoot().GetLastToken()); 1255Debug.Assert(type.IsExtension); 1292Debug.Assert(property.SetMethod.ParameterCount > 0); 1307Debug.Assert((object)delegateType != null); 1309Debug.Assert((object)invokeMethod != null); 1391Debug.Assert(crefSyntax != null); 1392Debug.Assert(memberSyntax != null); 1434Debug.Assert(xmlSyntax is XmlAttributeSyntax || xmlSyntax.Kind() == SyntaxKind.XmlEmptyElement || xmlSyntax.Kind() == SyntaxKind.XmlElementStartTag); 1469Debug.Assert(curr != null);
Binder\BinderFactory.cs (2)
126Debug.Assert(node != null); 158Debug.Assert(typeDecl.ParameterList is not null);
Binder\BlockBinder.cs (1)
29Debug.Assert(block != null);
Binder\CatchClauseBinder.cs (1)
23Debug.Assert(syntax != null);
Binder\ContextualAttributeBinder.cs (1)
28Debug.Assert(symbol is not null);
Binder\DecisionDagBuilder.cs (39)
287Debug.Assert(pattern.HasErrors || pattern.InputType.Equals(input.Type, TypeCompareKind.AllIgnoreOptions) || pattern.InputType.IsErrorType()); 384Debug.Assert(input.Index == 0); 407Debug.Assert(variableAccess.Type!.Equals(input.Type, TypeCompareKind.AllIgnoreOptions) || variableAccess.Type.IsErrorType()); 461Debug.Assert(!conversion.IsUserDefined); 500Debug.Assert(constant.Value.Type is not null || constant.HasErrors); 505Debug.Assert(input.Source is BoundDagPropertyEvaluation { IsLengthOrCount: true }); 587Debug.Assert(recursive.HasAnyErrors); 697Debug.Assert(bin.HasErrors || output.Type.Equals(bin.NarrowedType, TypeCompareKind.AllIgnoreOptions)); 709Debug.Assert(type is { }); 761Debug.Assert(kvp.Key == kvp.Value); 907Debug.Assert(!first.IsImpossible); 931Debug.Assert(e.Input.IsEquivalentTo(e.Target)); 976Debug.Assert(_defaultLabel != null); 977Debug.Assert(defaultDecision != null); 1177Debug.Assert(e.IsLengthOrCount); 1183Debug.Assert(input.Index == 0); 1198Debug.Assert(input.Index == 0); 1470Debug.Assert(s1LengthTemp.Syntax is ListPatternSyntax); 1471Debug.Assert(s2LengthTemp.Syntax is ListPatternSyntax); 1477Debug.Assert(s1LengthTemp.IsEquivalentTo(s2LengthTemp)); 1485Debug.Assert(state.RemainingValues.ContainsKey(s1LengthTemp)); 1489Debug.Assert(!lengthValues.IsEmpty); 1783Debug.Assert(arrayBuilder != null); 1890Debug.Assert(dagState.RemainingValues is null); 1891Debug.Assert(dagState.SelectedTest is null); 1892Debug.Assert(dagState.TrueBranch is null); 1893Debug.Assert(dagState.FalseBranch is null); 1894Debug.Assert(dagState.Dag is null); 2171Debug.Assert(relationEffect is True or One(BoundDagAssignmentEvaluation)); 2224Debug.Assert(t.Value.Discriminator == ConstantValueTypeDiscriminator.Int32); 2225Debug.Assert(t.Relation == BinaryOperatorKind.GreaterThanOrEqual); 2226Debug.Assert(t.Value.Int32Value >= 0); 2239Debug.Assert(t.Value.Discriminator == ConstantValueTypeDiscriminator.Int32); 2243Debug.Assert(t.Value.Discriminator == ConstantValueTypeDiscriminator.Int32); 2267Debug.Assert(value >= 0); // Tests with negative values should never be created. 2268Debug.Assert(offset >= 0); // The number of elements in a list is always non-negative. 2326Debug.Assert(remainingTests.Length > 1); 2391Debug.Assert(t2 is not (True or False)); 2471Debug.Assert(t2 is not (True or False));
Binder\DecisionDagBuilder_ListPatterns.cs (10)
16Debug.Assert(input.Type.IsErrorType() || list.HasErrors || list.InputType.IsErrorType() || 39Debug.Assert(list.LengthAccess is not null); 41Debug.Assert(lengthProperty is not null); 59Debug.Assert(slice.IndexerAccess is not null); 60Debug.Assert(index <= 0); 61Debug.Assert(slice.ReceiverPlaceholder is not null); 62Debug.Assert(slice.ArgumentPlaceholder is not null); 75Debug.Assert(list.IndexerAccess is not null); 76Debug.Assert(list.ReceiverPlaceholder is not null); 77Debug.Assert(list.ArgumentPlaceholder is not null);
Binder\EarlyWellKnownAttributeBinder.cs (1)
59Debug.Assert(node != null);
Binder\EmbeddedStatementBinder.cs (1)
27Debug.Assert(statement != null);
Binder\ExecutableCodeBinder.cs (1)
41Debug.Assert((object)memberSymbol == null ||
Binder\ExpressionListVariableBinder.cs (1)
22Debug.Assert(expressions.Count > 0);
Binder\ExpressionVariableFinder.cs (7)
27Debug.Assert(node != null); 55Debug.Assert(node.Parent is ConstructorInitializerSyntax || node.Parent is PrimaryConstructorBaseTypeSyntax); 58Debug.Assert(node is ExpressionSyntax); 115Debug.Assert(nodes.Count > 0); 226Debug.Assert(node.Designation == null || node.Designation.Kind() == SyntaxKind.DiscardDesignation); 265Debug.Assert(node.Designation is null or SingleVariableDesignationSyntax or DiscardDesignationSyntax); 277Debug.Assert(node.Designation is null or SingleVariableDesignationSyntax or DiscardDesignationSyntax);
Binder\FixedStatementBinder.cs (1)
25Debug.Assert(syntax != null);
Binder\ForEachEnumeratorInfo.cs (6)
72Debug.Assert(patternDisposeInfo == null || needsDisposal); 73Debug.Assert(inlineArraySpanType is WellKnownType.Unknown or WellKnownType.System_Span_T or WellKnownType.System_ReadOnlySpan_T); 74Debug.Assert(inlineArraySpanType == WellKnownType.Unknown || 76Debug.Assert(!inlineArrayUsedAsValue || inlineArraySpanType != WellKnownType.Unknown); 122Debug.Assert(MoveNextInfo != null); 123Debug.Assert(CurrentPropertyGetter != null);
Binder\ForEachLoopBinder.cs (44)
43Debug.Assert(syntax != null); 315Debug.Assert(declType.HasType); 468Debug.Assert(!IsDisallowedExtensionInOlderLangVer(getEnumeratorMethod)); 476Debug.Assert(!IsDisallowedExtensionInOlderLangVer(builder.MoveNextInfo.Method)); 477Debug.Assert(!IsDisallowedExtensionInOlderLangVer(builder.CurrentPropertyGetter)); 555Debug.Assert(collectionConversionClassification.IsValid); 556Debug.Assert(currentConversionClassification.IsValid || 579Debug.Assert( 643Debug.Assert(!collectionConversionClassification.IsUserDefined); 656Debug.Assert(collectionConversionClassification.IsIdentity); 657Debug.Assert(convertedCollectionExpression == (object)collectionExpr); 658Debug.Assert(collectionType.Equals(collectionExpr.Type, TypeCompareKind.AllIgnoreOptions)); // Should not create an Identity conversion that changes type. 684Debug.Assert(!isAsync || !isSpread); 779Debug.Assert(!isAsync || !isSpread); 876Debug.Assert(span == originalSpan); 877Debug.Assert(!builder.ViaExtensionMethod || builder.GetEnumeratorInfo.Method.IsExtensionMethod || builder.GetEnumeratorInfo.Method.GetIsNewExtensionMember()); 884Debug.Assert(builder.CollectionType == (object)spanType); 922Debug.Assert(collectionExpr == originalCollectionExpr || 924Debug.Assert(!builder.ViaExtensionMethod || builder.GetEnumeratorInfo.Method.IsExtensionMethod || builder.GetEnumeratorInfo.Method.GetIsNewExtensionMember()); 952Debug.Assert(collectionExpr.HasAnyErrors); // should already have been reported 1033Debug.Assert((object)builder.GetEnumeratorInfo != null); 1035Debug.Assert(!(viaExtensionMethod && builder.GetEnumeratorInfo.Method.IsExtensionMethod && builder.GetEnumeratorInfo.Method.Parameters.IsDefaultOrEmpty)); 1036Debug.Assert(!(viaExtensionMethod && !builder.GetEnumeratorInfo.Method.IsExtensionMethod && !builder.GetEnumeratorInfo.Method.GetIsNewExtensionMember())); 1094Debug.Assert((object)builder.CollectionType != null); 1111Debug.Assert(IsIAsyncEnumerable(collectionType.OriginalDefinition)); 1117Debug.Assert(getEnumeratorMethod is null or { ParameterCount: 1 }); 1128Debug.Assert(collectionType.OriginalDefinition.SpecialType == SpecialType.System_Collections_Generic_IEnumerable_T); 1149Debug.Assert(enumeratorType.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IAsyncEnumerator_T))); 1187Debug.Assert(collectionType.SpecialType == SpecialType.System_Collections_IEnumerable); 1194Debug.Assert((object)builder.GetEnumeratorInfo == null || 1230Debug.Assert(!patternDisposeMethod.IsExtensionMethod && !patternDisposeMethod.GetIsNewExtensionMember()); 1231Debug.Assert(patternDisposeMethod.ParameterRefKinds.IsDefaultOrEmpty || 1251Debug.Assert(argsToParams.IsDefault); 1272Debug.Assert(!enumeratorType.IsRefLikeType); // Ref like types are supposed to be structs, therefore, sealed. 1333Debug.Assert((object)builder.GetEnumeratorInfo == null || 1383Debug.Assert(lookupResult.IsClear); 1506Debug.Assert(argsToParams.IsDefault); 1552Debug.Assert(result.IsExtensionMethod || result.GetIsNewExtensionMember()); 1573Debug.Assert(!collectionConversion.IsUserDefined); 1645Debug.Assert((object)builder.GetEnumeratorInfo.Method != null); 1698Debug.Assert((object)lookupSymbol != null); 1950Debug.Assert(resolvedMember is null or { ParameterCount: 0 }); 1959Debug.Assert((extensionReceiverOpt != null) == method.IsExtensionMethod); 1986Debug.Assert(argsToParams.IsDefault);
Binder\ForLoopBinder.cs (3)
24Debug.Assert(syntax != null); 108Debug.Assert(increment.Kind != BoundKind.StatementList || ((BoundStatementList)increment).Statements.Length > 1); 128Debug.Assert(this.Locals == this.GetDeclaredLocalsForScope(node));
Binder\HostObjectModeBinder.cs (1)
27Debug.Assert((object)result != null);
Binder\ImportChain.cs (4)
24Debug.Assert(imports != null); 39Debug.Assert(result); 40Debug.Assert(!imports.IsDefault); 107Debug.Assert(!symbol.IsExtern);
Binder\Imports.cs (10)
41Debug.Assert(usingAliases != null); 42Debug.Assert(!usings.IsDefault); 43Debug.Assert(!externs.IsDefault); 67Debug.Assert(previousSubmissionImports != null); 68Debug.Assert(newSubmission.IsSubmission); 93Debug.Assert(newSubmission.IsSubmission); 156Debug.Assert(usingAliases != null); 157Debug.Assert(!usings.IsDefault); 158Debug.Assert(!externs.IsDefault); 173Debug.Assert(otherImports != null);
Binder\InContainerBinder.cs (2)
31Debug.Assert((object)container != null); 114Debug.Assert(result.IsClear);
Binder\InMethodBinder.cs (4)
44Debug.Assert(!enclosing.Flags.Includes(BinderFlags.InCatchFilter)); 45Debug.Assert((object)owner != null); 197Debug.Assert(result.IsClear); 247Debug.Assert(!locations.IsEmpty || parameter.IsImplicitlyDeclared);
Binder\InSubmissionClassBinder.cs (2)
29Debug.Assert(submissionClass.IsSubmissionClass); 50Debug.Assert(result.IsClear);
Binder\LocalBinderFactory.cs (25)
136Debug.Assert((object)containingMemberOrLambda != null); 137Debug.Assert(containingMemberOrLambda.Kind != SymbolKind.Local && containingMemberOrLambda.Kind != SymbolKind.RangeVariable && containingMemberOrLambda.Kind != SymbolKind.Parameter); 175Debug.Assert(node.ParameterList is object); 176Debug.Assert(node.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration); 288Debug.Assert((current.Flags & BinderFlags.InContextualAttributeBinder) != 0); 291Debug.Assert(contextualAttributeBinder is not null); 333Debug.Assert(false); 347Debug.Assert(false); 354Debug.Assert(delegateType.IsDelegateType()); 360Debug.Assert(false); 367Debug.Assert(parameters[^1] is SynthesizedAccessorValueParameterSymbol); 535Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 548Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 576Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 586Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 596Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 642Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 695Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 731Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 879Debug.Assert((object)_containingMemberOrLambda == _enclosing.ContainingMemberOrLambda); 919Debug.Assert(_map.TryGetValue(node.Block, out finallyBinder) && finallyBinder.Flags.Includes(BinderFlags.InFinallyBlock)); 1012Debug.Assert(node.CanHaveAssociatedLocalBinder() || 1024Debug.Assert(!_map.TryGetValue(node, out existing) || existing == binder || existing == binder.Next || existing == binder.Next?.Next); 1052Debug.Assert((object)_containingMemberOrLambda == enclosing.ContainingMemberOrLambda); 1057Debug.Assert((object)_containingMemberOrLambda == enclosing.ContainingMemberOrLambda);
Binder\LocalInProgressBinder.cs (1)
35Debug.Assert(_localSymbol is not null);
Binder\LocalScopeBinder.cs (5)
134Debug.Assert(array.Length > 0); 276Debug.Assert(statementBinder != null); // Lock always has a binder. 424Debug.Assert(options.AreValid()); 425Debug.Assert(result.IsClear); 464Debug.Assert(options.AreValid());
Binder\LockBinder.cs (1)
70Debug.Assert(this.Locals.IsDefaultOrEmpty);
Binder\LockOrUsingBinder.cs (3)
44Debug.Assert(targetExpressionSyntax.Parent.Kind() == SyntaxKind.LockStatement || 73Debug.Assert(_lazyLockedOrDisposedVariables != null); 95Debug.Assert(_lazyExpressionAndDiagnostics != null);
Binder\LookupSymbolsInfo.cs (1)
38Debug.Assert(info.Count == 0);
Binder\MethodArgumentInfo.cs (1)
36Debug.Assert(method.ParameterCount == 0);
Binder\MethodGroupResolution.cs (6)
46Debug.Assert((methodGroup != null) || ((object)otherSymbol != null) || analyzedArguments == null); // analyzedArguments is only set if we have some result 47Debug.Assert((methodGroup == null) || (methodGroup.Methods.Count > 0)); 48Debug.Assert((methodGroup == null) || ((object)otherSymbol == null)); 50Debug.Assert(((object)otherSymbol == null) || (otherSymbol.Kind != SymbolKind.Method)); 51Debug.Assert(resultKind != LookupResultKind.Ambiguous); // HasAnyApplicableMethod is expecting Viable methods. 96Debug.Assert((extensionMember is not null) || !isExtensionMember);
Binder\ParamsCollectionTypeInProgressBinder.cs (1)
22Debug.Assert(inProgress is not null);
Binder\PatternExplainer.cs (7)
47Debug.Assert(!nodes.Contains(x)); 84Debug.Assert(next != null); 85Debug.Assert(distance(next) == (d - 1)); 328Debug.Assert(sense); // we have dropped failing type tests 441Debug.Assert(e == slice); 586Debug.Assert(typeName != null || deconstruction != null || propertyString != null); 673Debug.Assert(underlyingType.IsNativeIntegerType);
Binder\RefSafetyAnalysis.cs (20)
178Debug.Assert(_localEscapeScopes?.ContainsKey(local) == true || _symbol != local.ContainingSymbol); 187Debug.Assert(_localEscapeScopes?.ContainsKey(local) == true); 194Debug.Assert(_placeholderScopes?.ContainsKey(placeholder) != true); 206Debug.Assert(_placeholderScopes?.ContainsKey(placeholder) == true); 216Debug.Assert(_placeholderScopes?.ContainsKey(placeholder) == true); 279Debug.Assert(ContainsPlaceholderScope(placeholder)); 295Debug.Assert(ContainsPlaceholderScope(placeholder)); 429Debug.Assert(_localEscapeScopes?.ContainsKey(node.LocalSymbol) == true || 457Debug.Assert(_localEscapeScopes?.ContainsKey(local) != true); 471Debug.Assert(_localEscapeScopes is { }); 492Debug.Assert(localSymbol.RefKind == RefKind.None || 717Debug.Assert(node.InitialBindingReceiverIsSubjectToCloning != ThreeState.Unknown); 744Debug.Assert(interpolationData.ReceiverPlaceholder is not null); 754Debug.Assert(receiver != null); 765Debug.Assert(placeholder.Type.SpecialType == SpecialType.System_Boolean); 893Debug.Assert(node.InitialBindingReceiverIsSubjectToCloning != ThreeState.Unknown); 899Debug.Assert(node.InitialBindingReceiverIsSubjectToCloning != ThreeState.Unknown); 966Debug.Assert(node.ArgumentPlaceholders.All(p => p is BoundImplicitIndexerValuePlaceholder { Type.SpecialType: SpecialType.System_Int32 })); 987Debug.Assert(conversion.Kind == ConversionKind.Deconstruction); 1015Debug.Assert(parameters.Length - offset == n);
Binder\SafeContext.cs (2)
66Debug.Assert(_value >= ReturnOnlyRaw); 76Debug.Assert(_value >= CurrentMethodRaw);
Binder\Semantics\AccessCheck.cs (22)
69Debug.Assert(symbol is object); 142Debug.Assert((object)symbol != null); 143Debug.Assert((object)within != null); 144Debug.Assert(within.IsDefinition); 145Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol); 225Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol); 226Debug.Assert((object)type != null); 261Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol); 262Debug.Assert((object)assembly != null); 307Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol); 308Debug.Assert((object)containingType != null); 464Debug.Assert(current.IsDefinition); 497Debug.Assert(within is NamedTypeSymbol || within is AssemblySymbol); 518Debug.Assert((object)withinType != null); 519Debug.Assert((object)originalContainingType != null); 520Debug.Assert(originalContainingType.IsDefinition); 527Debug.Assert(current.IsDefinition); 551Debug.Assert(type.IsDefinition); 552Debug.Assert(baseType.IsDefinition); 570Debug.Assert(current.IsDefinition); 602Debug.Assert(!result); 613Debug.Assert(currentBase.IsDefinition);
Binder\Semantics\BestTypeInferrer.cs (3)
72Debug.Assert(!NullableWalker.IsTargetTypedExpression(expr)); 137Debug.Assert(!NullableWalker.IsTargetTypedExpression(expr1)); 152Debug.Assert(!NullableWalker.IsTargetTypedExpression(expr2));
Binder\Semantics\Conversions\Conversion.cs (11)
98Debug.Assert(!deconstructConversionInfo.IsDefaultOrEmpty); 115Debug.Assert(collectionExpressionTypeKind != CollectionExpressionTypeKind.None); 116Debug.Assert(elementType is { }); 182Debug.Assert(kind == ConversionKind.Deconstruction); 195Debug.Assert(_kind is ConversionKind.MethodGroup or ConversionKind.IntPtr or ConversionKind.ImplicitUserDefined or ConversionKind.ExplicitUserDefined); 202Debug.Assert(_kind.IsDynamic()); 203Debug.Assert(_uncommonData == null); 350Debug.Assert(kind == ConversionKind.ImplicitNullable || kind == ConversionKind.ExplicitNullable); 412Debug.Assert((_uncommonData as NestedUncommonData)?._nestedConversionsChecked ?? true); 583Debug.Assert(!this.IsUserDefined); 1256Debug.Assert(invocation is not BoundCall { Expanded: true });
Binder\Semantics\Conversions\Conversions.cs (11)
40Debug.Assert(IncludeNullability != includeNullability); 58Debug.Assert(methodSymbol == ((NamedTypeSymbol)destination).DelegateInvokeMethod); 105Debug.Assert(!resolution.IsNonMethodExtensionMember(out _)); 152Debug.Assert(source is BoundUnconvertedInterpolatedString); 185Debug.Assert(elementType is { }); 270Debug.Assert(!resolution.IsNonMethodExtensionMember(out _)); 330Debug.Assert((object)method != null); 333Debug.Assert(method.IsExtensionMethod || method.GetIsNewExtensionMember()); 502Debug.Assert(method.ParameterCount == parameterCount + (isExtensionMethod ? 1 : 0)); 511Debug.Assert((object)sourceExpression.Type == null); 512Debug.Assert((object)sourceExpression.ElementType != null);
Binder\Semantics\Conversions\ConversionsBase.cs (153)
35Debug.Assert((object)corLibrary != null); 36Debug.Assert(otherNullabilityOpt == null || includeNullability != otherNullabilityOpt.IncludeNullability); 37Debug.Assert(otherNullabilityOpt == null || currentRecursionDepth == otherNullabilityOpt.currentRecursionDepth); 38Debug.Assert(corLibrary == corLibrary.CorLibrary); 60Debug.Assert(_lazyOtherNullability.IncludeNullability == includeNullability); 61Debug.Assert(_lazyOtherNullability._lazyOtherNullability == this); 100Debug.Assert(sourceExpression != null); 101Debug.Assert(Compilation != null); 102Debug.Assert((object)destination != null); 171Debug.Assert((object)source != null); 172Debug.Assert((object)destination != null); 221Debug.Assert(false); 236Debug.Assert((object)source != null); 237Debug.Assert((object)destination != null); 285Debug.Assert(sourceExpression != null); 286Debug.Assert(Compilation != null); 287Debug.Assert((object)destination != null); 319Debug.Assert((object)source != null); 320Debug.Assert((object)destination != null); 377Debug.Assert(source != null); 378Debug.Assert(Compilation != null); 379Debug.Assert((object)destination != null); 431Debug.Assert((object)source != null); 432Debug.Assert((object)destination != null); 501Debug.Assert((object)source != null); 502Debug.Assert((object)destination != null); 543Debug.Assert(sourceExpression is null || Compilation is not null); 544Debug.Assert(sourceExpression != null || (object)source != null); 545Debug.Assert((object)destination != null); 607Debug.Assert(sourceExpression is null || Compilation is not null); 608Debug.Assert(sourceExpression != null || (object)source != null); 609Debug.Assert(sourceExpression == null || (object)sourceExpression.Type == (object)source); 610Debug.Assert((object)destination != null); 647Debug.Assert(isStandardImplicitConversionFromExpression(conversion.Kind)); 698Debug.Assert(conversion.Kind == ConversionKind.NoConversion || IsStandardImplicitConversionFromType(conversion.Kind)); 703Debug.Assert((object)source != null); 704Debug.Assert((object)destination != null); 724Debug.Assert(false); 765Debug.Assert((object)source != null); 766Debug.Assert((object)destination != null); 795Debug.Assert((object)source != null); 796Debug.Assert((object)destination != null); 805Debug.Assert(!HasExplicitNumericConversion(source, destination)); 952Debug.Assert((object)baseType != null); 953Debug.Assert((object)derivedType != null); 987Debug.Assert((object)derivedType != null); 988Debug.Assert((object)baseType != null); 1031Debug.Assert(sourceExpression is null || Compilation is not null); 1032Debug.Assert(sourceExpression != null || (object)source != null); 1033Debug.Assert(sourceExpression == null || (object)sourceExpression.Type == (object)source); 1034Debug.Assert((object)destination != null); 1186Debug.Assert(Compilation is not null); 1215Debug.Assert(Compilation is not null); 1233Debug.Assert((object)source != null); 1234Debug.Assert((object)destination != null); 1295Debug.Assert(Compilation is not null); 1321Debug.Assert(Compilation is not null); 1403Debug.Assert(sourceExpression != null); 1404Debug.Assert(Compilation != null); 1405Debug.Assert((object)destination != null); 1443Debug.Assert((object)source != null); 1444Debug.Assert((object)destination != null); 1469Debug.Assert((object)anonymousFunction != null); 1470Debug.Assert((object)type != null); 1588Debug.Assert((object)anonymousFunction != null); 1589Debug.Assert((object)type != null); 1590Debug.Assert(type.IsExpressionTree()); 1626Debug.Assert((object)anonymousFunction != null); 1627Debug.Assert((object)type != null); 1643Debug.Assert(source != null); 1644Debug.Assert((object)destination != null); 1656Debug.Assert(compilation is { }); 1731Debug.Assert((object)sourceType != null); 1732Debug.Assert(!sourceType.IsValidV6SwitchGoverningType()); 1741Debug.Assert(switchGoverningType.IsValidV6SwitchGoverningType(isTargetTypeOfUserDefinedOp: true)); 1804Debug.Assert((object)type1 != null); 1805Debug.Assert((object)type2 != null); 1891Debug.Assert(IncludeNullability); 1912Debug.Assert((object)thisType != null); 1922Debug.Assert(sourceExpressionOpt is null || Compilation is not null); 1923Debug.Assert(sourceExpressionOpt == null || (object)sourceExpressionOpt.Type == sourceType); 1924Debug.Assert((object)destination != null); 1953Debug.Assert(!IncludeNullability); 2025Debug.Assert(conversion.Kind == ConversionKind.NoConversion); 2034Debug.Assert((object)source != null); 2035Debug.Assert((object)destination != null); 2050Debug.Assert(conversionKind is ConversionKind.ImplicitNumeric or ConversionKind.ExplicitNumeric); 2123Debug.Assert((object)source != null); 2124Debug.Assert((object)target != null); 2209Debug.Assert((object)source != null); 2210Debug.Assert((object)destination != null); 2238Debug.Assert((object)source != null); 2239Debug.Assert((object)destination != null); 2284Debug.Assert(Compilation is not null); 2288Debug.Assert(!IncludeNullability); 2302Debug.Assert(Compilation is not null); 2306Debug.Assert(!IncludeNullability); 2327Debug.Assert(Compilation is not null); 2338Debug.Assert(arguments.Length == targetElementTypes.Length); 2433Debug.Assert((object)source != null); 2434Debug.Assert((object)destination != null); 2488Debug.Assert((object)source != null); 2489Debug.Assert((object)destination != null); 2510Debug.Assert((object)source != null); 2511Debug.Assert((object)destination != null); 2526Debug.Assert((object)destination != null); 2535Debug.Assert((object)source != null); 2536Debug.Assert((object)destination != null); 2542Debug.Assert((object)source != null); 2543Debug.Assert((object)destination != null); 2623Debug.Assert((object)source != null); 2624Debug.Assert((object)destination != null); 2873Debug.Assert((object)source != null); 2874Debug.Assert((object)destination != null); 2970Debug.Assert((object)derivedType != null); 2971Debug.Assert((object)baseType != null); 3001Debug.Assert(targetInterfaceType.IsErrorType() || targetInterfaceType.IsInterface); 3035Debug.Assert(targetInterfaceType.IsErrorType() || targetInterfaceType.IsInterface); 3069Debug.Assert((object)source != null); 3070Debug.Assert((object)destination != null); 3088Debug.Assert((object)source != null); 3089Debug.Assert((object)destination != null); 3138Debug.Assert((object)source != null); 3139Debug.Assert((object)destination != null); 3157Debug.Assert((object)source != null); 3158Debug.Assert((object)destination != null); 3170Debug.Assert(TypeSymbol.Equals(source.OriginalDefinition, destination.OriginalDefinition, TypeCompareKind.AllIgnoreOptions)); 3250Debug.Assert((object)source != null); 3251Debug.Assert((object)destination != null); 3304Debug.Assert((object)source != null); 3305Debug.Assert((object)destination != null); 3365Debug.Assert((object)source != null); 3366Debug.Assert((object)destination != null); 3433Debug.Assert((object)source != null); 3434Debug.Assert((object)destination != null); 3456Debug.Assert((object)source != null); 3457Debug.Assert((object)destination != null); 3530Debug.Assert((object)source != null); 3531Debug.Assert((object)destination != null); 3582Debug.Assert((object)source != null); 3583Debug.Assert((object)destination != null); 3633Debug.Assert((object)source != null); 3634Debug.Assert((object)destination != null); 3722Debug.Assert((object)source != null); 3723Debug.Assert((object)destination != null); 3814Debug.Assert((object)source != null); 3815Debug.Assert((object)destination != null); 3882Debug.Assert((object)source != null); 3883Debug.Assert((object)destination != null); 3890Debug.Assert((object)source != null); 3891Debug.Assert((object)destination != null); 3908Debug.Assert((object)source != null); 3909Debug.Assert((object)destination != null);
Binder\Semantics\Conversions\TypeConversions.cs (1)
32Debug.Assert(IncludeNullability != includeNullability);
Binder\Semantics\Conversions\UserDefinedExplicitConversions.cs (19)
27Debug.Assert(sourceExpression is null || Compilation is not null); 28Debug.Assert(sourceExpression != null || (object)source != null); 29Debug.Assert((object)target != null); 94Debug.Assert(sourceExpression is null || Compilation is not null); 95Debug.Assert(sourceExpression != null || (object)source != null); 96Debug.Assert((object)target != null); 97Debug.Assert(d != null); 98Debug.Assert(u != null); 106Debug.Assert(constrainedToTypeOpt is not null); 152Debug.Assert(sourceExpression is null || Compilation is not null); 153Debug.Assert(sourceExpression != null || (object)source != null); 154Debug.Assert((object)target != null); 155Debug.Assert(u != null); 156Debug.Assert((object)declaringType != null); 327Debug.Assert(liftedFromConversion.Exists); 328Debug.Assert(liftedToConversion.Exists); 481Debug.Assert(expr is null || Compilation is not null); 482Debug.Assert(expr != null || (object)a != null); 483Debug.Assert((object)b != null);
Binder\Semantics\Conversions\UserDefinedImplicitConversions.cs (17)
31Debug.Assert(sourceExpression is null || Compilation is not null); 32Debug.Assert(sourceExpression != null || (object)source != null); 33Debug.Assert((object)target != null); 151Debug.Assert(sourceExpression is null || Compilation is not null); 152Debug.Assert(sourceExpression != null || (object)source != null); 153Debug.Assert(((object)target != null) == !allowAnyTarget); 154Debug.Assert(d != null); 155Debug.Assert(u != null); 259Debug.Assert(constrainedToTypeOpt is not null); 577Debug.Assert(aExpr is null || Compilation is not null); 578Debug.Assert((object)a != null); 579Debug.Assert((object)b != null); 596Debug.Assert(aExpr is null || Compilation is not null); 597Debug.Assert(aExpr != null || (object)a != null); 598Debug.Assert((object)b != null); 906Debug.Assert((object)source != null); 907Debug.Assert(!source.IsValidV6SwitchGoverningType());
Binder\Semantics\Operators\BinaryOperatorEasyOut.cs (6)
317Debug.Assert(leftConversion.Exists && leftConversion.IsImplicit); 318Debug.Assert(rightConversion.Exists && rightConversion.IsImplicit); 325Debug.Assert(left != null); 326Debug.Assert((object?)left.Type != null); 327Debug.Assert(right != null); 328Debug.Assert((object?)right.Type != null);
Binder\Semantics\Operators\BinaryOperatorOverloadResolution.cs (32)
43Debug.Assert(left != null); 44Debug.Assert(right != null); 67Debug.Assert(left != null); 68Debug.Assert(right != null); 131Debug.Assert((result.Results.Count == 0) != hadApplicableCandidates); 204Debug.Assert((result.Results.Count == 0) != hadApplicableCandidates); 247Debug.Assert(hadUserDefinedCandidateFromInterfaces == candidates.Any(r => r.IsValid)); 299Debug.Assert(hadUserDefinedCandidate == results.Any(r => r.IsValid)); 339Debug.Assert(left != null); 340Debug.Assert(right != null); 479Debug.Assert((object)enumType != null); 488Debug.Assert((object)underlying != null); 489Debug.Assert(underlying.SpecialType != SpecialType.None); 558Debug.Assert((object)pointerType != null); 603Debug.Assert(left != null); 604Debug.Assert(right != null); 692Debug.Assert(left != null); 693Debug.Assert(right != null); 738Debug.Assert(op.LeftType.IsObjectType()); 739Debug.Assert(op.RightType.IsObjectType()); 744Debug.Assert(convLeft.IsImplicit); 745Debug.Assert(convRight.IsImplicit); 840Debug.Assert(op.Signature.Kind.Operator() == existingSignature.Kind.Operator()); 927Debug.Assert(hadApplicableCandidates == results.Any(r => r.IsValid)); 1218Debug.Assert(op1.Priority.HasValue == op2.Priority.HasValue); 1434Debug.Assert(isChecked || name2Opt is null); 1499Debug.Assert(extensionDeclaration.IsExtension); 1555Debug.Assert(lifting is LiftingResult.LiftOperandsAndResult or LiftingResult.LiftOperandsButNotResult); 1586Debug.Assert(candidate.Method.ContainingType.ExtensionParameter is not null); 1605Debug.Assert(extensionParameter is not null); 1612Debug.Assert(operand.Type is not null); 1613Debug.Assert(candidate.Method.ContainingType.ExtensionParameter is not null);
Binder\Semantics\Operators\BinaryOperatorSignature.cs (4)
98Debug.Assert(Method.ParameterCount == 2); 102Debug.Assert(Method.ParameterRefKinds.Length == 2); 120Debug.Assert(Method.ParameterCount == rightIndex + 1); 124Debug.Assert(Method.ParameterRefKinds.Length == rightIndex + 1);
Binder\Semantics\Operators\OperatorKindExtensions.cs (6)
122Debug.Assert(kind == (kind & ~UnaryOperatorKind.TypeMask)); 123Debug.Assert(type == (type & UnaryOperatorKind.TypeMask)); 149Debug.Assert(kind == (kind & ~BinaryOperatorKind.TypeMask)); 167Debug.Assert(kind == (kind & ~UnaryOperatorKind.TypeMask)); 185Debug.Assert(kind == (kind & ~BinaryOperatorKind.TypeMask)); 186Debug.Assert(type == (type & BinaryOperatorKind.TypeMask));
Binder\Semantics\Operators\UnaryOperatorEasyOut.cs (1)
116Debug.Assert(conversion.HasValue && conversion.Value.IsImplicit);
Binder\Semantics\Operators\UnaryOperatorOverloadResolution.cs (12)
33Debug.Assert(operand != null); 82Debug.Assert(isChecked || name2Opt is null); 83Debug.Assert(operand.Type is not null); 148Debug.Assert(extensionDeclaration.IsExtension); 226Debug.Assert(operand.Type is not null); 227Debug.Assert(candidate.Method.ContainingType.ExtensionParameter is not null); 231Debug.Assert(operand.Type.IsNullableType()); 256Debug.Assert(x is { }); 257Debug.Assert(y is { }); 542Debug.Assert(operand != null); 573Debug.Assert(operand != null); 604Debug.Assert(operand != null);
Binder\Semantics\Operators\UnaryOperatorSignature.cs (2)
52Debug.Assert(Method.ParameterCount == 1); 56Debug.Assert(Method.ParameterRefKinds.Length == 1);
Binder\Semantics\OverloadResolution\ArgumentAnalysisResult.cs (2)
21Debug.Assert(arg >= 0); 26Debug.Assert(arg < ArgsToParamsOpt.Length);
Binder\Semantics\OverloadResolution\CallingConventionInfo.cs (1)
17Debug.Assert(unmanagedCallingConventionTypes.IsEmpty || callKind == Cci.CallingConvention.Unmanaged);
Binder\Semantics\OverloadResolution\MemberAnalysisResult.cs (10)
31Debug.Assert(!_argumentsCoerced); 53Debug.Assert(!_argumentsCoerced); 67Debug.Assert(!_argumentsCoerced); 81Debug.Assert(!_argumentsCoerced); 130Debug.Assert(kind != MemberResolutionKind.ApplicableInExpandedForm || definitionParamsElementTypeOpt.HasType); 131Debug.Assert(kind != MemberResolutionKind.ApplicableInExpandedForm || paramsElementTypeOpt.HasType); 166Debug.Assert(arg >= 0); 171Debug.Assert(arg < ArgsToParamsOpt.Length); 325Debug.Assert(conversions.Length != 0); 326Debug.Assert(badArguments.TrueBits().Any());
Binder\Semantics\OverloadResolution\MethodGroup.cs (7)
54Debug.Assert(method.IsExtensionMethod || method.GetIsNewExtensionMember()); 129Debug.Assert(this.Receiver == null); 130Debug.Assert(this.Methods.Count == 0); 131Debug.Assert(this.TypeArguments.Count == 0); 132Debug.Assert(!this.IsExtensionMethodGroup); 133Debug.Assert(this.Error == null); 134Debug.Assert(this.ResultKind == LookupResultKind.Empty);
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (132)
283Debug.Assert(!methodTypeParameters.IsDefault); 284Debug.Assert(methodTypeParameters.Length > 0); 285Debug.Assert(!formalParameterTypes.IsDefault); 286Debug.Assert(formalParameterRefKinds.IsDefault || formalParameterRefKinds.Length == formalParameterTypes.Length); 287Debug.Assert(!arguments.IsDefault); 343Debug.Assert(ordinals is null || ordinals.Values.Count() == ordinals.Values.Distinct().Count()); 344Debug.Assert(ordinals is null || methodTypeParameters.All(tp => ordinals.ContainsKey(tp))); 352Debug.Assert(_nullableAnnotationLowerBounds.All(annotation => annotation.IsNotAnnotated())); 441Debug.Assert(0 <= index && index < _formalParameterTypes.Length); 496Debug.Assert(ValidIndex(methodTypeParameterIndex)); 502Debug.Assert(type.HasType); 537Debug.Assert(IsUnfixedTypeParameter(methodTypeParameterWithAnnotations)); 552Debug.Assert(ValidIndex(methodTypeParameterIndex)); 560Debug.Assert((object)delegateOrFunctionPointerType != null); 561Debug.Assert(delegateOrFunctionPointerType.IsDelegateType() || delegateOrFunctionPointerType is FunctionPointerTypeSymbol); 601Debug.Assert(!_formalParameterTypes.IsDefault); 602Debug.Assert(!_arguments.IsDefault); 669Debug.Assert(targetType is { }); 703Debug.Assert(target.Type is { }); 742Debug.Assert(sourceArguments.Length == destTypes.Length); 800Debug.Assert(res != InferenceResult.NoProgress); 939Debug.Assert(sourceArguments.Length == destTypes.Length); 1126Debug.Assert(ValidIndex(iParam)); 1127Debug.Assert(ValidIndex(jParam)); 1139Debug.Assert(IsUnfixed(iParam)); 1140Debug.Assert(IsUnfixed(jParam)); 1192Debug.Assert(_dependencies == null); 1196Debug.Assert(0 == (int)Dependency.Unknown); 1213Debug.Assert(_dependencies != null); 1219Debug.Assert(0 <= iParam && iParam < _methodTypeParameters.Length); 1220Debug.Assert(0 <= jParam && jParam < _methodTypeParameters.Length); 1232Debug.Assert(_dependencies != null); 1233Debug.Assert(ValidIndex(iParam)); 1234Debug.Assert(ValidIndex(jParam)); 1268Debug.Assert(_dependencies != null); 1289Debug.Assert(_dependencies != null); 1304Debug.Assert(_dependencies != null); 1322Debug.Assert(ValidIndex(iParam)); 1337Debug.Assert(ValidIndex(iParam)); 1350Debug.Assert(ValidIndex(iParam)); 1369Debug.Assert(expression != null); 1370Debug.Assert(target.HasType); 1402Debug.Assert(source != null); 1403Debug.Assert(target.HasType); 1430Debug.Assert(inferredReturnType.Type is not FunctionTypeSymbol); 1438Debug.Assert(source != null); 1439Debug.Assert((object)target != null); 1521Debug.Assert(!resolution.IsNonMethodExtensionMember(out _)); 1547Debug.Assert(source != null); 1548Debug.Assert(target.HasType); 1602Debug.Assert(source != null); 1603Debug.Assert(target.HasType); 1638Debug.Assert(source.HasType); 1639Debug.Assert(target.HasType); 1692Debug.Assert(source.HasType); 1693Debug.Assert(target.HasType); 1707Debug.Assert(source.HasType); 1708Debug.Assert(target.HasType); 1739Debug.Assert(source is not null); 1740Debug.Assert(target is not null); 1766Debug.Assert(type.IsSpan() || type.IsReadOnlySpan()); 1802Debug.Assert(source.HasType); 1803Debug.Assert(target.HasType); 1831Debug.Assert(source.HasType); 1832Debug.Assert(target.HasType); 1858Debug.Assert(source.HasType); 1859Debug.Assert(target.HasType); 1942Debug.Assert((object)source != null); 1943Debug.Assert((object)target != null); 1944Debug.Assert(TypeSymbol.Equals(source.OriginalDefinition, target.OriginalDefinition, TypeCompareKind.ConsiderEverything2)); 1969Debug.Assert(source.HasType); 1970Debug.Assert(target.HasType); 2063Debug.Assert(source.HasType); 2064Debug.Assert(target.HasType); 2078Debug.Assert((object)source != null); 2079Debug.Assert((object)target != null); 2113Debug.Assert((object)source != null); 2114Debug.Assert((object)target != null); 2151Debug.Assert(source is not null); 2152Debug.Assert(target is not null); 2194Debug.Assert((object)source != null); 2195Debug.Assert((object)target != null); 2258Debug.Assert((object)source != null); 2259Debug.Assert((object)target != null); 2303Debug.Assert((object)source != null); 2304Debug.Assert((object)target != null); 2384Debug.Assert((object)source != null); 2385Debug.Assert((object)target != null); 2386Debug.Assert(TypeSymbol.Equals(source.OriginalDefinition, target.OriginalDefinition, TypeCompareKind.ConsiderEverything2)); 2478Debug.Assert(source.HasType); 2479Debug.Assert(target.HasType); 2512Debug.Assert(source.Type.IsReferenceType || source.Type.IsFunctionPointer()); 2539Debug.Assert(source.HasType); 2540Debug.Assert(target.HasType); 2553Debug.Assert(source.HasType); 2554Debug.Assert(target.HasType); 2595Debug.Assert(sourceWithAnnotations.HasType); 2596Debug.Assert(targetWithAnnotations.HasType); 2655Debug.Assert((object)source != null); 2656Debug.Assert((object)target != null); 2684Debug.Assert((object)source != null); 2685Debug.Assert((object)target != null); 2734Debug.Assert((object)source != null); 2735Debug.Assert((object)target != null); 2736Debug.Assert(TypeSymbol.Equals(source.OriginalDefinition, target.OriginalDefinition, TypeCompareKind.ConsiderEverything2)); 2827Debug.Assert(IsUnfixed(iParam)); 2849Debug.Assert(best.Type.Type.Equals(withoutNullability.Type, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 2881Debug.Assert(!containsFunctionTypes(exact)); 2882Debug.Assert(!containsFunctionTypes(upper)); 2972Debug.Assert(!best.Equals(candidate, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 3063Debug.Assert((object)target != null); 3064Debug.Assert(target.IsDelegateType()); 3067Debug.Assert(!target.DelegateInvokeMethod.ReturnsVoid); 3071Debug.Assert(!HasUnfixedParamInInputType(source, target)); 3157Debug.Assert(target.IsInterface); 3194Debug.Assert(extension is not null); 3195Debug.Assert(extension.Arity > 0); 3196Debug.Assert(extension.ExtensionParameter is not null); 3197Debug.Assert(!extension.ExtensionParameter.Type.IsDynamic()); 3198Debug.Assert(extension.IsDefinition); 3199Debug.Assert(receiver is not null); 3262Debug.Assert((object)method != null); 3263Debug.Assert(method.Arity > 0); 3264Debug.Assert(!arguments.IsDefault); 3273Debug.Assert(!method.GetParameterType(0).IsDynamic()); 3300Debug.Assert(!_formalParameterTypes.IsDefault); 3301Debug.Assert(_formalParameterTypes.Length >= 1); 3302Debug.Assert(!_arguments.IsDefault); 3303Debug.Assert(_arguments.Length >= 1); 3322Debug.Assert(IsUnfixed(iParam)); 3392Debug.Assert(conversions.IncludeNullability || 3423Debug.Assert(variance == VarianceKind.In || variance == VarianceKind.Out);
Binder\Semantics\OverloadResolution\OverloadResolution.cs (82)
103Debug.Assert(!dynamicResolution || arguments.HasDynamicArgument); 149Debug.Assert((options & Options.DynamicResolution) == 0 || arguments.HasDynamicArgument); 150Debug.Assert((options & Options.InferWithDynamic) == 0 || (options & Options.DynamicResolution) == 0); 151Debug.Assert((options & Options.IsFunctionPointerResolution) == 0 || (options & Options.DynamicResolution) == 0); 152Debug.Assert((options & Options.IsMethodGroupConversion) == 0 || (options & Options.DynamicResolution) == 0); 153Debug.Assert((options & Options.InferWithDynamic) == 0 || (options & Options.IsMethodGroupConversion) != 0); 173Debug.Assert(!dynamicResolution || arguments.HasDynamicArgument); 515Debug.Assert(hidden == hidden.ConstructedFrom()); 563Debug.Assert(funcPtrBuilder[0].Arity == 0); 671Debug.Assert(expectedConvention.UnmanagedCallingConventionTypes is not null); 672Debug.Assert(expectedConvention.UnmanagedCallingConventionTypes.IsEmpty || expectedConvention.CallKind == Cci.CallingConvention.Unmanaged); 674Debug.Assert(!_binder.IsEarlyAttributeBinder); 692Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyData, UnmanagedCallersOnlyAttributeData.AttributePresentDataNotBound) 715Debug.Assert(unmanagedCallingConventionTypes.All(u => FunctionPointerTypeSymbol.IsCallingConventionModifier((NamedTypeSymbol)u))); 858Debug.Assert(typeof(TMember) == typeof(MethodSymbol)); 936Debug.Assert(!MemberAnalysisResult.UnsupportedMetadata().HasUseSiteDiagnosticToReportFor(constructor)); 1036Debug.Assert(!constructor.IsVararg); 1052Debug.Assert(!result.IsValid || result.Kind == MemberResolutionKind.ApplicableInExpandedForm); 1069Debug.Assert(checkOverriddenOrHidden || containingTypeMapOpt is null); 1070Debug.Assert((options & Options.IgnoreNormalFormIfHasValidParamsParameter) == 0 || (options & Options.IsMethodGroupConversion) == 0); 1155Debug.Assert(!MemberAnalysisResult.UnsupportedMetadata().HasUseSiteDiagnosticToReportFor(member)); 1237Debug.Assert(!normalResult.IsValid); 1368Debug.Assert(elementType.Type is { }); 1883Debug.Assert(memberWithPriority is not null); 1914Debug.Assert(previousResults.All(r => r.MemberWithPriority.GetOverloadResolutionPriority() == previousPriority)); 2058Debug.Assert(worse[i] != notBetterThanEverything || i == notBestIdx); 2062Debug.Assert(worse[notBestIdx] == notBetterThanEverything); 2067Debug.Assert(countOfNotBestCandidates > 1); 2099Debug.Assert(extensionParameter is not null); 2117Debug.Assert(m1.Result.IsValid); 2118Debug.Assert(m2.Result.IsValid); 2119Debug.Assert(arguments != null); 2157Debug.Assert(m1.Result.IsValid); 2158Debug.Assert(m2.Result.IsValid); 2159Debug.Assert(arguments != null); 2194Debug.Assert(i == arguments.Count - 1); 2195Debug.Assert(m1.Member.GetIsVararg() && m2.Member.GetIsVararg()); 2295Debug.Assert(result == r); 2296Debug.Assert(result == BetterResult.Left || result == BetterResult.Right); 2336Debug.Assert(i == arguments.Count - 1); 2337Debug.Assert(m1.Member.GetIsVararg() && m2.Member.GetIsVararg()); 2389Debug.Assert(m1.Result.Kind != MemberResolutionKind.ApplicableInExpandedForm); 2496Debug.Assert(i == arguments.Count - 1); 2497Debug.Assert(m1.Member.GetIsVararg() && m2.Member.GetIsVararg()); 2601Debug.Assert(paramsElementTypeOpt.HasType); 2602Debug.Assert(paramsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel); 2619Debug.Assert(m.Result.IsValid); 2660Debug.Assert(!isInterpolatedStringHandlerConversion || arguments[i] is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true }); 2799Debug.Assert(arr1.HasSameShapeAs(arr2)); 2815Debug.Assert(t1.IsDynamic() && t2.IsDynamic() || 2830Debug.Assert(((object)n1 == null) == ((object)n2 == null)); 2899Debug.Assert(refKind1 == RefKind.None || refKind1 == RefKind.Ref); 2900Debug.Assert(refKind2 == RefKind.None || refKind2 == RefKind.Ref); 3111Debug.Assert(underlyingElementConversions1.Length == underlyingElementConversions2.Length && underlyingElementConversions1.Length == collectionExpressionElements.Length); 3177Debug.Assert(!Conversions.HasIdentityConversion(t1, t2)); 3195Debug.Assert(kind1 is not (CollectionExpressionTypeKind.ReadOnlySpan or CollectionExpressionTypeKind.Span)); 3382Debug.Assert(sourceArguments.Length == destTypes.Length); 3702Debug.Assert((r1.IsVoidType()) == (r2.IsVoidType())); 3706Debug.Assert(!r1.IsVoidType()); 3707Debug.Assert(!r2.IsVoidType()); 3708Debug.Assert(!Conversions.HasIdentityConversion(r1, r2)); 3719Debug.Assert(currentResult == BetterResult.Right); 3724Debug.Assert(currentResult == BetterResult.Left); 3746Debug.Assert( 3864Debug.Assert(firstParamsElementIndex == -1 || (firstParamsElementIndex >= 0 && firstParamsElementIndex < types.Length)); 3881Debug.Assert(argumentRefKinds != null); 3896Debug.Assert(member.ContainingType.ExtensionParameter is not null); 3998Debug.Assert(compilation is not null); 4042Debug.Assert(argumentRefKinds != null); 4065Debug.Assert(paramsIterationType.HasType); 4141Debug.Assert(!hasAnyRefOmittedArgument || (options & Options.AllowRefOmittedArguments) != 0); 4210Debug.Assert(!hasAnyRefOmittedArgument || (options & Options.AllowRefOmittedArguments) != 0); 4227Debug.Assert(!result.Result.IsValid || result.Result.Kind == MemberResolutionKind.ApplicableInExpandedForm); 4249Debug.Assert(GetConstructedFrom(leastOverriddenMember) == (object)leastOverriddenMember); 4386Debug.Assert(isNewExtensionMember); 4388Debug.Assert(!result.IsDefaultOrEmpty); 4575Debug.Assert(candidate is MethodSymbol { MethodKind: MethodKind.UserDefinedOperator }); 4607Debug.Assert( 4620Debug.Assert(badArguments.IsNull); 4621Debug.Assert(conversions == null); 4664Debug.Assert(paramsElementTypeOpt.HasType); 4719Debug.Assert(argRefKind != RefKind.None);
Binder\Semantics\OverloadResolution\OverloadResolution_ArgsToParameters.cs (10)
34Debug.Assert(parameters == null || parameters.Length == length); 47Debug.Assert(0 <= argument && argument < _length); 60Debug.Assert(symbol.GetIsNewExtensionMember()); 71Debug.Assert((object)symbol != null); 72Debug.Assert(arguments != null); 286Debug.Assert(expanded); 353Debug.Assert(!parameters.IsDefault); 354Debug.Assert(arguments != null); 355Debug.Assert(arguments.Names.Count == 0); 445Debug.Assert(!(expanded && isMethodGroupConversion));
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (24)
68Debug.Assert(_bestResultState == ThreeState.True && _bestResult.Result.IsValid); 93Debug.Assert(_bestResultState == ThreeState.True); 209Debug.Assert(arguments.Arguments.All(a => a.Display != null)); 414Debug.Assert(!supportedRequiredParameterMissingConflicts); 512Debug.Assert(firstSupported.Member is MethodSymbol { MethodKind: MethodKind.Constructor }); 521Debug.Assert(firstSupported.Member is MethodSymbol { Name: "Add" }); 583Debug.Assert(diagInfo != null); 584Debug.Assert(diagInfo.Severity == DiagnosticSeverity.Error); 597Debug.Assert(firstSupported.Result.Kind == MemberResolutionKind.WrongCallingConvention); 800Debug.Assert(badName != null); 820Debug.Assert(badName != null); 831Debug.Assert(result.Result.BadArgumentsOpt.TrueBits().Count() == 1); 834Debug.Assert(name != null); 860Debug.Assert(badName != null); 903Debug.Assert(badMember.Kind == SymbolKind.Method); 904Debug.Assert(((MethodSymbol)(object)badMember).IsVararg); 1196Debug.Assert(refArg == RefKind.None); 1301Debug.Assert(argument.Kind != BoundKind.OutDeconstructVarPendingInference); 1302Debug.Assert(argument.Kind != BoundKind.OutVariablePendingInference); 1303Debug.Assert(argument.Kind != BoundKind.DiscardExpression || argument.HasExpressionType()); 1304Debug.Assert(argument.Display != null); 1308Debug.Assert((arg == 0) && (parm == arg)); 1309Debug.Assert(!badArg.Result.ConversionForArg(parm).IsImplicit); 1384Debug.Assert(badArg.Result.ParamsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel);
Binder\SwitchBinder.cs (16)
43Debug.Assert(_switchGoverningExpression != null); 95Debug.Assert(labels.Length > 0); 211Debug.Assert(caseLabel.Value != null); 279Debug.Assert((object)constantValue != null); 312Debug.Assert(key != null); 320Debug.Assert((object)label != null); 374Debug.Assert(ScopeDesignator == SwitchSyntax); 377Debug.Assert(binder != null); 417Debug.Assert(conversion.Kind == ConversionKind.ImplicitUserDefined); 418Debug.Assert(conversion.Method.IsUserDefinedConversion()); 419Debug.Assert(conversion.UserDefinedToConversion.IsIdentity); 420Debug.Assert(resultantGoverningType.IsValidV6SwitchGoverningType(isTargetTypeOfUserDefinedOp: true)); 442Debug.Assert((object)switchGoverningExpression.Type == null || switchGoverningExpression.Type.IsVoidType()); 474Debug.Assert(node.Kind() == SyntaxKind.GotoCaseStatement || node.Kind() == SyntaxKind.GotoDefaultStatement); 494Debug.Assert(node.Kind() == SyntaxKind.GotoCaseStatement); 519Debug.Assert(node.Kind() == SyntaxKind.GotoDefaultStatement);
Binder\SwitchBinder_Patterns.cs (3)
31Debug.Assert(SwitchSyntax.Equals(node)); 143Debug.Assert(this.SwitchSyntax == node.Parent.Parent); 189Debug.Assert(sectionBinder != null);
Binder\SwitchExpressionArmBinder.cs (2)
31Debug.Assert(node == _arm); 38Debug.Assert(node == _arm);
Binder\SwitchExpressionBinder.cs (4)
28Debug.Assert(node == SwitchExpressionSyntax); 90Debug.Assert(wasAcyclic); 182Debug.Assert(inputExpression.Type is not null); 193Debug.Assert(inputExpression.Type is not null);
Binder\UsingStatementBinder.cs (9)
85Debug.Assert(boundUsingStatement is BoundUsingStatement); 105Debug.Assert(isUsingDeclaration || usingBinderOpt != null); 119Debug.Assert(expressionOpt is not null); 130Debug.Assert(!declarationsOpt.IsEmpty && declarationsOpt[0].DeclaredTypeOpt != null); 188Debug.Assert(!fromExpression || expressionOpt != null); 224Debug.Assert(argsToParams.IsDefault); 239Debug.Assert((object)disposableInterface != null); 278Debug.Assert(expressionOpt is { }); 283Debug.Assert(declarationTypeOpt is { });
Binder\WhileBinder.cs (3)
24Debug.Assert(syntax != null && (syntax.IsKind(SyntaxKind.WhileStatement) || syntax.IsKind(SyntaxKind.DoStatement))); 34Debug.Assert(this.Locals == this.GetDeclaredLocalsForScope(node)); 44Debug.Assert(this.Locals == this.GetDeclaredLocalsForScope(node));
Binder\WithClassTypeParametersBinder.cs (1)
26Debug.Assert((object)container != null);
Binder\WithExtensionParameterBinder.cs (1)
39Debug.Assert(result.IsClear);
Binder\WithExternAliasesBinder.cs (3)
35Debug.Assert(result.IsClear); 91Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 117Debug.Assert(!externAliases.IsDefault);
Binder\WithExternAndUsingAliasesBinder.cs (6)
28Debug.Assert(!next.WithImportChainEntry); 39Debug.Assert(result.IsClear); 72Debug.Assert(this.Next is WithUsingNamespacesAndTypesBinder); 76Debug.Assert(_lazyImportChain != null); 120Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 234Debug.Assert(!externAliases.IsDefault);
Binder\WithLambdaParametersBinder.cs (1)
89Debug.Assert(result.IsClear);
Binder\WithNullableContextBinder.cs (2)
19Debug.Assert(syntaxTree != null); 20Debug.Assert(position >= 0);
Binder\WithParametersBinder.cs (2)
27Debug.Assert(!parameters.IsDefaultOrEmpty); 53Debug.Assert(result.IsClear);
Binder\WithPrimaryConstructorParametersBinder.cs (1)
66Debug.Assert(result.IsClear);
Binder\WithTypeParametersBinder.cs (1)
40Debug.Assert(result.IsClear);
Binder\WithUsingNamespacesAndTypesBinder.cs (7)
81Debug.Assert(methods.Count == 0); 134Debug.Assert(extensions.Count == 0); 160Debug.Assert(result.IsClear); 271Debug.Assert(_lazyImportChain != null || !_withImportChainEntry); 303Debug.Assert(declarationSyntax.Kind() is SyntaxKind.CompilationUnit or SyntaxKind.NamespaceDeclaration or SyntaxKind.FileScopedNamespaceDeclaration); 333Debug.Assert(declarationSyntax.IsKind(SyntaxKind.CompilationUnit) || declarationSyntax.IsKind(SyntaxKind.NamespaceDeclaration)); 368Debug.Assert(!namespacesOrTypes.IsDefault);
BoundTree\BoundBinaryOperator.UncommonData.cs (1)
56Debug.Assert(interpolatedStringHandlerData is null || !isUnconvertedInterpolatedStringAddition);
BoundTree\BoundBinaryPattern.cs (4)
13Debug.Assert(Left.InputType.Equals(InputType, TypeCompareKind.AllIgnoreOptions)); 17Debug.Assert(Right.InputType.Equals(InputType, TypeCompareKind.AllIgnoreOptions)); 23Debug.Assert(Right.InputType.Equals(Left.NarrowedType, TypeCompareKind.AllIgnoreOptions)); 24Debug.Assert(NarrowedType.Equals(Right.NarrowedType, TypeCompareKind.AllIgnoreOptions));
BoundTree\BoundConstantPattern.cs (1)
13Debug.Assert(NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions) ||
BoundTree\BoundDagEvaluation.cs (3)
48Debug.Assert(result is not null || this is BoundDagAssignmentEvaluation); 131Debug.Assert(IndexerAccess is BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess); 147Debug.Assert(IndexerAccess is BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess);
BoundTree\BoundDecisionDag.cs (2)
81Debug.Assert(wasAcyclic); 108Debug.Assert(!replacement.ContainsKey(node));
BoundTree\BoundDeclarationPattern.cs (1)
13Debug.Assert(DeclaredType is null ?
BoundTree\BoundDiscardExpression.cs (3)
14Debug.Assert(Type is null && type.HasType); 15Debug.Assert(this.IsInferred); 32Debug.Assert(this.Type is { });
BoundTree\BoundDiscardPattern.cs (1)
13Debug.Assert(NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions));
BoundTree\BoundExpression.cs (5)
42Debug.Assert(suppress || !this.IsSuppressed); 226Debug.Assert(false); // Getting here is unexpected. 423Debug.Assert(LogicalOperator.ParameterCount == 2); 424Debug.Assert(TrueOperator.ParameterCount == 1); 425Debug.Assert(FalseOperator.ParameterCount == 1);
BoundTree\BoundExpressionExtensions.cs (1)
137Debug.Assert(expr.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda);
BoundTree\BoundFunctionPointerInvocation.cs (1)
16Debug.Assert(InvokedExpression.Type is FunctionPointerTypeSymbol);
BoundTree\BoundImplicitIndexerAccess.cs (2)
20Debug.Assert(LengthOrCountAccess is BoundPropertyAccess or BoundArrayLength or BoundLocal or BoundBadExpression); 21Debug.Assert(IndexerOrSliceAccess is BoundIndexerAccess or BoundCall or BoundArrayAccess);
BoundTree\BoundInlineArrayAccess.cs (9)
16Debug.Assert(!IsValue || GetItemOrSliceHelper == WellKnownMember.System_ReadOnlySpan_T__get_Item); 18Debug.Assert(Argument.Type is 35Debug.Assert(GetItemOrSliceHelper is 41Debug.Assert(Type.Name == "ReadOnlySpan"); 45Debug.Assert(Type.Name == "Span"); 49Debug.Assert(Type is 62Debug.Assert(((NamedTypeSymbol)Type).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].Equals(Expression.Type?.TryGetInlineArrayElementField()?.TypeWithAnnotations ?? default, TypeCompareKind.ConsiderEverything)); 66Debug.Assert(GetItemOrSliceHelper is 70Debug.Assert(Type.Equals(Expression.Type?.TryGetInlineArrayElementField()?.Type, TypeCompareKind.ConsiderEverything));
BoundTree\BoundIsPatternExpression.cs (2)
17Debug.Assert(negated == this.IsNegated); 27Debug.Assert(!decisionDag.ContainsAnySynthesizedNodes());
BoundTree\BoundITuplePattern.cs (1)
14Debug.Assert(NarrowedType.IsCompilerServicesTopLevelType() && NarrowedType.Name == "ITuple");
BoundTree\BoundListPattern.cs (4)
14Debug.Assert(LengthAccess is null or BoundPropertyAccess or BoundBadExpression); 15Debug.Assert(IndexerAccess is null or BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess or BoundBadExpression or BoundDynamicIndexerAccess); 16Debug.Assert(Binder.GetIndexerOrImplicitIndexerSymbol(IndexerAccess) is var _); 17Debug.Assert(NarrowedType.Equals(InputType.StrippedType(), TypeCompareKind.AllIgnoreOptions));
BoundTree\BoundNegatedPattern.cs (2)
13Debug.Assert(NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions)); 14Debug.Assert(Negated.InputType.Equals(InputType, TypeCompareKind.AllIgnoreOptions));
BoundTree\BoundNode.cs (7)
75Debug.Assert( 157Debug.Assert(original is BoundExpression || !original.IsSuppressed); 360Debug.Assert(value || !IsParamsArrayOrCollection); 361Debug.Assert(!value || 366Debug.Assert(!value || 562Debug.Assert(added); 579Debug.Assert(removed);
BoundTree\BoundNodeExtensions.cs (7)
41Debug.Assert(statement != null); 59Debug.Assert(call != null); 150Debug.Assert(stack.Count == 0); 156Debug.Assert(typeof(TInterpolatedStringType) == typeof(BoundInterpolatedString) || binary.IsUnconvertedInterpolatedStringAddition); 209Debug.Assert(currentBinary.Left is TInterpolatedStringType || result != null); 231Debug.Assert(result != null); 242Debug.Assert(typeof(TInterpolatedStringType) == typeof(BoundInterpolatedString) || binary.IsUnconvertedInterpolatedStringAddition);
BoundTree\BoundRecursivePattern.cs (1)
14Debug.Assert(DeclaredType is null ?
BoundTree\BoundRelationalPattern.cs (1)
13Debug.Assert(NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions) ||
BoundTree\BoundSlicePattern.cs (3)
13Debug.Assert(IndexerAccess is null or BoundIndexerAccess or BoundImplicitIndexerAccess or BoundArrayAccess or BoundBadExpression or BoundDynamicIndexerAccess); 14Debug.Assert(Binder.GetIndexerOrImplicitIndexerSymbol(IndexerAccess) is var _); 15Debug.Assert(NarrowedType.Equals(InputType, TypeCompareKind.AllIgnoreOptions));
BoundTree\BoundStatementExtensions.cs (3)
30Debug.Assert(node != null); 35Debug.Assert(((BoundLabelStatement)node).Label == label); 39Debug.Assert(((BoundLabeledStatement)node).Label == label);
BoundTree\BoundSwitchExpression.cs (1)
29Debug.Assert(!decisionDag.ContainsAnySynthesizedNodes());
BoundTree\BoundSwitchStatement.cs (1)
25Debug.Assert(!decisionDag.ContainsAnySynthesizedNodes());
BoundTree\BoundTreeRewriter.cs (14)
38System.Diagnostics.Debug.Assert(item != null); 69Debug.Assert(symbol is not null); 75Debug.Assert(symbol is not null); 84Debug.Assert(symbol is not null); 90Debug.Assert(symbol is not null); 102Debug.Assert(symbol is not null); 177Debug.Assert(newSymbol is not null); 274Debug.Assert(left is { }); 280Debug.Assert(right is { }); 286Debug.Assert((object)binary == node); 334Debug.Assert((object)ifStatement == node); 368Debug.Assert(left is { }); 374Debug.Assert(right is { }); 379Debug.Assert((object)binary == node);
BoundTree\BoundTreeVisitors.cs (2)
202Debug.Assert(node is BoundExpression or BoundPattern); 221Debug.Assert(saveRecursionDepth == recursionDepth);
BoundTree\BoundTreeWalker.cs (1)
88Debug.Assert(node is BoundExpression or BoundPattern);
BoundTree\BoundTypePattern.cs (1)
13Debug.Assert(NarrowedType.Equals(DeclaredType.Type, TypeCompareKind.AllIgnoreOptions));
BoundTree\Constructors.cs (3)
137Debug.Assert(arguments.IsDefaultOrEmpty || (object)receiverOpt != (object)arguments[0]); 206Debug.Assert(method is ErrorMethodSymbol || arguments[i].Kind == BoundKind.ArgListOperator); 531Debug.Assert((object)type != null);
BoundTree\InterpolatedStringHandlerData.cs (3)
37Debug.Assert(construction is BoundObjectCreationExpression or BoundDynamicObjectCreationExpression or BoundBadExpression); 38Debug.Assert(!placeholders.IsDefault); 41Debug.Assert(!positionInfo.IsDefault);
BoundTree\LengthBasedStringSwitchData.cs (11)
92Debug.Assert(lengthCaseLabels.Length > 0); 107Debug.Assert(charCaseLabels.Length > 0); 122Debug.Assert(stringCaseLabels.Length > 0); 139Debug.Assert(inputCases.All(c => c.value.IsString && c.label is not null)); 168Debug.Assert(stringLength >= 0); 169Debug.Assert(casesWithGivenLength.All(c => c.value.Length == stringLength)); 170Debug.Assert(casesWithGivenLength.Length > 0); 206Debug.Assert(stringLength > 0); 207Debug.Assert(caseLabels.Length > 0); 234Debug.Assert(caseLabel.value is not null); 255Debug.Assert(cases.Length > 0 && cases.All(c => c.value is not null));
BoundTree\NullabilityRewriter.cs (7)
39Debug.Assert(rewrittenConsequence is { }); 87Debug.Assert(stack.Count > 0); 133Debug.Assert(currentBinary != null); 208Debug.Assert(updatedContaining is object); 213Debug.Assert(updatedDelegateType is object); 219Debug.Assert(lambda.ParameterCount == updatedLambda.ParameterCount); 285Debug.Assert(updatedSymbol is object);
BoundTree\OutDeconstructVarPendingInference.cs (1)
16Debug.Assert(Placeholder is null);
BoundTree\TupleBinaryOperatorInfo.cs (5)
73Debug.Assert(Kind.IsUserDefined() == (MethodSymbolOpt is { })); 111Debug.Assert(leftConvertedTypeOpt is null || leftConvertedTypeOpt.StrippedType().IsTupleType); 112Debug.Assert(rightConvertedTypeOpt is null || rightConvertedTypeOpt.StrippedType().IsTupleType); 113Debug.Assert(!operators.IsDefault); 114Debug.Assert(operators.IsEmpty || operators.Length > 1); // an empty array is used for error cases, otherwise tuples must have cardinality > 1
BoundTree\UnboundLambda.cs (28)
87Debug.Assert( 137Debug.Assert(!UnboundLambda.HasExplicitReturnType(out _, out _)); 138Debug.Assert(conversions != null); 188Debug.Assert(!node.UnboundLambda.HasExplicitReturnType(out _, out _)); 195Debug.Assert(!node.HasExplicitReturnType(out _, out _)); 228Debug.Assert(bestType.Type is not FunctionTypeSymbol); 407Debug.Assert(binder != null); 408Debug.Assert(syntax.IsAnonymousFunction()); 537Debug.Assert(binder != null); 538Debug.Assert(binder.ContainingMemberOrLambda != null); 551Debug.Assert(unbound != null); 552Debug.Assert(_unboundLambda == null || (object)_unboundLambda == unbound); 566Debug.Assert((state._bindingCache == null) != includeCache); 720Debug.Assert(Binder.ContainingMemberOrLambda is { }); 769Debug.Assert(getEffectiveScopeFromSymbol); 774Debug.Assert(lambdaSymbol.Parameters[i].EffectiveScope == parameterScopesBuilder[i]); 797Debug.Assert(Binder.ContainingMemberOrLambda is { }); 1054Debug.Assert(parameterTypes.Length == parameterRefKinds.Length); 1055Debug.Assert(taskLikeReturnTypeOpt is null || ((object)taskLikeReturnTypeOpt == taskLikeReturnTypeOpt.ConstructedFrom && taskLikeReturnTypeOpt.IsCustomTaskType(out var builderArgument))); 1227Debug.Assert(!inferredReturnType.IsExplicitType); 1522Debug.Assert(HasSignature && 0 <= index && index < ParameterCount); 1545Debug.Assert(!_parameterNames.IsDefault && 0 <= index && index < _parameterNames.Length); 1551Debug.Assert(0 <= index && index < this.ParameterCount); 1557Debug.Assert(0 <= index && index < this.ParameterCount); 1563Debug.Assert(0 <= index && index < this.ParameterCount); 1569Debug.Assert(0 <= index && index < this.ParameterCount); 1575Debug.Assert(this.HasExplicitlyTypedParameterList); 1576Debug.Assert(0 <= index && index < _parameterTypesWithAnnotations.Length);
BoundTree\VariablePendingInference.cs (5)
29Debug.Assert(type.HasType); 36Debug.Assert(binderOpt != null || type.HasType); 37Debug.Assert(this.Syntax.Kind() == SyntaxKind.SingleVariableDesignation || 95Debug.Assert(inferenceDiagnostics.DependenciesBag is object); 96Debug.Assert(inferenceDiagnostics.DependenciesBag.Count == 0);
CodeGen\CodeGenerator.cs (18)
92Debug.Assert((object)method != null); 93Debug.Assert(boundBody != null); 94Debug.Assert(builder != null); 95Debug.Assert(moduleBuilder != null); 96Debug.Assert(diagnostics != null); 97Debug.Assert(diagnostics.DiagnosticBag != null); 212Debug.Assert(_asyncCatchHandlerOffset < 0); 213Debug.Assert(_asyncYieldPoints == null); 214Debug.Assert(_asyncResumePoints == null); 225Debug.Assert(_asyncCatchHandlerOffset >= 0); 232Debug.Assert((yieldPoints == null) == (resumePoints == null)); 248Debug.Assert(resumeOffset >= 0); // resume marker should always be reachable from dispatch 311Debug.Assert(_method.ReturnsVoid == (_returnTemp == null)); 443Debug.Assert(node.Syntax is { }); 487Debug.Assert(_emitPdbSequencePoints); 498Debug.Assert(syntaxTree != null); 499Debug.Assert(_emitPdbSequencePoints); 520Debug.Assert(!exprTemps.Contains(temp));
CodeGen\CodeGenerator_HasHome.cs (6)
49Debug.Assert(containingSymbol is object); 125Debug.Assert(HasHome( 131Debug.Assert(HasHome( 178Debug.Assert(containingSymbol is object); 216Debug.Assert(field.RefKind == RefKind.None); 226Debug.Assert(!IsAnyReadOnly(addressKind));
CodeGen\EmitAddress.cs (9)
41Debug.Assert(!expression.Type.IsReferenceType); 42Debug.Assert(!expression.Type.IsValueType || expression.Type.IsNullableType()); 102Debug.Assert(operand.Type.IsPointerType()); 170Debug.Assert(!HasHome(expression, addressKind)); 236Debug.Assert(!expression.Type.IsReferenceType); 237Debug.Assert(!expression.Type.IsValueType); 249Debug.Assert(receiverTemp == null); 530Debug.Assert(receiverType.TypeKind == TypeKind.TypeParameter || receiverType.IsValueType); 536Debug.Assert(!receiverType.IsVerifierReference());
CodeGen\EmitArrayInitializer.cs (15)
150Debug.Assert(!indices.Any()); 467Debug.Assert(!rosPointerCtor.HasUnsupportedMetadata); 511Debug.Assert(arrayType is not null); 512Debug.Assert(elementType is not null); 525Debug.Assert(length is not null); 569Debug.Assert(used); 612Debug.Assert(!createSpan.HasUnsupportedMetadata); 690Debug.Assert(initializer != null); 693Debug.Assert(initializers.All(static init => init.ConstantValueOpt != null)); 694Debug.Assert(!elementType.IsEnumType()); 739Debug.Assert(used); 770Debug.Assert(used); 784Debug.Assert(!rosArrayCtor.HasUnsupportedMetadata); 813Debug.Assert(initializers.Length > 0); 814Debug.Assert(initializers.All(static init => init.ConstantValueOpt != null));
CodeGen\EmitConversion.cs (8)
152Debug.Assert(IsNumeric(toType)); 155Debug.Assert(IsNumeric(fromType)); 156Debug.Assert( 216Debug.Assert(IsNumeric(fromType)); 220Debug.Assert(IsNumeric(toType)); 288Debug.Assert(!conversion.Type.IsNullableType()); 297Debug.Assert(IsNumeric(fromType)); 306Debug.Assert(IsNumeric(toType));
CodeGen\EmitExpression.cs (87)
79Debug.Assert(_recursionDepth == 1); 84Debug.Assert(_recursionDepth == 1); 236Debug.Assert(used); 241Debug.Assert(used); 246Debug.Assert(!used); 251Debug.Assert(used); 256Debug.Assert(used); 261Debug.Assert(used); 266Debug.Assert(used); 271Debug.Assert(used); 276Debug.Assert(used); 281Debug.Assert(used); 316Debug.Assert(used); 362Debug.Assert(expression.Kind != BoundKind.BadExpression); 379Debug.Assert(!expression.Type.IsReferenceType); 380Debug.Assert(!expression.Type.IsValueType); 418Debug.Assert(receiverType.IsVerifierReference()); 522Debug.Assert(receiver.Type.IsNullableType()); 575Debug.Assert(receiverTemp == null); 578Debug.Assert(receiverTemp == null || receiver.IsDefaultValue()); 616Debug.Assert(walker._result.HasValue); 634Debug.Assert(!_result.HasValue); 643Debug.Assert(!_result.HasValue); 654Debug.Assert(!expression.Type.IsValueType); 694Debug.Assert((object)getTypeMethod != null); 729Debug.Assert(refKind is RefKind.Ref or RefKind.Out or RefKindExtensions.StrictIn); 802Debug.Assert((object)meth != null); 809Debug.Assert(thisType.TypeKind != TypeKind.TypeParameter); 859Debug.Assert(sequence.Value.Kind != BoundKind.TypeExpression || !used); 1002Debug.Assert(arguments[i].Kind == BoundKind.ArgListOperator); 1644Debug.Assert(method.IsImplicitlyDeclared); 1645Debug.Assert(TypeSymbol.Equals(method.ContainingType, receiver.Type, TypeCompareKind.ConsiderEverything2)); 1646Debug.Assert(receiver.Kind == BoundKind.ThisReference); 1661Debug.Assert(method.IsStatic); 1722Debug.Assert(!box); 1730Debug.Assert(addressKind.GetValueOrDefault() != AddressKind.Constrained); 1731Debug.Assert(!parentCallReceiverType.IsVerifierValue()); 1732Debug.Assert(parentCallKind != CallKind.ConstrainedCallVirt); 1736Debug.Assert(!box); 1737Debug.Assert(!parentCallReceiverType.IsVerifierReference()); 1767Debug.Assert(receiverUseKind == UseKind.UsedAsValue); 1777Debug.Assert(receiverUseKind == UseKind.UsedAsValue); 1782Debug.Assert(!parentCallReceiverType.IsVerifierReference()); 1786Debug.Assert(receiverUseKind == UseKind.UsedAsValue); 1787Debug.Assert(!HasHome(nested, addressKind.GetValueOrDefault())); 1827Debug.Assert(!method.IsStatic && !method.IsDefaultValueTypeConstructor() && method.RequiresInstanceReceiver); 1867Debug.Assert(TypeSymbol.Equals(receiverType, methodContainingType, TypeCompareKind.ObliviousNullableModifierMatchesAny)); 1908Debug.Assert((callKind != CallKind.ConstrainedCallVirt) || (addressKind.GetValueOrDefault() == AddressKind.Constrained) || receiverType.IsVerifierValue()); 1931Debug.Assert(!box); 1932Debug.Assert(!receiverType.IsVerifierReference()); 1977Debug.Assert(receiver.Type.IsVerifierReference()); 1988Debug.Assert(receiver.Type.IsVerifierReference()); 2154Debug.Assert(!b.OperatorKind.IsUserDefined()); 2167Debug.Assert(!conv.ConversionKind.IsUserDefinedConversion()); 2347Debug.Assert(expression.Type.SpecialType == SpecialType.System_Int32 || 2895Debug.Assert(left.IsRef); 2931Debug.Assert(left.Method.RefKind != RefKind.None); 2942Debug.Assert(left.FunctionPointer.Signature.RefKind != RefKind.None); 3004Debug.Assert(lhs.Kind != BoundKind.Parameter || exprTempsAfter <= exprTempsBefore); 3110Debug.Assert(((BoundDup)expression).RefKind != RefKind.None); 3115Debug.Assert(((BoundConditionalOperator)expression).IsRef); 3133Debug.Assert(((BoundCall)expression).Method.RefKind != RefKind.None); 3138Debug.Assert(((BoundFunctionPointerInvocation)expression).FunctionPointer.Signature.RefKind != RefKind.None); 3189Debug.Assert(thisRef.Type.IsValueType); 3385Debug.Assert((object)operand.Type != null); 3404Debug.Assert(asOp.OperandPlaceholder is null); 3405Debug.Assert(asOp.OperandConversion is null); 3414Debug.Assert((object)targetType != null); 3511Debug.Assert((object)getTypeMethod != null); // Should have been checked during binding 3532Debug.Assert(node.Method.IsDefinition); 3533Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32); 3550Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32); 3564Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32); 3578Debug.Assert(field.IsDefinition); 3587Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32); 3623Debug.Assert(throwMethod != null); 3666Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32); 3677Debug.Assert((object)getMethod != null); 3685Debug.Assert(getMethod.ParameterCount == 2); 3704Debug.Assert((object)getField != null); 3712Debug.Assert(getField.ParameterCount == 2); 3840Debug.Assert(expr.Type.IsReferenceType); 3920Debug.Assert(conversionKind != ConversionKind.NullLiteral && conversionKind != ConversionKind.DefaultLiteral); 3987Debug.Assert(to.IsVerifierReference()); 4007Debug.Assert(!type.IsRefLikeType); 4093Debug.Assert(method.RefKind != RefKind.None); 4099Debug.Assert(load.Type is { TypeKind: TypeKind.FunctionPointer });
CodeGen\EmitOperators.cs (21)
153Debug.Assert((object)binary == expression); 305Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 306Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 314Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 315Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 331Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 332Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 337Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 338Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 343Debug.Assert(binOp.Left.Type.SpecialType == SpecialType.System_Boolean); 344Debug.Assert(binOp.Right.Type.SpecialType == SpecialType.System_Boolean); 496Debug.Assert(condition.Type.SpecialType == SpecialType.System_Boolean); 501Debug.Assert(constantValue.Discriminator == ConstantValueTypeDiscriminator.Boolean); 531Debug.Assert(condition.Type.SpecialType == SpecialType.System_Boolean); 535Debug.Assert(constantValue.Discriminator == ConstantValueTypeDiscriminator.Boolean); 575Debug.Assert(unOp.OperatorKind == UnaryOperatorKind.BoolLogicalNegation); 583Debug.Assert(expression.OperatorKind.Operator() == UnaryOperatorKind.UnaryMinus); 596Debug.Assert(type == UnaryOperatorKind.Int || type == UnaryOperatorKind.Long || type == UnaryOperatorKind.NInt); 659Debug.Assert(TypeSymbol.Equals(expression.Left.Type, expression.Right.Type, TypeCompareKind.ConsiderEverything2)); 676Debug.Assert(enumType.IsEnumType()); 779Debug.Assert(opKind.Operator() != BinaryOperatorKind.UnsignedRightShift);
CodeGen\EmitStackAllocInitializer.cs (3)
24Debug.Assert(type is PointerTypeSymbol || type is NamedTypeSymbol); 25Debug.Assert(_diagnostics.DiagnosticBag is not null); 75Debug.Assert(TypeSymbol.Equals(readOnlySpan.OriginalDefinition, _module.Compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.ConsiderEverything));
CodeGen\EmitStatement.cs (49)
145Debug.Assert((_asyncYieldPoints == null) == (_asyncResumePoints == null)); 156Debug.Assert(_asyncYieldPoints != null); 157Debug.Assert(_asyncYieldPoints != null); 192Debug.Assert(label != null); 221Debug.Assert(tc != Microsoft.Cci.PrimitiveTypeCode.Invalid); 222Debug.Assert(tc != Microsoft.Cci.PrimitiveTypeCode.Void); 232Debug.Assert(opKind == BinaryOperatorKind.Equal || 378Debug.Assert(_recursionDepth == 1); 383Debug.Assert(_recursionDepth == 1); 421Debug.Assert(binOp.ConstantValueOpt is null); 589Debug.Assert((object)operand.Type != null); 794Debug.Assert(!block.Locals.IsEmpty); 800Debug.Assert(local.Name != null); 801Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.UserDefined && 924Debug.Assert(!statement.CatchBlocks.IsDefault); 1129Debug.Assert(exceptionSourceOpt.Type.IsTypeParameter()); // only expecting type parameters 1138Debug.Assert(seq.Locals.IsDefaultOrEmpty); 1147Debug.Assert(exceptionSourceLocal.LocalSymbol.RefKind == RefKind.None); 1158Debug.Assert(!left.ReceiverOpt.Type.IsTypeParameter()); 1159Debug.Assert(left.FieldSymbol.RefKind == RefKind.None); 1173Debug.Assert(receiverTemp == null); 1192Debug.Assert(_builder.IsStackEmpty); 1224Debug.Assert(_asyncCatchHandlerOffset < 0); // only one expected 1232Debug.Assert((object)dispatch.Expression.Type != null); 1233Debug.Assert(dispatch.Expression.Type.IsValidV6SwitchGoverningType() || dispatch.Expression.Type.IsSpanOrReadOnlySpanChar()); 1236Debug.Assert(!dispatch.Expression.Type.IsNullableType()); 1239Debug.Assert(dispatch.Cases.Any()); 1255Debug.Assert((object)expression.Type != null && 1257Debug.Assert(switchCaseLabels.Length > 0); 1259Debug.Assert(switchCaseLabels != null || lengthBasedSwitchStringJumpTableOpt != null); 1307Debug.Assert(lengthBasedSwitchStringJumpTableOpt is null || 1373Debug.Assert(indexerRef is not null); 1374Debug.Assert(lengthMethodRef is not null); 1479Debug.Assert(diag.IsEmptyWithoutResolution); 1544Debug.Assert(sequenceEqualsTMethod != null && !sequenceEqualsTMethod.HasUseSiteError); 1549Debug.Assert(asSpanMethod != null && !asSpanMethod.HasUseSiteError); 1555Debug.Assert(stringEqualityMethod != null && !stringEqualityMethod.HasUseSiteError); 1566Debug.Assert(!isSpanOrReadOnlySpan); 1596Debug.Assert(diag.IsEmptyWithoutResolution); 1639Debug.Assert(spanTLengthMethod != null && !spanTLengthMethod.HasUseSiteError); 1697Debug.Assert(stringEqualityMethodRef != null); 1701Debug.Assert(stringEqualityMethodRef == _module.Translate((MethodSymbol)_module.Compilation.GetSpecialTypeMember(SpecialMember.System_String__op_Equality), (CSharpSyntaxNode)syntaxNode, assertDiagnostics)); 1735Debug.Assert(sequenceEqualsRef != null); 1736Debug.Assert(asSpanRef != null); 1774Debug.Assert(local.HasConstantValue); 1796Debug.Assert(local.RefKind == RefKind.None); 1797Debug.Assert(local.TypeWithAnnotations.Type.IsPointerType()); 1862Debug.Assert((local.Name == null) == (localKind != SynthesizedLocalKind.UserDefined)); 1879Debug.Assert(ordinal == 0 || localKind != SynthesizedLocalKind.UserDefined);
CodeGen\Optimizer.cs (23)
298Debug.Assert(instance._localDefs == null); 450Debug.Assert(expr.Kind != BoundKind.Label); 520Debug.Assert(_recursionDepth == 1); 525Debug.Assert(_recursionDepth == 1); 541Debug.Assert(result != null || context == ExprContext.None); 567Debug.Assert(node == null || EvalStackIsEmpty()); 868Debug.Assert(_assignmentLocal == null); 1167Debug.Assert(method.IsStatic); 1256Debug.Assert(!arguments.IsDefault); 1257Debug.Assert(!parameters.IsDefault); 1259Debug.Assert(arguments.Length == parameters.Length || arguments.Length == parameters.Length + 1); 1319Debug.Assert(node.InitializerExpressionOpt == null); 1419Debug.Assert(EvalStackIsEmpty()); 1539Debug.Assert((object)binary == node); 1568Debug.Assert(node.LeftPlaceholder is null); 1569Debug.Assert(node.LeftConversion is null); 1920Debug.Assert(local == empty || locInfo.StackAtDeclaration == StackDepth()); 1941Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.OptimizerTemp); 1946Debug.Assert(local == empty || locInfo.StackAtDeclaration == StackDepth()); 1954Debug.Assert(local.SynthesizedKind != SynthesizedLocalKind.OptimizerTemp); 2111Debug.Assert((object)binary == node); 2143Debug.Assert(node.InitializerExpressionOpt == null); 2183Debug.Assert(locInfo.LocalDefs.Any((d) => _nodeCounter == d.Start && _nodeCounter <= d.End));
CommandLine\CSharpCommandLineParser.cs (9)
52Debug.Assert(baseDirectory == null || PathUtilities.IsAbsolute(baseDirectory)); 166Debug.Assert(optionsEnded || !arg.StartsWith("@", StringComparison.Ordinal)); 425Debug.Assert(loweredValue == nameof(NullableContextOptions.Disable).ToLower()); 429Debug.Assert(loweredValue == nameof(NullableContextOptions.Enable).ToLower()); 433Debug.Assert(loweredValue == nameof(NullableContextOptions.Warnings).ToLower()); 437Debug.Assert(loweredValue == nameof(NullableContextOptions.Annotations).ToLower()); 1697Debug.Assert(!IsScriptCommandLineParser); 1739Debug.Assert(IsScriptCommandLineParser); 2046Debug.Assert(!PathUtilities.IsValidFilePath(fullPath));
CommandLine\CSharpCompiler.cs (5)
94Debug.Assert(hadErrors); 103Debug.Assert(normalizedFilePath != null); 104Debug.Assert(sourceFiles[i].IsInputRedirected || PathUtilities.IsAbsolute(normalizedFilePath)); 118Debug.Assert(touchedFilesLogger is object); 196Debug.Assert(fileDiagnostics.Count == 0);
Compilation\AttributeSemanticModel.cs (1)
31Debug.Assert(syntax != null);
Compilation\BuiltInOperators.cs (5)
692Debug.Assert(_compilation.IsReadOnlySpanType(readonlySpanOfByte)); 693Debug.Assert(((NamedTypeSymbol)readonlySpanOfByte).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Single().Type.SpecialType is SpecialType.System_Byte); 835Debug.Assert(kind.IsLifted()); 886Debug.Assert((object)leftType != null); 897Debug.Assert((object)rightType != null);
Compilation\CSharpCompilation.cs (54)
410Debug.Assert(!isSubmission || options.ReferencesSupersedeLowerVersions); 447Debug.Assert(compilation._lazyAssemblySymbol is null); 490Debug.Assert(previousSubmission == null || previousSubmission.HostObjectType == hostObjectType); 495Debug.Assert(previousSubmission == null && submissionReturnType == null && hostObjectType == null); 518Debug.Assert(_lazyAssemblySymbol is null); 524Debug.Assert(debugEntryPoint != null); 771Debug.Assert(IsSubmission); 1038Debug.Assert(this.ContainsSyntaxTree(tree)); 1083Debug.Assert(contentHash.Length == InterceptableLocation1.ContentHashLength); 1147Debug.Assert(_lazyAssemblySymbol is object); 1201Debug.Assert(reference.Properties.Kind == MetadataImageKind.Module); 1525Debug.Assert(foundNamespace == !(@namespace is MissingNamespaceSymbol)); 1559Debug.Assert(tree != null); 1560Debug.Assert(!this.IsSubmission || _syntaxAndDeclarations.ExternalSyntaxTrees.Length <= 1); 1617Debug.Assert(this.IsSubmission); 1618Debug.Assert(_syntaxAndDeclarations.ExternalSyntaxTrees.Length <= 1); 1638Debug.Assert(this.IsSubmission); 1679Debug.Assert(result.ExtendedSpecialType == specialType); 1825Debug.Assert(result?.IsErrorType() != true); 1892Debug.Assert(!this.Options.Errors.IsDefaultOrEmpty); 2128Debug.Assert(!ReferenceEquals(data, UnmanagedCallersOnlyAttributeData.Uninitialized)); 2129Debug.Assert(!ReferenceEquals(data, UnmanagedCallersOnlyAttributeData.AttributePresentDataNotBound)); 2448Debug.Assert(!_declarationDiagnosticsFrozen); 2478Debug.Assert(!_declarationDiagnosticsFrozen); 2479Debug.Assert(!InterceptorsDiscoveryComplete); 2554Debug.Assert(model != null); 2587Debug.Assert(System.Runtime.CompilerServices.Unsafe.AreSame(ref cachedBinderFactories, ref ignoreAccessibility ? ref _ignoreAccessibilityBinderFactories : ref _binderFactories)); 2618Debug.Assert(slot is object); 2660Debug.Assert(diagnostics is { }); 2662Debug.Assert(bag.DiagnosticBag is { }); 2862Debug.Assert(!_declarationDiagnosticsFrozen || true); 2953Debug.Assert(builder.DiagnosticBag is { }); 3054Debug.Assert(!loadDirectives.IsEmpty); 3114Debug.Assert(bindingDiagnostics.DiagnosticBag is { }); 3140Debug.Assert(reportUnusedUsings); 3159Debug.Assert(reportUnusedUsings); 3162Debug.Assert(discarded.DiagnosticBag is object); 3310Debug.Assert(!_lazyClsComplianceDependencies.IsDefault); 3311Debug.Assert(!_lazyClsComplianceDiagnostics.IsDefault); 3431Debug.Assert(!IsSubmission || HasCodeToEmit() || 3567Debug.Assert(methodBodyDiagnosticBag.DiagnosticBag is { }); 3568Debug.Assert(moduleBeingBuilt is object); 3656Debug.Assert(symbol.ContainingSymbol.Kind == SymbolKind.Namespace); // avoid unnecessary traversal of nested types 3706Debug.Assert(_declarationDiagnosticsFrozen); 3760Debug.Assert(xmlDiagnostics.DiagnosticBag is { }); 4283Debug.Assert(csharpReturnType is not null); 4284Debug.Assert(csharpLeftType is not null); 4285Debug.Assert(csharpRightType is not null); 4507Debug.Assert(csharpReturnType is not null); 4508Debug.Assert(csharpOperandType is not null); 4591Debug.Assert(loc1.IsInSource); 4592Debug.Assert(loc2.IsInSource); 4759Debug.Assert(symbol.IsDefinition); 4816Debug.Assert(LanguageVersion == LanguageVersion.MapSpecifiedToEffectiveVersion());
Compilation\CSharpCompilation.UsingsFromOptionsAndDiagnostics.cs (6)
57Debug.Assert(directiveDiagnostics.DiagnosticBag is object); 58Debug.Assert(directiveDiagnostics.DependenciesBag is object); 107Debug.Assert(_state.HasComplete(CompletionPart.StartValidatingImports)); 133Debug.Assert(diagnostics.DiagnosticBag is object); 134Debug.Assert(diagnostics.DependenciesBag is object); 146Debug.Assert(@using.UsingDirective is null);
Compilation\CSharpDiagnosticFilter.cs (5)
153Debug.Assert(location.SourceTree is null || location.SourceTree is CSharpSyntaxTree); 325Debug.Assert(isEnabledByDefault); 326Debug.Assert(!specifiedWarnAsErrorMinus); 334Debug.Assert(report == ReportDiagnostic.Default); 335Debug.Assert(generalDiagnosticOption == ReportDiagnostic.Error);
Compilation\CSharpScriptCompilationInfo.cs (1)
17Debug.Assert(previousCompilationOpt == null || previousCompilationOpt.HostObjectType == globalsType);
Compilation\CSharpSemanticModel.cs (62)
62Debug.Assert(node != null); 205Debug.Assert(expression != null); 254Debug.Assert(binder != null); 255Debug.Assert(binder.IsSemanticModelBinder); 256Debug.Assert(expression != null); 257Debug.Assert(bindingOption != SpeculativeBindingOption.BindAsTypeOrNamespace || expression is TypeSyntax); 266Debug.Assert(bindingOption == SpeculativeBindingOption.BindAsExpression); 726Debug.Assert(boundNode == null || crefSymbols.IsDefault); 752Debug.Assert(CanGetSemanticInfo(attribute, isSpeculative: true)); 780Debug.Assert(CanGetSemanticInfo(constructorInitializer, isSpeculative: true)); 852Debug.Assert(CanGetSemanticInfo(constructorInitializer, isSpeculative: true)); 913Debug.Assert(CanGetSemanticInfo(cref, isSpeculative: true)); 1056Debug.Assert(boundNode == null || crefSymbols.IsDefault); 1203Debug.Assert(boundNode == null || crefSymbols.IsDefault); 1223Debug.Assert(result == null || result.IsSemanticModelBinder); 1315Debug.Assert(IsInTree(node)); 1333Debug.Assert(position == fullSpan.Start); 1341Debug.Assert(node.Width == 0); 1573Debug.Assert(!options.IsAttributeTypeLookup()); // Not exposed publicly. 1593Debug.Assert((object)container == null); 1680Debug.Assert(symbol.GetIsNewExtensionMember()); 1739Debug.Assert(results != null); 1742Debug.Assert((options & LookupOptions.AllMethodsOnArityZero) == 0); 2323Debug.Assert((object)symbol != null); 2361Debug.Assert((object)symbol != null); 3314Debug.Assert(catchClause.Kind() == SyntaxKind.CatchClause); 3494Debug.Assert((object)indexerAccess.Indexer != null); 3543Debug.Assert((object)symbol != null); 3587Debug.Assert(conditional.ExpressionSymbol is null); 3593Debug.Assert(boundNodeForSyntacticParent == null); 3605Debug.Assert(resultKind != LookupResultKind.Viable); 3639Debug.Assert(dynamicInvocation.ExpressionSymbol is null); 3647Debug.Assert(collectionInit.ExpressionSymbol is null); 3655Debug.Assert(dynamicIndexer.ExpressionSymbol is null); 3662Debug.Assert((object)boundNode.ExpressionSymbol == null); 3678Debug.Assert(boundObjectCreation.ConstructorsGroup.Contains(boundObjectCreation.Constructor)); 3819Debug.Assert((object)unaryOperator.MethodOpt == null && unaryOperator.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty); 3842Debug.Assert((object)increment.MethodOpt == null && increment.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty); 3867Debug.Assert((object)binaryOperator.Method == null && binaryOperator.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty); 3906Debug.Assert(returnType.IsDynamic()); 3910Debug.Assert(rightType.IsDynamic()); 3915Debug.Assert(leftType.IsDynamic()); 3940Debug.Assert((object)compoundAssignment.Operator.Method == null && compoundAssignment.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty); 3999Debug.Assert(resultKind != LookupResultKind.Viable || 4034Debug.Assert(lowestBoundNode != null); 4035Debug.Assert(binderOpt != null || IsInTree(lowestBoundNode.Syntax)); 4039Debug.Assert(lowestBoundNode.Syntax != null); 4060Debug.Assert(resultKind != LookupResultKind.Viable); 4071Debug.Assert(candidateConstructors.Contains(constructorOpt)); 4077Debug.Assert(resultKind != LookupResultKind.Viable); 4095Debug.Assert(binderOpt != null || IsInTree(boundNode.Syntax)); 4252Debug.Assert(binderOpt != null || IsInTree(boundNode.Syntax)); 4404Debug.Assert(binderOpt != null || IsInTree(boundNode.Syntax)); 4487Debug.Assert(SyntaxFacts.IsNamedArgumentName(identifierNameSyntax)); 4587Debug.Assert(nonHiddenMethods.Any()); // Something must be hiding, so can't all be hidden. 4623Debug.Assert(receiver != null); 4744Debug.Assert((members.Count == 0) == (resultKind == LookupResultKind.Empty)); 4756Debug.Assert(!methods.IsDefault); 4770Debug.Assert((object)receiverType != null); 4791Debug.Assert((object)method != null); 4795Debug.Assert(call.Arguments.Length > 0); 4808Debug.Assert((object)method != null);
Compilation\InitializerSemanticModel.cs (7)
33Debug.Assert(!(syntax is ConstructorInitializerSyntax || syntax is PrimaryConstructorBaseTypeSyntax)); 41Debug.Assert(containingSemanticModel != null); 42Debug.Assert(syntax.IsKind(SyntaxKind.VariableDeclarator) || syntax.IsKind(SyntaxKind.EnumMemberDeclaration)); 51Debug.Assert(containingSemanticModel != null); 52Debug.Assert(syntax.IsKind(SyntaxKind.PropertyDeclaration)); 61Debug.Assert(containingSemanticModel != null); 279Debug.Assert(MemberSymbol.ContainingType is SourceMemberContainerTypeSymbol);
Compilation\LexicalOrderSymbolComparer.cs (2)
36Debug.Assert((object)x.DeclaringCompilation == y.DeclaringCompilation); 51Debug.Assert(comparison != 0);
Compilation\MemberSemanticModel.cs (52)
53Debug.Assert(root != null); 54Debug.Assert((object)memberSymbol != null); 55Debug.Assert(containingPublicSemanticModel.IsSpeculativeSemanticModel == (containingPublicSemanticModel is SpeculativeSemanticModelWithMemberModel)); 149Debug.Assert(false); 159Debug.Assert(_lazySnapshotManager is object || this is AttributeSemanticModel || !IsNullableAnalysisEnabled()); 166Debug.Assert(_lazyRemappedSymbols is object || this is AttributeSemanticModel || !IsNullableAnalysisEnabled()); 228Debug.Assert(root.Contains(node)); 237Debug.Assert(current != null); // Why were we asked for an enclosing binder for a node outside our root? 254Debug.Assert(ownerOfTypeParametersInScope == null); 282Debug.Assert(binder != null); 357Debug.Assert(!current.CanHaveAssociatedLocalBinder()); 367Debug.Assert(binder != null); 395Debug.Assert(binder != null); 405Debug.Assert(binder != null); 411Debug.Assert(binder != null); 422Debug.Assert(binder != null); 530Debug.Assert(node == GetBindableSyntaxNode(node)); 552Debug.Assert(node == GetBindableSyntaxNode(node)); 833Debug.Assert(parameter != null); 868Debug.Assert(parameter != null); 869Debug.Assert(lambda != null && lambda.IsAnonymousFunction()); 953Debug.Assert(enumeratorInfoOpt != null || boundForEach.HasAnyErrors); 1007Debug.Assert(boundConversion != null); 1025Debug.Assert(boundDeconstruction != null || boundForEach.HasAnyErrors); 1095Debug.Assert(index >= 0); 1096Debug.Assert(index < anonymousObjectCreation.Initializers.Count); 1189Debug.Assert(highestBoundNode != null); 1201Debug.Assert(highestBoundNode.Kind != BoundKind.UnboundLambda); 1371Debug.Assert(node != null); 1435Debug.Assert(_nodeMapLock.IsWriteLockHeld || _nodeMapLock.IsReadLockHeld); 1453Debug.Assert(_nodeMapLock.IsWriteLockHeld); 1467Debug.Assert(syntax != _root || _guardedBoundNodeMap.ContainsKey(bound.Syntax)); 1484Debug.Assert(_nodeMapLock.IsWriteLockHeld); 1503Debug.Assert(syntax != _root || _guardedBoundNodeMap.ContainsKey(bound.Syntax)); 1511Debug.Assert((manager is null && (!IsNullableAnalysisEnabled() || syntax != Root || syntax is TypeSyntax || 1529Debug.Assert(node != null); 1664Debug.Assert(bindingRoot.Contains(enclosingLambdaOrQuery)); 1706Debug.Assert(lambdaOrQuery != nodeToBind); 1741Debug.Assert(boundInnerLambdaOrQuery != null); 1759Debug.Assert(result != null); 1900Debug.Assert(containingLambda.IsAnonymousFunction()); 1901Debug.Assert(LookupPosition.IsInAnonymousFunctionOrQuery(position, containingLambda)); 1952Debug.Assert(!isNullableAnalysisEnabled || 1998Debug.Assert(Compilation.IsNullableAnalysisEnabledAlways); 2026Debug.Assert(binder is SimpleProgramBinder); 2076Debug.Assert(node == GetBindableSyntaxNode(node)); 2237Debug.Assert(parent.Kind() == SyntaxKind.VariableDeclaration); 2315Debug.Assert(bindableParent != null); 2343Debug.Assert(symbol is LocalSymbol or ParameterSymbol or MethodSymbol { MethodKind: MethodKind.LambdaMethod }); 2412Debug.Assert(!(binder is IncrementalBinder)); 2469Debug.Assert(!block.WasCompilerGenerated); 2533Debug.Assert(alternative is BoundIfStatement);
Compilation\MemberSemanticModel.SpeculativeMemberSemanticModel.cs (2)
34Debug.Assert(containingPublicSemanticModel is not null); 51Debug.Assert(boundRoot.Syntax is TypeSyntax);
Compilation\MethodBodySemanticModel.cs (8)
51Debug.Assert((object)owner != null); 52Debug.Assert(owner.Kind == SymbolKind.Method); 53Debug.Assert(syntax != null); 54Debug.Assert(parentRemappedSymbolsOpt is null || IsSpeculativeSemanticModel); 55Debug.Assert((syntax.Kind() == SyntaxKind.CompilationUnit) == (!IsSpeculativeSemanticModel && owner is SynthesizedSimpleProgramEntryPointSymbol)); 63Debug.Assert(containingSemanticModel != null); 186Debug.Assert(binder != null); 263Debug.Assert(typeDecl.Kind() is (SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration));
Compilation\SpeculativeSemanticModelWithMemberModel.cs (10)
33Debug.Assert(parentSemanticModel is not null); 51Debug.Assert(syntax != null); 52Debug.Assert(rootBinder != null); 53Debug.Assert(rootBinder.IsSemanticModelBinder); 80Debug.Assert(syntax != null); 81Debug.Assert(rootBinder != null); 82Debug.Assert(rootBinder.IsSemanticModelBinder); 110Debug.Assert(syntax != null); 111Debug.Assert(rootBinder != null); 112Debug.Assert(rootBinder.IsSemanticModelBinder);
Compilation\SpeculativeSyntaxTreeSemanticModel.cs (5)
39Debug.Assert(parentSemanticModel is SyntaxTreeSemanticModel); 40Debug.Assert(root != null); 41Debug.Assert(root is TypeSyntax || root is CrefSyntax); 42Debug.Assert(rootBinder != null); 43Debug.Assert(rootBinder.IsSemanticModelBinder);
Compilation\SyntaxAndDeclarationManager.cs (12)
274Debug.Assert(diagnostics.IsEmptyWithoutResolution); 395Debug.Assert(!oldLoadDirectives.IsEmpty); 418Debug.Assert(!loadDirectives.IsEmpty); 448Debug.Assert(!nestedLoadDirectives.IsEmpty); 518Debug.Assert(!loadDirectiveMapBuilder.ContainsKey(oldTree)); 519Debug.Assert(!loadDirectiveMapBuilder.ContainsKey(newTree)); 562Debug.Assert(newTrees.Length == ordinalMap.Count); 572Debug.Assert(!oldLoadDirectives.IsDefault); 573Debug.Assert(!oldLoadDirectives.IsEmpty); 574Debug.Assert(oldLoadDirectives.Length == newLoadDirectivesSyntax.Count); 578Debug.Assert(ordinalMap.ContainsKey(oldTree)); // Checked by RemoveSyntaxTreeFromDeclarationMapAndTable 687Debug.Assert(!loadDirectives.IsEmpty);
Compilation\SyntaxAndDeclarationManager.LazyState.cs (1)
55Debug.Assert(syntaxTrees.All(tree => syntaxTrees[syntaxTreeOrdinalMap[tree]] == tree));
Compilation\SyntaxTreeSemanticModel.cs (34)
259Debug.Assert(symbols.All(s => s.Kind == SymbolKind.TypeParameter || s.Kind == SymbolKind.Parameter)); 332Debug.Assert(this.GetMemberModel(node) == null); 768Debug.Assert(speculativeSyntax.SyntaxTree != SyntaxTree); 1218Debug.Assert((object)scriptInitializer != null); 1326Debug.Assert(declarationSyntax != null); 1338Debug.Assert((object)container != null); 1342Debug.Assert((object)symbol != null); 1346Debug.Assert((object)symbol != null); 1382Debug.Assert(declarationSyntax != null); 1395Debug.Assert(extensionDeclaration != null); 1398Debug.Assert(container is not null); 1417Debug.Assert(declarationSyntax != null); 1425Debug.Assert(declarationSyntax != null); 1428Debug.Assert((object)container != null); 1618Debug.Assert((object)container != null); 1619Debug.Assert(declarationSyntax.Keyword.Kind() != SyntaxKind.IdentifierToken); 1639Debug.Assert((object)container != null); 1761Debug.Assert((object)left != null); 1865Debug.Assert((object)container != null); 1868Debug.Assert((object)result != null); 2034Debug.Assert(parameter != null); 2065Debug.Assert(parameter != null); 2102Debug.Assert(parameter != null); 2129Debug.Assert(parameter != null); 2382Debug.Assert((object)container != null); 2442Debug.Assert(symbol is LocalSymbol or ParameterSymbol or MethodSymbol { MethodKind: MethodKind.LambdaMethod }); 2469Debug.Assert(((INamespaceSymbol)declaredSymbol).IsGlobalNamespace); 2474Debug.Assert((object)declaredSymbol.GetSymbol() == (object)entryPoint); 2479Debug.Assert((object)declaredSymbol.GetSymbol() == (object)entryPoint.ContainingSymbol); 2494Debug.Assert((object)declaredSymbol.GetSymbol() == (object)ctor); 2515Debug.Assert((object)declaredSymbol.GetSymbol() == (object)ctor.ContainingSymbol); 2530Debug.Assert((object)declaredSymbol.GetSymbol() == (object)ctor); 2543Debug.Assert((object)declaredSymbol.GetSymbol() == (object)ctor.ContainingSymbol); 2564Debug.Assert(declaredSymbol.GetSymbol() is SynthesizedRecordPropertySymbol);
Compiler\AnonymousTypeMethodBodySynthesizer.cs (2)
38Debug.Assert(ContainingType.BaseTypeNoUseSiteDiagnostics.SpecialType == SpecialType.System_Object); 50Debug.Assert(anonymousType.Properties.Length == paramCount);
Compiler\ClsComplianceChecker.cs (28)
44Debug.Assert(diagnostics.DependenciesBag is null || diagnostics.DependenciesBag is ConcurrentSet<AssemblySymbol>); 93System.Diagnostics.Debug.Assert(symbol is SourceAssemblySymbol); 243Debug.Assert(!symbol.IsImplicitClass); 424System.Diagnostics.Debug.Assert( 430System.Diagnostics.Debug.Assert(!symbol.IsAccessor()); 546System.Diagnostics.Debug.Assert((object)containingType == null || !containingType.IsImplicitClass); 665System.Diagnostics.Debug.Assert(syntaxRef.SyntaxTree.HasCompilationUnitRoot); 738System.Diagnostics.Debug.Assert(method.ContainingType.TypeKind == TypeKind.Delegate); 743System.Diagnostics.Debug.Assert(!method.IsAccessor()); 804System.Diagnostics.Debug.Assert(IsAccessibleOutsideAssembly(symbol)); 805System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol))); 886Debug.Assert(sameNameSymbols.Count > 0); 887Debug.Assert(symbol.Name == symbolName); 929System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol))); 930System.Diagnostics.Debug.Assert(IsAccessibleOutsideAssembly(symbol)); 952System.Diagnostics.Debug.Assert(name.Length == 0 || name[0] != '\uFF3F'); 1136Debug.Assert(symbol.Kind != SymbolKind.Alias); 1137Debug.Assert(symbol.Kind != SymbolKind.Label); 1138Debug.Assert(symbol.Kind != SymbolKind.Namespace); 1139Debug.Assert(symbol.Kind != SymbolKind.Parameter); 1140Debug.Assert(symbol.Kind != SymbolKind.RangeVariable); 1172System.Diagnostics.Debug.Assert(symbol.Kind != SymbolKind.Assembly); 1175System.Diagnostics.Debug.Assert((object)containing != null); 1246System.Diagnostics.Debug.Assert(symbol.Kind == SymbolKind.ErrorType); 1318System.Diagnostics.Debug.Assert((object)x != null); 1319System.Diagnostics.Debug.Assert((object)y != null); 1320System.Diagnostics.Debug.Assert((object)x != (object)y); 1321System.Diagnostics.Debug.Assert(x.Kind == y.Kind);
Compiler\DocumentationCommentCompiler.cs (28)
106Debug.Assert(compiler._indentDepth == 0); 141Debug.Assert( 149Debug.Assert(compilation != null); 165Debug.Assert(compiler._indentDepth == 0); 180Debug.Assert(_assemblyName != null); 199Debug.Assert(!_isForSingleSymbol); 421Debug.Assert(location.SourceTree!.ReportDocumentationCommentDiagnostics()); //Should be the same tree as for the symbol. 436Debug.Assert(location.SourceTree!.ReportDocumentationCommentDiagnostics()); //Should be the same tree as for the symbol. 467Debug.Assert(paramTags.Count > 0); 536Debug.Assert(!docCommentNodes.IsDefaultOrEmpty); 693Debug.Assert((object)symbol != null); 811Debug.Assert(numLines > 0); 816Debug.Assert(numLines > 0); 850Debug.Assert(start >= 0); 851Debug.Assert(start <= str.Length); 852Debug.Assert(end >= 0); 853Debug.Assert(end <= str.Length); 854Debug.Assert(end >= start); 977Debug.Assert(numLines > 0); 997Debug.Assert(pattern.StartsWith(currentLinePattern, StringComparison.Ordinal)); 1119Debug.Assert((object)symbol != null); 1130Debug.Assert(!ns.IsGlobalNamespace); 1225Debug.Assert(referencedSymbol.Kind == SymbolKind.Parameter); 1226Debug.Assert(documentedParameters != null); 1239Debug.Assert(referencedSymbol.Kind == SymbolKind.TypeParameter); 1240Debug.Assert(documentedTypeParameters != null); 1289Debug.Assert(_indentDepth >= 0); 1347Debug.Assert(depth >= 0);
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (14)
135Debug.Assert(expander._nextSourceIncludeElementIndex == expander._sourceIncludeElementNodes.Length); 149Debug.Assert(nodes != null); 165Debug.Assert(builder == null || builder.All(node => node.Parent == null)); 269Debug.Assert(originatingSyntax != null); 351Debug.Assert(doc != null); 458Debug.Assert(_inProgressIncludeElementNodes != null); 460Debug.Assert(result); 476Debug.Assert(_nextSourceIncludeElementIndex < _sourceIncludeElementNodes.Length); 477Debug.Assert(originatingSyntax == null); 490Debug.Assert(location != null); 553Debug.Assert((object)containingSymbol != null); 622Debug.Assert(leadingTrivia.Count == 1); 625Debug.Assert(structure.Content.Count == 2); 627Debug.Assert(elementSyntax.Attributes.Count == 1);
Compiler\MethodBodySynthesizer.cs (12)
37Debug.Assert((object)constructor.ContainingType.BaseTypeNoUseSiteDiagnostics == null || constructor.ContainingType.BaseTypeNoUseSiteDiagnostics.SpecialType == SpecialType.System_Object); 90Debug.Assert(submissionConstructor.ParameterCount == 1); 99Debug.Assert(slotIndex >= 0); 144Debug.Assert(targetSubmissionIndex >= 0); 176Debug.Assert(accessor.MethodKind == MethodKind.PropertyGet || accessor.MethodKind == MethodKind.PropertySet); 197Debug.Assert(accessor.MethodKind == MethodKind.PropertySet); 217Debug.Assert(eventSymbol.HasAssociatedField); 237Debug.Assert((object)accessor != null); 240Debug.Assert((object)field != null); 243Debug.Assert(fieldType.Name == "EventRegistrationTokenTable"); 532Debug.Assert(method.MethodKind == MethodKind.Destructor); 533Debug.Assert(syntax.Kind() == SyntaxKind.Block || syntax.Kind() == SyntaxKind.ArrowExpressionClause);
Compiler\MethodBodySynthesizer.Lowered.cs (3)
328Debug.Assert(this.Arity == methodBeingWrapped.Arity); 361Debug.Assert(system_Int32.SpecialType == SpecialType.System_Int32); 404Debug.Assert(fields.Count > 0);
Compiler\MethodCompiler.cs (64)
90Debug.Assert(compilation != null); 91Debug.Assert(diagnostics != null); 92Debug.Assert(diagnostics.DiagnosticBag != null); 93Debug.Assert(diagnostics.DependenciesBag == null || diagnostics.DependenciesBag is ConcurrentSet<AssemblySymbol>); 119Debug.Assert(compilation != null); 120Debug.Assert(diagnostics != null); 121Debug.Assert(diagnostics.DiagnosticBag != null); 228Debug.Assert(diagnostics.DiagnosticBag != null); 295Debug.Assert(lazyVariableSlotAllocator is null); 296Debug.Assert(stateMachineTypeOpt is null); 297Debug.Assert(codeCoverageSpans.IsEmpty); 298Debug.Assert(lambdaDebugInfoBuilder.IsEmpty); 299Debug.Assert(lambdaRuntimeRudeEditsBuilder.IsEmpty); 300Debug.Assert(closureDebugInfoBuilder.IsEmpty); 301Debug.Assert(stateMachineStateDebugInfoBuilder.IsEmpty); 363Debug.Assert(_moduleBeingBuiltOpt != null); 476Debug.Assert((object)scriptCtor != null); 477Debug.Assert((object)scriptInitializer != null); 522Debug.Assert(scriptCtorOrdinal == -1); 523Debug.Assert((object)scriptCtor == method); 595Debug.Assert(containingType.IsScriptClass == (scriptCtorOrdinal >= 0)); 614Debug.Assert(processedStaticInitializers.BoundInitializers.All((init) => 654Debug.Assert(scriptCtorOrdinal >= 0); 684Debug.Assert(_moduleBeingBuiltOpt != null); 693Debug.Assert(method.SynthesizesLoweredBoundBody); 704Debug.Assert(diagnostics.DiagnosticBag != null); 725Debug.Assert(_moduleBeingBuiltOpt != null); 726Debug.Assert(compilationState.ModuleBuilderOpt == _moduleBeingBuiltOpt); 772Debug.Assert((object)iteratorStateMachine == null || (object)asyncStateMachine == null); 819Debug.Assert(emittedBody is null); 848Debug.Assert(synthesizedExplicitImpl.SynthesizesLoweredBoundBody); 874Debug.Assert(synthesizedAccessor.SynthesizesLoweredBoundBody); 919Debug.Assert(!methodSymbol.SynthesizesLoweredBoundBody); 990Debug.Assert(methodSymbol.IsImplicitlyDeclared); 995Debug.Assert(methodSymbol.IsImplicitlyDeclared); 1050Debug.Assert(!prependedDefaultValueTypeConstructorInitializer || originalBodyNested); 1051Debug.Assert(!prependedDefaultValueTypeConstructorInitializer || methodSymbol.ContainingType.IsStructType()); 1109Debug.Assert(importChain == null); 1113Debug.Assert(processedInitializers.BoundInitializers.IsDefaultOrEmpty || processedInitializers.FirstImportChain != null); 1162Debug.Assert(rootSyntax == forSemanticModel.Syntax); 1225Debug.Assert(loweredBodyOpt != null); 1239Debug.Assert(!(methodSymbol.IsImplicitInstanceConstructor && methodSymbol.ParameterCount == 0) || 1282Debug.Assert(!instrumentation.Kinds.Contains(InstrumentationKind.TestCoverage)); 1302Debug.Assert(initializerCodeCoverageSpans.IsEmpty); 1307Debug.Assert(initializerStateMachineTypeOpt is null); 1308Debug.Assert(!hasErrors); 1402Debug.Assert(_diagnostics.DiagnosticBag != null); 1403Debug.Assert(_moduleBeingBuiltOpt != null); 1469Debug.Assert(compilationState.ModuleBuilderOpt != null); 1575Debug.Assert((object)iteratorStateMachine == null || (object)asyncStateMachine == null); 1617Debug.Assert(diagnosticsForThisMethod.DiagnosticBag != null); 1640Debug.Assert(kickoffMethod != null); 1712Debug.Assert(method.IsAsync || method.IsIterator); 1782Debug.Assert(index >= 0); 1880Debug.Assert(!sourceMethod.IsDefaultValueTypeConstructor()); 1916Debug.Assert(diagnostics.DiagnosticBag != null); 1952Debug.Assert(IsEmptyRewritePossible(methodBody)); 1953Debug.Assert(WasPropertyBackingFieldAccessChecked.FindUncheckedAccess(methodBody) is null); 1983Debug.Assert(constructor.Initializer is null); 1984Debug.Assert(constructor.Locals.IsEmpty); 1985Debug.Assert(BindImplicitConstructorInitializerIfAny(method, compilationState, BindingDiagnosticBag.Discarded) is null); 1993Debug.Assert(body != null); 2276Debug.Assert(false); 2445Debug.Assert(!method.ContainingType.IsDelegateType());
Compiler\SynthesizedMetadataCompiler.cs (2)
31Debug.Assert(moduleBeingBuilt != null); 46Debug.Assert(moduleBeingBuilt != null);
Compiler\TypeCompilationState.cs (1)
98Debug.Assert(_typeOpt is { });
Declarations\DeclarationTable.cs (1)
106Debug.Assert(compilation.Declarations == this);
Declarations\DeclarationTreeBuilder.cs (6)
129Debug.Assert( 242Debug.Assert(nameLocation.SourceTree is not null); 267Debug.Assert(_syntaxTree.Options.Kind != SourceCodeKind.Regular); 327Debug.Assert(parent.Kind() == SyntaxKind.CompilationUnit && _syntaxTree.Options.Kind != SourceCodeKind.Regular); 559Debug.Assert(node.Parent is CompilationUnitSyntax); 569Debug.Assert(node is NamespaceDeclarationSyntax);
Declarations\RootSingleNamespaceDeclaration.cs (1)
43Debug.Assert(!referenceDirectives.IsDefault);
Declarations\SingleTypeDeclaration.cs (1)
91Debug.Assert(kind != DeclarationKind.Namespace);
DocumentationComments\DocumentationCommentIDVisitor.PartVisitor.cs (2)
160Debug.Assert(containingSymbol is NamedTypeSymbol); 243Debug.Assert(_inParameterOrReturnType);
Emitter\EditAndContinue\CSharpDefinitionMap.cs (4)
62Debug.Assert(stateMachineType.ContainingAssembly is PEAssemblySymbol); 123Debug.Assert(!handle.IsNil); 127Debug.Assert(result.Length == localInfos.Length); 217Debug.Assert(name.Length >= closeBracketOffset + 1);
Emitter\EditAndContinue\CSharpSymbolMatcher.cs (45)
147Debug.Assert((object)symbol.ContainingAssembly != (object)_otherAssembly); 182Debug.Assert(symbol.IsDefinition); 267Debug.Assert(@namespace.IsGlobalNamespace); 325Debug.Assert(sourceType.IsDefinition); 340Debug.Assert((object)otherContainer == (object)_otherAssembly.GlobalNamespace); 346Debug.Assert((object)otherContainer == (object)_otherAssembly.GlobalNamespace); 475Debug.Assert((object)delegateSymbol.ContainingSymbol == (object)_sourceAssembly.GlobalNamespace); 483Debug.Assert((object)template.ContainingSymbol == (object)_sourceAssembly.GlobalNamespace); 491Debug.Assert(delegateTemplate.DelegateInvokeMethod != null); 501Debug.Assert(otherDelegateType is not null); 516Debug.Assert(type.Arity == otherType.Arity); 556Debug.Assert(!string.IsNullOrEmpty(sourceMember.MetadataName)); 576Debug.Assert(type.ElementTypeWithAnnotations.CustomModifiers.IsEmpty); 577Debug.Assert(other.ElementTypeWithAnnotations.CustomModifiers.IsEmpty); 585Debug.Assert(StringOrdinalComparer.Equals(@event.Name, other.Name)); 594Debug.Assert(StringOrdinalComparer.Equals(field.Name, other.Name)); 600Debug.Assert(StringOrdinalComparer.Equals(method.Name, other.Name)); 602Debug.Assert(method.IsDefinition); 603Debug.Assert(other.IsDefinition); 616Debug.Assert(method.IsDefinition); 630Debug.Assert(StringOrdinalComparer.Equals(type.MetadataName, other.MetadataName)); 633Debug.Assert(type.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.All(t => t.CustomModifiers.IsEmpty)); 634Debug.Assert(other.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.All(t => t.CustomModifiers.IsEmpty)); 641Debug.Assert(type.IsDefinition); 655Debug.Assert(StringOrdinalComparer.Equals(@namespace.MetadataName, other.MetadataName)); 661Debug.Assert(parameter.Ordinal == other.Ordinal); 671Debug.Assert(type.PointedAtTypeWithAnnotations.CustomModifiers.IsEmpty); 672Debug.Assert(other.PointedAtTypeWithAnnotations.CustomModifiers.IsEmpty); 703Debug.Assert(type.CustomModifiers.IsEmpty); 704Debug.Assert(verifyRefModifiers(refCustomModifiers, refKind, allowOut)); 708Debug.Assert(RefKind.RefReadOnly == RefKind.In); 722Debug.Assert(StringOrdinalComparer.Equals(property.MetadataName, other.MetadataName)); 733Debug.Assert(type.Ordinal == other.Ordinal); 734Debug.Assert(StringOrdinalComparer.Equals(type.Name, other.Name)); 738Debug.Assert(type.HasConstructorConstraint == other.HasConstructorConstraint); 739Debug.Assert(type.HasValueTypeConstraint == other.HasValueTypeConstraint); 740Debug.Assert(type.AllowsRefLikeType == other.AllowsRefLikeType); 741Debug.Assert(type.HasUnmanagedTypeConstraint == other.HasUnmanagedTypeConstraint); 742Debug.Assert(type.HasReferenceTypeConstraint == other.HasReferenceTypeConstraint); 743Debug.Assert(type.ConstraintTypesNoUseSiteDiagnostics.Length == other.ConstraintTypesNoUseSiteDiagnostics.Length); 749Debug.Assert(type.CustomModifiers.IsDefaultOrEmpty); 750Debug.Assert(other.CustomModifiers.IsDefaultOrEmpty); 824Debug.Assert(matcher != null); 899Debug.Assert(type.IsDefinition); 958Debug.Assert((object)translatedType != null);
Emitter\EditAndContinue\EmitHelpers.cs (1)
82Debug.Assert(baseline.PEModuleBuilder != null);
Emitter\EditAndContinue\PEDeltaAssemblyBuilder.cs (3)
87Debug.Assert(visited is not null); 256Debug.Assert(EmitOptions.InstrumentationKinds.IsEmpty); 279Debug.Assert(Compilation == template.DeclaringCompilation);
Emitter\Model\AssemblyReference.cs (1)
25Debug.Assert((object)assemblySymbol != null);
Emitter\Model\AttributeDataAdapter.cs (3)
30Debug.Assert(argument.Kind != TypedConstantKind.Error); 121Debug.Assert(!argument.Values.IsDefault); 145Debug.Assert(argument.ValueInternal != null);
Emitter\Model\ExpandedVarargsMethodReference.cs (5)
27Debug.Assert(underlyingMethod.AcceptsExtraArguments); 28Debug.Assert(!argListParams.IsEmpty); 66Debug.Assert(_underlyingMethod.AsGenericMethodInstanceReference == _underlyingMethod); 80Debug.Assert(_underlyingMethod.AsSpecializedMethodReference == _underlyingMethod); 211Debug.Assert(!(value is ISymbol));
Emitter\Model\FieldSymbolAdapter.cs (5)
65Debug.Assert(this.IsDefinitionOrDistinct()); 80Debug.Assert(this.IsDefinitionOrDistinct()); 95Debug.Assert(this.IsDefinitionOrDistinct()); 105Debug.Assert(this.IsDefinitionOrDistinct()); 293Debug.Assert(!AdaptedFieldSymbol.IsDefinition);
Emitter\Model\GenericMethodInstanceReference.cs (1)
36Debug.Assert(arg.CustomModifiers.IsEmpty);
Emitter\Model\GenericTypeInstanceReference.cs (3)
28Debug.Assert(underlyingNamedType.IsDefinition); 30Debug.Assert(!underlyingNamedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Any(static a => a.CustomModifiers.Any())); 52System.Diagnostics.Debug.Assert(UnderlyingNamedType.OriginalDefinition.IsDefinition);
Emitter\Model\MethodReference.cs (1)
21Debug.Assert((object)underlyingMethod != null);
Emitter\Model\MethodSymbolAdapter.cs (19)
39Debug.Assert(this.IsDefinitionOrDistinct()); 55Debug.Assert(this.IsDefinitionOrDistinct()); 60Debug.Assert((object)AdaptedMethodSymbol.ContainingType != null && 76Debug.Assert(this.IsDefinitionOrDistinct()); 95Debug.Assert(this.IsDefinitionOrDistinct()); 101Debug.Assert(((Cci.IMethodReference)this).AsGenericMethodInstanceReference != null); 106Debug.Assert(((Cci.IMethodReference)this).AsSpecializedMethodReference != null); 115Debug.Assert(((Cci.IMethodReference)this).GetResolvedMethod(visitor.Context) != null); 161Debug.Assert(this.IsDefinitionOrDistinct()); 167Debug.Assert((object)AdaptedMethodSymbol.PartialDefinitionPart == null); // must be definition 192Debug.Assert(this.IsDefinitionOrDistinct()); 207Debug.Assert(AdaptedMethodSymbol.Parameters.All(p => p.IsDefinition)); 251Debug.Assert(((Cci.IMethodReference)this).AsGenericMethodInstanceReference != null); 255Debug.Assert(arg.CustomModifiers.IsEmpty); 264Debug.Assert(((Cci.IMethodReference)this).AsGenericMethodInstanceReference != null); 287Debug.Assert(((Cci.IMethodReference)this).AsSpecializedMethodReference != null); 339Debug.Assert(@param.IsDefinition); 359Debug.Assert(AdaptedMethodSymbol.HasDeclarativeSecurity); 647Debug.Assert(this.MethodKind != MethodKind.Destructor);
Emitter\Model\ModuleReference.cs (2)
25Debug.Assert(moduleBeingBuilt != null); 26Debug.Assert((object)underlyingModule != null);
Emitter\Model\NamedTypeReference.cs (1)
23Debug.Assert((object)underlyingNamedType != null);
Emitter\Model\NamedTypeSymbolAdapter.cs (33)
64Debug.Assert(this.IsDefinitionOrDistinct()); 98Debug.Assert(this.IsDefinitionOrDistinct()); 119Debug.Assert(this.IsDefinitionOrDistinct()); 135Debug.Assert(this.IsDefinitionOrDistinct()); 169Debug.Assert(this.IsDefinitionOrDistinct()); 185Debug.Assert(this.IsDefinitionOrDistinct()); 190Debug.Assert((object)AdaptedNamedTypeSymbol.ContainingType != null && 208Debug.Assert(this.IsDefinitionOrDistinct()); 288Debug.Assert(((Cci.ITypeReference)this).AsTypeDefinition(context) != null); 294Debug.Assert((object)baseType == null); 329Debug.Assert((object)method.PartialDefinitionPart == null); // must be definition 390Debug.Assert(body.ContainingType == (object)container); 410Debug.Assert((object)method.PartialDefinitionPart == null); // must be definition 417Debug.Assert(!method.RequiresExplicitOverride(out _)); 432Debug.Assert((object)(f.TupleUnderlyingField ?? f) == f); 433Debug.Assert(!(f is TupleErrorFieldSymbol)); 484Debug.Assert(((Cci.ITypeReference)this).AsTypeDefinition(context) != null); 630Debug.Assert((object)method != null); 678Debug.Assert((object)property != null); 809Debug.Assert(((Cci.ITypeReference)this).AsNamespaceTypeReference != null); 819Debug.Assert(((Cci.ITypeReference)this).AsNamespaceTypeReference != null); 829Debug.Assert((object)AdaptedNamedTypeSymbol.ContainingType == null && AdaptedNamedTypeSymbol.ContainingModule is SourceModuleSymbol); 839Debug.Assert(((Cci.ITypeReference)this).AsNestedTypeReference != null); 841Debug.Assert(this.IsDefinitionOrDistinct()); 853Debug.Assert((object)AdaptedNamedTypeSymbol.ContainingType != null); 864Debug.Assert((object)AdaptedNamedTypeSymbol.ContainingType != null); 875Debug.Assert(((Cci.ITypeReference)this).AsGenericTypeInstanceReference != null); 896Debug.Assert(((Cci.ITypeReference)this).AsGenericTypeInstanceReference != null); 909Debug.Assert(((Cci.ITypeReference)this).AsSpecializedNestedTypeReference != null); 912Debug.Assert(result != null); 926Debug.Assert(this is not SynthesizedPrivateImplementationDetailsType); 966Debug.Assert(this.IsDefinition); 967Debug.Assert(this.ContainingModule is SourceModuleSymbol);
Emitter\Model\ParameterSymbolAdapter.cs (1)
191Debug.Assert(this.IsDefinitionOrDistinct());
Emitter\Model\ParameterTypeInformation.cs (1)
22Debug.Assert((object)underlyingParameter != null);
Emitter\Model\PEAssemblyBuilder.cs (5)
77Debug.Assert(sourceAssembly is object); 562Debug.Assert(!allowUserDefinedAttribute || typeof(T) == typeof(NamedTypeSymbol)); 583Debug.Assert(symbol.Constructors.Length == description.Signatures.Length); 597Debug.Assert(userDefinedAttribute is null || (object)userDefinedAttribute.ContainingModule == _sourceAssembly.SourceModule); 598Debug.Assert(userDefinedAttribute?.IsErrorType() != true);
Emitter\Model\PEModuleBuilder.cs (54)
73Debug.Assert(!_needsGeneratedAttributes_IsFrozen); 253Debug.Assert(methodDocumentList.Count == 0); 530Debug.Assert(Compilation == template.DeclaringCompilation); 538Debug.Assert(Compilation == template.DeclaringCompilation); 591Debug.Assert(symbol.IsDefinition); 645Debug.Assert(OutputKind.IsNetModule() == sourceAssembly.DeclaringCompilation.Options.OutputKind.IsNetModule()); 678Debug.Assert(type.IsDefinition); 713Debug.Assert(contender.ContainingAssembly == sourceAssembly); 816Debug.Assert(diagnostics != null); 961Debug.Assert(namedTypeSymbol.IsDefinitionOrDistinct()); 962Debug.Assert(diagnostics != null); 967Debug.Assert(!needDeclaration); 1000Debug.Assert(!needDeclaration); 1048Debug.Assert((object)container != null); 1067Debug.Assert(namedTypeSymbol.IsDefinition); 1140Debug.Assert(diagnostics != null); 1173Debug.Assert(fieldSymbol.IsDefinitionOrDistinct()); 1180Debug.Assert(!needDeclaration); 1215Debug.Assert(!methodSymbol.IsDefaultValueTypeConstructor()); 1216Debug.Assert(optArgList == null || (methodSymbol.IsVararg && !needDeclaration)); 1255Debug.Assert(!needDeclaration); 1259Debug.Assert(methodSymbol.IsDefinitionOrDistinct()); 1263Debug.Assert(!needDeclaration); 1264Debug.Assert(!(methodSymbol.OriginalDefinition is NativeIntegerMethodSymbol)); 1265Debug.Assert(!(methodSymbol.ConstructedFrom is NativeIntegerMethodSymbol)); 1295Debug.Assert(typeIsGeneric); 1349Debug.Assert(methodSymbol.IsDefinition); 1366Debug.Assert(@params.All(p => p.IsDefinitionOrDistinct())); 1570Debug.Assert(flagsBuilder.All(f => f <= 2)); 1639Debug.Assert((object)type != null); 1640Debug.Assert(type.ContainsNativeIntegerWrapperType()); 1652Debug.Assert(builder.Any()); 1653Debug.Assert(builder.Contains(true)); 1663Debug.Assert((object)booleanType != null); 1685Debug.Assert(scope != ScopedKind.None); 1686Debug.Assert(!ParameterHelpers.IsRefScopedByDefault(symbol) || scope == ScopedKind.ScopedValue); 1687Debug.Assert(!symbol.IsThis); 1760Debug.Assert(!_needsGeneratedAttributes_IsFrozen); 1839Debug.Assert(methodAdapter.Name == methodName); 1844Debug.Assert(methodSymbol.Name == methodName); 1906Debug.Assert(intType.SpecialType == SpecialType.System_Int32); 1924Debug.Assert(arrayLength > 0); 1933Debug.Assert(attributeConstructor is { }); 1940Debug.Assert(typeAdapter.Name == typeName); 1946Debug.Assert(syntaxNode is { }); 1947Debug.Assert(diagnostics is { }); 1961Debug.Assert(typeAdapter.Name == typeName); 1975Debug.Assert(intType.SpecialType == SpecialType.System_Int32); 1992Debug.Assert(intType.SpecialType == SpecialType.System_Int32); 2008Debug.Assert(intType.SpecialType == SpecialType.System_Int32); 2096Debug.Assert(container is not NamedTypeSymbol { IsExtension: true } || nestedType.GetInternalSymbol() is FixedFieldImplementationType); 2102Debug.Assert(container is not NamedTypeSymbol { IsExtension: true }); 2108Debug.Assert(container is not NamedTypeSymbol { IsExtension: true }); 2114Debug.Assert(container is not NamedTypeSymbol { IsExtension: true });
Emitter\Model\PropertySymbolAdapter.cs (2)
145Debug.Assert(AdaptedPropertySymbol.IsDefinition); 148Debug.Assert(AdaptedPropertySymbol.ContainingModule is SourceModuleSymbol || AdaptedPropertySymbol.ContainingAssembly.IsLinked);
Emitter\Model\SpecializedFieldReference.cs (2)
26Debug.Assert((object)underlyingField != null); 48Debug.Assert(_underlyingField.OriginalDefinition.IsDefinition);
Emitter\Model\SpecializedGenericMethodInstanceReference.cs (2)
27Debug.Assert(PEModuleBuilder.IsGenericType(underlyingMethod.ContainingType) && underlyingMethod.ContainingType.IsDefinition); 37Debug.Assert(arg.CustomModifiers.IsEmpty);
Emitter\Model\SpecializedGenericNestedTypeInstanceReference.cs (3)
27Debug.Assert(underlyingNamedType.IsDefinition); 29Debug.Assert(!underlyingNamedType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.Any(static a => a.CustomModifiers.Any())); 51System.Diagnostics.Debug.Assert(UnderlyingNamedType.OriginalDefinition.IsDefinition);
Emitter\Model\SpecializedNestedTypeReference.cs (2)
28Debug.Assert(UnderlyingNamedType.OriginalDefinition.IsDefinition); 32Debug.Assert(result != null);
Emitter\Model\SymbolAdapter.cs (4)
65Debug.Assert(this.IsDefinition); 68Debug.Assert(this.ContainingModule is SourceModuleSymbol || 89Debug.Assert(this.Kind != SymbolKind.Assembly); 96Debug.Assert(this.Kind != SymbolKind.Assembly);
Emitter\Model\TypeParameterSymbolAdapter.cs (6)
78Debug.Assert(AdaptedTypeParameterSymbol.IsDefinition); 113Debug.Assert(AdaptedTypeParameterSymbol.IsDefinition); 200Debug.Assert(AdaptedTypeParameterSymbol.IsDefinition); 221Debug.Assert(AdaptedTypeParameterSymbol.IsDefinition); 230Debug.Assert(AdaptedTypeParameterSymbol.IsDefinition); 262Debug.Assert(!type.NullableAnnotation.IsAnnotated());
Emitter\NoPia\EmbeddedParameter.cs (1)
28Debug.Assert(underlyingParameter.AdaptedParameterSymbol.IsDefinition);
Emitter\NoPia\EmbeddedType.cs (5)
32Debug.Assert(underlyingNamedType.AdaptedNamedTypeSymbol.IsDefinition); 33Debug.Assert(underlyingNamedType.AdaptedNamedTypeSymbol.IsTopLevelType()); 34Debug.Assert(!underlyingNamedType.AdaptedNamedTypeSymbol.IsGenericType); 39Debug.Assert(UnderlyingNamedType.AdaptedNamedTypeSymbol.IsInterfaceType()); 125Debug.Assert((object)TypeManager.ModuleBeingBuilt == context.Module);
Emitter\NoPia\EmbeddedTypeParameter.cs (1)
24Debug.Assert(underlyingTypeParameter.AdaptedTypeParameterSymbol.IsDefinition);
Emitter\NoPia\EmbeddedTypesManager.cs (11)
182Debug.Assert(guidString == null); 353Debug.Assert(namedType.IsDefinition); 370Debug.Assert(namedType.IsDefinition); 400Debug.Assert(namedType.TypeKind == TypeKind.Struct || namedType.TypeKind == TypeKind.Enum || namedType.TypeKind == TypeKind.Delegate); 436Debug.Assert(field.AdaptedSymbol.IsDefinition); 472Debug.Assert(method.AdaptedSymbol.IsDefinition); 473Debug.Assert(!method.AdaptedMethodSymbol.IsDefaultValueTypeConstructor()); 533Debug.Assert(property.AdaptedPropertySymbol.IsDefinition); 568Debug.Assert(@event.AdaptedSymbol.IsDefinition); 605Debug.Assert(member.AdaptedSymbol.IsDefinition); 636Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
Errors\CSDiagnosticInfo.cs (1)
42Debug.Assert(code != ErrorCode.ERR_InternalError);
Errors\LazyMissingNonNullTypesContextDiagnosticInfo.cs (2)
24Debug.Assert(type.HasType); 63Debug.Assert(questionToken.SyntaxTree != null);
Errors\LazyObsoleteDiagnosticInfo.cs (3)
20Debug.Assert(symbol is Symbol || symbol is TypeWithAnnotations); 46Debug.Assert(kind != ObsoleteDiagnosticKind.Lazy); 47Debug.Assert(kind != ObsoleteDiagnosticKind.LazyPotentiallySuppressed);
Errors\LazyUnmanagedCallersOnlyMethodCalledDiagnosticInfo.cs (2)
36Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyAttributeData, UnmanagedCallersOnlyAttributeData.Uninitialized)); 37Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyAttributeData, UnmanagedCallersOnlyAttributeData.AttributePresentDataNotBound));
Errors\MessageID.cs (1)
479Debug.Assert(RequiredFeature(feature) == null);
Errors\SyntaxDiagnosticInfo.cs (1)
19Debug.Assert(width >= 0);
FlowAnalysis\AbstractFlowPass.cs (41)
140Debug.Assert(newState != null); 190Debug.Assert(node != null); 199Debug.Assert(firstInRegion != null); 200Debug.Assert(lastInRegion != null); 272Debug.Assert(this.regionPlace == RegionPlace.Before); 289Debug.Assert(IsInside); 299Debug.Assert(span.Length > 0); 537Debug.Assert(_labelsSeen.Count == 0); 672Debug.Assert(!this.IsConditionalState); 826Debug.Assert(!this.IsConditionalState); 922Debug.Assert(!IsConditionalState); 925Debug.Assert(node.Pattern is 931Debug.Assert(negated == node.IsNegated); 935Debug.Assert(!IsConditionalState); 998Debug.Assert(binaryPatterns.Peek().Left is not BoundBinaryPattern); 1039Debug.Assert(binaryPatterns.Peek().Left is not BoundBinaryPattern); 1188Debug.Assert(shortCircuitState != null); 1517Debug.Assert(method?.OriginalDefinition.MethodKind != MethodKind.LocalFunction); 2203Debug.Assert(node.HasAnyErrors || (object)readMethod != (object)GetWriteMethod(property)); 2394Debug.Assert(!node.OperatorKind.IsUserDefined()); 2436Debug.Assert(!binOp.OperatorKind.IsUserDefined()); 2460Debug.Assert(stack.Count > 0); 2504Debug.Assert(!isBool || binary.Kind != BoundKind.UserDefinedConditionalLogicalOperator); 2506Debug.Assert(isAnd || op == BinaryOperatorKind.Or); 2713Debug.Assert(node.InterpolatedStringHandlerData.HasValue); 2726Debug.Assert(parts.Count >= 2); 2752Debug.Assert(shortCircuitState != null || (!usesBoolReturns && !firstPartIsConditional)); 2776Debug.Assert(shortCircuitState != null); 2840Debug.Assert(node.HasAnyErrors || (object)readMethod != (object)writeMethod); 2936Debug.Assert(!IsConditionalState); 2972Debug.Assert(!IsConditionalState); 3017Debug.Assert(!IsConditionalState); 3043Debug.Assert(method is object); 3044Debug.Assert(method.ParameterCount is 1); 3116Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion)); 3127Debug.Assert(expr is BoundExpression); 3256Debug.Assert(!this.IsConditionalState); 3264Debug.Assert(!this.IsConditionalState); 3367Debug.Assert(!this.IsConditionalState); 3464Debug.Assert(!this.IsConditionalState); 3579Debug.Assert(this.IsConditionalState);
FlowAnalysis\AlwaysAssignedWalker.cs (1)
52Debug.Assert(!IsInside);
FlowAnalysis\ControlFlowPass.cs (3)
83Debug.Assert(!self.Alive || !self.Reported); 92Debug.Assert(!self.Alive || !self.Reported); 166Debug.Assert(!badRegion);
FlowAnalysis\DefiniteAssignment.cs (27)
245Debug.Assert(member is TypeSymbol type && 249Debug.Assert((object)member.ContainingAssembly == compilation?.SourceAssembly); 466Debug.Assert(node != null || location != null); 480Debug.Assert(thisSlot > 0); 541Debug.Assert(!parameter.IsThis); 558Debug.Assert(diagnostics != null); 572Debug.Assert(unused.IsDefault); 651Debug.Assert(walker.TrackImplicitlyInitializedFields); 661Debug.Assert(!badRegion); 672Debug.Assert(strictAnalysis || implicitlyInitializedFieldsOpt.IsDefault); 693Debug.Assert(captured.Kind == SymbolKind.Parameter || captured.Kind == SymbolKind.Local || captured.Kind == SymbolKind.RangeVariable); 786Debug.Assert(fieldOrEventAccess.Kind == BoundKind.FieldAccess || fieldOrEventAccess.Kind == BoundKind.EventAccess); 1154Debug.Assert(!IsConditionalState); 1259Debug.Assert(CurrentSymbol is MethodSymbol { MethodKind: MethodKind.Constructor, ContainingType.TypeKind: TypeKind.Struct }); 1291Debug.Assert(foundUnassignedField); 1473Debug.Assert(unassignedSlot > 0); 1536Debug.Assert(!IsConditionalState); 1561Debug.Assert(local.InitializerOpt == value || value == null); 1690Debug.Assert(containingSlot != -1); 1691Debug.Assert(!state.IsAssigned(containingSlot)); 1730Debug.Assert(!_emptyStructTypeCache.IsEmptyStructType(type)); 1766Debug.Assert(!_emptyStructTypeCache.IsEmptyStructType(type)); 1947Debug.Assert(!this.IsConditionalState); 2278Debug.Assert(_usedVariables.Contains(local)); 2780Debug.Assert((object)iterationVariable != null); 2910Debug.Assert(!other.Reachable); 2929Debug.Assert(!assigned.IsNull);
FlowAnalysis\DefiniteAssignment.LocalFunctions.cs (3)
70Debug.Assert(!IsConditionalState); 97Debug.Assert(localFunc != null); 107Debug.Assert(!_emptyStructTypeCache.IsEmptyStructType(type));
FlowAnalysis\DefiniteAssignment.VariableIdentifier.cs (5)
27Debug.Assert(containingSlot >= 0); 28Debug.Assert(symbol.Kind switch 50Debug.Assert(Exists); 63Debug.Assert(Exists); 64Debug.Assert(other.Exists);
FlowAnalysis\EmptyStructTypeCache.cs (2)
55Debug.Assert(compilation != null || !dev12CompilerCompatibility); 105Debug.Assert(!Cache.ContainsKey(nts) || Cache[nts] == result);
FlowAnalysis\FlowAnalysisPass.cs (17)
41Debug.Assert(!hasTrailingExpression || method.IsScriptInitializer); 56Debug.Assert(!implicitlyInitializedFields.IsEmpty); 59Debug.Assert(method is not SourceMemberMethodSymbol { SyntaxNode: ConstructorDeclarationSyntax { Initializer: not null } } || block.HasErrors); 71Debug.Assert(unusedImplicitlyInitializedFields.IsDefault); 72Debug.Assert(needsImplicitReturn); 76Debug.Assert(method.MethodKind != MethodKind.AnonymousFunction); 82Debug.Assert(!submissionResultType.IsVoidType()); 92Debug.Assert(!Analyze(compilation, method, block, flowAnalysisDiagnostics, needsImplicitReturn: out _, out unusedImplicitlyInitializedFields)); 93Debug.Assert(unusedImplicitlyInitializedFields.IsDefault); 95Debug.Assert(getErrorsOnly(flowAnalysisDiagnostics.ToReadOnly()).SequenceEqual(getErrorsOnly(diagnostics.ToReadOnly().Diagnostics.Skip(initialDiagnosticCount)))); 112Debug.Assert(!implicitlyInitializedFields.IsEmpty); 113Debug.Assert(method.MethodKind == MethodKind.Constructor); 115Debug.Assert(containingType.IsStructType()); 125Debug.Assert(elementField == implicitlyInitializedFields.Single()); 189Debug.Assert(body != null); 190Debug.Assert(method != null); 194Debug.Assert(body.WasCompilerGenerated ||
FlowAnalysis\LocalDataFlowPass.cs (4)
42Debug.Assert(emptyStructs != null); 102Debug.Assert(containingSlot >= 0); 103Debug.Assert(symbol != null); 229Debug.Assert((receiver is null) != member.RequiresInstanceReceiver());
FlowAnalysis\NullableWalker.cs (302)
63Debug.Assert(variables.Id == variableNullableStates.Id); 130Debug.Assert(TypeSymbol.Equals(RValueType.Type, LValueType.Type, TypeCompareKind.ConsiderEverything)); 147Debug.Assert(!StateForLambda.HasValue); 350Debug.Assert(TypeAllowsConditionalState(visitResult.RValueType.Type) 448Debug.Assert(_targetTypedAnalysisCompletionOpt is null or { Count: 0 }); 472Debug.Assert(!TrackingRegions); 473Debug.Assert(!useDelegateInvokeParameterTypes || delegateInvokeMethodOpt is object); 474Debug.Assert(baseOrThisInitializer is null or { MethodKind: MethodKind.Constructor }); 547Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.Type)); 548Debug.Assert(expression != null || placeholder.Kind == BoundKind.InterpolatedStringArgumentPlaceholder); 557Debug.Assert(_resultForPlaceholdersOpt is { }); 559Debug.Assert(removed); 565Debug.Assert(placeholder is { }); 648Debug.Assert(_useConstructorExitWarnings); 653Debug.Assert(thisParameter is object); 993Debug.Assert(requiredMember.IsRequired()); 1465Debug.Assert(node.SyntaxTree is object); 1511Debug.Assert(method.IsConstructor()); 1831Debug.Assert(diagnostics != null); 1832Debug.Assert(getterNullResilienceData is null || symbol is SourcePropertyAccessorSymbol { MethodKind: MethodKind.PropertyGet }); 1833Debug.Assert(getterNullResilienceData is null || !useConstructorExitWarnings); 1857Debug.Assert(!walker.IsConditionalState); 1875Debug.Assert(snapshotBuilderOpt is null || symbol is object); 1882Debug.Assert(walker._variables.Id == initialState.Value.Id); 1888Debug.Assert(!badRegion); 1909Debug.Assert(result.RequiredAnalysis == requiredAnalysis); 1925Debug.Assert(!IsConditionalState); 1948Debug.Assert(node is object); 1998Debug.Assert(slot > 0); 2087Debug.Assert(member?.RequiresInstanceReceiver() ?? true); 2106Debug.Assert(node.HasErrors || 2226Debug.Assert(containingSlot == 0); 2623Debug.Assert(!IsConditionalState); 2677Debug.Assert(ErrorFacts.NullableWarnings.Contains(MessageProvider.Instance.GetIdForErrorCode((int)errorCode))); 2686Debug.Assert(targetSlot > 0); 2687Debug.Assert(EmptyStructTypeCache.IsTrackableStructType(targetType)); 2721Debug.Assert(targetContainerSlot > 0); 2722Debug.Assert(skipSlot > 0); 2806Debug.Assert(slot > 0); 2827Debug.Assert(targetSlot > 0); 2831Debug.Assert(actualType is { }); 2839Debug.Assert(conversion.Kind is ConversionKind.Identity or ConversionKind.ImplicitReference); 2872Debug.Assert(false); 2900Debug.Assert(targetSlot > 0); 2901Debug.Assert(valueSlot > 0); 2983Debug.Assert(!IsConditionalState); 3037Debug.Assert(!IsConditionalState); 3143Debug.Assert((object)returnType != LambdaSymbol.ReturnTypeIsBeingInferred); 3193Debug.Assert(node.Type.IsErrorType() || type.Type.IsErrorType()); 3225Debug.Assert(!TrackingRegions); 3292Debug.Assert(newBodiesVisited); 3382Debug.Assert((object?)variables.Container == container); 3394Debug.Assert(!useDelegateInvokeParameterTypes || delegateInvokeMethod is object); 3395Debug.Assert(!useDelegateInvokeReturnType || delegateInvokeMethod is object); 3517Debug.Assert(!IsConditionalState); 3543Debug.Assert(!IsConditionalState); 3632Debug.Assert(!IsConditionalState); 3667Debug.Assert(type.Type.IsErrorType()); 3686Debug.Assert(node is BoundExpression or BoundPattern); 3687Debug.Assert(!IsConditionalState); 3704Debug.Assert((object?)resultType.Type != _invalidType.Type); 3705Debug.Assert(AreCloseEnough(resultType.Type, node.Type)); 3803Debug.Assert(!_completingTargetTypedExpression); 3890Debug.Assert(node.Placeholder is { }); 3894Debug.Assert(initializer.ArgsToParamsOpt.IsDefault); 3966Debug.Assert(completion is not null); 3976Debug.Assert(TypeSymbol.Equals(strippedTargetCollectionType, node.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4024Debug.Assert(foundIterationType); 4029Debug.Assert(!targetElementType.HasType); 4043Debug.Assert(node.ExpressionPlaceholder is { }); 4044Debug.Assert(node.EnumeratorInfoOpt is { }); 4057Debug.Assert(node.HasErrors); 4058Debug.Assert(node.Conversion is null); 4059Debug.Assert(node.EnumeratorInfoOpt is null); 4067Debug.Assert(!IsConditionalState); 4077Debug.Assert(isTargetTyped == argumentsCompletion is not null); 4108Debug.Assert(argumentsCompletion is not null); 4109Debug.Assert(initialStateInferenceCompletion is not null); 4114Debug.Assert(argumentsCompletion is null); 4115Debug.Assert(initialStateInferenceCompletion is null); 4116Debug.Assert(initializerCompletion is null); 4132Debug.Assert(resultState == NullableFlowState.NotNull); 4137Debug.Assert(TypeSymbol.Equals(resultTypeWithAnnotations.Type, node.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4175Debug.Assert(node.Kind is BoundKind.ObjectCreationExpression or BoundKind.DynamicObjectCreationExpression or BoundKind.NewT or BoundKind.NoPiaObjectCreationExpression); 4244Debug.Assert(completion is null); 4245Debug.Assert(resultState == NullableFlowState.NotNull); 4257Debug.Assert(!delayCompletionForType || containingSlot == -1); 4307Debug.Assert(!delayCompletionForType || containingSlot == -1); 4375Debug.Assert(argumentsCompletion is null); 4376Debug.Assert(initializationCompletion is null); 4395Debug.Assert(initializationCompletion is null || symbol is not null); 4401Debug.Assert(result is null); 4411Debug.Assert(TypeSymbol.Equals(objectInitializer.Type, GetTypeOrReturnType(symbol), TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4426Debug.Assert(!delayCompletionForType || slot == -1); 4442Debug.Assert(nestedCompletion is null); 4467Debug.Assert(!delayCompletionForType || conversionCompletion is null); 4474Debug.Assert(GetTypeOrReturnTypeWithAnnotations(symbol).HasType); 4486Debug.Assert(conversionCompletion is not null); 4490Debug.Assert(conversionCompletion is null); 4503Debug.Assert(result is null); 4542Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4543Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.LValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4559Debug.Assert(visitArgumentsCompletion is not null); 4563Debug.Assert(visitArgumentsCompletion is null); 4564Debug.Assert(reinferredMethod is object); 4600Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4601Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.LValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 4678Debug.Assert(node.Type is object); 4696Debug.Assert((object)placeholder != null); 4702Debug.Assert(!IsConditionalState); 4703Debug.Assert(node.Type.IsAnonymousType); 4880Debug.Assert(namedType.Name == "Span"); 4881Debug.Assert(namedType.OriginalDefinition.Arity == 1); 4887Debug.Assert(namedType.Name == "Span"); 4888Debug.Assert(namedType.OriginalDefinition.Arity == 1); 4997Debug.Assert(!IsConditionalState); 5001Debug.Assert(!IsConditionalState); 5002Debug.Assert(!node.Expression.Type!.IsValueType); 5031Debug.Assert(!IsConditionalState); 5035Debug.Assert(!IsConditionalState); 5036Debug.Assert(expressionType is not null); 5037Debug.Assert(expressionType.IsValueType); 5111Debug.Assert(!IsConditionalState); 5269Debug.Assert(binary.Type.SpecialType == SpecialType.System_Boolean); 5302Debug.Assert(!IsConditionalState); 5337Debug.Assert(operand == expr); 5355Debug.Assert(!IsConditionalState); 5359Debug.Assert(binary.Type!.SpecialType == SpecialType.System_Boolean); 5485Debug.Assert(!IsConditionalState); 5586Debug.Assert(operand != null); 5834Debug.Assert(targetType.Type.ContainsErrorType() || 5846Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.Type, TypeCompareKind.AllIgnoreOptions)); 5857Debug.Assert(!IsConditionalState); 5908Debug.Assert(rightType is object); 5915Debug.Assert(!conversion.IsUserDefined); 5920Debug.Assert(!conversion.IsUserDefined); 5943Debug.Assert(conversionResult.Type is not null); 5972Debug.Assert(targetType.HasType); 5984Debug.Assert(!IsConditionalState); 6022Debug.Assert(!IsConditionalState); 6068Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion)); 6080Debug.Assert(expr is BoundExpression); 6090Debug.Assert(expr is BoundExpression); 6251Debug.Assert(!wasTargetTyped); 6258Debug.Assert(node is BoundUnconvertedConditionalOperator); 6259Debug.Assert(_returnTypesOpt is not null || _disableDiagnostics); 6351Debug.Assert(!isRef); 6363Debug.Assert(isRef); 6497Debug.Assert(node.InvokedAsExtensionMethod || isNewExtensionMethod); 6504Debug.Assert(node.Method.ContainingType.ExtensionParameter is not null); 6543Debug.Assert(node.ReceiverOpt is null); 6633Debug.Assert(newMethod is not null); 6657Debug.Assert(extensionParameter is not null); 6691Debug.Assert(extensionParameter is not null); 6742Debug.Assert(arguments.Length == 2); 6753Debug.Assert(arguments.Length == 1); 6842Debug.Assert(baseType is object); 6914Debug.Assert(!compareExchangeInfo.IsDefault); 6936Debug.Assert(argsToParamsOpt is { IsDefault: true } or { Length: 3 }); 7179Debug.Assert(result.completion is null); 7201Debug.Assert(!arguments.IsDefault); 7202Debug.Assert(!expanded || !parametersOpt.IsDefault); 7203Debug.Assert(refKindsOpt.IsDefaultOrEmpty || refKindsOpt.Length == arguments.Length); 7204Debug.Assert(argsToParamsOpt.IsDefault || argsToParamsOpt.Length == arguments.Length); 7212Debug.Assert(!arguments.Any(a => a.IsParamsArrayOrCollection)); 7310Debug.Assert(method is ErrorMethodSymbol); 7433Debug.Assert(result.completion is null); 7445Debug.Assert(arguments.Count(a => a.IsParamsArrayOrCollection) <= 1); 7452Debug.Assert(parametersOpt.IsDefault || arguments.Length == parametersOpt.Length); 7480Debug.Assert(defaultArguments.IsNull || elements.Length == 1); 7481Debug.Assert(elements.Length == 1 || a == arguments.Length - 1); 7590Debug.Assert(receiverSlot >= 0); 7679Debug.Assert(!IsConditionalState); 7743Debug.Assert(!IsConditionalState); 7791Debug.Assert(!IsConditionalState); 7810Debug.Assert(!this.IsConditionalState); 7827Debug.Assert(argumentResultType is not null); 7883Debug.Assert(!this.IsConditionalState); 8068Debug.Assert(!IsConditionalState); 8073Debug.Assert(!IsConditionalState); 8233Debug.Assert(variables.Id == localState.Id); 8252Debug.Assert(!expanded); 8262Debug.Assert(paramsIterationType.HasType); 8279Debug.Assert(member.GetMemberArityIncludingExtension() != 0); 8369Debug.Assert(false); // unexpected value 8408Debug.Assert(lambdaState.HasValue); 8421Debug.Assert(collectionExpressionVisitResults is not null); 8422Debug.Assert(collectionExpressionVisitResults.Length == collection.Elements.Length); 8551Debug.Assert(group != null || !conversion.ExplicitCastInCode); // Explicit conversions should include a group. 8664Debug.Assert((object)symbol != null); 8698Debug.Assert(symbol.ContainingType.IsDefinition); 8735Debug.Assert(false); 8765Debug.Assert(targetType.HasType); 8810Debug.Assert(completion is null); 8841Debug.Assert(targetTypeOpt.HasType); 8870Debug.Assert(result.completion is null); 8900Debug.Assert(!IsConditionalState); 8936Debug.Assert(diagnostics.DiagnosticBag is { }); 8962Debug.Assert(tupleType.IsTupleType); 8963Debug.Assert(values.Length == types.Length); 8964Debug.Assert(values.Length == (useRestField ? Math.Min(tupleType.TupleElements.Length, NamedTypeSymbol.ValueTupleRestPosition) : tupleType.TupleElements.Length)); 8997Debug.Assert(index != -1); 9004Debug.Assert(containingType.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T); 9005Debug.Assert(containingSlot > 0); 9006Debug.Assert(valueSlot > 0); 9027Debug.Assert(conversion.Kind == ConversionKind.ImplicitTuple || conversion.Kind == ConversionKind.ExplicitTuple); 9028Debug.Assert(slot > 0); 9029Debug.Assert(valueSlot > 0); 9131Debug.Assert(diagnostics.DiagnosticBag is { }); 9187Debug.Assert(diagnostics.DiagnosticBag is { }); 9242Debug.Assert(conversionOpt is null 9289Debug.Assert(!trackMembers || !IsConditionalState); 9290Debug.Assert(conversionOperand != null); 9316Debug.Assert(conversionOpt is null); 9484Debug.Assert(conversionOperand != null); 9492Debug.Assert(containingSlot > 0); 9531Debug.Assert(conversionOperand != null); 9587Debug.Assert(targetType.IsValueType || targetType.IsErrorType()); 9690Debug.Assert(dependsOn); // If this case fails, add a corresponding test. 9763Debug.Assert(handlerData.ArgumentPlaceholders.IsEmpty 9836Debug.Assert(conversionOperand != null); 9837Debug.Assert(targetTypeWithNullability.HasType); 9838Debug.Assert(diagnosticLocation != null); 9839Debug.Assert(conversion.Kind == ConversionKind.ExplicitUserDefined || conversion.Kind == ConversionKind.ImplicitUserDefined); 9871Debug.Assert(method is object); 9872Debug.Assert(method.ParameterCount == 1); 9873Debug.Assert(operandType.Type is object); 9980Debug.Assert(conversionOpt.ConversionGroupOpt == conversionGroup); 9992Debug.Assert(conversionOpt.ConversionGroupOpt == conversionGroup); 10053Debug.Assert(operandType.Type is object); 10054Debug.Assert(diagnosticLocation != null); 10087Debug.Assert(node.Type.IsDelegateType()); 10134Debug.Assert(analysisCompletion is null); 10146Debug.Assert(TypeSymbol.Equals(resultTypeWithAnnotations.Type, node.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 10223Debug.Assert(arg.Type is not null); 10242Debug.Assert(arg.Type is not null); 10263Debug.Assert(!IsConditionalState); 10329Debug.Assert(_binder is object); 10338Debug.Assert(receiverParameter is not null); 10372Debug.Assert(delegateTypeOpt?.IsDelegateType() != false); 10440Debug.Assert(!IsConditionalState); 10545Debug.Assert(expr is not BoundObjectInitializerMember); 10654Debug.Assert(conversion.Kind == ConversionKind.Deconstruction); 10682Debug.Assert(invocation is object); 10683Debug.Assert(rightResult.Type is object); 10720Debug.Assert(parameters.Length - offset == n); 10727Debug.Assert(receiverParameter is not null); 10771Debug.Assert(rightParts.Length == n); 10938Debug.Assert(!IsConditionalState); 11116Debug.Assert(!IsConditionalState); 11240Debug.Assert(MakeSlot(node) == -1); 11332Debug.Assert(node.ReceiverOpt is not null); 11336Debug.Assert(extensionParameter is not null); 11346Debug.Assert(updatedProperty is not null); 11448Debug.Assert(!IsConditionalState); 11449Debug.Assert(!member.GetIsNewExtensionMember()); 11480Debug.Assert(!IsConditionalState); 11517Debug.Assert(containingType.IsNullableType()); 11518Debug.Assert(TypeSymbol.Equals(NominalSlotType(containingSlot), containingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 11530Debug.Assert(node.HasErrors); 11582Debug.Assert(resultType is object); 11629Debug.Assert(!foundMultiple); 11630Debug.Assert(targetTypeWithAnnotations.HasType); 11691Debug.Assert(wellKnownSpan is WellKnownType.System_Span_T or WellKnownType.System_ReadOnlySpan_T); 11737Debug.Assert(disposalPlaceholder is not null); 11915Debug.Assert(!IsConditionalState); 12093Debug.Assert(leftOperand is not null); 12118Debug.Assert(isAnd || op == BinaryOperatorKind.Or); 12123Debug.Assert(IsConditionalState); 12149Debug.Assert(!isBool); 12222Debug.Assert(placeholder is object); 12279Debug.Assert(!this.IsConditionalState); 12299Debug.Assert(!this.IsConditionalState); 12318Debug.Assert(node.Type.SpecialType == SpecialType.System_Boolean); 12370Debug.Assert(node.Type.SpecialType == SpecialType.System_RuntimeArgumentHandle); 12378Debug.Assert(node.Type is null); 12385Debug.Assert(!IsConditionalState); 12393Debug.Assert(!IsConditionalState); 12402Debug.Assert(node.WasCompilerGenerated); 12410Debug.Assert(node.WasCompilerGenerated); 12449Debug.Assert(node.Type.IsDynamic()); 12468Debug.Assert(node.Type.IsDynamic()); 12469Debug.Assert(node.Type.IsReferenceType); 12479Debug.Assert(!IsConditionalState); 12575Debug.Assert(node.Type.IsDynamic()); 12588Debug.Assert(!this.IsConditionalState); 12598Debug.Assert(receiverOpt.Type is null || AreCloseEnough(receiverOpt.Type, resultTypeSymbol)); 12719Debug.Assert(node.Type is null || node.Type.IsErrorType() || node.Type.IsRefLikeType); 12739Debug.Assert(node.Type is not null); 12898Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull }); 12969Debug.Assert(!otherIsConditional); 13106Debug.Assert(Id == variables.Container!.Id); 13165Debug.Assert(state.Id > id); 13179Debug.Assert(Id < variables.Id); 13225Debug.Assert(Id > id); 13238Debug.Assert(index < Capacity); 13240Debug.Assert((_state[index], _state[index + 1]) != (false, false)); 13257Debug.Assert(Id > id); 13312Debug.Assert(Id == other.Id); 13319Debug.Assert(_state.Capacity == other._state.Capacity); 13341Debug.Assert(Id == other.Id); 13348Debug.Assert(_state.Capacity == other._state.Capacity);
FlowAnalysis\NullableWalker.PlaceholderLocal.cs (2)
30Debug.Assert(identifier != null); 31Debug.Assert(containingSymbol is null || containingSymbol.DeclaringCompilation is not null);
FlowAnalysis\NullableWalker.SnapshotManager.cs (5)
42Debug.Assert(!incrementalSnapshots.IsDefaultOrEmpty); 47Debug.Assert(currentPosition > previousPosition); 172Debug.Assert(_symbolToSlot.Count == _walkerStates.Count); 173Debug.Assert(_symbolToSlot.Count > 0); 223Debug.Assert(AreCloseEnough(originalSymbol, updatedSymbol));
FlowAnalysis\NullableWalker.Variables.cs (16)
164Debug.Assert(_variableSlot.Count == 0); 165Debug.Assert(_variableTypes.Count == 0); 166Debug.Assert(_variableBySlot.Count == 1); 185Debug.Assert(id >= 0); 186Debug.Assert(id <= IdMask); 187Debug.Assert(container is null || container.Id < id); 216Debug.Assert(GetVariablesForMethodScope(method) is null); 217Debug.Assert(!(method.ContainingSymbol is MethodSymbol containingMethod) || 262Debug.Assert(slot <= 0 || 290Debug.Assert(id == Id); 306Debug.Assert((object)variables == this); 416Debug.Assert(id >= 0); 417Debug.Assert(id <= IdMask); 418Debug.Assert(index >= 0); 419Debug.Assert(index <= IndexMask); 426Debug.Assert(slot > -1);
FlowAnalysis\NullableWalker_Patterns.cs (32)
36Debug.Assert(!IsConditionalState); 129Debug.Assert(current.Left is not BoundBinaryPattern); 396Debug.Assert(originalInputSlot > 0); 410Debug.Assert(isDerivedType(NominalSlotType(originalInputSlot), expressionTypeWithState.Type)); 421Debug.Assert(found); // the topologically sorted nodes should contain only reachable nodes 438Debug.Assert(inputSlot > 0); 454Debug.Assert(outputSlot > 0); 479Debug.Assert(!IsConditionalState); 487Debug.Assert(inputSlot > 0); 518Debug.Assert(originalInputMap[outputSlot] == ((BoundTupleExpression)expression).Arguments[originalTupleElement.TupleElementIndex]); 527Debug.Assert(outputSlot > 0); 533Debug.Assert(inputSlot > 0); 542Debug.Assert(outputSlot > 0); 559Debug.Assert(inputSlot > 0); 563Debug.Assert(outputSlot > 0); 571Debug.Assert(inputSlot > 0); 575Debug.Assert(outputSlot > 0); 592Debug.Assert(foundTemp); 631Debug.Assert(t.Value != ConstantValue.Null); 708Debug.Assert(this.IsConditionalState); 714Debug.Assert(w.WhenFalse is null); 743Debug.Assert(slot > 0); 747Debug.Assert(outputSlotAndType.slot == slot); 748Debug.Assert(isDerivedType(outputSlotAndType.type, type)); 752Debug.Assert(NominalSlotType(slot) is var slotType && (slotType.IsErrorType() || isDerivedType(slotType, type))); 779Debug.Assert(false); 784Debug.Assert(false); 789Debug.Assert(false); 813Debug.Assert(false); 842Debug.Assert(outputSlot > 0); 966Debug.Assert((node is BoundUnconvertedSwitchExpression && (_returnTypesOpt is not null || _disableDiagnostics)) 1055Debug.Assert(!IsConditionalState);
FlowAnalysis\ReadWriteWalker.cs (1)
95Debug.Assert(!ignoreThisParameter || m is SynthesizedPrimaryConstructor);
FlowAnalysis\UnassignedAddressTakenVariablesWalker.cs (1)
30Debug.Assert(!badRegion);
Lowering\AsyncRewriter\AsyncExceptionHandlerRewriter.cs (16)
40Debug.Assert(TypeSymbol.Equals(factory.CurrentType, (containingType ?? containingMethod.ContainingType), TypeCompareKind.ConsiderEverything2)); 116Debug.Assert(containingSymbol != null); 117Debug.Assert((object)containingType != null); 118Debug.Assert(statement != null); 119Debug.Assert(compilationState != null); 120Debug.Assert(diagnostics != null); 140Debug.Assert(SyntaxBindingUtilities.BindsToTryStatement(tryStatementSyntax)); 170Debug.Assert(asTry.FinallyBlockOpt == null); 543Debug.Assert(!_inCatchWithoutAwaits); 548Debug.Assert(node.Syntax.IsKind(SyntaxKind.CatchClause)); 578Debug.Assert(filterPrologueOpt is null); 939Debug.Assert(parent != null); 940Debug.Assert(syntax != null); 942Debug.Assert(SyntaxBindingUtilities.BindsToTryStatement(syntax)); 1007Debug.Assert(_syntaxOpt != null); 1067Debug.Assert(pendingCatch.SyntaxOpt.IsKind(SyntaxKind.TryStatement));
Lowering\AsyncRewriter\AsyncIteratorMethodToStateMachineRewriter.cs (7)
68Debug.Assert(asyncIteratorInfo != null); 204Debug.Assert(_currentDisposalLabel is object); 214Debug.Assert(_currentDisposalLabel is object); 254Debug.Assert(_exprReturnLabel.Equals(_currentDisposalLabel)); 304Debug.Assert(_currentDisposalLabel is object); // no yield return allowed inside a finally 317Debug.Assert(_asyncIteratorInfo != null); 323Debug.Assert(_currentDisposalLabel is object); // no yield break allowed inside a finally
Lowering\AsyncRewriter\AsyncMethodBuilderMemberCollection.cs (4)
117Debug.Assert((object)builderType != null); 151Debug.Assert((object)builderType != null); 214Debug.Assert((object)builderType != null); 296Debug.Assert((object)builderType != null);
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (5)
293Debug.Assert(!CurrentMethod.IsIterator); // an override handles async-iterators 376Debug.Assert(node.Syntax.IsKind(SyntaxKind.AwaitExpression) || node.WasCompilerGenerated); 428Debug.Assert(receiver != null); 436Debug.Assert(methodName != null); 665Debug.Assert(_method.IsAsyncEffectivelyReturningGenericTask(F.Compilation));
Lowering\AsyncRewriter\AsyncRewriter.AsyncIteratorRewriter.cs (4)
45Debug.Assert(!TypeSymbol.Equals(method.IteratorElementTypeWithAnnotations.Type, null, TypeCompareKind.ConsiderEverything2)); 48Debug.Assert(_isEnumerable != method.IsAsyncReturningIAsyncEnumerator(method.DeclaringCompilation)); 160Debug.Assert(stateMachineType.Constructor is IteratorConstructor); 385Debug.Assert(!_asyncMethodBuilderMemberCollection.CheckGenericMethodConstraints);
Lowering\AsyncRewriter\AsyncRewriter.cs (1)
51Debug.Assert(compilationState.ModuleBuilderOpt != null);
Lowering\BoundTreeToDifferentEnclosingContextRewriter.cs (1)
148Debug.Assert(node.InterpolatedStringHandlerData is null);
Lowering\ClosureConversion\ClosureConversion.Analysis.cs (6)
84Debug.Assert(scopeTree != null); 181Debug.Assert(!oldEnv.IsStruct); 182Debug.Assert(oldEnv.Parent == null || oldEnv.Parent == env); 343Debug.Assert(scope.DeclaredEnvironment is null); 384Debug.Assert(environmentsToScopes.ContainsKey(env)); 530Debug.Assert(syntax != null);
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (17)
82Debug.Assert(boundNode != null); 153Debug.Assert(value); 162Debug.Assert(symbol != null); 355Debug.Assert(rootScope != null); 356Debug.Assert(topLevelMethod != null); 357Debug.Assert(methodsConvertedToDelegates != null); 358Debug.Assert(diagnostics != null); 374Debug.Assert(node == FindNodeToAnalyze(node)); 375Debug.Assert(topLevelMethod != null); 608Debug.Assert( 632Debug.Assert(symbol.ContainingSymbol != null); 671Debug.Assert(_freeVariables.Contains(symbol)); 694Debug.Assert(capturedVariable.Kind == SymbolKind.Method); 700Debug.Assert(false); // Add test(s) for scenarios that hit this code path 745Debug.Assert(parentScope.BoundNode != node); 791Debug.Assert(!_localToScope.ContainsKey(local)); 795Debug.Assert(_freeVariables.Add(local));
Lowering\ClosureConversion\ClosureConversion.cs (39)
207Debug.Assert(localOrParameter is LocalSymbol || localOrParameter is ParameterSymbol || 246Debug.Assert(thisType is not null); 247Debug.Assert(thisParameter is null || TypeSymbol.Equals(thisParameter.Type, thisType, TypeCompareKind.ConsiderEverything2)); 248Debug.Assert(compilationState.ModuleBuilderOpt != null); 249Debug.Assert(diagnostics.DiagnosticBag != null); 312Debug.Assert(_addedStatements == null); 349Debug.Assert(!_frames.ContainsKey(scope.BoundNode)); 373Debug.Assert(syntax != null); 395Debug.Assert(!proxies.ContainsKey(captured)); 462Debug.Assert((object)translatedLambdaContainer != _topLevelMethod.ContainingType || 585Debug.Assert(TypeSymbol.Equals(result.Type, frameType, TypeCompareKind.ConsiderEverything2)); 599Debug.Assert(frameClass.IsDefinition); 670Debug.Assert(frame.ScopeSyntaxOpt != null); 682Debug.Assert(TypeSymbol.Equals(frameType, constructor.ContainingType, TypeCompareKind.ConsiderEverything2)); 705Debug.Assert(capturedFrame.Type.IsReferenceType); // Make sure we're not accidentally capturing a struct by value 809Debug.Assert(_thisProxyInitDeferred == null); 814Debug.Assert(_currentMethod is not SynthesizedPrimaryConstructor primaryConstructor || 881Debug.Assert(localFunc.MethodKind == MethodKind.LocalFunction); 891Debug.Assert(!arguments.IsDefault); 904Debug.Assert(frameType is SynthesizedClosureEnvironment); 909Debug.Assert(typeParameters.Length == frameType.Arity); 967Debug.Assert(!typeArguments.IsDefault); 1003Debug.Assert((object)oldTypeArg.Type == newTypeArg.Type); 1007Debug.Assert(oldTypeArg.NullableAnnotation == newTypeArg.NullableAnnotation); 1028Debug.Assert((typeArgumentsOpt.IsDefault && !originalMethod.IsGenericMethod) || (typeArgumentsOpt.Length == originalMethod.Arity)); 1054Debug.Assert(realTypeArguments.Length == 0); 1205Debug.Assert(!node.Locals.IsEmpty); 1259Debug.Assert(rewrittenFilter != null); 1369Debug.Assert(node.TargetMethod is { RequiresInstanceReceiver: false, IsStatic: true }); 1381Debug.Assert(arguments.IsDefault && 1395Debug.Assert(_inExpressionLambda || conversion.Conversion.MethodSymbol is null); 1397Debug.Assert(conversion.ConversionKind != ConversionKind.MethodGroup); 1444Debug.Assert(syntax != null); 1445Debug.Assert(CompilationState.ModuleBuilderOpt != null); 1446Debug.Assert(closureOrdinal >= LambdaDebugInfo.MinClosureOrdinal); 1475Debug.Assert(closureKind == ClosureKind.Singleton); 1484Debug.Assert(!isLambdaBody || LambdaUtilities.IsLambdaBody(lambdaOrLambdaBodySyntax)); 1525Debug.Assert(synthesizedMethod != null); 1544Debug.Assert(tmpScope != null);
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (8)
133Debug.Assert(block.Locals.IsEmpty); 273Debug.Assert(saveRecursionDepth == _recursionDepth); 370Debug.Assert(node.OperandPlaceholder is null); 371Debug.Assert(node.OperandConversion is null); 879Debug.Assert(node.LeftPlaceholder is not null); 954Debug.Assert((object)sym != null); 999Debug.Assert(ci.Initializers.Length != 0); 1187Debug.Assert((object)node.MethodOpt == null);
Lowering\ClosureConversion\LambdaCapturedVariable.cs (5)
33Debug.Assert(type.HasType); 48Debug.Assert(captured is LocalSymbol || captured is ParameterSymbol); 98Debug.Assert(local.SynthesizedKind != SynthesizedLocalKind.LocalStoreTracker); 112Debug.Assert(variable.Name != null); 181Debug.Assert(parameter is { IsThis: false });
Lowering\ClosureConversion\SynthesizedClosureEnvironment.cs (1)
87Debug.Assert(methodId.Ordinal >= 0);
Lowering\ClosureConversion\SynthesizedClosureMethod.cs (2)
45Debug.Assert(containingType.DeclaringCompilation is not null); 106Debug.Assert(!(originalMethod is LocalFunctionSymbol) || !originalMethod.IsStatic || IsStatic);
Lowering\DiagnosticsPass_ExpressionTrees.cs (11)
33Debug.Assert(node != null); 34Debug.Assert((object)containingSymbol != null); 51Debug.Assert(diagnostics != null); 52Debug.Assert((object)containingSymbol != null); 208Debug.Assert(symbol.Kind == SymbolKind.Local || symbol.Kind == SymbolKind.Parameter || symbol is LocalFunctionSymbol); 314Debug.Assert((object)method != null); 315Debug.Assert(((object)propertyAccess == null) || 345Debug.Assert(_compilation.IsFeatureEnabled(MessageID.IDS_FeatureExpressionOptionalAndNamedArguments)); 771Debug.Assert(!node.TrueOperator.GetIsNewExtensionMember()); 772Debug.Assert(!node.FalseOperator.GetIsNewExtensionMember()); 936Debug.Assert(!(!parentIsConversion && _inExpressionLambda));
Lowering\DiagnosticsPass_Warnings.cs (12)
25Debug.Assert(arguments.Length == argumentRefKindsOpt.Length); 228Debug.Assert(TypeSymbol.Equals(expr1.Type, expr2.Type, TypeCompareKind.ConsiderEverything2)); 306Debug.Assert(node != null); 383Debug.Assert(node != null); 384Debug.Assert(node.OperatorKind.IsComparison()); 394Debug.Assert(tree != null); 395Debug.Assert(constantValue != null); 396Debug.Assert(operand != null); 720Debug.Assert(node != null); 735Debug.Assert(node != null); 782Debug.Assert(node != null); 912Debug.Assert(length == rightTuple.Arguments.Length);
Lowering\ExtensionMethodBodyRewriter.cs (7)
36Debug.Assert(sourceMethod is not null); 37Debug.Assert(implementationMethod is not null); 38Debug.Assert(sourceMethod == (object)implementationMethod.UnderlyingMethod); 46Debug.Assert(implementationMethod.ParameterCount - 1 == sourceMethod.ParameterCount); 51Debug.Assert(_rewrittenContainingMethod is not null); 59Debug.Assert(symbol.Parameters.Length == rewrittenParameters.Length); 198Debug.Assert(symbol?.GetIsNewExtensionMember() != true);
Lowering\ExtensionMethodReferenceRewriter.cs (11)
36Debug.Assert(node != null); 77Debug.Assert(node.Method.MethodKind == MethodKind.LocalFunction || node.Method.IsStatic || node.ReceiverOpt is not null); 102Debug.Assert(boundCall.Method.OriginalDefinition.TryGetCorrespondingExtensionImplementationMethod() == (object)method.OriginalDefinition); 103Debug.Assert(!boundCall.Method.IsStatic); 123Debug.Assert(receiverOpt.Type!.Equals(method.Parameters[0].Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 168Debug.Assert(method?.GetIsNewExtensionMember() != true || 171Debug.Assert(method is null || 195Debug.Assert(method.IsDefinition); // Tracked by https://github.com/dotnet/roslyn/issues/78962 : From the code coverage and other instrumentations perspective, should we remap the index to the implementation symbol? 214Debug.Assert(node.MethodOpt!.OriginalDefinition.TryGetCorrespondingExtensionImplementationMethod() == (object)methodOpt.OriginalDefinition); 242Debug.Assert(node.InterpolatedStringHandlerData is null); 254Debug.Assert(symbol?.GetIsNewExtensionMember() != true);
Lowering\Extensions.cs (3)
34Debug.Assert(expr != null); 78Debug.Assert(expr != null); 131Debug.Assert(expr != null);
Lowering\InitializerRewriter.cs (5)
21Debug.Assert(!boundInitializers.IsDefault); 22Debug.Assert((method.MethodKind == MethodKind.Constructor) || (method.MethodKind == MethodKind.StaticConstructor)); 31Debug.Assert(!boundInitializers.IsDefault); 65Debug.Assert(!submissionResultType.IsVoidType()); 115Debug.Assert(LocalRewriter.IsFieldOrPropertyInitializer(boundStatement));
Lowering\Instrumentation\CodeCoverageInstrumenter.cs (4)
143Debug.Assert(method.MethodKind != MethodKind.LocalFunction && method.MethodKind != MethodKind.AnonymousFunction); 417Debug.Assert(returnStatement.ExpressionOpt.Syntax.Parent != null); 441Debug.Assert(whenClause != null); 625Debug.Assert(keyword.Node != null || type != null);
Lowering\Instrumentation\CompoundInstrumenter.cs (1)
25Debug.Assert(previous != null);
Lowering\Instrumentation\DebugInfoInjector.cs (7)
65Debug.Assert(ctorDecl.Initializer == null); 70Debug.Assert(ctorDecl.Body != null); 95Debug.Assert(typeDecl.ParameterList != null); 96Debug.Assert(typeDecl.BaseList?.Types.Any(t => t is PrimaryConstructorBaseTypeSyntax { ArgumentList: not null }) != true); 141Debug.Assert(syntax is { Parent: { Parent: { } } }); 414Debug.Assert(parameterSyntax is { Parent.Parent: RecordDeclarationSyntax }); 481Debug.Assert(filterClause is not null);
Lowering\Instrumentation\DebugInfoInjector_SequencePoints.cs (8)
30Debug.Assert(declarationSyntax.Initializer != null); 55Debug.Assert(startFallbackOpt != default || endOpt != default); 89Debug.Assert(declaratorSyntax.Parent != null); 91Debug.Assert(declarationSyntax.Parent != null); 109Debug.Assert(!modifiers.Any(SyntaxKind.ConstKeyword)); // const locals don't have a sequence point 144Debug.Assert(declaratorSyntax.Parent != null); 148Debug.Assert(declarationSyntax.Parent != null); 173Debug.Assert(condition.Type is not null);
Lowering\Instrumentation\Instrumenter.cs (47)
39Debug.Assert(!original.WasCompilerGenerated); 50Debug.Assert(!original.WasCompilerGenerated || original.Syntax.Kind() == SyntaxKind.Block); 103Debug.Assert(LocalRewriter.IsFieldOrPropertyInitializer(original)); 114Debug.Assert(!original.WasCompilerGenerated); 115Debug.Assert(original.Syntax.Kind() == SyntaxKind.DoStatement); 116Debug.Assert(factory != null); 122Debug.Assert(!original.WasCompilerGenerated); 123Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); 124Debug.Assert(factory != null); 130Debug.Assert(!original.WasCompilerGenerated); 131Debug.Assert(original.Syntax.Kind() == SyntaxKind.DoStatement); 137Debug.Assert(!original.WasCompilerGenerated); 138Debug.Assert(original.Syntax.Kind() == SyntaxKind.WhileStatement); 145Debug.Assert(!original.WasCompilerGenerated); 146Debug.Assert(original.Syntax is CommonForEachStatementSyntax); 152Debug.Assert(original.Syntax is CommonForEachStatementSyntax); 158Debug.Assert(!original.WasCompilerGenerated); 159Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForEachStatement); 165Debug.Assert(!original.WasCompilerGenerated); 166Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForEachVariableStatement); 172Debug.Assert(!original.WasCompilerGenerated); 173Debug.Assert(original.Syntax is CommonForEachStatementSyntax); 179Debug.Assert(!original.WasCompilerGenerated); 180Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForStatement); 186Debug.Assert(!original.WasCompilerGenerated); 187Debug.Assert(original.Syntax.Kind() == SyntaxKind.ForStatement); 188Debug.Assert(factory != null); 194Debug.Assert(original.Syntax.Kind() == SyntaxKind.IfStatement); 200Debug.Assert(!original.WasCompilerGenerated); 201Debug.Assert(original.Syntax.Kind() == SyntaxKind.IfStatement); 202Debug.Assert(factory != null); 208Debug.Assert(original.Syntax.Kind() == SyntaxKind.LabeledStatement); 214Debug.Assert(original.Syntax.Kind() == SyntaxKind.VariableDeclarator || 222Debug.Assert(original.Left is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.UserDefined } or BoundParameter); 258Debug.Assert(!original.WasCompilerGenerated); 259Debug.Assert(original.Syntax.Kind() == SyntaxKind.LockStatement); 270Debug.Assert(original.Syntax.Kind() == SyntaxKind.SwitchStatement); 281Debug.Assert(!original.WasCompilerGenerated); 282Debug.Assert(original.Syntax.FirstAncestorOrSelf<WhenClauseSyntax>() != null); 288Debug.Assert(!original.WasCompilerGenerated); 289Debug.Assert(original.Syntax.Kind() == SyntaxKind.UsingStatement); 302Debug.Assert(original.Syntax.Kind() == SyntaxKind.CatchClause); 307Debug.Assert(original.Kind == BoundKind.SwitchStatement); 308Debug.Assert(!original.WasCompilerGenerated); 309Debug.Assert(original.Syntax.Kind() == SyntaxKind.SwitchStatement); 310Debug.Assert(factory != null); 319Debug.Assert(factory != null);
Lowering\Instrumentation\LocalStateTracingInstrumenter.cs (12)
114Debug.Assert(_lazyPreviousContextVariables?.IsEmpty != false); 259Debug.Assert(enumDelta == 0 || overloadOpt.Value != WellKnownMember.Microsoft_CodeAnalysis_Runtime_LocalStoreTracker__LogLocalStoreLocalAlias); 264Debug.Assert(symbol?.IsGenericMethod != true); 298Debug.Assert(_factory.TopLevelMethod is not null); 299Debug.Assert(_factory.CurrentFunction is not null); 358Debug.Assert(original.Left is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.UserDefined } or BoundParameter); 421Debug.Assert(!parameterSymbol.IsDiscard); 448Debug.Assert(parameter.RefKind == RefKind.None); 453Debug.Assert(!parameter.Type.IsManagedTypeNoUseSiteDiagnostics); 475Debug.Assert(targetType.IsStructType()); 554Debug.Assert(refKinds.IsDefault || arguments.Length == refKinds.Length); 555Debug.Assert(invocation.Type is not null);
Lowering\Instrumentation\ModuleCancellationInstrumenter.cs (2)
80Debug.Assert(_factory.TopLevelMethod is not null); 81Debug.Assert(_factory.CurrentFunction is not null);
Lowering\Instrumentation\StackOverflowProbingInstrumenter.cs (2)
70Debug.Assert(_factory.TopLevelMethod is not null); 71Debug.Assert(_factory.CurrentFunction is not null);
Lowering\IteratorRewriter\IteratorFinallyMethodSymbol.cs (2)
37Debug.Assert((object)stateMachineType != null); 38Debug.Assert(name != null);
Lowering\IteratorRewriter\IteratorMethodToStateMachineRewriter.cs (2)
396Debug.Assert(!frame.IsRoot()); 414Debug.Assert(frame.parent.finalizeState == _currentFinallyFrame.finalizeState);
Lowering\IteratorRewriter\IteratorRewriter.cs (2)
175Debug.Assert(F.ModuleBuilderOpt is not null); 277Debug.Assert(stateMachineType.Constructor is IteratorConstructor);
Lowering\LocalRewriter\DelegateCacheContainer.cs (7)
25Debug.Assert(containingType.IsDefinition); 38Debug.Assert(containingType.IsDefinition); 39Debug.Assert(owner.IsDefinition); 40Debug.Assert(owner is NamedTypeSymbol { Arity: > 0 } or MethodSymbol { Arity: > 0 }); 65Debug.Assert(delegateType.IsDelegateType()); 66Debug.Assert(targetMethod is { }); 83Debug.Assert(_constructedContainer is { });
Lowering\LocalRewriter\DelegateCacheRewriter.cs (7)
28Debug.Assert(factory.TopLevelMethod is { }); 38Debug.Assert(targetMethod is { }); 45Debug.Assert(boundDelegateCreation.MethodOpt is { }); 63Debug.Assert(_factory.ModuleBuilderOpt is { }); 64Debug.Assert(_factory.CurrentFunction is { }); 126Debug.Assert(targetMethod is { }); 167Debug.Assert(targetMethod.MethodKind == MethodKind.Ordinary);
Lowering\LocalRewriter\DynamicSiteContainer.cs (1)
22Debug.Assert(topLevelMethod != null);
Lowering\LocalRewriter\LocalRewriter.cs (35)
66Debug.Assert(factory.InstrumentationState != null); 72Debug.Assert(TypeSymbol.Equals(factory.CurrentType, (containingType ?? containingMethod.ContainingType), TypeCompareKind.ConsiderEverything2)); 101Debug.Assert(statement != null); 102Debug.Assert(compilationState != null); 147Debug.Assert(loweredStatement is { }); 248Debug.Assert(!nameofOperator.WasCompilerGenerated); 280Debug.Assert(visited == null || visited.HasErrors || ReferenceEquals(visited.Type, node.Type) || 317Debug.Assert(CanBePassedByReference(node)); 319Debug.Assert(CanBePassedByReference(result)); 328Debug.Assert(_factory.ModuleBuilderOpt is { }); 503Debug.Assert(_placeholderReplacementMapDoNotUseDirectly is { }); 512Debug.Assert(value.Type is { } && (value.Type.Equals(placeholder.Type, TypeCompareKind.AllIgnoreOptions) || value.HasErrors)); 521Debug.Assert(_placeholderReplacementMapDoNotUseDirectly.Count == 0); 549Debug.Assert(placeholder is { }); 550Debug.Assert(_placeholderReplacementMapDoNotUseDirectly is { }); 553Debug.Assert(removed); 577Debug.Assert(node.Type is { }); 598Debug.Assert((syntax != null) ^ (location != null)); 648Debug.Assert(node.Type.ExtendedSpecialType == InternalSpecialType.System_Type || 650Debug.Assert(node.GetTypeFromHandle is null); 653Debug.Assert(sourceType is { }); 674Debug.Assert(getTypeFromHandle is not null); 675Debug.Assert(TypeSymbol.Equals(type, getTypeFromHandle.ReturnType, TypeCompareKind.AllIgnoreOptions)); 681Debug.Assert(node.GetTypeFromHandle is null); 714Debug.Assert(statement is { }); 843Debug.Assert(node.Expression.Type is { TypeKind: TypeKind.Array }); 873Debug.Assert(parent.Parent is { }); 922Debug.Assert(assignment.Left.Kind == BoundKind.FieldAccess); 1059Debug.Assert(eventAccess.ReceiverOpt is { }); 1060Debug.Assert(eventAccess.ReceiverOpt.Type is { }); 1070Debug.Assert(fieldAccess.ReceiverOpt is { }); 1071Debug.Assert(fieldAccess.ReceiverOpt.Type is { }); 1143Debug.Assert(!member.IsStatic); 1145Debug.Assert(extensionParameter is not null); 1148Debug.Assert(Conversions.IsValidExtensionMethodThisArgConversion(this._compilation.Conversions.ClassifyConversionFromType(receiver.Type, extensionParameter.Type, isChecked: false, ref discardedUseSiteInfo)));
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (21)
361Debug.Assert(inputTemp != loweredSwitchGoverningExpression); 444Debug.Assert(node == nodesToLower[indexOfNode]); 475Debug.Assert(test != null); 500Debug.Assert(!loweredNodes.Contains(node)); 528Debug.Assert(!loweredNodes.Contains(test2)); 567Debug.Assert(foundLabel); 634Debug.Assert(cases.Length == whenTrueCases.Length + whenFalseCases.Length); 710Debug.Assert(_fac is { }); 717Debug.Assert(x.Discriminator switch 726Debug.Assert(y.Discriminator == x.Discriminator); 1068Debug.Assert(found); 1089Debug.Assert(whenNodes.All(n => n.Syntax == whenClauseSyntax)); 1090Debug.Assert(whenNodes.All(n => n.WhenExpression == whenExpression)); 1091Debug.Assert(whenNodes.All(n => n.Bindings == whenNodes[0].Bindings)); 1092Debug.Assert(whenNodes.All(n => GetDagNodeLabel(n.WhenTrue) == whenTrueLabel)); 1103Debug.Assert(whenNode.WhenFalse != null); 1112Debug.Assert(_whenNodeIdentifierLocal is not null); 1166Debug.Assert(whenFalse != null); 1172Debug.Assert(whenFalse == null); 1184Debug.Assert(left.Kind == BoundKind.Local && left == binding.VariableAccess); 1206Debug.Assert(sideEffect != null);
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.ValueDispatchNode.cs (10)
88Debug.Assert(op.OperandTypes() != 0); 109Debug.Assert(Math.Abs(l - r) <= 1); 117Debug.Assert(_height < 2 * Math.Log(_weight)); 127Debug.Assert(whenTrue.Height == this.WhenTrue.Height); 128Debug.Assert(whenFalse.Height == this.WhenFalse.Height); 142Debug.Assert(op.OperandTypes() != 0); 162Debug.Assert(Math.Abs(left.Height - right.Height) <= 2); 190Debug.Assert(leftDispatch.Right.Height == right.Height); 231Debug.Assert(rightDispatch.Left.Height == left.Height); 251Debug.Assert(Math.Abs(left.Height - right.Height) < 2);
Lowering\LocalRewriter\LocalRewriter.PatternLocalRewriter.cs (25)
172Debug.Assert(method.Name == WellKnownMemberNames.DeconstructMethodName); 176Debug.Assert(method.IsExtensionMethod); 190Debug.Assert(parameter.RefKind == RefKind.Out); 203Debug.Assert(inputType is { }); 217Debug.Assert(!conversion.IsUserDefined); 246Debug.Assert(e.Property.GetMethod.ParameterCount == 1); 247Debug.Assert(e.Property.GetMethod.Parameters[0].Type.SpecialType == SpecialType.System_Int32); 344Debug.Assert(input.Type is { }); 358Debug.Assert(!input.Type.IsNullableType()); 362Debug.Assert(!input.Type.IsNullableType()); 363Debug.Assert(input.Type.IsValueType); 373Debug.Assert(!rewrittenExpr.Type.IsSpanOrReadOnlySpanChar()); 400Debug.Assert(operatorType != BinaryOperatorKind.Error); 410Debug.Assert(operatorKind.Operator() == BinaryOperatorKind.Equal); 419Debug.Assert(comparisonType.SpecialType switch 446Debug.Assert(sequenceEqual != null && asSpan != null); 479Debug.Assert(output.Type is { }); 515Debug.Assert(loweredInput.Type is { }); 535Debug.Assert(tempAssigned); 549Debug.Assert(l.LocalSymbol.DeclarationKind == LocalDeclarationKind.PatternVariable); 579Debug.Assert(savedInputExpression != null); 628Debug.Assert(field != null); 646Debug.Assert(!IsCapturedPrimaryConstructorParameter(expr)); 677Debug.Assert(!evalNode.Evaluation.Input.IsOriginalInput); 681Debug.Assert(!testNode.Test.Input.IsOriginalInput);
Lowering\LocalRewriter\LocalRewriter.PlaceholderReplacer.cs (2)
24Debug.Assert(result is not null); 31Debug.Assert(value is not null);
Lowering\LocalRewriter\LocalRewriter_AsOperator.cs (7)
28Debug.Assert(result is { }); 42Debug.Assert(rewrittenTargetType.Type.Equals(rewrittenType)); 45Debug.Assert(!rewrittenType.IsValueType || rewrittenType.IsNullableType()); 60Debug.Assert(constantValue.IsNull); 83Debug.Assert(operandPlaceholder is not null); 84Debug.Assert(operandConversion is not null); 88Debug.Assert(result.Type!.Equals(rewrittenType, TypeCompareKind.ConsiderEverything));
Lowering\LocalRewriter\LocalRewriter_AssignmentOperator.cs (12)
48Debug.Assert(!node.IsRef); 118Debug.Assert(eventAccess.IsUsableAsField); 181Debug.Assert(!isRef); 185Debug.Assert(!property.IsIndexer); 200Debug.Assert(!isRef); 205Debug.Assert(indexer.IsIndexer || indexer.IsIndexedProperty); 222Debug.Assert(!isRef || rewrittenLeft.GetRefKind() != RefKind.None); 258Debug.Assert(!isRef); 286Debug.Assert(_factory.CurrentFunction.IsConstructor()); 287Debug.Assert(property.Equals(autoProp, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 323Debug.Assert(exprType is object); 377Debug.Assert(newElement is { });
Lowering\LocalRewriter\LocalRewriter_BasePatternSwitchLocalRewriter.cs (1)
31Debug.Assert(sectionSyntax is { });
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (70)
125Debug.Assert(applyParentUnaryOperator is null); 131Debug.Assert(applyParentUnaryOperator is null); 147Debug.Assert(stack.Count >= 1); 169Debug.Assert(node.OperatorKind == BinaryOperatorKind.StringConcatenation); 170Debug.Assert(node.InterpolatedStringHandlerData is not null); 209Debug.Assert(oldNode == null || (oldNode.Syntax == syntax)); 234Debug.Assert(!isPointerElementAccess); 242Debug.Assert(method is null); 340Debug.Assert(loweredLeft.Type is { }); 341Debug.Assert(loweredRight.Type is { }); 354Debug.Assert(loweredLeft.Type is { }); 355Debug.Assert(loweredRight.Type is { }); 368Debug.Assert(loweredLeft.Type is { }); 369Debug.Assert(loweredRight.Type is { }); 576Debug.Assert(loweredLeft.Type is { }); 613Debug.Assert(operatorKind.Operator() == BinaryOperatorKind.And || operatorKind.Operator() == BinaryOperatorKind.Or); 630Debug.Assert(applyParentUnaryOperator == null || applyParentUnaryOperator.OperatorKind == testOperator); 636Debug.Assert(leftTruthOperator == null); 711Debug.Assert(temp is { }); 736Debug.Assert(leftTruthOperator == null); 749Debug.Assert(leftTruthOperator == null); 767Debug.Assert(leftTruthOperator != null); 771Debug.Assert(conversion.IsImplicit); 794Debug.Assert(!operatorKind.IsLogical()); 802Debug.Assert(method is { }); 803Debug.Assert(TypeSymbol.Equals(method.ReturnType, type, TypeCompareKind.ConsiderEverything2)); 821Debug.Assert(left != null); 822Debug.Assert(right != null); 864Debug.Assert(nonNull is { }); 908Debug.Assert(expression.Type is { }); 931Debug.Assert(expression.Type is { }); 945Debug.Assert(expression.Type is { }); 1323Debug.Assert(left != null); 1324Debug.Assert(right != null); 1391Debug.Assert(!(leftAlwaysNull && rightAlwaysNull)); // We've already optimized this case. 1632Debug.Assert(TypeSymbol.Equals(seq.Type, conditional.Type, TypeCompareKind.ConsiderEverything2)); 1633Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 1634Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 1684Debug.Assert(!(leftAlwaysNull && rightAlwaysNull)); // We've already optimized this case. 1707Debug.Assert(alwaysNull.Type is { }); 1749Debug.Assert(conditionalExpression.Type is { }); 1783Debug.Assert(leftNonNull == null || rightNonNull == null); // We've already optimized the case where they are both non-null. 1784Debug.Assert(!NullableNeverHasValue(left) && !NullableNeverHasValue(right)); // We've already optimized the case where one is null. 1925Debug.Assert(nullableType2 is { }); 1957Debug.Assert(loweredLeft != null); 1958Debug.Assert(loweredRight != null); 1959Debug.Assert((object)returnType != null); 1960Debug.Assert(returnType.SpecialType == SpecialType.System_Boolean); 1961Debug.Assert(loweredLeft.IsLiteralNull() != loweredRight.IsLiteralNull()); 2021Debug.Assert((object)method != null); 2046Debug.Assert((object)method != null); 2058Debug.Assert(loweredLeft.Type is { SpecialType: SpecialType.System_Decimal }); 2059Debug.Assert(loweredRight.Type is { SpecialType: SpecialType.System_Decimal }); 2082Debug.Assert((object)method != null); 2089Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) || 2095Debug.Assert( 2155Debug.Assert(loweredRight.Type is { }); 2157Debug.Assert(rightType.SpecialType == SpecialType.System_Int32); 2222Debug.Assert(loweredLeft.Type is { }); 2224Debug.Assert(leftType.SpecialType is SpecialType.System_IntPtr or SpecialType.System_UIntPtr); 2227Debug.Assert(loweredRight.Type is { }); 2229Debug.Assert(rightType.SpecialType == SpecialType.System_Int32); 2278Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer }); 2283Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer }); 2289Debug.Assert(kind.Operator() == BinaryOperatorKind.Addition); 2323Debug.Assert(sizeOfExpression.Type is { SpecialType: SpecialType.System_Int32 }); 2333Debug.Assert(numericOperand.Type is { }); 2470Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer }); 2471Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer }); 2472Debug.Assert(returnType.SpecialType == SpecialType.System_Int64);
Lowering\LocalRewriter\LocalRewriter_Call.cs (69)
43Debug.Assert(methodGroup.ReceiverOpt == null || methodGroup.ReceiverOpt.Kind != BoundKind.TypeOrValueExpression); 49Debug.Assert(node.ApplicableMethods.All(m => !m.RequiresInstanceReceiver && TypeSymbol.Equals(m.ContainingType, firstContainer, TypeCompareKind.ConsiderEverything2))); 56Debug.Assert(_factory.CurrentType is { }); 85Debug.Assert(loweredReceiver != null); 162Debug.Assert(nameSyntax != null); 163Debug.Assert(interceptor.IsDefinition); 164Debug.Assert(!interceptor.ContainingType.IsGenericType); 200Debug.Assert(containingMethod is not null); 213Debug.Assert(receiverOpt is not BoundTypeExpression || method.IsStatic); 288Debug.Assert(methodThisParameter is not null); 289Debug.Assert(receiverOpt?.Type is not null); 295Debug.Assert(receiverOpt.Type.Equals(interceptor.Parameters[0].Type, TypeCompareKind.AllIgnoreOptions) 337Debug.Assert(node != null); 388Debug.Assert(invokedAsExtensionMethod && !arguments.IsEmpty); 445Debug.Assert(node.ReceiverOpt is null); 471Debug.Assert(rewrittenArguments.Length == 2); 524Debug.Assert(rewrittenBoundCall.Type is not null); 572Debug.Assert(!IsCapturedPrimaryConstructorParameter(expression)); 681Debug.Assert(argumentRefKindsOpt.IsDefault || argumentRefKindsOpt.Length == arguments.Length); 683Debug.Assert(!requiresInstanceReceiver || rewrittenReceiver != null || _inExpressionLambda); 684Debug.Assert(captureReceiverMode == ReceiverCaptureMode.Default || (requiresInstanceReceiver && rewrittenReceiver != null && storesOpt is object)); 692Debug.Assert(!_inExpressionLambda); 693Debug.Assert(rewrittenReceiver is object); 694Debug.Assert(rewrittenReceiver.Type is { }); 790Debug.Assert(saveTempsOpt is object || tempsOpt?.Count is null or > 0); 797Debug.Assert(assignmentToTemp is object); 798Debug.Assert(tempsOpt is object); 855Debug.Assert(!_inExpressionLambda); 860Debug.Assert(!((BoundConversion)argument).ExplicitCastInCode); 866Debug.Assert(!argumentsAssignedToTemp.IsNull); 872Debug.Assert(argIndex < argumentIndex); 878Debug.Assert(usesReceiver(argument)); 879Debug.Assert(requiresInstanceReceiver); 880Debug.Assert(receiverTemp is object); 894Debug.Assert(visitedArgumentsBuilder[argIndex] != null); 931Debug.Assert(!((BoundConversion)argument).ExplicitCastInCode); 949Debug.Assert(assignmentToTemp.IsRef); 952Debug.Assert(receiverType is object); 988Debug.Assert(SpillSequenceSpiller.IsComplexConditionalInitializationOfReceiverRef(assignmentToTemp, out _, out _, out _, out _)); 1005Debug.Assert(CodeGenerator.ReceiverIsKnownToReferToTempIfReferenceType(receiverTemp)); 1036Debug.Assert(expanded ? rewrittenArguments.Length == parameters.Length : rewrittenArguments.Length >= parameters.Length); 1037Debug.Assert(rewrittenArguments.Count(a => a.IsParamsArrayOrCollection) <= (expanded ? 1 : 0)); 1143Debug.Assert(actualArguments.All(static arg => arg is not null)); 1190Debug.Assert(parameters[i].Type is NamedTypeSymbol { IsInterpolatedStringHandlerType: true, IsValueType: true }); 1204Debug.Assert(argumentRefKindsOpt.IsDefault || argumentRefKindsOpt.Length >= parameters.Length); 1213Debug.Assert(!argumentRefKindsOpt.IsEmpty); 1242Debug.Assert(rewrittenArguments.Length == methodOrIndexer.GetParameterCount() + 1); 1243Debug.Assert(argsToParamsOpt.IsDefault); 1266Debug.Assert(methodOrIndexer.ContainingType.ExtensionParameter is not null); 1289Debug.Assert(paramsArray.IsParamsArrayOrCollection); 1345Debug.Assert(rewrittenArguments.Length == parameters.Length); 1346Debug.Assert(rewrittenArguments.Count(a => a.IsParamsArrayOrCollection) <= (expanded ? 1 : 0)); 1355Debug.Assert(arguments[p] == null); 1359Debug.Assert(expanded); 1360Debug.Assert(p == parameters.Length - 1); 1361Debug.Assert(argRefKind == RefKind.None); 1380Debug.Assert(arguments[p].IsParamsArrayOrCollection); 1396Debug.Assert(argRefKind is RefKind.None or RefKind.In or RefKind.Ref); 1488Debug.Assert(arguments != null); 1489Debug.Assert(storesToTemps != null); 1490Debug.Assert(temporariesBuilder != null); 1517Debug.Assert(arguments != null); 1518Debug.Assert(tempStores != null); 1584Debug.Assert(value.Type is { }); 1636Debug.Assert(actualArguments != null); 1637Debug.Assert(actualArguments.Length == parameters.Length); 1639Debug.Assert(argsRefKindsBuilder != null); 1666Debug.Assert(localRefKind == RefKind.None); 1693Debug.Assert(node.TypeArgumentsOpt.IsDefault);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (72)
32Debug.Assert(conversion.Kind == ConversionKind.CollectionExpression); 33Debug.Assert(!_inExpressionLambda); 34Debug.Assert(_additionalLocals is { }); 35Debug.Assert(node.Type is { }); 61Debug.Assert(elementType is { }); 118Debug.Assert(spreadElement.IteratorBody is { }); 136Debug.Assert(spreadElement.IteratorBody is { }); 138Debug.Assert(iteratorBody is { }); 151Debug.Assert(result is { }); 175Debug.Assert(singleSpread.Expression.Type is not null); 192Debug.Assert(targetEnumerableType.OriginalDefinition == (object)_compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T)); 247Debug.Assert(!_inExpressionLambda); 248Debug.Assert(_additionalLocals is { }); 249Debug.Assert(node.CollectionCreation is null); // shouldn't have generated a constructor call 250Debug.Assert(node.Placeholder is null); 262Debug.Assert(collectionTypeKind is CollectionExpressionTypeKind.Span or CollectionExpressionTypeKind.ReadOnlySpan); 263Debug.Assert(spanType.OriginalDefinition.Equals(_compilation.GetWellKnownType( 265Debug.Assert(elementType.Equals(spanType.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0], TypeCompareKind.AllIgnoreOptions)); 277Debug.Assert(!IsAllocatingRefStructCollectionExpression(node, collectionTypeKind, elementType.Type, _compilation)); 286Debug.Assert(!IsAllocatingRefStructCollectionExpression(node, collectionTypeKind, elementType.Type, _compilation)); 294Debug.Assert(IsAllocatingRefStructCollectionExpression(node, collectionTypeKind, elementType.Type, _compilation)); 315Debug.Assert(list.Type is { }); 316Debug.Assert(list.Type.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_List_T), TypeCompareKind.AllIgnoreOptions)); 327Debug.Assert(TypeSymbol.Equals(array.Type, spanConstructor.Parameters[0].Type, TypeCompareKind.AllIgnoreOptions)); 333Debug.Assert(!_inExpressionLambda); 338Debug.Assert(rewrittenReceiver is { }); 347Debug.Assert(placeholder is { }); 395Debug.Assert(!_inExpressionLambda); 396Debug.Assert(_factory.ModuleBuilderOpt is { }); 397Debug.Assert(_diagnostics.DiagnosticBag is { }); 398Debug.Assert(node.Type is NamedTypeSymbol); 399Debug.Assert(node.CollectionCreation is null); 400Debug.Assert(node.Placeholder is null); 418Debug.Assert(numberIncludingLastSpread == 0); 469Debug.Assert(!_inExpressionLambda); 470Debug.Assert(node.Type is { }); 471Debug.Assert(node.CollectionCreation is null); 472Debug.Assert(node.Placeholder is null); 473Debug.Assert(node.CollectionBuilderMethod is { }); 474Debug.Assert(node.CollectionBuilderInvocationPlaceholder is { }); 475Debug.Assert(node.CollectionBuilderInvocationConversion is { }); 480Debug.Assert(spanType.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions)); 545Debug.Assert(elements.Length > 0); 546Debug.Assert(elements.All(e => e is BoundExpression)); 547Debug.Assert(_factory.ModuleBuilderOpt is { }); 548Debug.Assert(_diagnostics.DiagnosticBag is { }); 549Debug.Assert(_compilation.Assembly.RuntimeSupportsInlineArrayTypes); 550Debug.Assert(_additionalLocals is { }); 571Debug.Assert(inlineArrayType.HasInlineArrayAttribute(out int inlineArrayLength) && inlineArrayLength == arrayLength); 612Debug.Assert(span.Type is { }); 731Debug.Assert(TryOptimizeSingleSpreadToArray(node, arrayType) is null); 788Debug.Assert(arrayTemp.Type is ArrayTypeSymbol); 789Debug.Assert(indexTemp.Type is { SpecialType: SpecialType.System_Int32 }); 903Debug.Assert(type is not null); 999Debug.Assert((object)spreadOperandAsSpan != rewrittenSpreadOperand || spreadOperandAsSpan is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.LoweringTemp }); 1022Debug.Assert(!_inExpressionLambda); 1093Debug.Assert(useKnownLength); 1094Debug.Assert(setCount is { }); 1095Debug.Assert(asSpan is { }); 1096Debug.Assert(knownLengthTemp is { }); 1124Debug.Assert(spanTemp.Type is NamedTypeSymbol); 1125Debug.Assert(indexTemp.Type is { SpecialType: SpecialType.System_Int32 }); 1177Debug.Assert(rewrittenSpreadOperand.Type is not null); 1258Debug.Assert(statements.Length > 0); 1286Debug.Assert(collectionPlaceholder is { }); 1291Debug.Assert(lengthAccess is { }); 1310Debug.Assert(sum is { }); 1332Debug.Assert(enumeratorInfo is { }); 1333Debug.Assert(convertedExpression is { }); 1334Debug.Assert(expressionPlaceholder is { }); 1335Debug.Assert(elementPlaceholder is { }); 1336Debug.Assert(iteratorBody is { });
Lowering\LocalRewriter\LocalRewriter_CompoundAssignmentOperator.cs (41)
24Debug.Assert(TypeSymbol.Equals(node.Right.Type, node.Operator.RightType, TypeCompareKind.ConsiderEverything2)); 38Debug.Assert(node.Operator.Method is { }); 39Debug.Assert(node.LeftConversion is null || (node.Left.Type!.IsReferenceType && node.Operator.Method.GetIsNewExtensionMember())); 40Debug.Assert(node.FinalConversion is null); 54Debug.Assert(leftType is { }); 55Debug.Assert(TypeSymbol.Equals(leftType, node.Type, TypeCompareKind.AllIgnoreOptions)); 77Debug.Assert(node.LeftConversion is null); 116Debug.Assert(!IsBinaryStringConcatenation(binaryOperator)); 153Debug.Assert(rewrittenAssignment.Type is { }); 165Debug.Assert(rewrittenAssignment.Type is { }); 196Debug.Assert(node.LeftPlaceholder is not null); 206Debug.Assert(!rightIsVisited); 207Debug.Assert(node.Operator.ReturnType is { SpecialType: SpecialType.System_String }); 216Debug.Assert(node.Left.Type is { }); 221Debug.Assert(node.FinalPlaceholder is not null); 228Debug.Assert(TypeSymbol.Equals(transformedLHS.Type, node.Left.Type, TypeCompareKind.AllIgnoreOptions)); 235Debug.Assert(propertyOrEvent.Kind == SymbolKind.Property || propertyOrEvent.Kind == SymbolKind.Event); 261Debug.Assert(receiverOpt.Kind != BoundKind.TypeExpression); 274Debug.Assert(rewrittenReceiver.Type is { }); 319Debug.Assert(receiverOpt != null); 382Debug.Assert(temps is object); 421Debug.Assert(array is BoundArrayCreation); 438Debug.Assert(accessor is not null); 448Debug.Assert(actualArguments.All(static arg => arg is not null)); 497Debug.Assert(implicitIndexerAccess.IndexerOrSliceAccess.GetRefKind() == RefKind.None); 533Debug.Assert(fieldOrEvent.Kind == SymbolKind.Field || fieldOrEvent.Kind == SymbolKind.Event); 541Debug.Assert(receiver is { Type: { } }); 551Debug.Assert(receiver.Type.IsReferenceType); 552Debug.Assert(receiver.Kind != BoundKind.TypeExpression); 555Debug.Assert(rewrittenReceiver.Type is { }); 694Debug.Assert(implicitIndexerAccess.Argument.Type!.Equals(_compilation.GetWellKnownType(WellKnownType.System_Index)) 750Debug.Assert(originalLHS.GetRefKind() == RefKind.Ref); 766Debug.Assert((object)result == originalLHS || IsCapturedPrimaryConstructorParameter(originalLHS)); // If this fails, we might need to add tests for new scenarios and relax the assert. 771Debug.Assert(((BoundCall)originalLHS).Method.RefKind != RefKind.None); 775Debug.Assert(((BoundFunctionPointerInvocation)originalLHS).FunctionPointer.Signature.RefKind != RefKind.None); 779Debug.Assert(((BoundConditionalOperator)originalLHS).IsRef); 783Debug.Assert(((BoundAssignmentOperator)originalLHS).IsRef); 794Debug.Assert(eventAccess.IsUsableAsField); 957Debug.Assert(!IsCapturedPrimaryConstructorParameter(expression)); 977Debug.Assert(expression.Type is { }); 997Debug.Assert(call.ReceiverOpt is { });
Lowering\LocalRewriter\LocalRewriter_ConditionalAccess.cs (10)
40Debug.Assert(!_inExpressionLambda); 41Debug.Assert(node.AccessExpression.Type is { }); 44Debug.Assert(loweredReceiver.Type is { }); 119Debug.Assert(loweredAccessExpression != null); 120Debug.Assert(loweredAccessExpression.Type is { }); 135Debug.Assert(TypeSymbol.Equals(accessExpressionType, nodeType.GetNullableUnderlyingType(), TypeCompareKind.ConsiderEverything2)); 140Debug.Assert(TypeSymbol.Equals(accessExpressionType, nodeType, TypeCompareKind.ConsiderEverything2) || 149Debug.Assert(loweredReceiver.Type is { }); 166Debug.Assert(temp is { }); 205Debug.Assert(newtarget is { Type: { } });
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (90)
25Debug.Assert(node.Type is NamedTypeSymbol { IsInterpolatedStringHandlerType: true }); 39Debug.Assert(node.Operand is BoundConvertedSwitchExpression { WasTargetTyped: true }); 43Debug.Assert(node.Operand is BoundConditionalOperator { WasTargetTyped: true }); 47Debug.Assert(node.Operand is not null); 52Debug.Assert(node.Operand is BoundObjectCreationExpressionBase { WasTargetTyped: true }); 56Debug.Assert(node.Operand is BoundObjectCreationExpressionBase { WasTargetTyped: true } or 82Debug.Assert(result.Type!.Equals(toType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 94Debug.Assert(node.Type is not null); 95Debug.Assert(_compilation.IsReadOnlySpanType(node.Type)); 97Debug.Assert(byteType.SpecialType == SpecialType.System_Byte); 142Debug.Assert(byteArray.IsSZArray); 143Debug.Assert(byteArray.ElementType.SpecialType == SpecialType.System_Byte); 166Debug.Assert(node.OperatorKind is BinaryOperatorKind.Utf8Addition); 194Debug.Assert(utf8Addition.OperatorKind is BinaryOperatorKind.Utf8Addition); 224Debug.Assert(rewrittenNode.Type is { }); 271Debug.Assert(result.Type is { } rt && rt.Equals(rewrittenType, TypeCompareKind.AllIgnoreOptions)); 305Debug.Assert(oldNodeOpt == null || oldNodeOpt.Syntax == syntax); 306Debug.Assert(rewrittenType is { }); 307Debug.Assert(_factory.ModuleBuilderOpt is { }); 308Debug.Assert(_diagnostics.DiagnosticBag is { }); 318Debug.Assert(rewrittenOperand.Type is { }); 426Debug.Assert(rewrittenOperand.Type is { }); 441Debug.Assert(rewrittenOperand.Type is { }); 444Debug.Assert(rewrittenOperand.Type.Equals(rewrittenType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 487Debug.Assert(rewrittenOperand.Type is { }); 497Debug.Assert(rewrittenOperand.Type.IsEnumType()); 508Debug.Assert(rewrittenType.IsEnumType()); 533Debug.Assert(conversion.Method is null); 534Debug.Assert(!conversion.IsExtensionMethod); 552Debug.Assert(symbolOpt is { }); 562Debug.Assert(oldNodeOpt is { }); 565Debug.Assert(method is { }); 569Debug.Assert(receiver is { }); 576Debug.Assert(_factory.TopLevelMethod is { }); 594Debug.Assert(rewrittenOperand.Type is not null); 605Debug.Assert(spanType.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_Span_T), TypeCompareKind.AllIgnoreOptions)); 621Debug.Assert(sourceType is not null); 646Debug.Assert(destinationType.IsReadOnlySpan()); 647Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 678Debug.Assert(destinationType.IsReadOnlySpan()); 679Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 680Debug.Assert(Binder.NeedsSpanCastUp(sourceType, destinationType)); 697Debug.Assert(destinationType.IsReadOnlySpan()); 698Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan); 740Debug.Assert(_factory.ModuleBuilderOpt is { }); 753Debug.Assert((object)target != null); 815Debug.Assert(rewrittenOperand.Type is { }); 847Debug.Assert(conversion.IsValid); 872Debug.Assert(conversion.Method is { }); 873Debug.Assert(conversion.BestUserDefinedConversionAnalysis is { }); 899Debug.Assert(rewrittenOperand.Type is { }); 956Debug.Assert(rewrittenOperand.Type is { }); 997Debug.Assert(expression.Type is { }); 1043Debug.Assert((object)rewrittenType != null); 1051Debug.Assert(rewrittenOperandType is { }); 1052Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType()); 1099Debug.Assert((object)rewrittenType != null); 1100Debug.Assert(rewrittenOperand.Type is { }); 1102Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType()); 1224Debug.Assert(conversion.Method is { }); 1244Debug.Assert(operand != null); 1245Debug.Assert((object)type != null); 1313Debug.Assert(TypeSymbol.Equals(seq.Type, conditional.Type, TypeCompareKind.ConsiderEverything2)); 1314Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 1315Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 1346Debug.Assert(conversion.Method is { } && !conversion.Method.ReturnsVoid && conversion.Method.ParameterCount == 1); 1347Debug.Assert(rewrittenOperand.Type is { }); 1377Debug.Assert(TypeSymbol.Equals(result.Type, rewrittenType, TypeCompareKind.ConsiderEverything2)); 1385Debug.Assert(resultType.IsNullableType() && TypeSymbol.Equals(resultType.GetNullableUnderlyingType(), call.Method.ReturnType, TypeCompareKind.ConsiderEverything2)); 1400Debug.Assert(rewrittenOperand.Type is { }); 1414Debug.Assert((object)rewrittenType != null); 1415Debug.Assert(rewrittenOperand.Type.IsNullableType()); 1446Debug.Assert(conversion.Method is { }); 1490Debug.Assert(rewrittenOperand != null); 1491Debug.Assert((object)rewrittenType != null); 1492Debug.Assert(rewrittenOperand.Type is { }); 1493Debug.Assert(!_compilation.Assembly.RuntimeSupportsNumericIntPtr); 1506Debug.Assert(!method.ReturnsVoid); 1507Debug.Assert(method.ParameterCount == 1); 1513Debug.Assert(target.IsNullableType()); 1539Debug.Assert((object)source != null); 1540Debug.Assert((object)target != null); 1699Debug.Assert(fromType.SpecialType == SpecialType.System_Decimal || toType.SpecialType == SpecialType.System_Decimal); 1718Debug.Assert(operand.Type is { }); 1746Debug.Assert(TypeSymbol.Equals(method.ReturnType, toType, TypeCompareKind.ConsiderEverything2)); 1763Debug.Assert(meth is { }); 1792Debug.Assert(!_compilation.Assembly.RuntimeSupportsNumericIntPtr); 1823Debug.Assert(underlying is { }); 1836Debug.Assert(underlying is { }); 1868Debug.Assert(!meth.ContainingType.IsInterface);
Lowering\LocalRewriter\LocalRewriter_DeconstructionAssignmentOperator.cs (18)
20Debug.Assert(right.Conversion.Kind == ConversionKind.Deconstruction); 42Debug.Assert(left.Type is { }); 65Debug.Assert(!conditional.IsRef); 87Debug.Assert(returnValue is null); 114Debug.Assert(right is not ({ Kind: BoundKind.TupleLiteral } or BoundConversion { Operand.Kind: BoundKind.TupleLiteral })); 162Debug.Assert(target is { Single: not null, NestedVariables: null } or { Single: null, NestedVariables: not null }); 172Debug.Assert(!IsCapturedPrimaryConstructorParameter(single)); 219Debug.Assert(conversion.Kind == ConversionKind.Deconstruction); 223Debug.Assert(!deconstructConversionInfo.IsDefault); 231Debug.Assert(placeholder is not null); 232Debug.Assert(nestedConversion is not null); 247Debug.Assert(leftTarget is { Type: { } }); 258Debug.Assert(builder is null || resultPart is { }); 285Debug.Assert(!IsTupleExpression(right.Kind)); 318Debug.Assert(right.Type is { }); 337Debug.Assert(expression.Type is { }); 338Debug.Assert(expression.Type.IsTupleType); 462Debug.Assert(variable.Type is { });
Lowering\LocalRewriter\LocalRewriter_DelegateCreationExpression.cs (2)
16Debug.Assert(!node.Type.IsAnonymousType); // Missing EnsureParamCollectionAttributeExists call? 32Debug.Assert(method is { });
Lowering\LocalRewriter\LocalRewriter_DoStatement.cs (2)
17Debug.Assert(node != null); 21Debug.Assert(rewrittenBody is { });
Lowering\LocalRewriter\LocalRewriter_Event.cs (10)
57Debug.Assert(method is { }); 58Debug.Assert(method.ReturnType.Equals(node.Type, TypeCompareKind.AllIgnoreOptions)); 91Debug.Assert(eventSymbol.IsStatic || rewrittenReceiverOpt is { }); 193Debug.Assert(left.IsUsableAsField); 196Debug.Assert(eventSymbol.HasAssociatedField); 197Debug.Assert(eventSymbol.IsWindowsRuntimeEvent); 213Debug.Assert(node.IsUsableAsField); 227Debug.Assert(eventSymbol.HasAssociatedField); 230Debug.Assert(fieldSymbol is { }); 238Debug.Assert(fieldType.Name == "EventRegistrationTokenTable");
Lowering\LocalRewriter\LocalRewriter_FixedStatement.cs (20)
49Debug.Assert(rewrittenBody is { }); 53Debug.Assert(statementBuilder.Count == numFixedLocals + 1 + 1); 84Debug.Assert(node is { }); 135Debug.Assert(node.Parent is TryStatementSyntax); 144Debug.Assert(node is { } && node.Kind() == SyntaxKind.TryStatement); 200Debug.Assert(!ReferenceEquals(initializer, null)); 241Debug.Assert(initializerExpr.Type is { TypeKind: TypeKind.Pointer }); 245Debug.Assert(initializerExpr.Kind == BoundKind.AddressOfOperator); 268Debug.Assert(pinnedTemp.IsPinned); 269Debug.Assert(!localSymbol.IsPinned); 308Debug.Assert(initializerExpr.Type is { }); 313Debug.Assert(getPinnableMethod is { }); 389Debug.Assert(nullableBoundTemp is not null); 390Debug.Assert(nullableTempAssignment is not null); 446Debug.Assert(initializerType is { }); 459Debug.Assert(pinnedTemp.IsPinned); 460Debug.Assert(!localSymbol.IsPinned); 515Debug.Assert(initializerType is { }); 522Debug.Assert(pinnedTemp.IsPinned); 523Debug.Assert(!localSymbol.IsPinned);
Lowering\LocalRewriter\LocalRewriter_ForEachStatement.cs (33)
44Debug.Assert(nodeExpressionType is { }); 117Debug.Assert(enumeratorInfo != null); 120Debug.Assert(rewrittenBody is { }); 227Debug.Assert(awaitableInfo is { GetResult: { } }); 337Debug.Assert(_factory.CurrentFunction is { }); 362Debug.Assert(idisposableTypeSymbol is { }); 393Debug.Assert(enumeratorType.OriginalDefinition.SpecialType != SpecialType.System_Nullable_T); 418Debug.Assert(!enumeratorType.IsSealed); 419Debug.Assert(!enumeratorInfo.IsAsync); 420Debug.Assert(idisposableTypeSymbol is { }); 421Debug.Assert(disposeMethod is { }); 497Debug.Assert(receiver.Type is { }); 500Debug.Assert(receiverConversion.IsImplicit && !receiverConversion.IsUserDefined); 525Debug.Assert(!receiverConversion.IsNumeric); 560Debug.Assert(rewrittenBody is { }); 562Debug.Assert(node.EnumeratorInfoOpt is not null); 597Debug.Assert(collectionType is { }); 735Debug.Assert(rewrittenExpression.Type is not null); 757Debug.Assert(rewriter._factory.ModuleBuilderOpt is { }); 758Debug.Assert(rewriter._diagnostics.DiagnosticBag is { }); 767Debug.Assert(enumeratorInfo.InlineArraySpanType == WellKnownType.System_ReadOnlySpan_T); 783Debug.Assert(length > 0); 807Debug.Assert(iterationVariables.Length == 1); 864Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 867Debug.Assert(rewrittenBody is { }); 892Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 898Debug.Assert(arrayType is { IsSZArray: true }); 1013Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 1016Debug.Assert(rewrittenBody is { }); 1041Debug.Assert(collectionExpression.Type is { TypeKind: TypeKind.Array }); 1048Debug.Assert(!arrayType.IsSZArray); 1194Debug.Assert(forLoop != null); 1234Debug.Assert(result is { });
Lowering\LocalRewriter\LocalRewriter_ForStatement.cs (5)
17Debug.Assert(node != null); 23Debug.Assert(rewrittenBody is { }); 51Debug.Assert(original.Kind is BoundKind.ForStatement or BoundKind.ForEachStatement or BoundKind.CollectionExpressionSpreadElement); 52Debug.Assert(rewrittenBody != null); 213Debug.Assert(rewrittenBody != null);
Lowering\LocalRewriter\LocalRewriter_FunctionPointerInvocation.cs (2)
17Debug.Assert(rewrittenExpression != null); 36Debug.Assert(discardedReceiver is null);
Lowering\LocalRewriter\LocalRewriter_HostObjectMemberReference.cs (3)
13Debug.Assert(_previousSubmissionFields != null); 14Debug.Assert(_factory.TopLevelMethod is { IsStatic: false }); 15Debug.Assert(_factory.CurrentType is { });
Lowering\LocalRewriter\LocalRewriter_IfStatement.cs (4)
16Debug.Assert(node != null); 25Debug.Assert(rewrittenConsequence is { }); 91Debug.Assert(elseIfStatement is not null); 100Debug.Assert(builder[conditionalGotoIndex] is BoundConditionalGoto);
Lowering\LocalRewriter\LocalRewriter_Index.cs (3)
15Debug.Assert(node.MethodOpt != null); 71Debug.Assert(targetNullableType.IsNullableType()); 72Debug.Assert(TypeSymbol.Equals(targetNullableType.GetNullableUnderlyingType(), underlyingValue.Type, TypeCompareKind.AllIgnoreOptions));
Lowering\LocalRewriter\LocalRewriter_IndexerAccess.cs (61)
69Debug.Assert(node.AccessorKind != AccessorKind.Unknown); 70Debug.Assert(node.Indexer.IsIndexer || node.Indexer.IsIndexedProperty); 71Debug.Assert((object?)node.Indexer.GetOwnOrInheritedGetMethod() != null); 79Debug.Assert(indexer.IsIndexer || indexer.IsIndexedProperty); 80Debug.Assert(node.AccessorKind != AccessorKind.Unknown); 81Debug.Assert(isLeftOfAssignment || (node.AccessorKind != AccessorKind.Set)); 85Debug.Assert(rewrittenReceiver is { }); 114Debug.Assert(oldNode is BoundIndexerAccess or BoundObjectInitializerMember); 119Debug.Assert(oldNode.Type is not null); 120Debug.Assert(oldNode.Type.Equals(type, TypeCompareKind.ConsiderEverything)); 157Debug.Assert(getMethod is not null); 180Debug.Assert(call.Type is not null); 201Debug.Assert(_factory.ModuleBuilderOpt is { }); 202Debug.Assert(_diagnostics.DiagnosticBag is { }); 203Debug.Assert(node.Expression.Type is object); 204Debug.Assert(node.Argument.Type is object); 216Debug.Assert(getItemOrSliceHelper is object); 227Debug.Assert(length > 0); 240Debug.Assert(receiverStore is null); 241Debug.Assert(TypeSymbol.Equals(node.Argument.Type, _compilation.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.AllIgnoreOptions)); 265Debug.Assert(rewrittenRangeArg is not null); 323Debug.Assert(node.Expression.Type is object); 340Debug.Assert(node.Expression.Type is object); 341Debug.Assert(index.Type?.SpecialType == SpecialType.System_Int32); 358Debug.Assert(node.GetItemOrSliceHelper is WellKnownMember.System_ReadOnlySpan_T__get_Item); 377Debug.Assert(node.GetItemOrSliceHelper is WellKnownMember.System_ReadOnlySpan_T__get_Item); 387Debug.Assert(index.ConstantValueOpt is null); // Binder should have reported an error due to index out of bounds, or should have handled by code above. 444Debug.Assert(TypeSymbol.Equals( 448Debug.Assert(!isLeftOfAssignment || node.IndexerOrSliceAccess.GetRefKind() == RefKind.Ref); 479Debug.Assert(node.ArgumentPlaceholders.Length == 1); 480Debug.Assert(node.IndexerOrSliceAccess is BoundIndexerAccess or BoundArrayAccess); 482Debug.Assert(TypeSymbol.Equals( 499Debug.Assert(receiver.Type is { }); 561Debug.Assert(node.ArgumentPlaceholders.Length == 1); 563Debug.Assert(integerArgument.Type!.SpecialType == SpecialType.System_Int32); 569Debug.Assert(indexerAccess.Arguments.Length == 1); 586Debug.Assert(locals is not null); 653Debug.Assert(lengthAccess is not null); 657Debug.Assert(loweredExpr is not null); 658Debug.Assert(lengthAccess is not null); 659Debug.Assert(loweredExpr.Type!.SpecialType == SpecialType.System_Int32); 669Debug.Assert(loweredExpr is not null); 670Debug.Assert(loweredExpr.Type!.SpecialType == SpecialType.System_Int32); 674Debug.Assert(loweredExpr is not null); 675Debug.Assert(lengthAccess is not null); 676Debug.Assert(TypeSymbol.Equals( 709Debug.Assert(TypeSymbol.Equals( 718Debug.Assert(hatExpression.Operand is { Type: { SpecialType: SpecialType.System_Int32 } }); 771Debug.Assert(node.ArgumentPlaceholders.Length == 2); 772Debug.Assert(node.IndexerOrSliceAccess is BoundCall); 774Debug.Assert(TypeSymbol.Equals( 801Debug.Assert(receiver.Type is { }); 915Debug.Assert(startStrategy != PatternIndexOffsetLoweringStrategy.Zero || (rewriteFlags & captureStartOffset) == 0); 916Debug.Assert((rewriteFlags & captureEndOffset) == 0 || (rewriteFlags & captureStartOffset) != 0 || startStrategy == PatternIndexOffsetLoweringStrategy.Zero); 917Debug.Assert((rewriteFlags & captureStartOffset) == 0 || (rewriteFlags & captureEndOffset) != 0 || endStrategy == PatternIndexOffsetLoweringStrategy.Length); 918Debug.Assert(endStrategy != PatternIndexOffsetLoweringStrategy.Length || (rewriteFlags & captureEndOffset) == 0); 919Debug.Assert((rewriteFlags & captureLength) == 0 || (rewriteFlags & useLength) != 0); 923Debug.Assert(startMakeOffsetInput is not null); 934Debug.Assert(endMakeOffsetInput is not null); 978Debug.Assert(rewrittenRangeArg is not null); 982Debug.Assert(node.ArgumentPlaceholders.Length == 2);
Lowering\LocalRewriter\LocalRewriter_IsOperator.cs (3)
52Debug.Assert(targetType is { }); 86Debug.Assert(constantValue == ConstantValue.True || constantValue == ConstantValue.False); 87Debug.Assert((object)type != null);
Lowering\LocalRewriter\LocalRewriter_IsPatternOperator.cs (8)
66Debug.Assert(w.WhenFalse is null); 119Debug.Assert(node.Type is { SpecialType: SpecialType.System_Boolean }); 178Debug.Assert(test.Type.SpecialType == SpecialType.System_Boolean); 278Debug.Assert(leafNode.Label == whenTrueLabel); 283Debug.Assert(whenNode.WhenExpression == null); 284Debug.Assert(whenNode.WhenTrue is BoundLeafDecisionDagNode d && d.Label == whenTrueLabel); 307Debug.Assert(_sideEffectBuilder.Count == 0); 315Debug.Assert(result != null);
Lowering\LocalRewriter\LocalRewriter_LabeledStatement.cs (1)
16Debug.Assert(node != null);
Lowering\LocalRewriter\LocalRewriter_Literal.cs (13)
19Debug.Assert(node.ConstantValueOpt is { }); 25Debug.Assert(constantValue != null); 30Debug.Assert(type is { SpecialType: SpecialType.System_Decimal }); 38Debug.Assert(type is { SpecialType: SpecialType.System_DateTime }); 53Debug.Assert(constantValue != null); 54Debug.Assert(constantValue.IsDecimal); 71Debug.Assert(curMethod is { }); 132Debug.Assert((object)ctor != null); 133Debug.Assert(ctor.ContainingType.SpecialType == SpecialType.System_Decimal); 144Debug.Assert(constantValue != null); 145Debug.Assert(constantValue.IsDateTime); 151Debug.Assert((object)ctor != null); 152Debug.Assert(ctor.ContainingType.SpecialType == SpecialType.System_DateTime);
Lowering\LocalRewriter\LocalRewriter_LockStatement.cs (3)
28Debug.Assert(rewrittenBody is { }); 35Debug.Assert(rewrittenArgument.ConstantValueOpt == ConstantValue.Null); 201Debug.Assert(enterMethod.ParameterCount == 1);
Lowering\LocalRewriter\LocalRewriter_NullCoalescingAssignmentOperator.cs (9)
16Debug.Assert(node.Type is { }); 20Debug.Assert(node.LeftOperand.Type is { }); 24Debug.Assert(transformedLHS.Type is { }); 41Debug.Assert(TypeSymbol.Equals(transformedLHS.Type, node.LeftOperand.Type, TypeCompareKind.AllIgnoreOptions)); 47Debug.Assert(conditionalExpression.Type is { }); 63Debug.Assert(node.LeftOperand.Type.IsNullableType()); 90Debug.Assert(!_inExpressionLambda && lhsRead.Kind != BoundKind.PropertyAccess); 112Debug.Assert(transformedLHS.Type.GetNullableUnderlyingType().Equals(tmp.Type.StrippedType(), TypeCompareKind.AllIgnoreOptions)); 115Debug.Assert(TypeSymbol.Equals(transformedLHS.Type, node.LeftOperand.Type, TypeCompareKind.AllIgnoreOptions));
Lowering\LocalRewriter\LocalRewriter_NullCoalescingOperator.cs (16)
31Debug.Assert(rewrittenLeft != null); 32Debug.Assert(rewrittenRight != null); 33Debug.Assert(BoundNode.GetConversion(leftConversion, leftPlaceholder).IsValid); 34Debug.Assert(rewrittenResultType is { }); 35Debug.Assert(rewrittenRight.Type is { }); 36Debug.Assert(rewrittenRight.Type.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 42Debug.Assert(rewrittenLeft.Type is { }); 46Debug.Assert(leftPlaceholder is not null); 90Debug.Assert(rewrittenLeft.Type is { }); 167Debug.Assert(convertedLeft.HasErrors || convertedLeft.Type!.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 180Debug.Assert(conditionalExpression.Type!.Equals(rewrittenResultType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 237Debug.Assert(rewrittenLeft != null); 238Debug.Assert(rewrittenLeft.Type is { }); 239Debug.Assert(rewrittenResultType is { }); 240Debug.Assert(BoundNode.GetConversion(leftConversion, leftPlaceholder).IsValid); 243Debug.Assert(rewrittenLeftType.IsNullableType() || !rewrittenLeftType.IsValueType);
Lowering\LocalRewriter\LocalRewriter_ObjectCreationExpression.cs (13)
33Debug.Assert(node != null); 55Debug.Assert(receiverDiscard is null); 81Debug.Assert(TypeSymbol.Equals(rewrittenObjectCreation.Type, ((NamedTypeSymbol)node.Type).ComImportCoClass, TypeCompareKind.ConsiderEverything2)); 114Debug.Assert(TypeSymbol.Equals(rewrittenObjectCreation.Type, ((NamedTypeSymbol)node.Type).ComImportCoClass, TypeCompareKind.ConsiderEverything2)); 135Debug.Assert(receiver.Type!.Equals(type, TypeCompareKind.ConsiderEverything)); 183Debug.Assert(withExpr.CloneMethod is not null); 184Debug.Assert(withExpr.CloneMethod.ParameterCount == 0); 209Debug.Assert(left.MemberSymbol is not null); 218Debug.Assert(property.MemberIndexOpt!.Value >= 0 && property.MemberIndexOpt.Value < anonymousType.Properties.Length); 261Debug.Assert(!_inExpressionLambda); 262Debug.Assert(initializerExpression != null && !initializerExpression.HasErrors); 340Debug.Assert((object)method != null); 384Debug.Assert(node.GuidString is { });
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (41)
38Debug.Assert(!_inExpressionLambda); 39Debug.Assert(rewrittenReceiver != null); 68Debug.Assert(_inExpressionLambda); 100Debug.Assert(!elementInitializer.AddMethod.CallsAreOmitted(initializer.SyntaxTree)); 102Debug.Assert(!elementInitializer.InvokedAsExtensionMethod); 103Debug.Assert(!elementInitializer.AddMethod.IsExtensionMethod); 104Debug.Assert(!elementInitializer.AddMethod.GetIsNewExtensionMember()); 105Debug.Assert(elementInitializer.Arguments.Length == elementInitializer.AddMethod.ParameterCount); 106Debug.Assert(elementInitializer.ImplicitReceiverOpt is BoundObjectOrCollectionValuePlaceholder); 129Debug.Assert(rewrittenReceiver is { } || _inExpressionLambda); 143Debug.Assert(!_inExpressionLambda); 144Debug.Assert(initializer.Kind == BoundKind.DynamicCollectionElementInitializer); 183Debug.Assert(addMethod.Name == "Add"); 184Debug.Assert(addMethod.Parameters 187Debug.Assert(initializer.Arguments.Any()); 188Debug.Assert(!_inExpressionLambda); 231Debug.Assert(addMethod.IsStatic); 232Debug.Assert(addMethod.IsExtensionMethod); 233Debug.Assert(rewrittenReceiver is null); 289Debug.Assert(!_inExpressionLambda); 309Debug.Assert(rewrittenReceiver != null); 310Debug.Assert(!_inExpressionLambda); 332Debug.Assert(memberInit is { }); 336Debug.Assert(memberInit.Arguments.Count(a => a.IsParamsArrayOrCollection) <= (memberInit.Expanded ? 1 : 0)); 360Debug.Assert(!memberInit.Expanded); 377Debug.Assert(setMember.SiteInitialization is { }); 389Debug.Assert(getMember.SiteInitialization is { }); 400Debug.Assert(assignment.Type.IsDynamic() || TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 411Debug.Assert(initializerMember is { }); 421Debug.Assert(setMember.SiteInitialization is { }); 428Debug.Assert(getMember.SiteInitialization is { }); 437Debug.Assert(rewrittenArrayAccess is { }); 441Debug.Assert(!arrayAccess.Indices.Any(a => a.IsParamsArrayOrCollection)); 452Debug.Assert(getSubArrayCall.Arguments.Length == 2); 454Debug.Assert(TypeSymbol.Equals(rangeArgument.Type, _compilation.GetWellKnownType(WellKnownType.System_Range), TypeCompareKind.ConsiderEverything)); 472Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 505Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 539Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions)); 578Debug.Assert(initializers is not null); 696Debug.Assert(memberSymbol is object); 700Debug.Assert(_compilation.Conversions.ClassifyConversionFromType(rewrittenReceiver.Type, memberSymbol.ContainingType, isChecked: false, ref discardedUseSiteInfo).IsImplicit ||
Lowering\LocalRewriter\LocalRewriter_PointerElementAccess.cs (2)
46Debug.Assert(rewrittenExpression.Type is { }); 47Debug.Assert(rewrittenIndex.Type is { });
Lowering\LocalRewriter\LocalRewriter_PreviousSubmissionReference.cs (4)
15Debug.Assert(targetType.TypeKind == TypeKind.Submission); 16Debug.Assert(_factory.TopLevelMethod is { IsStatic: false }); 17Debug.Assert(_factory.CurrentType is { }); 19Debug.Assert(_previousSubmissionFields != null);
Lowering\LocalRewriter\LocalRewriter_PropertyAccess.cs (4)
84Debug.Assert(argumentRefKindsOpt.IsDefaultOrEmpty); 93Debug.Assert(getMethod is { }); 94Debug.Assert(getMethod.ParameterCount == rewrittenArguments.Length); 95Debug.Assert(getMethodOpt is null || ReferenceEquals(getMethod, getMethodOpt));
Lowering\LocalRewriter\LocalRewriter_Range.cs (17)
19Debug.Assert(node != null && node.MethodOpt != null); 54Debug.Assert(operand != null); 56Debug.Assert(operand.Type is { }); 65Debug.Assert(operand.Type is { }); 79Debug.Assert(node.Type.IsNullableType()); 80Debug.Assert(left?.Type?.IsNullableType() == true || right?.Type?.IsNullableType() == true); 81Debug.Assert(!(left is null && right is null)); 82Debug.Assert(node.MethodOpt is { }); 93Debug.Assert(condition != null); 131Debug.Assert(tempOperand.Type is { }); 181Debug.Assert(left is null ^ right is null); 182Debug.Assert(constructionMethod.MetadataName == "StartAt" || 184Debug.Assert(constructionMethod.IsStatic); 186Debug.Assert(arg is { }); 192Debug.Assert(constructionMethod.MetadataName == "get_All"); 193Debug.Assert(constructionMethod.IsStatic); 194Debug.Assert(left is null && right is null);
Lowering\LocalRewriter\LocalRewriter_StackAlloc.cs (2)
29Debug.Assert(type is { }); 123Debug.Assert(size > 0);
Lowering\LocalRewriter\LocalRewriter_StringConcat.cs (20)
25Debug.Assert(IsBinaryStringConcatenation(operatorKind)); 26Debug.Assert(!_inExpressionLambda); 32Debug.Assert(ReferenceEquals(arguments[0], left)); 48Debug.Assert(IsBinaryStringConcatenation(originalOperator)); 74Debug.Assert(!_inExpressionLambda); 75Debug.Assert(visitedArguments.All(arg => arg.Type!.SpecialType is SpecialType.System_String or SpecialType.System_Char or SpecialType.System_Object)); 109Debug.Assert(argumentType is not null); 195Debug.Assert(method is not null); 210Debug.Assert(!_inExpressionLambda); 221Debug.Assert(visitedCompoundAssignmentLeftRead is 280Debug.Assert(argument is not BoundBinaryOperator { InterpolatedStringHandlerData: null } op || !IsBinaryStringConcatenation(op)); 337Debug.Assert(constantValue.IsString || constantValue.IsChar); 474Debug.Assert(arg.Type is not null); 481Debug.Assert(readOnlySpanCtorRefParamChar.Parameters[0].RefKind != RefKind.Out); 505Debug.Assert(arg.HasAnyErrors || arg.Type.SpecialType == SpecialType.System_String); 506Debug.Assert(stringImplicitConversionToReadOnlySpan is not null); 532Debug.Assert(IsBinaryStringConcatenation(current)); 561Debug.Assert(method is not null); 605Debug.Assert(expr.Type is not null); 712Debug.Assert(!IsCapturedPrimaryConstructorParameter(expr));
Lowering\LocalRewriter\LocalRewriter_StringInterpolation.cs (20)
18Debug.Assert(conversion.ConversionKind == ConversionKind.InterpolatedString); 20Debug.Assert(interpolatedString.InterpolationData is { Construction: not null }); 31Debug.Assert(data.BuilderType is not null); 32Debug.Assert(data.ReceiverPlaceholder is not null); 33Debug.Assert(parts.All(static p => p is BoundCall or BoundDynamicInvocation)); 51Debug.Assert(construction.ArgumentRefKindsOpt[i] == RefKind.None); 58Debug.Assert(localType.SpecialType == SpecialType.System_Boolean); 75Debug.Assert(call.Type.SpecialType == SpecialType.System_Boolean == usesBoolReturns); 98Debug.Assert(!parts.IsEmpty); 118Debug.Assert(currentExpression != null); 145Debug.Assert(node.Type is { SpecialType: SpecialType.System_String }); // if target-converted, we should not get here. 177Debug.Assert(part is BoundLiteral && part.ConstantValueOpt?.StringValue is not null); 186Debug.Assert(result is not null); 193Debug.Assert(result is not null); 194Debug.Assert(result.Type is not null); 195Debug.Assert(result.Type.SpecialType == SpecialType.System_String || result.Type.IsErrorType()); 214Debug.Assert(node.InterpolationData is { Construction: not null }); 243Debug.Assert(((BoundObjectCreationExpression)data.Construction).Arguments.All( 251Debug.Assert(arguments.All(arg => arg is not BoundConversion { Conversion: { IsInterpolatedStringHandler: true }, ExplicitCastInCode: false })); 284Debug.Assert(_statements.IsDefault ^ _expressions.IsDefault);
Lowering\LocalRewriter\LocalRewriter_SwitchExpression.cs (7)
57Debug.Assert(savedInputExpression != null); 158Debug.Assert(factory.ModuleBuilderOpt is not null); 162Debug.Assert(diagnostics is not null); 173Debug.Assert(factory.ModuleBuilderOpt is not null); 177Debug.Assert(diagnostics is not null); 187Debug.Assert(factory.ModuleBuilderOpt is not null); 191Debug.Assert(diagnostics is not null);
Lowering\LocalRewriter\LocalRewriter_TryStatement.cs (2)
17Debug.Assert(tryBlock is { }); 89Debug.Assert(rewrittenBody is { });
Lowering\LocalRewriter\LocalRewriter_TupleBinaryOperator.cs (11)
54Debug.Assert(expr.Type == (object?)o.Type || expr.Type is { } && expr.Type.Equals(o.Type, TypeCompareKind.AllIgnoreOptions)); 107Debug.Assert(expr.Type is { }); 110Debug.Assert(boundConversion.Operand.Type is { }); 368Debug.Assert(expr.Type is { }); 398Debug.Assert(expr.Type is { }); 440Debug.Assert(expr.Type is { }); 443Debug.Assert(operand.Type is { }); 448Debug.Assert(underlyingConversions.Length == tupleCardinality); 507Debug.Assert(currentResult is { }); 524Debug.Assert(tuple.Type is { IsTupleType: true }); 583Debug.Assert(boolOperator.ReturnType.SpecialType == SpecialType.System_Boolean);
Lowering\LocalRewriter\LocalRewriter_TupleCreationExpression.cs (2)
39Debug.Assert(node.Type is { }); 45Debug.Assert(type.IsTupleType);
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (41)
38Debug.Assert(false); // these should have been represented as a BoundIncrementOperator 85Debug.Assert((kind == UnaryOperatorKind.DynamicTrue || kind == UnaryOperatorKind.DynamicFalse) && type.SpecialType == SpecialType.System_Boolean 87Debug.Assert(method is null); 113Debug.Assert(method is { }); 114Debug.Assert(TypeSymbol.Equals(type, method.ReturnType, TypeCompareKind.ConsiderEverything2)); 134Debug.Assert(underlyingType is { }); 277Debug.Assert(result.Type is { }); 328Debug.Assert(TypeSymbol.Equals(seq.Type, conditional.Type, TypeCompareKind.ConsiderEverything2)); 329Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2)); 330Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2)); 407Debug.Assert(node.MethodOpt is { }); 408Debug.Assert(node.OperandConversion is null || (node.Operand.Type!.IsReferenceType && node.MethodOpt.GetIsNewExtensionMember())); 414Debug.Assert(node.Type.IsVoidType()); 422Debug.Assert(operandType is { }); 423Debug.Assert(TypeSymbol.Equals(operandType, node.Type, TypeCompareKind.AllIgnoreOptions)); 451Debug.Assert(node.OperandConversion is null); 459Debug.Assert(operandType is { }); 467Debug.Assert(TypeSymbol.Equals(operandType, transformedLHS.Type, TypeCompareKind.AllIgnoreOptions)); 587Debug.Assert(operandType is { }); 588Debug.Assert(TypeSymbol.Equals(operandType, node.Type, TypeCompareKind.ConsiderEverything2)); 639Debug.Assert(!IsCapturedPrimaryConstructorParameter(expression)); 659Debug.Assert(boundTemp.Type is not null); 687Debug.Assert(boundTemp.Type is not null); 690Debug.Assert(tempValue.Type is { }); 746Debug.Assert(placeholder is not null); 779Debug.Assert(node.MethodOpt is { }); 780Debug.Assert(node.MethodOpt.ParameterCount == 1); 791Debug.Assert(TypeSymbol.Equals(node.MethodOpt.GetParameterType(0), node.MethodOpt.ReturnType, TypeCompareKind.ConsiderEverything2)); 888Debug.Assert(constantOne != null); 889Debug.Assert(constantOne.SpecialType != SpecialType.None); 890Debug.Assert(binaryOperandType.SpecialType != SpecialType.None); 891Debug.Assert(binaryOperatorKind.OperandTypes() != 0); 918Debug.Assert(binaryOperatorKind.OperandTypes() == BinaryOperatorKind.PointerAndInt); 919Debug.Assert(binaryOperand.Type is { TypeKind: TypeKind.Pointer }); 920Debug.Assert(boundOne.Type is { SpecialType: SpecialType.System_Int32 }); 966Debug.Assert((object)method != null); // Should have been checked during Warnings pass 973Debug.Assert(operand.Type is { SpecialType: SpecialType.System_Decimal }); 980Debug.Assert(operand.Type is { } && operand.Type.IsNullableType() && operand.Type.GetNullableUnderlyingType().SpecialType == SpecialType.System_Decimal); 1166Debug.Assert(underlyingType is { }); 1171Debug.Assert(underlyingType.IsEnumType()); 1173Debug.Assert(underlyingType is { });
Lowering\LocalRewriter\LocalRewriter_UsingStatement.cs (17)
38Debug.Assert(rewrittenBody is { }); 50Debug.Assert(node.DeclarationsOpt is { }); 70Debug.Assert(declarations != null); 110Debug.Assert(node.ExpressionOpt != null); 111Debug.Assert(node.DeclarationsOpt == null); 130Debug.Assert(node.Locals.IsEmpty); // TODO: This might not be a valid assumption in presence of semicolon operator. 149Debug.Assert(rewrittenExpression.Type is { }); 214Debug.Assert(localDeclaration.InitializerOpt is { }); 219Debug.Assert((object)localType != null); //otherwise, there wouldn't be a conversion to IDisposable 224Debug.Assert(rewrittenDeclaration is { }); 357Debug.Assert((awaitKeywordOpt == default) == (awaitOpt is null)); 442Debug.Assert(awaitOpt is null || awaitKeyword != default); 499Debug.Assert(expression == null); 500Debug.Assert(method.Parameters.AsSpan()[1..].All(static (p) => (p.IsOptional || p.IsParams) && p.RefKind is RefKind.None or RefKind.In or RefKind.RefReadOnlyParameter)); 504Debug.Assert(method.Parameters.All(p => p.IsOptional || p.IsParams)); 507Debug.Assert(method.ParameterRefKinds.IsDefaultOrEmpty || method.ParameterRefKinds.All(static refKind => refKind is RefKind.In or RefKind.RefReadOnlyParameter or RefKind.None)); 508Debug.Assert(methodArgumentInfo.Arguments.All(arg => arg is not BoundConversion { ConversionKind: ConversionKind.InterpolatedStringHandler }));
Lowering\LocalRewriter\LocalRewriter_WhileStatement.cs (3)
18Debug.Assert(node != null); 22Debug.Assert(rewrittenBody is { }); 49Debug.Assert(loop.Kind is BoundKind.WhileStatement or BoundKind.ForEachStatement or BoundKind.CollectionExpressionSpreadElement);
Lowering\LocalRewriter\LoweredDynamicOperation.cs (3)
54Debug.Assert(children.Length > 0); 63Debug.Assert(SiteInitialization == null && SiteInvocation is BoundBadExpression && _temps.IsDefaultOrEmpty); 68Debug.Assert(SiteInitialization is { });
Lowering\LocalRewriter\LoweredDynamicOperationFactory.cs (17)
25Debug.Assert(factory != null); 83Debug.Assert(!isExplicit || !isArrayIndex); 120Debug.Assert(operatorKind.IsDynamic()); 158Debug.Assert(operatorKind.IsDynamic()); 205Debug.Assert(_factory.TopLevelMethod is { }); 545Debug.Assert(loweredReceiver.Type is { }); 570Debug.Assert(argumentNames.IsDefaultOrEmpty || loweredArguments.Length == argumentNames.Length); 571Debug.Assert(refKinds.IsDefault || loweredArguments.Length == refKinds.Length); 572Debug.Assert(!receiverIsStaticType || receiverRefKind == RefKind.None); 608Debug.Assert(!loweredArguments.IsDefault); 687Debug.Assert(factory.CompilationState.ModuleBuilderOpt is { }); 688Debug.Assert(factory.TopLevelMethod is { }); 689Debug.Assert(factory.CurrentFunction is { }); 715Debug.Assert(_currentDynamicCallSiteContainer is { }); 727Debug.Assert(refKinds.IsDefaultOrEmpty || refKinds.Length == loweredArguments.Length); 786Debug.Assert(_factory.CompilationState.ModuleBuilderOpt is { }); 794Debug.Assert(refKind != RefKind.RefReadOnlyParameter);
Lowering\MethodToClassRewriter.cs (16)
40Debug.Assert(compilationState != null); 41Debug.Assert(diagnostics != null); 42Debug.Assert(diagnostics.DiagnosticBag != null); 105Debug.Assert(rewrittenMethodSymbol.IsMetadataVirtual(MethodSymbol.IsMetadataVirtualOption.ForceCompleteIfNeeded) 141Debug.Assert(methodBeingCalled.IsGenericMethod); 143Debug.Assert(typeArgs.Length == newMethod.Arity); 176Debug.Assert(wrapper.SynthesizesLoweredBoundBody); 221Debug.Assert(!NeedsProxy(node.LocalSymbol)); 271Debug.Assert(!proxies.ContainsKey(leftLocal.LocalSymbol)); 272Debug.Assert(originalRight.Kind != BoundKind.ConvertedStackAllocExpression); 279Debug.Assert(leftLocal.LocalSymbol.DeclarationKind == LocalDeclarationKind.None); 305Debug.Assert(!node.IsRef); 401Debug.Assert(member is not null); 432Debug.Assert(containingType.ContainingModule is SourceModuleSymbol); 433Debug.Assert(ReferenceEquals(methodBeingWrapped, methodBeingWrapped.ConstructedFrom)); 434Debug.Assert(!methodBeingWrapped.IsStatic);
Lowering\SpillSequenceSpiller.cs (37)
47Debug.Assert(value?.Kind != SpillSequenceBuilderKind); 217Debug.Assert(!_receiverSubstitution.ContainsKey(node.LocalSymbol)); 272Debug.Assert(builder.Value == null); 286Debug.Assert(statement != null); 290Debug.Assert(builder.Value == null); 308Debug.Assert(builder != null); 317Debug.Assert(refKind == RefKind.None); 318Debug.Assert(!sideEffectsOnly); 324Debug.Assert(refKind == RefKind.None); 325Debug.Assert(!sideEffectsOnly); 362Debug.Assert(receiverRefLocal.IsKnownToReferToTempIfReferenceType); 441Debug.Assert(call.Arguments.Length == 1); 451Debug.Assert(call.Arguments.Length == 1); 465Debug.Assert(call.Arguments.Length == 2); 473Debug.Assert(call.Arguments.Length == 1); 486Debug.Assert(objectCreationExpression.Arguments.Length == 1); 522Debug.Assert(call.Arguments.Length == 2); 590Debug.Assert(!sideEffectsOnly || refKinds.IsDefault); 591Debug.Assert(refKinds.IsDefault || refKinds.Length == args.Length); 599Debug.Assert(newList.Length == args.Length); 637Debug.Assert(sideEffectsOnly || replacement != null); 681Debug.Assert(expr != null); 682Debug.Assert(builder == null || builder.Value == null); 713Debug.Assert(exceptionFilterPrologueOpt is null); // it is introduced by this pass 718Debug.Assert(builder.Value is null); 731Debug.Assert(!(node is BoundStatement)); 852Debug.Assert(node.OperandPlaceholder is null); 853Debug.Assert(node.OperandConversion is null); 922Debug.Assert(field.ReceiverOpt is object); 1034Debug.Assert(refKind == RefKind.None || !receiver.Type.IsReferenceType); 1044Debug.Assert(!receiverType.IsReferenceType); 1147Debug.Assert(condition.Type.SpecialType == SpecialType.System_Boolean); 1235Debug.Assert(node.LeftPlaceholder is null); 1236Debug.Assert(node.LeftConversion is null); 1303Debug.Assert(node.HasValueMethodOpt == null); 1328Debug.Assert(whenNullOpt == null || !LocalRewriter.ReadIsSideeffecting(whenNullOpt)); 1414Debug.Assert(node.InitializerExpressionOpt == null);
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (6)
62Debug.Assert(!badRegion); 91Debug.Assert(local.RefKind != RefKind.None); 100Debug.Assert(parameter.TypeWithAnnotations.IsRestrictedType()); 111Debug.Assert(!allVariables.Any((s, method) => s.Symbol is ParameterSymbol { ContainingSymbol: var container } && container != method && container is not SynthesizedPrimaryConstructor, method)); 251Debug.Assert(parameter.IsThis || parameter.RefKind == RefKind.None); 287Debug.Assert(!topLevelMethod.GetIsNewExtensionMember()); // extension methods were replaced with implementation methods earlier in the pipeline
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (31)
115Debug.Assert(F != null); 116Debug.Assert(originalMethod != null); 117Debug.Assert(state != null); 118Debug.Assert(nonReusableLocalProxies != null); 119Debug.Assert(!nonReusableFieldsForCleanup.IsDefault); 120Debug.Assert(diagnostics != null); 121Debug.Assert(hoistedVariables != null); 122Debug.Assert(nextFreeHoistedLocalSlot >= 0); 150Debug.Assert(thisProxyReplacement.Type is not null); 177Debug.Assert(localOrParameter.Kind == SymbolKind.Local || localOrParameter.Kind == SymbolKind.Parameter); 209Debug.Assert(TypeSymbol.Equals(frameClass, result.Type, TypeCompareKind.ConsiderEverything2)); 284Debug.Assert(!NeedsProxy(local) || proxies.ContainsKey(local)); 315Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.Spill || 510Debug.Assert( 517Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.Spill || 519Debug.Assert(local.GetDeclaratorSyntax() != null); 521Debug.Assert(local.SynthesizedKind switch 541Debug.Assert(local.SynthesizedKind switch 566Debug.Assert(TypeSymbol.Equals(type, replacement.Type, TypeCompareKind.ConsiderEverything2)); 648Debug.Assert(refKind is RefKindExtensions.StrictIn or RefKind.Ref or RefKind.Out); 649Debug.Assert(call.Method.RefKind != RefKind.None); 666Debug.Assert(refKind is RefKindExtensions.StrictIn or RefKind.Ref or RefKind.In); 667Debug.Assert(conditional.IsRef); 691Debug.Assert(awaitSyntaxOpt != null); 756Debug.Assert(!node.Locals.IsEmpty); 763Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.UserDefined && 849Debug.Assert(!node.IsRef); 860Debug.Assert(leftLocal.SynthesizedKind == SynthesizedLocalKind.Spill || 862Debug.Assert(node.IsRef); 989Debug.Assert(proxy != null); 1005Debug.Assert(proxy != null);
Lowering\StateMachineRewriter\ResumableStateMachineStateAllocator.cs (2)
52Debug.Assert(SyntaxBindingUtilities.BindsToResumableStateMachineState(awaitOrYieldReturnSyntax)); 82Debug.Assert(f.ModuleBuilderOpt != null);
Lowering\StateMachineRewriter\StateMachineFieldSymbol.cs (3)
51Debug.Assert((object)type != null); 52Debug.Assert(slotDebugInfo.SynthesizedKind.IsLongLived() == (slotIndex >= 0)); 96Debug.Assert(parameter is { IsThis: false });
Lowering\StateMachineRewriter\StateMachineRewriter.cs (15)
46Debug.Assert(body != null); 47Debug.Assert(method != null); 48Debug.Assert(stateMachineType is not null); 49Debug.Assert(compilationState != null); 50Debug.Assert(diagnostics != null); 51Debug.Assert(diagnostics.DiagnosticBag != null); 52Debug.Assert(stateMachineStateDebugInfoBuilder.IsEmpty); 63Debug.Assert(TypeSymbol.Equals(F.CurrentType, method.ContainingType, TypeCompareKind.ConsiderEverything2)); 64Debug.Assert(F.Syntax == body.Syntax); 153Debug.Assert(variable.Kind == SymbolKind.Local || variable.Kind == SymbolKind.Parameter); 174Debug.Assert(synthesizedKind == SynthesizedLocalKind.Spill || 179Debug.Assert(local.RefKind == RefKind.None); 313Debug.Assert((object)method.ThisParameter != null); 381Debug.Assert(CanGetThreadId()); 521Debug.Assert(!method.IsIterator || !method.IsAsync); // an override handles async-iterators
Lowering\StateMachineRewriter\StateMachineTypeSymbol.cs (2)
24Debug.Assert(kickoffMethod != null); 57Debug.Assert(base.GetAttributes().Length == 0);
Lowering\StateMachineRewriter\SynthesizedStateMachineMethod.cs (1)
74Debug.Assert(base.GetAttributes().Length == 0);
Lowering\SynthesizedMethodBaseSymbol.cs (8)
54Debug.Assert((object)containingType != null); 55Debug.Assert((object)baseMethod != null); 63Debug.Assert(typeMap != null); 64Debug.Assert(this.TypeMap == null); 65Debug.Assert(!typeParameters.IsDefault); 66Debug.Assert(_typeParameters.IsDefault); 152Debug.Assert(base.GetAttributes().IsEmpty); 160Debug.Assert(base.GetReturnTypeAttributes().IsEmpty);
Lowering\SynthesizedSubmissionFields.cs (2)
33Debug.Assert(compilation != null); 34Debug.Assert(submissionClass.IsSubmissionClass);
Lowering\SyntheticBoundNodeFactory.cs (76)
116Debug.Assert(node != null); 117Debug.Assert(compilationState != null); 118Debug.Assert(diagnostics != null); 134Debug.Assert(TopLevelMethod is null || TypeSymbol.Equals(TopLevelMethod.ContainingType, CurrentType, TypeCompareKind.ConsiderEverything2)); 140Debug.Assert(CurrentFunction is null || 150Debug.Assert(ModuleBuilderOpt is { }); 172Debug.Assert(CurrentType is { }); 180Debug.Assert(CurrentType is { }); 188Debug.Assert(CurrentType is { }); 196Debug.Assert(CurrentType is { }); 204Debug.Assert(CurrentType is { }); 213Debug.Assert(ModuleBuilderOpt is { }); 224Debug.Assert(CurrentFunction is { IsStatic: false }); 235Debug.Assert(CurrentFunction is { IsStatic: false }); 267Debug.Assert(receiverOpt is null || receiverOpt.Type is { } && 275Debug.Assert((receiverOpt is null) == property.IsStatic); 284Debug.Assert(accessor is not null); 290Debug.Assert((receiverOpt is null) == property.IsStatic); 292Debug.Assert(accessor is not null); 361Debug.Assert(result is not null); 402Debug.Assert(result is not null); 439Debug.Assert(left.Type is { } && right.Type is { } && 558Debug.Assert(CurrentFunction is { }); 571Debug.Assert(conversion.Kind != ConversionKind.NoConversion); 574Debug.Assert(CurrentFunction.RefKind == RefKind.None); 584Debug.Assert(CurrentFunction is { }); 663Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 664Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 670Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 671Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 815Debug.Assert(methodSymbol.IsStatic); 823Debug.Assert(methodSymbol.IsStatic); 824Debug.Assert(methodSymbol.IsGenericMethod); 825Debug.Assert(methodSymbol.Arity == typeArgs.Length); 833Debug.Assert(methodSymbol.IsStatic); 862Debug.Assert(method.ParameterCount == args.Length); 904Debug.Assert(method.ParameterCount == args.Length); 919Debug.Assert(valueTypeReceiver.Type is { }); 920Debug.Assert(TypeSymbol.Equals(valueTypeReceiver.Type, referenceTypeReceiver.Type, TypeCompareKind.ConsiderEverything2)); 926Debug.Assert(left.Type!.Equals(right.Type, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) || left.Type.IsErrorType()); 927Debug.Assert(left.Type.IsReferenceType); 955Debug.Assert(thenClause != null); 1037Debug.Assert(result.Type is { }); 1044Debug.Assert(result.Type is { }); 1053Debug.Assert(result.Type is { }); 1083Debug.Assert(ex.Type is { SpecialType: CodeAnalysis.SpecialType.System_Int32 }); 1110Debug.Assert(statements[0] is null); 1127Debug.Assert(!labels.Contains(v2)); 1156Debug.Assert(stringConst.IsString || stringConst.IsNull); 1178Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1184Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1197Debug.Assert(array.Type is { TypeKind: TypeKind.Array }); 1204Debug.Assert(CurrentFunction is { }); 1249Debug.Assert(type.CanBeAssignedNull()); 1268Debug.Assert(systemType.ExtendedSpecialType == InternalSpecialType.System_Type || 1282Debug.Assert(TypeSymbol.Equals(systemType, getTypeFromHandle.ReturnType, TypeCompareKind.AllIgnoreOptions)); 1304Debug.Assert(this.CompilationState is { DynamicOperationContextType: { } }); 1326Debug.Assert(result.Type.IsErrorType() || result.Type!.IsDerivedFrom(result.GetMethodFromHandle!.ReturnType, TypeCompareKind.AllIgnoreOptions, ref discardedUseSiteInfo)); 1433Debug.Assert(result.Type.IsErrorType() || result.Type!.IsDerivedFrom(result.GetMethodFromHandle!.ReturnType, TypeCompareKind.AllIgnoreOptions, ref discardedUseSiteInfo)); 1450Debug.Assert(systemReflectionMethodOrConstructorInfo.ExtendedSpecialType == InternalSpecialType.System_Reflection_MethodInfo || 1482Debug.Assert(!allowBoxingByRefLikeTypeParametersToObject || type.IsObjectType()); 1503Debug.Assert(c.Exists); 1524Debug.Assert(arg.Type is { }); 1640Debug.Assert(expression is { Type: { SpecialType: CodeAnalysis.SpecialType.System_Boolean } }); 1661Debug.Assert(argument.Type is { }); 1663Debug.Assert(containingMethod is { }); 1664Debug.Assert(kind != SynthesizedLocalKind.UserDefined); 1681Debug.Assert(argument.GetRefKind() != RefKind.In); 1738Debug.Assert(node.Type is { }); 1761Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) || 1767Debug.Assert( 1837Debug.Assert(loweredLeft != null); 1838Debug.Assert(loweredRight != null); 1839Debug.Assert((object)returnType != null); 1840Debug.Assert(returnType.SpecialType == CodeAnalysis.SpecialType.System_Boolean); 1841Debug.Assert(loweredLeft.IsLiteralNull() != loweredRight.IsLiteralNull());
Lowering\UnmatchedGotoFinder.cs (1)
30Debug.Assert(unmatchedLabelsCache != null);
Operations\CSharpOperationFactory.cs (44)
513Debug.Assert(initializer.Initializers.All(i => i is ISimpleAssignmentOperation)); 527Debug.Assert(declaredTypeOpt != null); 538Debug.Assert(declaredTypeOpt != null); 695Debug.Assert(type is not null); 709Debug.Assert(constructor is not null); 719Debug.Assert(isImplicit); 720Debug.Assert(type is not null); 811Debug.Assert(!boundObjectInitializerMember.Expanded); 858Debug.Assert(boundObjectInitializerMember.Type.IsDynamic()); 1017Debug.Assert(!forceOperandImplicitLiteral || boundConversion.Operand is BoundLiteral); 1023Debug.Assert(!forceOperandImplicitLiteral); 1024Debug.Assert(!boundOperand.GetInterpolatedStringHandlerData().IsDefault); 1032Debug.Assert(!forceOperandImplicitLiteral); 1036Debug.Assert(boundConversion.SymbolOpt is object); 1050Debug.Assert(isImplicit || target.Syntax != syntax || target.IsImplicit || boundConversion.ConversionGroupOpt != null); 1070Debug.Assert(boundOperand.Kind == BoundKind.BadExpression || 1073Debug.Assert(!forceOperandImplicitLiteral); 1086Debug.Assert(!forceOperandImplicitLiteral); 1175Debug.Assert(typeOperand is not null); 1186Debug.Assert(typeOperand is not null); 1197Debug.Assert(typeOperand is not null); 1332Debug.Assert(!IsMemberInitializer(boundAssignmentOperator)); 1346Debug.Assert(IsMemberInitializer(boundAssignmentOperator)); 1538Debug.Assert(boundBinaryOperator.InterpolatedStringHandlerData is not null); 1651Debug.Assert(lengthSymbol is not null); 1652Debug.Assert(indexerSymbol is not null); 1965Debug.Assert(boundForEachStatement.IterationVariables.Length == 1); 2009Debug.Assert(boundCatchBlock.ExceptionFilterPrologueOpt is null); 2031Debug.Assert((boundUsingStatement.DeclarationsOpt == null) != (boundUsingStatement.ExpressionOpt == null)); 2032Debug.Assert(boundUsingStatement.ExpressionOpt is object || boundUsingStatement.Locals.Length > 0); 2124Debug.Assert(node.Parent != null); 2219Debug.Assert(boundExpressionStatement.Syntax == sequence.Value.Syntax); 2256Debug.Assert(positionInfo == null || boundInterpolatedString.InterpolationData is null or { BuilderType: null }); 2299Debug.Assert(parts.Length == positionInfo.Length); 2322Debug.Assert(bad.ChildBoundNodes.Length == 2350Debug.Assert(alignment is null); 2351Debug.Assert(format is null); 2359Debug.Assert(valueOperation.IsImplicit); 2369Debug.Assert(valueOperation.Syntax != part.Syntax); 2419Debug.Assert(conversion.Conversion.IsInterpolatedStringHandler); 2712Debug.Assert(boundSwitchExpression.DefaultLabel is GeneratedLabelSymbol); 2753Debug.Assert(boundSwitchLabel.Pattern.Kind == BoundKind.DiscardPattern); 2894Debug.Assert(nameSyntax is not null); 2943Debug.Assert(!patternDisposeInfo.Method.IsStatic);
Operations\CSharpOperationFactory_Methods.cs (7)
150Debug.Assert(boundConversion.SymbolOpt is not null); 202Debug.Assert(property is not null); 227Debug.Assert(attribute.Constructor is not null); 326Debug.Assert(methodOrIndexer.GetIsVararg() ^ parameters.Length == arguments.Length); 383Debug.Assert(argumentsInEvaluationBuilder.All(static arg => arg is not null)); 415Debug.Assert(arguments.Length >= declarations.Length); 471Debug.Assert(currentDeclarationIndex == declarations.Length);
Parser\Blender.cs (4)
37Debug.Assert(lexer != null); 93Debug.Assert(lexer != null); 94Debug.Assert(changes != null); 95Debug.Assert(newPosition >= 0);
Parser\Blender.Cursor.cs (1)
132Debug.Assert(this.CurrentNodeOrToken.IsNode);
Parser\Blender.Reader.cs (2)
108Debug.Assert(!_oldTreeCursor.IsFinished); 140Debug.Assert(_changeDelta > 0 || _oldTreeCursor.IsFinished);
Parser\CharacterInfo.cs (3)
55Debug.Assert(IsHexDigit(c)); 65Debug.Assert(IsBinaryDigit(c)); 75Debug.Assert(IsDecDigit(c));
Parser\DirectiveParser.cs (1)
413Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken);
Parser\DocumentationCommentParser.cs (8)
973Debug.Assert(CurrentToken.Kind == SyntaxKind.ThisKeyword); 987Debug.Assert(CurrentToken.ContextualKind == SyntaxKind.ExtensionKeyword); 1018Debug.Assert(CurrentToken.Kind == SyntaxKind.OperatorKeyword); 1153Debug.Assert(SyntaxFacts.IsAnyOverloadableOperator(operatorToken.Kind)); 1163Debug.Assert(kind is not (SyntaxKind.GreaterThanGreaterThanEqualsToken or SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken)); // Reaching this code path is not expected 1209Debug.Assert(CurrentToken.Kind == SyntaxKind.ExplicitKeyword || 1272Debug.Assert(CurrentToken.Kind != SyntaxKind.CommaToken); 1366Debug.Assert(CurrentToken.Kind == SyntaxKind.LessThanToken);
Parser\LanguageParser.cs (123)
211Debug.Assert(_recursionDepth == 0); 251Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NamespaceKeyword); 282Debug.Assert(semicolon != null || openBrace != null); 289Debug.Assert(semicolon != null); 570Debug.Assert(!IsInAsync); 932Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ExternKeyword); 943Debug.Assert(this.IsNamedAssignment()); 960Debug.Assert(this.CurrentToken.Kind == SyntaxKind.UsingKeyword); 1352Debug.Assert(!(forAccessors && forTopLevelStatements)); 1360Debug.Assert(newMod != DeclarationModifiers.Scoped); 1469Debug.Assert(modTok.Kind is not (SyntaxKind.OutKeyword or SyntaxKind.InKeyword)); 1495Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IdentifierToken && GetModifierExcludingScoped(this.CurrentToken) != DeclarationModifiers.None); 1613Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword); 1637Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.PartialKeyword); 1689Debug.Assert(!IsInAsync); 1711Debug.Assert(CurrentToken.ContextualKind is SyntaxKind.RecordKeyword or SyntaxKind.ExtensionKeyword); 1721Debug.Assert(this.CurrentToken.Kind is SyntaxKind.ClassKeyword or SyntaxKind.StructKeyword or SyntaxKind.InterfaceKeyword || 1725Debug.Assert(!IsInAsync); 1910Debug.Assert(name is not null); 1926Debug.Assert(name is not null); 1942Debug.Assert(name is not null); 1961Debug.Assert(name is not null); 1980Debug.Assert(name is null); 1981Debug.Assert(baseList is null); 2092Debug.Assert((_termState & TerminatorState.IsEndOfTypeSignature) != 0); 2518Debug.Assert(!IsInAsync); 2519Debug.Assert(parentKind == SyntaxKind.CompilationUnit); 2811Debug.Assert(identifierOrThisOpt != null); 3088Debug.Assert(!IsInAsync); 3089Debug.Assert(parentKind != SyntaxKind.CompilationUnit); 3220Debug.Assert(identifierOrThisOpt != null); 3410Debug.Assert(this.CurrentToken.Kind == SyntaxKind.TildeToken); 3555Debug.Assert(!IsInAsync); 3897Debug.Assert(type != null); // How could it be? The only caller got it from ParseReturnType. 4048Debug.Assert(thisKeyword.Kind == SyntaxKind.ThisKeyword); 4122Debug.Assert(IsStartOfPropertyBody(this.CurrentToken.Kind)); 4755Debug.Assert(parent.Kind() == SyntaxKind.ParameterList); 4886Debug.Assert(this.CurrentToken.Kind == SyntaxKind.FixedKeyword); 4904Debug.Assert(this.CurrentToken.Kind == SyntaxKind.EventKeyword); 4955Debug.Assert(identifierOrThisOpt.Kind == SyntaxKind.ThisKeyword); 4963Debug.Assert(identifier != null); 4964Debug.Assert(identifier.Kind == SyntaxKind.IdentifierToken); 5105Debug.Assert(localFunction == null); 5185Debug.Assert(localFunction is null); 5539Debug.Assert(this.CurrentToken.Kind is SyntaxKind.OpenParenToken or SyntaxKind.LessThanToken); 5596Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DelegateKeyword); 5629Debug.Assert(this.CurrentToken.Kind == SyntaxKind.EnumKeyword); 5978Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6051Debug.Assert(greaterThanToken.Kind == SyntaxKind.GreaterThanToken); 6135Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6148Debug.Assert(start.Kind == SyntaxKind.LessThanToken); 6149Debug.Assert(greaterThanToken.Kind == SyntaxKind.GreaterThanToken); 6321Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6527Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LessThanToken); 6651Debug.Assert(beforeIdentifierPointSet); 6834Debug.Assert(separator.Kind is SyntaxKind.DotToken or SyntaxKind.ColonColonToken); 6975Debug.Assert(mode != ParseTypeMode.NewExpression); 7007Debug.Assert(this.CurrentToken.Kind is SyntaxKind.IdentifierToken); 7018Debug.Assert(result is ScanTypeFlags.GenericTypeOrExpression or ScanTypeFlags.GenericTypeOrMethod or ScanTypeFlags.NonGenericTypeOrExpression); 7039Debug.Assert(result is ScanTypeFlags.GenericTypeOrExpression or ScanTypeFlags.GenericTypeOrMethod or ScanTypeFlags.NonGenericTypeOrExpression); 7193Debug.Assert(IsFunctionPointerStart()); 7234Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 7390Debug.Assert(type != null); 7457Debug.Assert(type != null); 7464Debug.Assert(this.CurrentToken.Kind == SyntaxKind.QuestionToken); 7789Debug.Assert(IsFunctionPointerStart()); 7838Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 7918Debug.Assert(CurrentToken.Kind == SyntaxKind.CommaToken); 8291Debug.Assert(PeekToken(1).Kind != SyntaxKind.OpenParenToken); 8297Debug.Assert(PeekToken(2).Kind != SyntaxKind.OpenParenToken); 8632Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NewKeyword); 9037Debug.Assert(this.CurrentToken.Kind is SyntaxKind.TryKeyword or SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword); 9050Debug.Assert(this.CurrentToken.Kind is SyntaxKind.CatchKeyword or SyntaxKind.FinallyKeyword); 9113Debug.Assert(this.CurrentToken.Kind == SyntaxKind.CatchKeyword); 9196Debug.Assert(this.CurrentToken.Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword); 9213Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DoKeyword); 9254Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9275Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9419Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ForEachKeyword || this.CurrentToken.Kind == SyntaxKind.ForKeyword); 9521Debug.Assert(mode is ParseTypeMode.Normal or ParseTypeMode.FirstElementOfPossibleTupleLiteral or ParseTypeMode.AfterTupleComma); 9636Debug.Assert(this.CurrentToken.Kind == SyntaxKind.GotoKeyword); 9669Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IfKeyword); 9734Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ElseKeyword); 9757Debug.Assert(this.CurrentToken.Kind == SyntaxKind.LockKeyword); 9769Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ReturnKeyword); 9779Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.YieldKeyword); 9816Debug.Assert(this.CurrentToken.Kind is SyntaxKind.SwitchKeyword or SyntaxKind.CaseKeyword); 9862Debug.Assert(parenExpression.GetDiagnostics().Length == 0); 9892Debug.Assert(this.IsPossibleSwitchSection()); 9942Debug.Assert(this.CurrentToken.Kind == SyntaxKind.DefaultKeyword); 9964Debug.Assert(this.CurrentToken.Kind == SyntaxKind.ThrowKeyword); 9974Debug.Assert(this.CurrentToken.Kind == SyntaxKind.UnsafeKeyword); 10099Debug.Assert(st != ScanTypeFlags.NullableType); 10110Debug.Assert(this.CurrentToken.Kind == SyntaxKind.WhileKeyword); 10124Debug.Assert(this.IsTrueIdentifier() && this.PeekToken(1).Kind == SyntaxKind.ColonToken); 10390Debug.Assert(localFunction == null); 10494Debug.Assert(this.CurrentToken.Kind == SyntaxKind.IdentifierToken); 11486Debug.Assert(IsExpectedAssignmentOperator(operatorToken.Kind)); 11487Debug.Assert(GetPrecedence(operatorExpressionKind) == Precedence.Assignment); 11528Debug.Assert(IsAtDotDotToken()); 11762Debug.Assert(expr != null); 11851Debug.Assert(this.CurrentToken.Kind == SyntaxKind.BaseKeyword); 12114Debug.Assert(openKind is SyntaxKind.OpenParenToken or SyntaxKind.OpenBracketToken); 12115Debug.Assert(closeKind is SyntaxKind.CloseParenToken or SyntaxKind.CloseBracketToken); 12116Debug.Assert((openKind == SyntaxKind.OpenParenToken) == (closeKind == SyntaxKind.CloseParenToken)); 12312Debug.Assert(checkedOrUnchecked.Kind is SyntaxKind.CheckedKeyword or SyntaxKind.UncheckedKeyword); 12346Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 12377Debug.Assert(CurrentToken.Kind == SyntaxKind.OpenParenToken); 12453Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenParenToken); 12853Debug.Assert(this.CurrentToken.Kind == SyntaxKind.NewKeyword); 12872Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenBracketToken); 12918Debug.Assert(IsAnonymousType()); 12921Debug.Assert(this.CurrentToken.Kind == SyntaxKind.OpenBraceToken); 13201Debug.Assert(this.CurrentToken.Kind is SyntaxKind.NewKeyword or SyntaxKind.StackAllocKeyword); 13410Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.AsyncKeyword); 13810Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.FromKeyword); 13843Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.JoinKeyword); 13863Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.LetKeyword); 13873Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.WhereKeyword); 13881Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.OrderByKeyword); 13944Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.SelectKeyword); 13952Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.GroupKeyword); 13962Debug.Assert(this.CurrentToken.ContextualKind == SyntaxKind.IntoKeyword);
Parser\LanguageParser_InterpolatedString.cs (9)
40Debug.Assert(this.CurrentToken.Kind == SyntaxKind.InterpolatedStringToken); 45Debug.Assert(originalText[0] == '$' || originalText[0] == '@'); 68Debug.Assert(originalToken.ToFullString() == result.ToFullString()); // yield from text equals yield from node 147Debug.Assert(closeQuoteText[afterWhitespace] == '"'); 387Debug.Assert(text[interpolation.OpenBraceRange.Start..interpolation.CloseBraceRange.End] == result.ToFullString()); // yield from text equals yield from node 402Debug.Assert(text[interpolation.OpenBraceRange.Start..interpolation.CloseBraceRange.End] == result.ToFullString()); // yield from text equals yield from node 459Debug.Assert(kind is Lexer.InterpolatedStringKind.Normal or Lexer.InterpolatedStringKind.Verbatim); 468Debug.Assert(token.Kind == SyntaxKind.StringLiteralToken); 478Debug.Assert(infos.Length > 0);
Parser\LanguageParser_Patterns.cs (1)
209Debug.Assert(precedence < Precedence.Shift);
Parser\Lexer.cs (42)
120Debug.Assert(options != null); 344Debug.Assert(info.Kind != SyntaxKind.IdentifierToken || info.StringValue != null); 426Debug.Assert(SyntaxFacts.IsPunctuationOrKeyword(info.Kind)); 629Debug.Assert(TextWindow.PeekChar() == '@'); 753Debug.Assert(TextWindow.PeekChar() == '@'); 779Debug.Assert(TextWindow.PeekChar() == '$'); 1052Debug.Assert(info.Text != null); 1150Debug.Assert(hasUSuffix && hasLSuffix); 1619Debug.Assert(string.Equals(info.Text.Substring(0, objectAddressOffset + 1), "@0x", StringComparison.OrdinalIgnoreCase)); 1655Debug.Assert(InXmlCrefOrNameAttributeValue); 2089Debug.Assert(firstCh is '<' or '|' or '=' or '>'); 2229Debug.Assert(delimiter is '/' or '@'); 2230Debug.Assert(TextWindow.PeekChar() == delimiter && TextWindow.PeekChar(1) == '*'); 2735Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 2830Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) || TextWindow.PeekChar() == SlidingTextWindow.InvalidCharacter); 2866Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 2867Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 2911Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 2925Debug.Assert(TextWindow.PeekChar() == '<'); 2974Debug.Assert(TextWindow.PeekChar() == '&'); 3233Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 3234Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 3329Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 3406Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 3407Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 3473Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 3564Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 3565Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 3624Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 3625Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 3909Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null); 4030Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 4031Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 4152Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 4153Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 4283Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start)); 4284Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior)); 4495Debug.Assert(this.StyleIs(XmlDocCommentStyle.Delimited)); 4660Debug.Assert(character == '\\'); 4710Debug.Assert(character == 'u' || character == 'x'); 4764Debug.Assert(TextWindow.PeekChar() == '&'); 4878Debug.Assert(codepoint > 0x0000FFFF && codepoint <= 0x0010FFFF);
Parser\Lexer_RawStringLiteral.cs (6)
63Debug.Assert(startingQuoteCount >= 3); 101Debug.Assert(info.StringValue != null); 104Debug.Assert(info.Kind is (SyntaxKind.SingleLineRawStringLiteralToken or SyntaxKind.MultiLineRawStringLiteralToken)); 197Debug.Assert(SyntaxFacts.IsNewLine(TextWindow.PeekChar())); 224Debug.Assert(SyntaxFacts.IsNewLine(TextWindow.PeekChar())); 317Debug.Assert(SyntaxFacts.IsNewLine(TextWindow.PeekChar()));
Parser\Lexer_StringLiteral.cs (24)
17Debug.Assert(quoteCharacter is '\'' or '"'); 63Debug.Assert(TextWindow.Width > 0); 134Debug.Assert(ch == '\\'); 194Debug.Assert(TextWindow.PeekChar() == '@'); 208Debug.Assert(TextWindow.PeekChar() == '"'); 383Debug.Assert(_lexer.TextWindow.Position != start); 448Debug.Assert(startingDollarSignCount > 0); 458Debug.Assert(totalAtCount + startingDollarSignCount + startingQuoteCount >= 2); 518Debug.Assert(kind is InterpolatedStringKind.SingleLineRaw or InterpolatedStringKind.MultiLineRaw); 529Debug.Assert(kind is InterpolatedStringKind.Normal or InterpolatedStringKind.Verbatim); 535Debug.Assert(IsAtEnd(kind)); 550Debug.Assert(kind is InterpolatedStringKind.SingleLineRaw or InterpolatedStringKind.MultiLineRaw); 558Debug.Assert(IsAtEnd(kind)); 574Debug.Assert(closeQuoteCount >= startingQuoteCount); 604Debug.Assert(closeQuoteCount >= startingQuoteCount); 621Debug.Assert(closeQuoteCount >= startingQuoteCount); 769Debug.Assert(kind == InterpolatedStringKind.Verbatim); 781Debug.Assert(kind is InterpolatedStringKind.SingleLineRaw or InterpolatedStringKind.MultiLineRaw); 818Debug.Assert(kind is InterpolatedStringKind.MultiLineRaw or InterpolatedStringKind.SingleLineRaw); 850Debug.Assert(kind is InterpolatedStringKind.Normal or InterpolatedStringKind.Verbatim); 879Debug.Assert(kind is InterpolatedStringKind.SingleLineRaw or InterpolatedStringKind.MultiLineRaw); 953Debug.Assert(_lexer.TextWindow.PeekChar() == ':'); 1039Debug.Assert(colonRange.Equals(default(Range))); 1139Debug.Assert(start == _lexer.TextWindow.PeekChar());
Parser\QuickScanner.cs (1)
261Debug.Assert(quickWidth == token.FullWidth);
Parser\SlidingTextWindow.cs (4)
299Debug.Assert(SyntaxFacts.IsNewLine(this.PeekChar())); 305Debug.Assert(SyntaxFacts.IsNewLine(currentChar)); 375Debug.Assert(this.Position > 0); 493Debug.Assert(codepoint > 0x0000FFFF && codepoint <= 0x0010FFFF);
Parser\SyntaxParser.cs (19)
173Debug.Assert(offset >= 0); 185Debug.Assert(offset >= 0 && offset < _tokenCount); 211Debug.Assert(_resetCount == point.ResetCount); 240Debug.Assert(_allowModeReset); 255Debug.Assert(_blendedTokens != null); 295Debug.Assert(_blendedTokens != null); 370Debug.Assert(tokenResult.Token != null); 382Debug.Assert(token != null); 406Debug.Assert(shiftOffset > 0); 434Debug.Assert(shiftOffset > 0); 468Debug.Assert(n >= 0); 523Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 539Debug.Assert(SyntaxFacts.IsAnyToken(expected)); 583Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 597Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 611Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 630Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 644Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 1179Debug.Assert(!assertIfFalse);
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
110Debug.Assert(ctor.MethodKind == MethodKind.Constructor && typeDeclaration.ParameterList is object);
SymbolDisplay\SymbolDisplay.cs (2)
268Debug.Assert(semanticModelOpt == null); 269Debug.Assert(positionOpt < 0);
SymbolDisplay\SymbolDisplayVisitor.cs (2)
90Debug.Assert(visitor != this); 371Debug.Assert((object)containingType != null || (symbol.ContainingSymbol is ITypeSymbol));
SymbolDisplay\SymbolDisplayVisitor.Members.cs (7)
395Debug.Assert(containingType != null); 615Debug.Assert(!conventionTypes.IsDefaultOrEmpty); 626Debug.Assert(conventionType.Name.StartsWith("CallConv")); 690Debug.Assert(operatorKind != SyntaxKind.None); 736Debug.Assert(conversionKind != SyntaxKind.None); 932Debug.Assert(containingType != null || (symbol.ContainingSymbol is ITypeSymbol)); 1057Debug.Assert(implementedMember.ContainingType != null);
SymbolDisplay\SymbolDisplayVisitor.Types.cs (7)
255Debug.Assert(symbol.DelegateInvokeMethod is not null); 320Debug.Assert(symbol.IsTupleType); 413Debug.Assert(symbol.Arity > 0); 495Debug.Assert(symbol.DelegateInvokeMethod is not null); 545Debug.Assert(tupleSymbol.IsTupleType); 584Debug.Assert(symbol.IsTupleType); 750Debug.Assert(!symbol.IsRefLikeType);
SymbolDisplay\SymbolDisplayVisitor_Constants.cs (2)
44Debug.Assert(value.GetType().GetTypeInfo().IsPrimitive || value is string || value is decimal); 46Debug.Assert(valueString != null);
SymbolDisplay\SymbolDisplayVisitor_Minimal.cs (2)
64Debug.Assert(symbol.ContainingNamespace != null || symbol.IsGlobalNamespace); 95Debug.Assert(Format.GlobalNamespaceStyle == SymbolDisplayGlobalNamespaceStyle.Included ||
Symbols\AbstractTypeMap.cs (5)
27Debug.Assert((object)previous.ConstructedFrom == (object)previous); 166Debug.Assert(builder.Count == customModifiers.Length); 196Debug.Assert(0 <= interfaces.Length && interfaces.Length <= 2); 200Debug.Assert(interfaces[0] is NamedTypeSymbol); // IList<T> 205Debug.Assert(interfaces[0] is NamedTypeSymbol); // IList<T>
Symbols\AliasSymbol.cs (3)
57Debug.Assert(locations.Length == 1 || (locations.IsEmpty && aliasName == "global")); // It looks like equality implementation depends on this condition. 58Debug.Assert(containingSymbol is not null); 288Debug.Assert(syntax.Alias is object);
Symbols\AnonymousTypes\AnonymousTypeDescriptor.cs (3)
54Debug.Assert(!this.Fields.IsDefault); 104Debug.Assert(!newFieldTypes.IsDefault); 105Debug.Assert(newFieldTypes.Length == this.Fields.Length);
Symbols\AnonymousTypes\AnonymousTypeField.cs (1)
74Debug.Assert(this.Name != null && this.Location != null && this.TypeWithAnnotations.HasType);
Symbols\AnonymousTypes\AnonymousTypeManager.cs (6)
19Debug.Assert(compilation != null); 46Debug.Assert((object)type != null); 47Debug.Assert(type.IsAnonymousType); 58Debug.Assert(type.IsAnonymousType); 70Debug.Assert(!newFieldTypes.IsDefault); 71Debug.Assert(type.IsAnonymousType);
Symbols\AnonymousTypes\AnonymousTypeManager.SymbolCollection.cs (3)
34Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor)); 35Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Diagnostics_DebuggerHiddenAttribute__ctor)); 36Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Diagnostics_DebuggerBrowsableAttribute__ctor));
Symbols\AnonymousTypes\AnonymousTypeManager.Templates.cs (22)
104Debug.Assert(_sourceLocationsSeen.ContainsKey(location)); 163Debug.Assert(refKinds.IsNull || parameterCount == refKinds.Capacity - (returnsVoid ? 0 : 1)); 188Debug.Assert(typeDescr.Location.IsInSource); // AnonymousDelegateTemplateSymbol requires a location in source for ordering. 198Debug.Assert(fields.All(f => hasDefaultScope(useUpdatedEscapeRules, f))); 208Debug.Assert(needsIndexedName); 209Debug.Assert(i == fields.Length - 2); 210Debug.Assert(field.Type.IsSZArray()); 224Debug.Assert(nTypeArguments != 0); 232Debug.Assert(lastParam.Type.IsSZArray()); 270Debug.Assert(typeArguments.Length == template.TypeParameters.Length); 293Debug.Assert(typeParameters.Length == template.TypeParameters.Length); 345Debug.Assert(changed); 400Debug.Assert(isContainedIn(yOwner, xOwner)); 428Debug.Assert(ReferenceEquals(this, anonymous.Manager)); 490Debug.Assert(!key.IsDelegate); 607Debug.Assert(!builder.Any()); 625Debug.Assert(!builder.Any()); 647Debug.Assert(!builder.Any()); 758Debug.Assert((object)type != null); 767Debug.Assert((object)type != null); 768Debug.Assert(type.IsAnonymousType); 779Debug.Assert((object)method != null);
Symbols\AnonymousTypes\PublicSymbols\AnonymousType.TypePublicSymbol.cs (1)
55Debug.Assert(membersCount == _members.Length);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.DelegateTemplateSymbol.cs (7)
41Debug.Assert(refKinds.IsNull || parameterCount == refKinds.Capacity - (voidReturnTypeOpt is { } ? 0 : 1)); 103Debug.Assert(SmallestLocation != null); 104Debug.Assert(SmallestLocation != Location.None); 136Debug.Assert(field.Type.IsSZArray()); 137Debug.Assert(i == parameterCount - 1); 163Debug.Assert(SmallestLocation != null); 164Debug.Assert(SmallestLocation != Location.None);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.FieldSymbol.cs (1)
26Debug.Assert((object)property != null);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.PropertySymbol.cs (5)
47Debug.Assert((object)container != null); 48Debug.Assert((object)field != null); 49Debug.Assert(fieldTypeWithAnnotations.HasType); 50Debug.Assert(index >= 0); 51Debug.Assert(!locations.IsDefault);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.TemplateSymbol.cs (1)
78Debug.Assert(membersCount == _members.Length);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.TypeOrDelegateTemplateSymbol.cs (4)
68Debug.Assert(_smallestLocation != null); 81Debug.Assert(value != null); 83Debug.Assert(oldValue == null || 94Debug.Assert(location.IsInSource);
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.TypeParameterSymbol.cs (2)
27Debug.Assert((object)container != null); 28Debug.Assert(!string.IsNullOrEmpty(name));
Symbols\ArrayTypeSymbol.cs (7)
30Debug.Assert(elementTypeWithAnnotations.HasType); 416Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 482Debug.Assert(nullableAnnotation != DefaultNullableAnnotation); 520Debug.Assert(constructedInterfaces.Length <= 2); 578Debug.Assert(rank >= 1); 641Debug.Assert(!sizes.IsDefaultOrEmpty || !lowerBounds.IsDefault); 642Debug.Assert(lowerBounds.IsDefaultOrEmpty || (!lowerBounds.IsEmpty && (lowerBounds.Length != rank || !lowerBounds.All(b => b == 0))));
Symbols\AssemblySymbol.cs (24)
64Debug.Assert((object)_corLibrary == null); 500Debug.Assert(SpecialMembers.GetDescriptor(feature).DeclaringSpecialType == SpecialType.System_Runtime_CompilerServices_RuntimeFeature); 653Debug.Assert(result?.IsErrorType() != true); 698Debug.Assert(parts.Length > 0); 708Debug.Assert(!type.IsErrorType()); 720Debug.Assert(!type.IsErrorType()); 735Debug.Assert(type?.IsErrorType() != true); 752Debug.Assert(!typeInfo.IsByRef); 755Debug.Assert(!typeInfo.ContainsGenericParameters); 781Debug.Assert(!typeInfo.IsArray); 791Debug.Assert(currentTypeInfo.IsGenericTypeDefinition || !currentTypeInfo.IsGenericType); 815Debug.Assert(symbol?.IsErrorType() != true); 830Debug.Assert(typeArgumentIndex == genericArguments.Length); 849Debug.Assert(!symbol.IsErrorType()); 854Debug.Assert(typeArgumentIndex == genericArguments.Length); 864Debug.Assert(remainingTypeArguments >= symbol.Arity); 902Debug.Assert(warnings is null || isWellKnownType); 909Debug.Assert(result?.IsErrorType() != true); 931Debug.Assert(corLibCandidate?.IsErrorType() != true); 966Debug.Assert(candidate?.IsErrorType() != true); 973Debug.Assert(!TypeSymbol.Equals(candidate, result, TypeCompareKind.ConsiderEverything)); 1011Debug.Assert(result?.IsErrorType() != true); 1048Debug.Assert(result?.IsErrorType() != true); 1049Debug.Assert(result is null || ReferenceEquals(result.ContainingAssembly, assembly));
Symbols\Attributes\AttributeData.cs (20)
88Debug.Assert(!attributeType.IsErrorType()); 216Debug.Assert(!this.HasErrors); 217Debug.Assert(arguments.Diagnostics is BindingDiagnosticBag); 245Debug.Assert(arguments.AttributeSyntaxOpt is object); 296Debug.Assert(arguments.AttributeSyntaxOpt is object); 339Debug.Assert((object)targetSymbol != null); 340Debug.Assert(targetSymbol.Kind == SymbolKind.Assembly || targetSymbol.Kind == SymbolKind.NamedType || targetSymbol.Kind == SymbolKind.Method); 341Debug.Assert(this.IsSecurityAttribute(compilation)); 382Debug.Assert((object)targetSymbol != null); 383Debug.Assert(targetSymbol.Kind == SymbolKind.Assembly || targetSymbol.Kind == SymbolKind.NamedType || targetSymbol.Kind == SymbolKind.Method); 384Debug.Assert(typedValue.ValueInternal is object); 508Debug.Assert(!this.HasErrors); 516Debug.Assert(AttributeClass is object); 572Debug.Assert(!this.HasErrors); 575Debug.Assert(ctorArgument.Kind == TypedConstantKind.Enum || ctorArgument.Kind == TypedConstantKind.Primitive); 597Debug.Assert(!this.HasErrors); 600Debug.Assert(ctorArgument.Kind == TypedConstantKind.Enum || ctorArgument.Kind == TypedConstantKind.Primitive); 623Debug.Assert(!this.HasErrors); 672Debug.Assert(target is SourceAssemblySymbol || target.ContainingAssembly is SourceAssemblySymbol); 805Debug.Assert(attribute is SourceAttributeData);
Symbols\Attributes\PEAttributeData.cs (1)
111Debug.Assert(lazyConstructorArguments != null && lazyNamedArguments != null);
Symbols\Attributes\RetargetingAttributeData.cs (4)
30Debug.Assert(underlying is SourceAttributeData or SynthesizedAttributeData); 31Debug.Assert(attributeClass is object || underlying.HasErrors); 54Debug.Assert(AttributeClass is object || _underlying.HasErrors); 62Debug.Assert(AttributeConstructor is null);
Symbols\Attributes\SourceAttributeData.cs (17)
41Debug.Assert(compilation is object); 42Debug.Assert(applicationNode is object); 43Debug.Assert(!isConditionallyOmitted || attributeClass is object && attributeClass.IsConditional); 44Debug.Assert(!constructorArguments.IsDefault); 45Debug.Assert(!namedArguments.IsDefault); 46Debug.Assert(constructorArgumentsSourceIndices.IsDefault || 48Debug.Assert(attributeConstructor is object || hasErrors); 129Debug.Assert(!this.HasErrors); 130Debug.Assert(this.AttributeConstructor is object); 131Debug.Assert(parameterIndex >= 0); 132Debug.Assert(parameterIndex < this.AttributeConstructor.ParameterCount); 139Debug.Assert(attributeSyntax.ArgumentList != null); 140Debug.Assert(this.AttributeConstructor.ParameterCount <= attributeSyntax.ArgumentList.Arguments.Count); 152Debug.Assert(this.AttributeConstructor.Parameters[parameterIndex].IsOptional || 158Debug.Assert(sourceArgIndex >= 0); 159Debug.Assert(sourceArgIndex < attributeSyntax.ArgumentList!.Arguments.Count); 475Debug.Assert(attributeClass is object);
Symbols\Attributes\WellKnownAttributeData\PropertyEarlyWellKnownAttributeData.cs (1)
32Debug.Assert(value != null);
Symbols\Attributes\WellKnownAttributeData\TypeWellKnownAttributeData.cs (2)
28Debug.Assert((object)_comImportCoClass == null); 29Debug.Assert((object)value != null);
Symbols\Attributes\WellKnownAttributeData\TypeWellKnownEarlyAttributeData.cs (1)
60Debug.Assert(value is -1 or > 0);
Symbols\BaseTypeAnalysis.cs (8)
20Debug.Assert((object)depends != null); 21Debug.Assert((object)on != null); 22Debug.Assert(on.IsDefinition); 65Debug.Assert((object)depends != null); 66Debug.Assert((object)on != null); 67Debug.Assert(on.IsDefinition); 82Debug.Assert((object)type != null); 175Debug.Assert((object)type != null);
Symbols\Compilation_UsedAssemblies.cs (3)
174Debug.Assert(!dependency.IsLinked); 192Debug.Assert(retargetingAssembly.Modules[0].ReferencedAssemblySymbols.Contains(underlyingDependency)); 253Debug.Assert(!added || !wasFrozen);
Symbols\Compilation_WellKnownMembers.cs (23)
54Debug.Assert(!_needsGeneratedAttributes_IsFrozen); 66Debug.Assert(!_needsGeneratedAttributes_IsFrozen); 79Debug.Assert(member >= 0 && member < WellKnownMember.Count); 123Debug.Assert(type.IsValid()); 151Debug.Assert(result?.IsErrorType() != true); 162Debug.Assert(conflicts.Item2 is null); 180Debug.Assert( 218Debug.Assert(wellKnownType == WellKnownType.System_Attribute || 264Debug.Assert(!isStatic); 399Debug.Assert(isOptionalUse || WellKnownMembers.IsSynthesizedAttributeOptional(constructor)); 422Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(constructor)); 445Debug.Assert(isOptionalUse); 514Debug.Assert(!modifyCompilation || !_needsGeneratedAttributes_IsFrozen); 565Debug.Assert(ShouldEmitNativeIntegerAttributes()); 624Debug.Assert(ShouldEmitNativeIntegerAttributes()); 676Debug.Assert(errorReported); 778Debug.Assert(type.ContainsDynamic()); 798Debug.Assert(type.ContainsTuple()); 893Debug.Assert(flagsBuilder.Any()); 894Debug.Assert(flagsBuilder.Contains(true)); 917Debug.Assert(!transformFlagsBuilder.Any()); 965Debug.Assert(!isNestedNamedType); 1043Debug.Assert(type.ContainingAssembly?.RuntimeSupportsNumericIntPtr != true);
Symbols\ConstantValueUtils.cs (1)
50Debug.Assert(value != null);
Symbols\ConstraintsHelper.cs (32)
139Debug.Assert(currentCompilation == null || typeParameter.IsFromCompilation(currentCompilation)); 161Debug.Assert(!constraintType.Type.ContainsDynamic()); 223Debug.Assert(inherited || currentCompilation == null || constraintType.TypeKind != TypeKind.Delegate); 257Debug.Assert(inherited || currentCompilation == null); 263Debug.Assert(inherited || currentCompilation == null); 269Debug.Assert(inherited || currentCompilation == null); 322Debug.Assert((effectiveBaseClass.SpecialType == SpecialType.System_Object) || (deducedBaseType.SpecialType != SpecialType.System_Object)); 328Debug.Assert(effectiveBaseClass.SpecialType == SpecialType.System_Object); 329Debug.Assert(interfaces.Length == 0); 359Debug.Assert(!withTypeParametersBinder.Flags.Includes(BinderFlags.GenericConstraintsClause)); 397Debug.Assert(!withTypeParametersBinder.Flags.Includes(BinderFlags.GenericConstraintsClause)); 419Debug.Assert(constraintClauses.Length == arity); 431Debug.Assert((constraintKind & (TypeParameterConstraintKind.ValueTypeFromConstraintTypes | TypeParameterConstraintKind.ReferenceTypeFromConstraintTypes)) == 0); 474Debug.Assert(!deducedBase.IsValueType || typeParameter.HasReferenceTypeConstraint); 612Debug.Assert(tuple.IsTupleType); 683Debug.Assert(typeArgumentsSyntax.Count == 0 /*omitted*/ || typeArgumentsSyntax.Count == type.Arity); 720Debug.Assert(args.CurrentCompilation is object); 909Debug.Assert(typeParameters.Length == typeArguments.Length); 910Debug.Assert(!args.Conversions.IncludeNullability || (nullabilityDiagnosticsBuilderOpt != null)); 917Debug.Assert(typeParameters.All(tp => ReferenceEquals(tp.ContainingSymbol, constructedContainingSymbol.OriginalDefinition))); 1066Debug.Assert(substitution != null); 1069Debug.Assert(ReferenceEquals(typeParameter.ContainingSymbol, constructedContainingSymbol.OriginalDefinition)); 1412Debug.Assert(iface.IsInterfaceType()); 1517Debug.Assert(type.TypeKind is TypeKind.Class or TypeKind.Struct); 1554Debug.Assert(IsValidEncompassedByArgument(a)); 1555Debug.Assert(IsValidEncompassedByArgument(b)); 1558Debug.Assert(!conversions.IncludeNullability); 1596Debug.Assert(!type.ConstructedFrom.Equals(type, TypeCompareKind.ConsiderEverything)); 1618Debug.Assert(method.ConstructedFrom != method 1626Debug.Assert((object)deducedBase != null); 1627Debug.Assert((object)effectiveBase != null); 1629Debug.Assert(deducedBase.IsErrorType() ||
Symbols\ConstructedNamedTypeSymbol.cs (4)
71Debug.Assert(constructedFrom.Arity == typeArgumentsWithAnnotations.Length); 72Debug.Assert(constructedFrom.Arity != 0); 99Debug.Assert(typeArguments.Length == n); 100Debug.Assert(typeArguments.Length > 0);
Symbols\CustomModifier.cs (1)
21Debug.Assert((object)modifier != null);
Symbols\DiscardSymbol.cs (1)
15Debug.Assert(typeWithAnnotations.Type is object);
Symbols\DynamicTypeEraser.cs (1)
20Debug.Assert((object)objectType != null);
Symbols\DynamicTypeSymbol.cs (2)
236Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 247Debug.Assert(nullableAnnotation != DefaultNullableAnnotation);
Symbols\ErrorMethodSymbol.cs (1)
283Debug.Assert(MethodKind == MethodKind.Constructor);
Symbols\ErrorTypeSymbol.cs (3)
481Debug.Assert(this.IsDefinition); 482Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol?.OriginalDefinition)); 562Debug.Assert(nullableAnnotation != DefaultNullableAnnotation);
Symbols\EventSymbol.cs (4)
266Debug.Assert(this.IsDefinition); 267Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition)); 268Debug.Assert(newOwner.IsDefinition || newOwner is SubstitutedNamedTypeSymbol); 288Debug.Assert(this.IsDefinition);
Symbols\ExtendedErrorTypeSymbol.cs (1)
35Debug.Assert(((object?)containingSymbol == null) ||
Symbols\Extensions\RewrittenLambdaOrLocalFunctionSymbol.cs (2)
18Debug.Assert(lambdaOrLocalFunctionSymbol.AssociatedSymbol is null); 19Debug.Assert(lambdaOrLocalFunctionSymbol.TryGetThisParameter(out var thisParameter) && thisParameter is null);
Symbols\Extensions\RewrittenMethodSymbol.cs (2)
20Debug.Assert(originalMethod.IsDefinition); 21Debug.Assert(originalMethod.ExplicitInterfaceImplementations.IsEmpty);
Symbols\Extensions\SourceExtensionImplementationMethodSymbol.cs (3)
24Debug.Assert(sourceMethod.GetIsNewExtensionMember()); 25Debug.Assert(sourceMethod.IsStatic || sourceMethod.ContainingType.ExtensionParameter is not null); 166Debug.Assert(string.Equals(result, withIncludes, System.StringComparison.Ordinal));
Symbols\Extensions\SynthesizedExtensionMarker.cs (4)
28Debug.Assert(extensionType.IsDefinition); 29Debug.Assert(extensionType.IsExtension); 30Debug.Assert(parameterList is not null); 84Debug.Assert(parameterTypeSyntax is not null);
Symbols\FieldOrPropertyInitializer.cs (1)
31Debug.Assert(((syntax.IsKind(SyntaxKind.EqualsValueClause) || syntax.IsKind(SyntaxKind.Parameter)) && fieldOpt != null) || syntax is StatementSyntax);
Symbols\FieldSymbol.cs (9)
329Debug.Assert(this.IsDefinition); 330Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition)); 353Debug.Assert(IsDefinition); 414Debug.Assert(!(this is TupleElementFieldSymbol or TupleErrorFieldSymbol)); 423Debug.Assert(!(this is TupleElementFieldSymbol or TupleErrorFieldSymbol)); 437Debug.Assert(!(this is TupleElementFieldSymbol)); 450Debug.Assert(!(this is TupleElementFieldSymbol)); 473Debug.Assert(!(this is TupleElementFieldSymbol or TupleErrorFieldSymbol or Retargeting.RetargetingFieldSymbol)); 491Debug.Assert(tupleElementPosition < NamedTypeSymbol.ValueTupleRestPosition);
Symbols\FunctionPointers\FunctionPointerMethodSymbol.cs (15)
59Debug.Assert(refKind != RefKind.None); 212Debug.Assert(specifierType?.IsErrorType() != true); 213Debug.Assert(specifierType is null || ReferenceEquals(specifierType.ContainingAssembly, compilation.Assembly.CorLibrary)); 280Debug.Assert(callingConvention == CallingConvention.Unmanaged); 312Debug.Assert(refKind is RefKind.None or RefKind.In or RefKind.Ref or RefKind.Out); 323Debug.Assert(refKind != RefKind.Out && refKind != RefKind.In); 350Debug.Assert(RefKind == signature.RefKind); 363Debug.Assert(thisParam.RefKind == otherParam.RefKind); 451Debug.Assert(originalParameters.Length == substitutedParameterTypes.Length); 452Debug.Assert(substitutedRefCustomModifiers.IsDefault || originalParameters.Length == substitutedRefCustomModifiers.Length); 496Debug.Assert(refKind != RefKind.Out); 497Debug.Assert(refCustomModifiers.IsDefaultOrEmpty || refKind != RefKind.None); 498Debug.Assert(parameterRefCustomModifiers.IsDefault || parameterRefCustomModifiers.Length == parameterTypes.Length); 545Debug.Assert(retAndParamTypes.Length > 0); 554Debug.Assert(RefKind != RefKind.Out);
Symbols\FunctionPointers\FunctionPointerParameterSymbol.cs (1)
18Debug.Assert(typeWithAnnotations.HasType);
Symbols\FunctionPointers\FunctionPointerTypeSymbol.cs (3)
128Debug.Assert(nullableAnnotation != DefaultNullableAnnotation); 164Debug.Assert(this.Equals(other, TypeCompareKind.AllIgnoreOptions)); 210Debug.Assert(modifierType.ContainingAssembly is not null || modifierType.IsErrorType());
Symbols\FunctionTypeSymbol.cs (7)
66Debug.Assert((object?)_lazyDelegateType == Uninitialized); 67Debug.Assert(_expression is null); 68Debug.Assert(expression.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda); 81Debug.Assert(_binder is { }); 82Debug.Assert(_calculateDelegate is { }); 83Debug.Assert(_expression is { }); 164Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
Symbols\LexicalSortKey.cs (4)
56Debug.Assert(position >= 0); 57Debug.Assert(treeOrdinal >= 0); 114Debug.Assert(comparison != 0); 137Debug.Assert(other.IsInitialized);
Symbols\MemberSignatureComparer.cs (4)
503Debug.Assert(sawInterfaceInName2); 628Debug.Assert(member1.GetMemberArity() == member2.GetMemberArity()); 643Debug.Assert(typeParameters1.Length == typeParameters2.Length); 768Debug.Assert(params1.Length == params2.Length);
Symbols\MemberSymbolExtensions.cs (16)
132Debug.Assert(member.GetMemberArityIncludingExtension() != 0); 143Debug.Assert(property.GetIsNewExtensionMember()); 158Debug.Assert(originalTypeParameters.Length == method.Arity + method.ContainingType.Arity); 230Debug.Assert(property.GetIsNewExtensionMember()); 232Debug.Assert(extension.Arity > 0); 233Debug.Assert(extension.Arity == typeArguments.Length); 256Debug.Assert((object)constructed != null); 282Debug.Assert(method.GetIsNewExtensionMember()); 297Debug.Assert(receiverType is not null); 298Debug.Assert(property.GetIsNewExtensionMember()); 363Debug.Assert(symbol.ContainingType.IsInterface); 784Debug.Assert(member.IsDefinition); 796Debug.Assert(member.IsDefinition); 808Debug.Assert(member.IsDefinition); 821Debug.Assert(member.IsDefinition); 833Debug.Assert(member.IsDefinition);
Symbols\MergedNamespaceSymbol.cs (2)
80Debug.Assert(namespacesToMerge.Length != 0); 100Debug.Assert(ns.ConstituentNamespaces.Length == 1);
Symbols\Metadata\PE\DynamicTypeDecoder.cs (15)
46Debug.Assert(!dynamicTransformFlags.IsEmpty); 47Debug.Assert((object)containingAssembly != null); 71Debug.Assert((object)metadataType != null); 112Debug.Assert((object)metadataType != null); 113Debug.Assert((object)containingAssembly != null); 114Debug.Assert(!dynamicTransformFlags.IsDefault); 131Debug.Assert(checkLength || decoder._dynamicTransformFlags.LastIndexOf(true) < decoder._index); 142Debug.Assert(_index >= 0); 195Debug.Assert(customModifiersCount >= 0); 211Debug.Assert(_index >= 0); 221Debug.Assert(!flag); 234Debug.Assert(newContainingType.IsGenericType); 305Debug.Assert(!flag); 328Debug.Assert(!flag); 350Debug.Assert(!flag);
Symbols\Metadata\PE\MemberRefMetadataDecoder.cs (5)
38Debug.Assert((object)containingType != null); 78Debug.Assert(cumulativeArity <= position); 104Debug.Assert((object)typeArgument == null); 249Debug.Assert(candidateMethodTypeMap != null); 277Debug.Assert(candidateMethodTypeMap != null);
Symbols\Metadata\PE\MetadataDecoder.cs (16)
58Debug.Assert((object)moduleSymbol != null); 101Debug.Assert(position >= 0 && position < type.Arity); 121Debug.Assert(result?.IsErrorType() != true); 169Debug.Assert(result?.IsErrorType() != true); 310Debug.Assert((object)result != null); 313Debug.Assert(cache != null); 316Debug.Assert(ReferenceEquals(newresult, result) || (newresult.Kind == SymbolKind.ErrorType)); 364Debug.Assert((object)assembly != null); 372Debug.Assert(candidate?.IsGenericType != true); 373Debug.Assert(candidate?.IsErrorType() != true); 374Debug.Assert(candidate is null || ReferenceEquals(candidate.ContainingAssembly, assembly)); 388Debug.Assert(!(assembly is SourceAssemblySymbol) || !((SourceAssemblySymbol)assembly).SourceModule.MightContainNoPiaLocalTypes()); 490Debug.Assert(typeSymbol.IsDefinition); 517Debug.Assert(typeSymbol is PENamedTypeSymbol || typeSymbol is ErrorTypeSymbol); 540Debug.Assert(!targetTypeSymbol.IsTupleType); 544Debug.Assert(scope.Kind == SymbolKind.NamedType || scope.Kind == SymbolKind.ErrorType);
Symbols\Metadata\PE\NativeIntegerTypeDecoder.cs (4)
41Debug.Assert(type.ContainsErrorType()); 42Debug.Assert(result is null); 47Debug.Assert(result is object); 102Debug.Assert(type.TypeKind == TypeKind.Error);
Symbols\Metadata\PE\NullableTypeDecoder.cs (3)
27Debug.Assert(metadataType.HasType); 28Debug.Assert(accessSymbol.IsDefinition); 29Debug.Assert((object)accessSymbol.ContainingModule == containingModule);
Symbols\Metadata\PE\PEAssemblySymbol.cs (2)
75Debug.Assert(assembly != null); 76Debug.Assert(documentationProvider != null);
Symbols\Metadata\PE\PEEventSymbol.cs (2)
62Debug.Assert(!handle.IsNil); 160Debug.Assert(candidateAssociatedField.DeclaredAccessibility == Accessibility.Private);
Symbols\Metadata\PE\PEFieldSymbol.cs (9)
55Debug.Assert((value & ~(FlowAnalysisAnnotations.DisallowNull | FlowAnalysisAnnotations.AllowNull | FlowAnalysisAnnotations.MaybeNull | FlowAnalysisAnnotations.NotNull)) == 0); 76Debug.Assert(value == 0 || result); 83Debug.Assert(IsVolatile == isVolatile); 92Debug.Assert(RefKind == refKind); 139Debug.Assert((object)moduleSymbol != null); 140Debug.Assert((object)containingType != null); 141Debug.Assert(!fieldDef.IsNil); 291Debug.Assert((object)eventSymbol != null); 292Debug.Assert(TypeSymbol.Equals(eventSymbol.ContainingType, _containingType, TypeCompareKind.ConsiderEverything2));
Symbols\Metadata\PE\PEGlobalNamespaceSymbol.cs (1)
32Debug.Assert((object)moduleSymbol != null);
Symbols\Metadata\PE\PEMethodSymbol.cs (30)
123Debug.Assert((int)value == ((int)value & MethodKindMask)); 170Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); 177Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); 183Debug.Assert((int)methodKind == ((int)methodKind & MethodKindMask)); 185Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); 195Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); 250Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet)); 406Debug.Assert((object)moduleSymbol != null); 407Debug.Assert((object)containingType != null); 408Debug.Assert(!methodDef.IsNil); 420Debug.Assert((uint)implFlags <= ushort.MaxValue); 433Debug.Assert((uint)localflags <= ushort.MaxValue); 455Debug.Assert(flag != 0 && ((ushort)flag & ((ushort)flag - 1)) == 0); 611Debug.Assert(_packedFlags.IsExplicitOverrideIsPopulated); 624Debug.Assert(_packedFlags.IsExplicitOverrideIsPopulated); 711Debug.Assert(!memberNotNull.IsDefault); 719Debug.Assert(!memberNotNullWhenTrue.IsDefault); 725Debug.Assert(!memberNotNullWhenFalse.IsDefault); 786Debug.Assert((methodKind == MethodKind.PropertyGet) || (methodKind == MethodKind.PropertySet)); 796Debug.Assert((methodKind == MethodKind.EventAdd) || (methodKind == MethodKind.EventRemove)); 804Debug.Assert(TypeSymbol.Equals(propertyOrEventSymbol.ContainingType, _containingType, TypeCompareKind.ConsiderEverything2)); 812Debug.Assert( 1053Debug.Assert(!attributeData.IsDefault); 1498Debug.Assert(!ReferenceEquals(data, UnmanagedCallersOnlyAttributeData.Uninitialized)); 1499Debug.Assert(!ReferenceEquals(data, UnmanagedCallersOnlyAttributeData.AttributePresentDataNotBound)); 1588Debug.Assert(!result.IsDefault); 1616Debug.Assert(MethodKind == MethodKind.Constructor); 1672Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyData, UnmanagedCallersOnlyAttributeData.Uninitialized) 1696Debug.Assert(result != null); 1778Debug.Assert(_uncommonFields is null or { _lazyOverloadResolutionPriority: 0 });
Symbols\Metadata\PE\PEModuleSymbol.cs (16)
128Debug.Assert(ordinal >= 0); 134Debug.Assert(ordinal > 0); 140Debug.Assert(ordinal > 0); 145Debug.Assert((object)assemblySymbol != null); 146Debug.Assert(module != null); 491Debug.Assert(added); 563Debug.Assert((object)_lazyEventRegistrationTokenSymbol != null); 580Debug.Assert((object)_lazyEventRegistrationTokenTableSymbol != null); 595Debug.Assert((object)_lazySystemTypeSymbol != null); 606Debug.Assert(currentModuleResult?.IsErrorType() != true); 610Debug.Assert(isAcceptableSystemTypeSymbol(currentModuleResult)); 645Debug.Assert(isAcceptableSystemTypeSymbol(referencedAssemblyResult)); 714Debug.Assert(result?.IsErrorType() != true); 793Debug.Assert(symbol is object); 794Debug.Assert(symbol.IsDefinition); 795Debug.Assert((object)symbol.ContainingModule == this);
Symbols\Metadata\PE\PENamedTypeSymbol.cs (26)
299Debug.Assert(!handle.IsNil); 300Debug.Assert((object)container != null); 301Debug.Assert(arity == 0 || this is PENamedTypeSymbolGeneric); 337Debug.Assert(ReferenceEquals(_name, metadataName) == (_name == metadataName)); 423Debug.Assert(!uncommon.MarkerMethod.IsNil); 440Debug.Assert(this.IsExtension); 441Debug.Assert(method.IsDefinition); 442Debug.Assert(method.ContainingType == (object)this); 928Debug.Assert(uncommon.lazyHasRequiredMembers.Value() != requiredHandle.IsNil); 1175Debug.Assert(instanceIndex == uncommon.lazyInstanceEnumFields.Length); 1176Debug.Assert(staticIndex == staticFields.Length || staticFields[staticIndex].Kind != SymbolKind.Field); 1198Debug.Assert((object)associatedField.AssociatedSymbol != null); 1199Debug.Assert(!nonEventFields.Contains(associatedField)); 1475Debug.Assert(SymbolKind.Field.ToSortOrder() < SymbolKind.Method.ToSortOrder()); 1476Debug.Assert(SymbolKind.Method.ToSortOrder() < SymbolKind.Property.ToSortOrder()); 1477Debug.Assert(SymbolKind.Property.ToSortOrder() < SymbolKind.Event.ToSortOrder()); 1478Debug.Assert(SymbolKind.Event.ToSortOrder() < SymbolKind.NamedType.ToSortOrder()); 1574Debug.Assert(field.AssociatedSymbol.Kind == SymbolKind.Event); 1609Debug.Assert(previous.Kind.ToSortOrder() <= current.Kind.ToSortOrder()); 1622Debug.Assert(members is object); 2250Debug.Assert(extensionMarkerMethod is not null || this.TypeKind is not TypeKind.Extension); 2428Debug.Assert(DeriveCompilerFeatureRequiredDiagnostic() is null); 2647Debug.Assert(!conditionalSymbols.IsDefault); 2851Debug.Assert(this.SpecialType == SpecialType.System_IntPtr || this.SpecialType == SpecialType.System_UIntPtr); 2895Debug.Assert(genericParameterHandles.Count > 0); 2960Debug.Assert(_arity > 0);
Symbols\Metadata\PE\PENamespaceSymbol.cs (4)
100Debug.Assert(lazyTypes != null); 213Debug.Assert(typesByNS != null); 344Debug.Assert(isNoPiaLocalType); 345Debug.Assert(result is not null);
Symbols\Metadata\PE\PENestedNamespaceSymbol.cs (4)
75Debug.Assert(name != null); 76Debug.Assert((object)containingNamespace != null); 77Debug.Assert(typesByNS != null); 132Debug.Assert(lazyNamespaces != null && lazyTypes != null);
Symbols\Metadata\PE\PEParameterSymbol.cs (23)
147Debug.Assert(value == 0 || result); 246Debug.Assert((object)moduleSymbol != null); 247Debug.Assert((object)containingSymbol != null); 248Debug.Assert(ordinal >= 0); 249Debug.Assert(typeWithAnnotations.HasType); 333Debug.Assert(refKind != RefKind.None); 362Debug.Assert(refKind == this.RefKind); 363Debug.Assert(hasNameInMetadata == this.HasNameInMetadata); 364Debug.Assert(_name is not null); 401Debug.Assert(parameter.RefKind != RefKind.RefReadOnlyParameter); 439Debug.Assert(_refCustomModifiers.IsEmpty || isByRef); 534Debug.Assert(!_handle.IsNil); 574Debug.Assert(!_handle.IsNil); 831Debug.Assert(indexes != s_defaultStringHandlerAttributeIndexes); 842Debug.Assert(indexes != s_defaultStringHandlerAttributeIndexes); 853Debug.Assert(indexes != s_defaultStringHandlerAttributeIndexes); 855Debug.Assert(initialized == s_defaultStringHandlerAttributeIndexes || indexes == initialized || indexes.SequenceEqual(initialized)); 975Debug.Assert(!_handle.IsNil); 989Debug.Assert(!_handle.IsNil); 1061Debug.Assert(!_handle.IsNil); 1135Debug.Assert(filterOutParamArrayAttribute); 1136Debug.Assert(filterOutParamCollectionAttribute); 1158Debug.Assert(!_lazyHiddenAttributes.IsDefault);
Symbols\Metadata\PE\PEPropertySymbol.cs (8)
193Debug.Assert((object)moduleSymbol != null); 194Debug.Assert((object)containingType != null); 195Debug.Assert(!handle.IsNil); 201Debug.Assert(propertyParams.Length > 0); 837Debug.Assert((getMethodParams == null) == ((object)getMethod == null)); 838Debug.Assert((setMethodParams == null) == ((object)setMethod == null)); 1048Debug.Assert(IsIndexer || IsIndexedProperty || this.GetIsNewExtensionMember()); 1060Debug.Assert(_uncommonFields is null or { _lazyOverloadResolutionPriority: 0 });
Symbols\Metadata\PE\PETypeParameterSymbol.cs (18)
71Debug.Assert((object)moduleSymbol != null); 72Debug.Assert((object)definingSymbol != null); 73Debug.Assert(ordinal >= 0); 74Debug.Assert(!handle.IsNil); 154Debug.Assert(!inProgress.Any() || ReferenceEquals(inProgress.Head.ContainingSymbol, this.ContainingSymbol)); 198Debug.Assert(!HasNotNullConstraint && !HasValueTypeConstraint); 322Debug.Assert(isNotNullable == true); 366Debug.Assert(fromTypes == true); 375Debug.Assert(fromNonTypeConstraints == null || fromNonTypeConstraints == true); 376Debug.Assert(fromTypes != true); 382Debug.Assert(!constraintTypes.IsDefaultOrEmpty); 392Debug.Assert(fromType == true); 546Debug.Assert(type.HasType && type.SpecialType == SpecialType.System_Object); 583Debug.Assert(!HasValueTypeConstraint); 661Debug.Assert(!inProgress.Any() || ReferenceEquals(inProgress.Head.ContainingSymbol, this.ContainingSymbol)); 666Debug.Assert(!constraintTypes.IsDefault); 697Debug.Assert(_lazyCachedConstraintsUseSiteInfo.IsInitialized); 704Debug.Assert(_lazyCachedConstraintsUseSiteInfo.IsInitialized);
Symbols\Metadata\PE\SymbolFactory.cs (1)
142Debug.Assert(typeParameters.Length > 0);
Symbols\Metadata\PE\TupleTypeDecoder.cs (3)
264Debug.Assert(decodedContainingType.IsGenericType); 297Debug.Assert(elementNames.IsDefault || elementNames.Length == tupleCardinality); 351Debug.Assert(numberOfElements > 0);
Symbols\MetadataOrSourceAssemblySymbol.cs (12)
50Debug.Assert(module.GetReferencedAssemblies().Length == 0); 60Debug.Assert(result?.IsErrorType() != true); 70Debug.Assert(_lazySpecialTypes is not null); 83Debug.Assert(typeId != SpecialType.None); 84Debug.Assert(ReferenceEquals(corType.ContainingAssembly, this)); 85Debug.Assert(corType.ContainingModule.Ordinal == 0); 86Debug.Assert(ReferenceEquals(this.CorLibrary, this)); 96Debug.Assert(ReferenceEquals(corType, _lazySpecialTypes[(int)typeId]) || 103Debug.Assert(_cachedSpecialTypes > 0 && _cachedSpecialTypes < (int)InternalSpecialType.NextAvailable); 137Debug.Assert(!underlyingType.IsNativeIntegerType); 186Debug.Assert(module.GetReferencedAssemblies().Length == 0); 252Debug.Assert(result != IVTConclusion.NoRelationshipClaimed);
Symbols\MethodSymbol.cs (11)
229Debug.Assert(this.RefKind != RefKind.Out); 391Debug.Assert(!(this is IAttributeTargetSymbol)); //such types must override 529Debug.Assert(conditionalSymbols != null); 713Debug.Assert(!this.GetIsNewExtensionMember()); 891Debug.Assert(this.IsDefinition); 892Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition)); 955Debug.Assert(this.IsDefinition); 1014Debug.Assert(callConvTypedConstant.Kind == TypedConstantKind.Type); 1040Debug.Assert((node == null) == (diagnostics == null)); 1296Debug.Assert(this.IsDefinition); 1297Debug.Assert(this.GetIsNewExtensionMember());
Symbols\MethodSymbolExtensions.cs (3)
23Debug.Assert((object)method != null); 86Debug.Assert(method.IsGenericMethod == (typeArguments.Length > 0)); 97Debug.Assert((object)hiddenMethod != null);
Symbols\MissingAssemblySymbol.cs (1)
34Debug.Assert(identity != null);
Symbols\MissingCorLibrarySymbol.cs (2)
44Debug.Assert(this == CorLibrary); 65Debug.Assert(module.GetReferencedAssemblies().Length == 0);
Symbols\MissingMetadataTypeSymbol.cs (2)
347Debug.Assert(this.SpecialType == SpecialType.System_IntPtr || this.SpecialType == SpecialType.System_UIntPtr); 357Debug.Assert(other.SpecialType == this.SpecialType);
Symbols\MissingModuleSymbol.cs (3)
33Debug.Assert((object)assembly != null); 34Debug.Assert(ordinal >= -1); 215Debug.Assert(name != null);
Symbols\MissingNamespaceSymbol.cs (3)
25Debug.Assert((object)containingModule != null); 33Debug.Assert((object)containingNamespace != null); 34Debug.Assert(name != null);
Symbols\NamedTypeSymbol.cs (21)
263Debug.Assert(includeInstance || includeStatic); 282Debug.Assert(method.MethodKind == MethodKind.Constructor); 290Debug.Assert(method.MethodKind == MethodKind.StaticConstructor); 321Debug.Assert(((PropertySymbol)candidate).IsIndexer); 370Debug.Assert(method.MethodKind != MethodKind.ReducedExtension); 452Debug.Assert(IsScriptClass); 458Debug.Assert(IsScriptClass); 464Debug.Assert(IsScriptClass); 497Debug.Assert(!(fileIdentifier != null && !MangleName && Arity > 0)); 551Debug.Assert(!_lazyRequiredMembers.IsDefault); 576Debug.Assert(!_lazyRequiredMembers.IsDefault); 895Debug.Assert(count == otherTypeArguments.Length); 1008Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 1049Debug.Assert(typeA.IsGenericType); 1050Debug.Assert(typeA.Equals(typeB, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 1229Debug.Assert(!unbound || typeArguments.All(TypeWithAnnotationsIsErrorType)); 1369Debug.Assert(this.IsDefinition); 1370Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition)); 1463Debug.Assert(owner.ContainingModule.HasUnifiedReferences); 1683Debug.Assert(tupleCardinality < ValueTupleRestPosition); 1716Debug.Assert(nullableAnnotation != DefaultNullableAnnotation);
Symbols\NamespaceOrTypeSymbol.cs (8)
224Debug.Assert(memberT.MergedDeclaration.Declarations.SelectAsArray(decl => decl.NameLocation).SequenceEqual(memberT.Locations)); 257Debug.Assert(!emittedTypeName.IsNull); 260Debug.Assert(scope is not MergedNamespaceSymbol); 261Debug.Assert(scope is NamespaceSymbol or NamedTypeSymbol); 273Debug.Assert(!isTopLevel || scope.ToDisplayString(SymbolDisplayFormat.QualifiedNameOnlyFormat) == emittedTypeName.NamespaceName); 277Debug.Assert(!emittedTypeName.UnmangledTypeName.Equals(emittedTypeName.TypeName) && emittedTypeName.InferredArity > 0); 303Debug.Assert(ReferenceEquals(emittedTypeName.UnmangledTypeName, emittedTypeName.TypeName) && emittedTypeName.InferredArity == 0); 326Debug.Assert(forcedArity == emittedTypeName.InferredArity);
Symbols\NamespaceSymbol.cs (2)
234Debug.Assert(types.Length == 1); 343Debug.Assert((object)assembly != null);
Symbols\NativeIntegerTypeSymbol.cs (15)
32Debug.Assert(underlyingType.TupleData is null); 33Debug.Assert(!underlyingType.IsNativeIntegerType); 34Debug.Assert(underlyingType.SpecialType == SpecialType.System_IntPtr || underlyingType.SpecialType == SpecialType.System_UIntPtr); 35Debug.Assert(!underlyingType.ContainingAssembly.RuntimeSupportsNumericIntPtr); 83Debug.Assert(_underlyingType.Equals(underlyingMember.ContainingSymbol)); 168Debug.Assert(useSiteInfo.DiagnosticInfo is null); // If assert fails, add unit test for use site diagnostic. 272Debug.Assert(!symbolA.Equals(symbolB, TypeCompareKind.ConsiderEverything)); 273Debug.Assert(!symbolB.Equals(symbolA, TypeCompareKind.ConsiderEverything)); 274Debug.Assert(symbolA.Equals(symbolB, TypeCompareKind.IgnoreNativeIntegers)); 275Debug.Assert(symbolB.Equals(symbolA, TypeCompareKind.IgnoreNativeIntegers)); 276Debug.Assert(symbolA.GetHashCode() == symbolB.GetHashCode()); 313Debug.Assert(_specialType == SpecialType.System_IntPtr || _specialType == SpecialType.System_UIntPtr); 341Debug.Assert(!underlyingMethod.IsGenericMethod); 418Debug.Assert(container != null); 471Debug.Assert(underlyingProperty.ParameterCount == 0);
Symbols\NonMissingAssemblySymbol.cs (3)
121Debug.Assert(result is null || ((object)result.ContainingAssembly == (object)this && !result.IsErrorType())); 173Debug.Assert(result is null || ((object)result.ContainingAssembly == (object)this && !result.IsErrorType())); 225System.Diagnostics.Debug.Assert(TypeSymbol.Equals(result1, result, TypeCompareKind.ConsiderEverything2)); // object identity may differ in error cases
Symbols\NonMissingModuleSymbol.cs (4)
156Debug.Assert(moduleReferences != null); 166Debug.Assert(_moduleReferences == null); 172Debug.Assert(_moduleReferences != null); 203Debug.Assert(result?.IsErrorType() != true);
Symbols\NoPiaAmbiguousCanonicalTypeSymbol.cs (1)
47Debug.Assert(Arity == 0);
Symbols\NoPiaIllegalGenericInstantiationSymbol.cs (1)
39Debug.Assert(Arity == 0);
Symbols\NoPiaMissingCanonicalTypeSymbol.cs (1)
71Debug.Assert(Arity == 0);
Symbols\NullableAnnotationExtensions.cs (9)
28Debug.Assert(a != NullableAnnotation.Ignored); 29Debug.Assert(b != NullableAnnotation.Ignored); 39Debug.Assert(a != NullableAnnotation.Ignored); 40Debug.Assert(b != NullableAnnotation.Ignored); 50Debug.Assert(a != NullableAnnotation.Ignored); 51Debug.Assert(b != NullableAnnotation.Ignored); 65Debug.Assert(a != NullableAnnotation.Ignored); 66Debug.Assert(b != NullableAnnotation.Ignored); 128Debug.Assert(annotation != NullableAnnotation.Ignored);
Symbols\ObsoleteAttributeHelpers.cs (4)
47Debug.Assert(obsoleteAttributeData == null || !obsoleteAttributeData.IsUninitialized); 155Debug.Assert(result?.IsObsoleteDiagnostic() != false); 180Debug.Assert(data.Message == null); 206Debug.Assert(!isColInit || symbol.Name == WellKnownMemberNames.CollectionInitializerAddMethodName);
Symbols\OverriddenOrHiddenMembersHelpers.cs (22)
86Debug.Assert(member.Kind == SymbolKind.Method || member.Kind == SymbolKind.Property || member.Kind == SymbolKind.Event); 106Debug.Assert(associatedPropertyOrEvent.Kind == SymbolKind.Event); 112Debug.Assert(!member.IsAccessor()); 243Debug.Assert(accessor.IsAccessor()); 244Debug.Assert((object)associatedProperty != null); 335Debug.Assert(accessor.IsAccessor()); 336Debug.Assert((object)associatedEvent != null); 411Debug.Assert(!member.IsAccessor()); 414Debug.Assert(containingType.IsInterfaceType()); 500Debug.Assert(overriddenMembers.Length == 0); 506Debug.Assert(overriddenMembers.IsEmpty); 542Debug.Assert(!member.IsAccessor()); 669Debug.Assert(!(param.TypeWithAnnotations.CustomModifiers.Any() || param.RefCustomModifiers.Any())); 670Debug.Assert(!param.Type.HasCustomModifiers(flagNonDefaultArraySizesOrLowerBounds: false)); 755Debug.Assert((object)hiddenMember != null); 791Debug.Assert((object)representativeMember != null); 792Debug.Assert(representativeMember.Kind == SymbolKind.Property || !representativeMember.ContainingType.IsDefinition); 853Debug.Assert((object)representativeMember != null); 854Debug.Assert(representativeMember.Kind != SymbolKind.Field); 855Debug.Assert(representativeMember.Kind != SymbolKind.NamedType); 856Debug.Assert(representativeMember.Kind == SymbolKind.Property || !representativeMember.ContainingType.IsDefinition); 964Debug.Assert(runtimeOverriddenMethod is { });
Symbols\OverriddenOrHiddenMembersResult.cs (1)
56Debug.Assert(!substitutedOverridingMember.IsDefinition);
Symbols\PlaceholderTypeArgumentSymbol.cs (1)
46Debug.Assert(Arity == 0);
Symbols\PointerTypeSymbol.cs (3)
29Debug.Assert(pointedAtType.HasType); 278Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 309Debug.Assert(nullableAnnotation != DefaultNullableAnnotation);
Symbols\PropertySymbol.cs (3)
382Debug.Assert(this.IsDefinition); 383Debug.Assert(ReferenceEquals(newOwner.OriginalDefinition, this.ContainingSymbol.OriginalDefinition)); 401Debug.Assert(this.IsDefinition);
Symbols\PublicModel\ArrayTypeSymbol.cs (2)
26Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 27Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\PublicModel\AssemblySymbol.cs (1)
93Debug.Assert(conclusion != IVTConclusion.NoRelationshipClaimed);
Symbols\PublicModel\DynamicTypeSymbol.cs (2)
23Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 24Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\PublicModel\ErrorTypeSymbol.cs (2)
24Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 25Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\PublicModel\FieldSymbol.cs (1)
20Debug.Assert(underlying is object);
Symbols\PublicModel\FunctionPointerTypeSymbol.cs (2)
42Debug.Assert(nullableAnnotation != this.NullableAnnotation); 43Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation);
Symbols\PublicModel\LocalSymbol.cs (1)
19Debug.Assert(underlying is object);
Symbols\PublicModel\MethodSymbol.cs (1)
26Debug.Assert(underlying is object);
Symbols\PublicModel\ModuleSymbol.cs (1)
18Debug.Assert(underlying is object);
Symbols\PublicModel\NamespaceSymbol.cs (1)
19Debug.Assert(underlying is object);
Symbols\PublicModel\NonErrorNamedTypeSymbol.cs (4)
18Debug.Assert(underlying is object); 19Debug.Assert(!underlying.IsErrorType()); 25Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 26Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\PublicModel\NonSourceAssemblySymbol.cs (2)
17Debug.Assert(underlying is object); 18Debug.Assert(!(underlying is Symbols.SourceAssemblySymbol));
Symbols\PublicModel\ParameterSymbol.cs (1)
20Debug.Assert(underlying is object);
Symbols\PublicModel\PointerTypeSymbol.cs (3)
19Debug.Assert(underlying is object); 25Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 26Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\PublicModel\PropertySymbol.cs (1)
20Debug.Assert(underlying is object);
Symbols\PublicModel\RangeVariableSymbol.cs (1)
17Debug.Assert(underlying is object);
Symbols\PublicModel\SourceAssemblySymbol.cs (1)
17Debug.Assert(underlying is object);
Symbols\PublicModel\TypeParameterSymbol.cs (3)
19Debug.Assert(underlying is object); 25Debug.Assert(nullableAnnotation != _underlying.DefaultNullableAnnotation); 26Debug.Assert(nullableAnnotation != this.NullableAnnotation);
Symbols\RangeVariableSymbol.cs (3)
61Debug.Assert(_location.SourceTree != null); 63Debug.Assert(token.Kind() == SyntaxKind.IdentifierToken); 65Debug.Assert(node is QueryClauseSyntax || node is QueryContinuationSyntax || node is JoinIntoClauseSyntax);
Symbols\ReducedExtensionMethodSymbol.cs (18)
39Debug.Assert(method.IsExtensionMethod && method.MethodKind != MethodKind.ReducedExtension); 40Debug.Assert(method.ParameterCount > 0); 41Debug.Assert((object)receiverType != null); 74Debug.Assert(method.IsExtensionMethod && method.MethodKind != MethodKind.ReducedExtension); 87Debug.Assert(!method.TypeArgumentsWithAnnotations.IsEmpty); 93Debug.Assert((object)reducedFrom != null); 94Debug.Assert(reducedFrom.IsExtensionMethod); 95Debug.Assert((object)reducedFrom.ReducedFrom == null); 96Debug.Assert(reducedFrom.ConstructedFrom == reducedFrom); 97Debug.Assert(reducedFrom.ParameterCount > 0); 115Debug.Assert(method.IsExtensionMethod); 116Debug.Assert(method.MethodKind != MethodKind.ReducedExtension); 117Debug.Assert(method.ParameterCount > 0); 118Debug.Assert((object)thisType != null); 281Debug.Assert(_reducedFrom.ConstructedFrom == _reducedFrom); 563Debug.Assert(count == 1); 623Debug.Assert(containingMethod != null); 624Debug.Assert(underlyingParameter.Ordinal > 0);
Symbols\ReferenceManager.cs (28)
93Debug.Assert(csReference.Compilation._lazyAssemblySymbol is object); 120Debug.Assert(AssemblyIdentityComparer.SimpleNameComparer.Equals(identity1.Name, identity2.Name)); 206Debug.Assert(successful); 212Debug.Assert(compilation._lazyAssemblySymbol is object); 260Debug.Assert(assembly is object); 316Debug.Assert(ReferenceEquals(compilation._referenceManager, this)); 333Debug.Assert(assemblyModules.Length == referencedModulesReferences.Length + 1); 398Debug.Assert(bindingResult.Length == allAssemblyData.Length); 433Debug.Assert(allAssemblyData[i].IsLinked == bound.AssemblySymbol.IsLinked); 543Debug.Assert(newSymbols.Count > 0); 571Debug.Assert(currentBindingResult.AssemblySymbol is object); 572Debug.Assert(currentBindingResult.ReferenceBinding is object); 593Debug.Assert(linkedAssemblySymbol is object); 624Debug.Assert(current.AssemblySymbol is object); 645Debug.Assert(currentBindingResult.AssemblySymbol is object); 646Debug.Assert(currentBindingResult.ReferenceBinding is object); 686Debug.Assert(newIndex == filteredReferencedAssemblies.Length); 722Debug.Assert(currentBindingResult.AssemblySymbol is object); 723Debug.Assert(currentBindingResult.ReferenceBinding is object); 768Debug.Assert(moduleSymbols.Length == 1 + modules.Length); 784Debug.Assert(bindingResult[0].ReferenceBinding is object); 786Debug.Assert(boundReference.ReferenceIdentity is object); 824Debug.Assert(referenceBinding.ReferenceIdentity is object); 826Debug.Assert(assembly is object); 875Debug.Assert(!referencedAssemblies.IsDefault); 1102Debug.Assert(sourceReferencedAssemblies.Length == sourceReferencedAssemblySymbols.Length); 1128Debug.Assert(result.Count == builderSize); 1162Debug.Assert(!(asm is RetargetingAssemblySymbol));
Symbols\RefKindExtensions.cs (1)
16Debug.Assert(refKind <= RefKind.RefReadOnly);
Symbols\Retargeting\RetargetingAssemblySymbol.cs (1)
104Debug.Assert((object)underlyingAssembly != null);
Symbols\Retargeting\RetargetingEventSymbol.cs (1)
36Debug.Assert(!(underlyingEvent is RetargetingEventSymbol));
Symbols\Retargeting\RetargetingFieldSymbol.cs (2)
38Debug.Assert((object)retargetingModule != null); 39Debug.Assert(!(underlyingField is RetargetingFieldSymbol));
Symbols\Retargeting\RetargetingMethodSymbol.cs (3)
61Debug.Assert((object)retargetingModule != null); 62Debug.Assert((object)underlyingMethod != null); 63Debug.Assert(!(underlyingMethod is RetargetingMethodSymbol));
Symbols\Retargeting\RetargetingModuleSymbol.cs (9)
82Debug.Assert((object)retargetingAssembly != null); 83Debug.Assert((object)underlyingModule != null); 102Debug.Assert(_underlyingModule.Ordinal == 0); // Always a source module 198Debug.Assert(referencedAssemblySymbols.Length == moduleReferences.Identities.Length); 199Debug.Assert(referencedAssemblySymbols.Length <= underlyingBoundReferences.Length); // Linked references are filtered out. 216Debug.Assert(identityComparer.Compare(moduleReferences.Identities[i], definitionIdentity) != AssemblyIdentityComparer.ComparisonResult.NotEquivalent); 217Debug.Assert(identityComparer.Compare(moduleReferences.Identities[i], underlyingBoundReferences[j].Identity) != AssemblyIdentityComparer.ComparisonResult.NotEquivalent); 231Debug.Assert(ReferenceEquals(destinationData.To, referencedAssemblySymbols[i])); 242Debug.Assert(j == underlyingBoundReferences.Length);
Symbols\Retargeting\RetargetingNamedTypeSymbol.cs (8)
47Debug.Assert((object)retargetingModule != null); 48Debug.Assert(!(underlyingType is RetargetingNamedTypeSymbol)); 112Debug.Assert(this.IsExtension); 113Debug.Assert(method.IsDefinition); 114Debug.Assert(method.ContainingType == (object)this); 182Debug.Assert((object)method != null); 292Debug.Assert(!underlyingResult.IsErrorType()); 293Debug.Assert((object)_underlyingType == underlyingResult.ContainingSymbol);
Symbols\Retargeting\RetargetingNamespaceSymbol.cs (6)
41Debug.Assert((object)retargetingModule != null); 42Debug.Assert((object)underlyingNamespace != null); 43Debug.Assert(!(underlyingNamespace is RetargetingNamespaceSymbol)); 128Debug.Assert(t.PrimitiveTypeCode == Cci.PrimitiveTypeCode.NotPrimitive); 220Debug.Assert((object)underlying.ContainingModule == (object)_retargetingModule.UnderlyingModule); 221Debug.Assert(!underlying.IsErrorType());
Symbols\Retargeting\RetargetingParameterSymbol.cs (4)
32Debug.Assert(!(underlyingParameter is RetargetingParameterSymbol)); 174Debug.Assert((object)retargetingMethod != null); 196Debug.Assert((object)retargetingProperty != null); 218Debug.Assert((object)retargetingType != null);
Symbols\Retargeting\RetargetingPropertySymbol.cs (3)
41Debug.Assert((object)retargetingModule != null); 42Debug.Assert(!(underlyingProperty is RetargetingPropertySymbol)); 172Debug.Assert(!impls.IsDefault);
Symbols\Retargeting\RetargetingSymbolTranslator.cs (37)
44Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 50Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 56Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 62Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 66Debug.Assert(correspondingTupleField is TupleErrorFieldSymbol); 88Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 94Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 100Debug.Assert(ReferenceEquals(symbol.ContainingModule, _underlyingModule)); 111Debug.Assert((object)retargetingModule != null); 164Debug.Assert(symbol.Kind != SymbolKind.NamedType || ((NamedTypeSymbol)symbol).PrimitiveTypeCode == Cci.PrimitiveTypeCode.NotPrimitive); 207Debug.Assert(type.IsDefinition); 241Debug.Assert(!retargetFrom.IsLinked); 283Debug.Assert(module.Ordinal == 0); 284Debug.Assert(!type.IsExplicitDefinitionOfNoPiaLocalType); 303Debug.Assert(module.Ordinal > 0); 305Debug.Assert(ReferenceEquals(((PEModuleSymbol)module).Module, addedModule.Module)); 350Debug.Assert(signatureIndex == 0 || signatureIndex == 1); 364Debug.Assert((object)type.ContainingAssembly != (object)RetargetingAssembly.UnderlyingAssembly); 386Debug.Assert((object)result != null); 403Debug.Assert(!type.ContainingModule.Equals(addedModule) && 435Debug.Assert(result is PENamedTypeSymbol peResult && peResult.Handle == type.Handle); 461Debug.Assert(result1?.IsErrorType() != true); 472Debug.Assert(result1.Arity == type.Arity); 475Debug.Assert(TypeSymbol.Equals(result1, result, TypeCompareKind.ConsiderEverything2)); 499Debug.Assert(originalDefinition.Arity == 0 || !ReferenceEquals(type.ConstructedFrom, type)); 510Debug.Assert((object)type.ContainingType == null || !type.ContainingType.IsUnboundGenericType()); 842Debug.Assert(nts.TypeKind == TypeKind.Error || nts.PrimitiveTypeCode == Cci.PrimitiveTypeCode.NotPrimitive); 854Debug.Assert(ts.TypeKind == TypeKind.Error || ts.PrimitiveTypeCode == Cci.PrimitiveTypeCode.NotPrimitive); 876Debug.Assert(ReferenceEquals(method.ContainingModule, this.UnderlyingModule)); 877Debug.Assert(ReferenceEquals(method, method.OriginalDefinition)); 884Debug.Assert((object)method == method.ConstructedFrom); 901Debug.Assert(!retargetedType.IsDefinition); 913Debug.Assert(retargetedType.IsDefinition); 926Debug.Assert(ReferenceEquals(property.ContainingModule, this.UnderlyingModule)); 927Debug.Assert(ReferenceEquals(property, property.OriginalDefinition)); 1048Debug.Assert((object)typeParameter.ContainingSymbol == _toFind); 1320Debug.Assert(ReferenceEquals(symbol, _retargetingModule.UnderlyingModule));
Symbols\Retargeting\RetargetingTypeParameterSymbol.cs (2)
41Debug.Assert((object)retargetingModule != null); 42Debug.Assert(!(underlyingTypeParameter is RetargetingTypeParameterSymbol));
Symbols\SignatureOnlyMethodSymbol.cs (1)
48Debug.Assert(returnType.IsDefault || isInitOnly == CustomModifierUtils.HasIsExternalInitModifier(returnType.CustomModifiers));
Symbols\SignatureOnlyParameterSymbol.cs (2)
30Debug.Assert((object)type.Type != null); 31Debug.Assert(!refCustomModifiers.IsDefault);
Symbols\Source\AttributeLocation.cs (1)
117Debug.Assert(result == AttributeLocation.None ^ SyntaxFacts.IsAttributeTargetSpecifier(kind));
Symbols\Source\ConstantEvaluationHelpers.cs (11)
63Debug.Assert(graph.Count >= 1); 76Debug.Assert(fields.All(f => map.Contains(f))); 159Debug.Assert(graph.Count > 0); 269Debug.Assert(graph.Count > 0); 339Debug.Assert(node.Dependencies != null); 340Debug.Assert(node.DependedOnBy != null); 346Debug.Assert(ok); 347Debug.Assert(n.DependedOnBy.Contains(field)); 354Debug.Assert(ok); 355Debug.Assert(n.Dependencies.Contains(field)); 365Debug.Assert(graph.Values.Sum(n => n.DependedOnBy.Count) == graph.Values.Sum(n => n.Dependencies.Count));
Symbols\Source\CustomModifierUtils.cs (9)
29Debug.Assert((object)sourceMethod != null); 32Debug.Assert((object)sourceMethod == sourceMethod.ConstructedFrom); 71Debug.Assert(sourceType.Equals(destinationType, TypeCompareKind.AllIgnoreOptions)); 105Debug.Assert(transformResult && position == length); 107Debug.Assert(resultType.Equals(sourceType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes | TypeCompareKind.IgnoreNativeIntegers)); // Same custom modifiers as source type. 110Debug.Assert(resultType.Equals(destinationType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds)); 117Debug.Assert(!destinationParameters.IsDefault); 118Debug.Assert(destinationParameters.All(p => p is SourceParameterSymbolBase)); 119Debug.Assert(sourceParameters.Length == destinationParameters.Length);
Symbols\Source\ExplicitInterfaceHelpers.cs (3)
108Debug.Assert(idx < fullName.Length); 127Debug.Assert((object)unsubstitutedInterfaceType != null); 129Debug.Assert((object)explicitInterfaceType != null);
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (11)
93Debug.Assert(completed); 96Debug.Assert(_lazyCustomAttributesBag.IsSealed); 165Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 170Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 315Debug.Assert(!boundAttributes.IsDefault); 316Debug.Assert(!allAttributeSyntaxNodes.IsDefault); 317Debug.Assert(boundAttributes.Length == allAttributeSyntaxNodes.Length); 318Debug.Assert(_lazyCustomAttributesBag != null); 319Debug.Assert(_lazyCustomAttributesBag.IsDecodedWellKnownAttributeDataComputed); 320Debug.Assert(symbolPart == AttributeLocation.None); 329Debug.Assert(boundAttributes.Any());
Symbols\Source\GlobalExpressionVariable.cs (7)
38Debug.Assert(DeclaredAccessibility == Accessibility.Private); 52Debug.Assert(nodeToBind.Kind() == SyntaxKind.VariableDeclarator || nodeToBind is ExpressionSyntax); 73Debug.Assert(fieldsBeingBound != null); 102Debug.Assert(type.HasType || isVar); 107Debug.Assert(_lazyType != null); 135Debug.Assert((object)originalType == null || 179Debug.Assert(nodeToBind.Kind() == SyntaxKind.VariableDeclarator || nodeToBind is ExpressionSyntax);
Symbols\Source\ImplicitNamedTypeSymbol.cs (1)
24Debug.Assert(declaration.Kind == DeclarationKind.ImplicitClass ||
Symbols\Source\LambdaSymbol.cs (7)
53Debug.Assert(syntaxReferenceOpt is not null); 54Debug.Assert(containingSymbol.DeclaringCompilation == compilation); 162Debug.Assert(inferredReturnType.HasType); 163Debug.Assert(_returnType.Type.IsErrorType()); 292Debug.Assert(diagnostics.DiagnosticBag is { }); 293Debug.Assert(diagnostics.DependenciesBag is { }); 328Debug.Assert(parameterTypes.Length == parameterRefKinds.Length);
Symbols\Source\LocalFunctionOrSourceMemberMethodSymbol.cs (1)
38Debug.Assert(TypeSymbol.Equals(_lazyIteratorElementType.Value.Type, elementType.Type, TypeCompareKind.ConsiderEverything));
Symbols\Source\LocalFunctionSymbol.cs (11)
44Debug.Assert(containingSymbol.DeclaringCompilation == binder.Compilation); 55Debug.Assert(diagnostics.DiagnosticBag is { }); 56Debug.Assert(diagnostics.DependenciesBag is { }); 192Debug.Assert(diagnostics.DiagnosticBag is { }); 193Debug.Assert(diagnostics.DependenciesBag is { }); 253Debug.Assert(diagnostics.DiagnosticBag is { }); 254Debug.Assert(diagnostics.DependenciesBag is { }); 257Debug.Assert(returnTypeSyntax is not ScopedTypeSyntax); 453Debug.Assert(tpEnclosing.ContainingSymbol.Kind == SymbolKind.NamedType); 482Debug.Assert(diagnostics.DiagnosticBag is { }); 483Debug.Assert(diagnostics.DependenciesBag is { });
Symbols\Source\ModifierUtils.cs (8)
50Debug.Assert(!isForTypeDeclaration || !isForInterfaceMember); 57Debug.Assert((allowedModifiers & (DeclarationModifiers.Override | DeclarationModifiers.Virtual)) == 0); 79Debug.Assert(oneError != DeclarationModifiers.None); 122Debug.Assert(modifier.Kind() == SyntaxKind.ScopedKeyword); 204Debug.Assert(oneError != DeclarationModifiers.None); 217Debug.Assert(location.SourceTree is not null); 231Debug.Assert(location.SourceTree is not null); 279Debug.Assert(!isExplicitInterfaceImplementation);
Symbols\Source\ParameterHelpers.cs (20)
76Debug.Assert(ordinal == 0); 77Debug.Assert(paramsKeyword.Kind() == SyntaxKind.None); 183Debug.Assert(!parsingFunctionPointer || owner is FunctionPointerMethodSymbol); 227Debug.Assert(methodOwner?.MethodKind != MethodKind.LambdaMethod); 265Debug.Assert(parameterContext is ParameterContext.Default or ParameterContext.FunctionPointer or ParameterContext.ExtensionReceiverParameter); 307Debug.Assert(parameterSyntax.Type != null); 312Debug.Assert(refnessKeyword.Kind() != SyntaxKind.None); 320Debug.Assert(parameter is SourceComplexParameterSymbolBase || !parameter.IsParams); // Only SourceComplexParameterSymbolBase validates 'params' type. 321Debug.Assert(parameter is SourceComplexParameterSymbolBase || parameter is not SourceParameterSymbol s || s.DeclaredScope == ScopedKind.None); // Only SourceComplexParameterSymbolBase validates 'scope'. 383Debug.Assert(moduleBuilder.Compilation.ShouldEmitNativeIntegerAttributes()); 406Debug.Assert(compilation.ShouldEmitNativeIntegerAttributes()); 425Debug.Assert(!parameter.IsThis); 524Debug.Assert(extensionMember.GetIsNewExtensionMember()); 548Debug.Assert(extensionMemberArity == 0); // we currently only apply the check for members which may not be generic 770Debug.Assert(!seenIn); 771Debug.Assert(!seenOut); 772Debug.Assert(!seenRef); 773Debug.Assert(!seenScoped); 859Debug.Assert(containingSymbol is null 1160Debug.Assert(refKind == RefKind.None);
Symbols\Source\QuickAttributeChecker.cs (4)
77Debug.Assert(!_sealed); 126Debug.Assert(_sealed); 165Debug.Assert(QuickAttributes.Last == QuickAttributes.AssemblySignatureKey); 197Debug.Assert(attributeDescription.Name.EndsWith(nameof(System.Attribute)));
Symbols\Source\SourceAssemblySymbol.cs (38)
122Debug.Assert(compilation != null); 123Debug.Assert(assemblySimpleName != null); 124Debug.Assert(!String.IsNullOrWhiteSpace(moduleName)); 125Debug.Assert(!netModules.IsDefault); 497Debug.Assert(!DeclaringCompilation.Options.Errors.IsEmpty); 925Debug.Assert(thisThreadCompleted); 949Debug.Assert(thisThreadCompleted); 1071Debug.Assert(moduleNs.Extent.Kind == NamespaceKind.Module); 1212Debug.Assert(!attribute.HasErrors); 1224Debug.Assert(!attribute.HasErrors); 1241Debug.Assert(success); 1318Debug.Assert(attributesFromNetModules.Any()); 1319Debug.Assert(netModuleNames.Any()); 1320Debug.Assert(attributesFromNetModules.Length == netModuleNames.Length); 1455Debug.Assert(lazyNetModuleAttributesBag.IsSealed); 1461Debug.Assert(attributeMatches is QuickAttributes.AssemblyKeyFile 1487Debug.Assert(attributesFromNetModules.Any()); 1488Debug.Assert(netModuleNames.Any()); 1489Debug.Assert(attributesFromNetModules.Length == netModuleNames.Length); 1547Debug.Assert(attributesBag.IsSealed); 1600Debug.Assert(!attributes.IsDefault); 1601Debug.Assert(!netmoduleAttributes.IsDefault); 1615Debug.Assert(!attributes.IsDefault); 1628Debug.Assert(_lazyOmittedAttributeIndices == null || !_lazyOmittedAttributeIndices.Any(i => i < 0 || i >= this.GetAttributes().Length)); 1629Debug.Assert(_lazySourceAttributesBag.IsSealed); 1630Debug.Assert(_lazyNetModuleAttributesBag.IsSealed); 1631Debug.Assert(index >= 0); 1632Debug.Assert(index < this.GetAttributes().Length); 1751Debug.Assert(added); 1757Debug.Assert(removed); 1782Debug.Assert(attributesBag.IsSealed); 2108Debug.Assert(conclusion != IVTConclusion.NoRelationshipClaimed); 2224Debug.Assert(forwardedType.TypeKind != TypeKind.Error); 2276Debug.Assert(!attrData.HasErrors); 2367Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 2596Debug.Assert(!attribute.HasErrors); 2777Debug.Assert(!_unusedFieldWarnings.IsDefault); 2823Debug.Assert(forcedArity == emittedName.InferredArity);
Symbols\Source\SourceClonedParameterSymbol.cs (1)
28Debug.Assert((object)originalParam != null);
Symbols\Source\SourceComplexParameterSymbol.cs (45)
54Debug.Assert((syntaxRef == null) || (syntaxRef.GetSyntax().IsKind(SyntaxKind.Parameter))); 250Debug.Assert(diagnostics.DiagnosticBag != null); 255Debug.Assert(previousValue == ConstantValue.Unset); 258Debug.Assert(completedOnThisThread); 287Debug.Assert(completedOnThisThread); 308Debug.Assert(binder.GetBinder(syntax) == null); 353Debug.Assert(diagnostics.DiagnosticBag != null); 382Debug.Assert(binder.InParameterDefaultValue); 383Debug.Assert(binder.ContainingMemberOrLambda == ContainingSymbol); 482Debug.Assert(!this.ContainingSymbol.IsPartialImplementation()); 498Debug.Assert(!this.ContainingSymbol.IsPartialDefinition()); 519Debug.Assert(PartialImplementationPart is null); 581Debug.Assert(!ReferenceEquals(copyFrom, this)); 615Debug.Assert(!attributeType.IsErrorType()); 678Debug.Assert(constructorArguments.Length == 1); 702Debug.Assert(description.Equals(AttributeDescription.DefaultParameterValueAttribute) || 731Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 735Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 736Debug.Assert(AttributeDescription.InterpolatedStringHandlerArgumentAttribute.Signatures.Length == 2); 756Debug.Assert(_lazyHasOptionalAttribute == ThreeState.True); 895Debug.Assert(syntax != null); 896Debug.Assert(diagnostics != null); 933Debug.Assert(!attribute.HasErrors); 945Debug.Assert(description.Equals(AttributeDescription.DateTimeConstantAttribute)); 952Debug.Assert(!diagnose || diagnosticsOpt != null); 972Debug.Assert(attribute.CommonConstructorArguments.Length == 1); 1044Debug.Assert(this.GetAttributeDeclarations().Any(attrLists => attrLists.Any(attrList => attrList.Contains(node)))); 1240Debug.Assert(attributeIndex is 0 or 1); 1242Debug.Assert(arguments.AttributeSyntaxOpt is not null); 1323Debug.Assert(arguments.AttributeSyntaxOpt is not null); 1338Debug.Assert(name != null); 1387Debug.Assert(!boundAttributes.IsDefault); 1388Debug.Assert(!allAttributeSyntaxNodes.IsDefault); 1389Debug.Assert(boundAttributes.Length == allAttributeSyntaxNodes.Length); 1390Debug.Assert(_lazyCustomAttributesBag != null); 1391Debug.Assert(_lazyCustomAttributesBag.IsDecodedWellKnownAttributeDataComputed); 1392Debug.Assert(symbolPart == AttributeLocation.None); 1456Debug.Assert(!ReferenceEquals(copyFrom, this)); 1516Debug.Assert(filter == null); 1538Debug.Assert(ParameterSyntax is not null); 1546Debug.Assert(completedOnThisThread); 1590Debug.Assert(!addMethods.IsDefaultOrEmpty); 1647Debug.Assert(elementType is { }); 1728Debug.Assert(!refCustomModifiers.IsEmpty); 1733Debug.Assert(refKind != RefKind.None || _refCustomModifiers.IsEmpty);
Symbols\Source\SourceConstructorSymbol.cs (12)
114Debug.Assert(syntaxReferenceOpt != null); 206Debug.Assert(PartialDefinitionPart is null); 282Debug.Assert(this.IsPartialDefinition); 283Debug.Assert(!ReferenceEquals(this, implementation)); 284Debug.Assert(ReferenceEquals(this.OtherPartOfPartial, implementation)); 314Debug.Assert(this.ParameterCount == implementation.ParameterCount); 350Debug.Assert(definition.IsPartialDefinition); 351Debug.Assert(implementation.IsPartialImplementation); 353Debug.Assert(definition._otherPartOfPartial is not { } alreadySetImplPart || ReferenceEquals(alreadySetImplPart, implementation)); 354Debug.Assert(implementation._otherPartOfPartial is not { } alreadySetDefPart || ReferenceEquals(alreadySetDefPart, definition)); 359Debug.Assert(ReferenceEquals(definition._otherPartOfPartial, implementation)); 360Debug.Assert(ReferenceEquals(implementation._otherPartOfPartial, definition));
Symbols\Source\SourceConstructorSymbolBase.cs (3)
31Debug.Assert(syntax.Kind() is SyntaxKind.ConstructorDeclaration or SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration); 107Debug.Assert(!IsPartial); 178Debug.Assert(position >= 0 && tree != null);
Symbols\Source\SourceCustomEventAccessorSymbol.cs (5)
38Debug.Assert(syntax != null); 39Debug.Assert(syntax.Kind() == SyntaxKind.AddAccessorDeclaration || syntax.Kind() == SyntaxKind.RemoveAccessorDeclaration); 64Debug.Assert(syntaxReferenceOpt != null); 86Debug.Assert(PartialImplementationPart is null); 90Debug.Assert(PartialDefinitionPart is null
Symbols\Source\SourceCustomEventSymbol.cs (1)
149Debug.Assert(containingType.IsInterface);
Symbols\Source\SourceDelegateMethodSymbol.cs (3)
42Debug.Assert(_parameters.IsDefault); 54Debug.Assert(returnTypeSyntax is not ScopedTypeSyntax); 316Debug.Assert(location != null);
Symbols\Source\SourceDestructorSymbol.cs (2)
50Debug.Assert(syntax.ParameterList.Parameters.Count == 0); 91Debug.Assert(syntaxReferenceOpt != null);
Symbols\Source\SourceEnumConstantSymbol.cs (7)
40Debug.Assert(otherConstantOffset == 0); 45Debug.Assert(otherConstantOffset > 0); 123Debug.Assert(!this.IsFixedSizeBuffer); 170Debug.Assert(syntax.EqualsValue != null); 176Debug.Assert(syntax.EqualsValue != null); 195Debug.Assert((object)otherConstant != null); 196Debug.Assert(otherConstantOffset > 0);
Symbols\Source\SourceEventAccessorSymbol.cs (5)
109Debug.Assert(compilation != null); 127Debug.Assert(this.MethodKind == MethodKind.EventRemove); 155Debug.Assert(!_lazyReturnType.IsDefault); 165Debug.Assert(!_lazyReturnType.IsDefault); 201Debug.Assert(this.Locations.Length == 1);
Symbols\Source\SourceEventSymbol.cs (19)
165Debug.Assert(syntax.Parent?.Parent is not null); 217Debug.Assert(!ReferenceEquals(definitionPart, this)); 230Debug.Assert(wasCompletedThisThread); 241Debug.Assert(PartialDefinitionPart is null); 346Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 537Debug.Assert(explicitInterfaceImplementation); 581Debug.Assert(!IsStatic || !IsOverride); // Otherwise should have been reported and cleared earlier. 582Debug.Assert(!IsStatic || ContainingType.IsInterface || (!IsAbstract && !IsVirtual)); // Otherwise should have been reported and cleared earlier. 744Debug.Assert(explicitInterfaceImplementations.Length == 1); 746Debug.Assert((object?)this.OverriddenEvent == null); 863Debug.Assert(this.IsPartialDefinition); 864Debug.Assert(!ReferenceEquals(this, implementation)); 865Debug.Assert(ReferenceEquals(this.OtherPartOfPartial, implementation)); 931Debug.Assert(definition.IsPartialDefinition); 932Debug.Assert(implementation.IsPartialImplementation); 934Debug.Assert(definition._otherPartOfPartial is not { } alreadySetImplPart || ReferenceEquals(alreadySetImplPart, implementation)); 935Debug.Assert(implementation._otherPartOfPartial is not { } alreadySetDefPart || ReferenceEquals(alreadySetDefPart, definition)); 940Debug.Assert(ReferenceEquals(definition._otherPartOfPartial, implementation)); 941Debug.Assert(ReferenceEquals(implementation._otherPartOfPartial, definition));
Symbols\Source\SourceFieldLikeEventSymbol.cs (11)
35Debug.Assert(declaratorSyntax.Parent is object); 208Debug.Assert(field.Name == _name); 242Debug.Assert(ev.IsPartialDefinition); 272Debug.Assert(IsPartialDefinition); 280Debug.Assert(IsExtern); 288Debug.Assert(false); 296Debug.Assert(IsPartialDefinition); 304Debug.Assert(IsExtern); 314Debug.Assert(false); 323Debug.Assert(IsPartialDefinition); 332Debug.Assert(false);
Symbols\Source\SourceFieldSymbol.cs (9)
24Debug.Assert((object)containingType != null); 116Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 117Debug.Assert(arguments.Diagnostics is BindingDiagnosticBag); 121Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 181Debug.Assert(name != null); 182Debug.Assert(syntax != null); 357Debug.Assert(value != Microsoft.CodeAnalysis.ConstantValue.Unset); 358Debug.Assert((GetLazyConstantValue(earlyDecodingWellKnownAttributes) == Microsoft.CodeAnalysis.ConstantValue.Unset) || 376Debug.Assert(wasSetThisThread);
Symbols\Source\SourceFixedFieldSymbol.cs (3)
38Debug.Assert(this.IsFixedSizeBuffer); 100Debug.Assert(sizeConstant != null); 137Debug.Assert(_fixedSize != FixedSizeNotInitialized);
Symbols\Source\SourceLabelSymbol.cs (1)
31Debug.Assert(identifierNodeOrToken.IsToken || identifierNodeOrToken.IsNode);
Symbols\Source\SourceLocalSymbol.cs (28)
50Debug.Assert(identifierToken.Kind() != SyntaxKind.None); 51Debug.Assert(declarationKind != LocalDeclarationKind.None); 52Debug.Assert(scopeBinder != null); 53Debug.Assert(containingSymbol.DeclaringCompilation == scopeBinder.Compilation); 144Debug.Assert(closestTypeSyntax != null); 145Debug.Assert(nodeBinder != null); 165Debug.Assert( 177Debug.Assert(!(nodeToBind.Kind() == SyntaxKind.SwitchExpressionArm) || nodeBinder is SwitchExpressionArmBinder); 211Debug.Assert(declarationKind != LocalDeclarationKind.ForEachIterationVariable); 299Debug.Assert(concurrentTypeResolutions < 50); 375Debug.Assert(declType.HasType); 390Debug.Assert(newType.Type is object); 396Debug.Assert((object)originalType?.DefaultType == null || 433Debug.Assert(node is VariableDeclaratorSyntax); 439Debug.Assert(node is VariableDeclaratorSyntax); 443Debug.Assert(node is ForEachStatementSyntax || node is SingleVariableDesignationSyntax); 447Debug.Assert(node is CatchDeclarationSyntax); 454Debug.Assert(node is SingleVariableDesignationSyntax); 535Debug.Assert(declarationKind != LocalDeclarationKind.ForEachIterationVariable); 536Debug.Assert(initializer != null); 581Debug.Assert(inProgress != this); 611Debug.Assert(boundInitValue != null); 634Debug.Assert(declarationKind == LocalDeclarationKind.ForEachIterationVariable); 686Debug.Assert(assignment.IsDeconstruction()); 693Debug.Assert(this.ScopeBinder.GetBinder((ForEachVariableStatementSyntax)_deconstruction) == _nodeBinder); 740Debug.Assert( 750Debug.Assert(!(nodeToBind.Kind() == SyntaxKind.SwitchExpressionArm) || nodeBinder is SwitchExpressionArmBinder); 812Debug.Assert(this.DeclarationKind == LocalDeclarationKind.DeclarationExpressionVariable);
Symbols\Source\SourceMemberContainerSymbol.cs (86)
146Debug.Assert(BitsAreUnsetOrSame(_flags, bitsToSet)); 230Debug.Assert(containingSymbol is NamespaceSymbol { IsGlobalNamespace: true } || !declaration.Declarations.Any(static d => d.IsSimpleProgram)); 259Debug.Assert(typeKind is TypeKind.Struct or TypeKind.Class || !HasPrimaryConstructor); 632Debug.Assert(thisThreadCompleted); 682Debug.Assert(thisThreadCompleted); 693Debug.Assert((incompletePart & CompletionPart.NamedTypeSymbolAll) == 0); 833Debug.Assert(!useSiteDiagnostics.IsDefault); 842Debug.Assert(!useSiteDependencies.IsDefault); 1072Debug.Assert(!nonTypeMembers.IsDefault); 1073Debug.Assert(!staticInitializers.IsDefault); 1074Debug.Assert(staticInitializers.All(g => !g.IsDefault)); 1075Debug.Assert(!instanceInitializers.IsDefault); 1076Debug.Assert(instanceInitializers.All(g => !g.IsDefault)); 1078Debug.Assert(!nonTypeMembers.Any(static s => s is TypeSymbol)); 1079Debug.Assert(haveIndexers == nonTypeMembers.Any(static s => s.IsIndexer())); 1146Debug.Assert(ctorInitializerLength >= 0); 1169Debug.Assert(distanceFromCtorBody > 0); 1377Debug.Assert(s_emptyTypeMembers.Count == 0); 1434Debug.Assert(symbol is not null); 1439Debug.Assert(attr is SourceAttributeData); 1893Debug.Assert(IsFileLocal); 1901Debug.Assert(fileIdentifier.FilePathChecksumOpt.IsDefault); 2193Debug.Assert(method1.ParameterCount == method2.ParameterCount); 2325Debug.Assert(!membersByName[indexerName.AsMemory()].Any(SymbolExtensions.IsIndexer)); 2417Debug.Assert(cloneMembersByName); 2421Debug.Assert(masterExtension is not null); 2457Debug.Assert(!newMembers.IsEmpty); 2461Debug.Assert(newMembers.All(static (m, membersUnordered) => membersUnordered.Contains(m), membersUnordered)); 2528Debug.Assert(false); // Usage of this method is unexpected 2627Debug.Assert(value == _lazyKnownCircularStruct); 2638Debug.Assert(TypeKind == TypeKind.Struct); 2872Debug.Assert(!this.IsExtension); 2955Debug.Assert(IsSubmissionClass || IsScriptClass); 2981Debug.Assert(ReferenceEquals(this, this.OriginalDefinition)); 3267Debug.Assert(!nonTypeMembersWithPartialImplementations.IsDefault); 3271Debug.Assert(!nonTypeMembersWithPartialImplementations.Any(static s => s is TypeSymbol)); 3272Debug.Assert(declarationWithParameters is object == primaryConstructor is object); 3287Debug.Assert(!initializers.IsDefault); 3295Debug.Assert(!group.IsDefaultOrEmpty); 3302Debug.Assert(LexicalSortKey.Compare(new LexicalSortKey(initializers[i - 1].First().Syntax, compilation), new LexicalSortKey(initializers[i].Last().Syntax, compilation)) < 0); 3307Debug.Assert(LexicalSortKey.Compare(new LexicalSortKey(initializers[i].First().Syntax, compilation), new LexicalSortKey(initializers[i + 1].Last().Syntax, compilation)) < 0); 3312Debug.Assert(LexicalSortKey.Compare(new LexicalSortKey(initializers[i].First().Syntax, compilation), new LexicalSortKey(initializers[i].Last().Syntax, compilation)) < 0); 3337Debug.Assert(declaredMembersAndInitializers != DeclaredMembersAndInitializers.UninitializedSentinel); 3363Debug.Assert(declaredMembers.PrimaryConstructor is object); 3364Debug.Assert(declaredMembers.DeclarationWithParameters is object); 3365Debug.Assert(declaredMembers.DeclarationWithParameters.SyntaxTree == InstanceInitializersForPositionalMembers[0].Syntax.SyntaxTree); 3366Debug.Assert(declaredMembers.DeclarationWithParameters.Span.Contains(InstanceInitializersForPositionalMembers[0].Syntax.Span.Start)); 3399Debug.Assert(insertedInitializers[insertedInitializers.Count - 1].Syntax.SyntaxTree == declaredInitializers[0].Syntax.SyntaxTree); 3400Debug.Assert(insertedInitializers[insertedInitializers.Count - 1].Syntax.Span.Start < declaredInitializers[0].Syntax.Span.Start); 3413Debug.Assert(!declaredMembers.InstanceInitializers.Any(g => declaredMembers.DeclarationWithParameters.SyntaxTree == g[0].Syntax.SyntaxTree && 3644Debug.Assert(!_lazySimpleProgramEntryPoints.IsDefault); 3703Debug.Assert(result is object); 3726Debug.Assert(primaryConstructor is not null); 3727Debug.Assert(!this.IsDelegateType()); 3761Debug.Assert(declared.PrimaryConstructor is not null); 3767Debug.Assert(membersAndInitializers.PrimaryConstructor is not null); 3796Debug.Assert(primaryConstructor is not null); 4010Debug.Assert(symbol.IsPartialMember()); 4029Debug.Assert(pair.Key.Equals(WellKnownMemberNames.InstanceConstructorName.AsMemory())); 4044Debug.Assert(symbol is SourceOrdinaryMethodSymbol or SourcePropertySymbol or SourcePropertyAccessorSymbol or SourceEventAccessorSymbol); 4045Debug.Assert(prev is SourceOrdinaryMethodSymbol or SourcePropertySymbol or SourcePropertyAccessorSymbol or SourceEventAccessorSymbol); 4053Debug.Assert(symbol.IsPartialMember()); 4130Debug.Assert(symbol.IsPartialMember()); 4382Debug.Assert(!propertySymbol.IsExplicitInterfaceImplementation); // checked by caller 4433Debug.Assert(!eventSymbol.IsExplicitInterfaceImplementation); // checked by caller 4568Debug.Assert(node.SyntaxTree == initializers.Last().Syntax.SyntaxTree); 4569Debug.Assert(node.SpanStart > initializers.Last().Syntax.Span.Start); 4735Debug.Assert(TypeKind == TypeKind.Struct); 4739Debug.Assert(builder.DeclarationWithParameters is TypeDeclarationSyntax { ParameterList: not null } type 4784Debug.Assert(ctor is object); 4794Debug.Assert(declaredMembersAndInitializers.PrimaryConstructor?.GetBackingFields().Any() != true); 4830Debug.Assert(declaredMembersAndInitializers.DeclarationWithParameters is object); 4834Debug.Assert(ctor is object); 4887Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false })); 4898Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol)); 4946Debug.Assert(isRecordClass); 4994Debug.Assert(isRecordClass); 5201Debug.Assert(property.GetMethod is object); 5202Debug.Assert(property.SetMethod is object); 5206Debug.Assert(backingField is object); 5268Debug.Assert(isRecordClass); 5390Debug.Assert(isRecordClass); 5729Debug.Assert(@event.IsPartial || @event.AddMethod is not null); 5730Debug.Assert(@event.IsPartial || @event.RemoveMethod is not null); 5754Debug.Assert(@event.AssociatedField is null); 5862Debug.Assert(
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (26)
199Debug.Assert(methodImpl is { Body: not null, Implemented: not null }); 356Debug.Assert(this.InterfacesAndTheirBaseInterfacesNoUseSiteDiagnostics[implementedInterface].Contains(implementedInterface)); 373Debug.Assert((object)directInterface != null); 387Debug.Assert((object)interfacePropertyOrEvent != null); 658Debug.Assert((object)sourceField == null || (object)sourceField.AssociatedSymbol == null || 672Debug.Assert(symbol.Kind == SymbolKind.Field || symbol.Kind == SymbolKind.NamedType); 747Debug.Assert((object)overridingMember != null); 748Debug.Assert(overriddenOrHiddenMembers != null); 756Debug.Assert(overridingMemberIsMethod ^ overridingMemberIsProperty ^ overridingMemberIsEvent); 761Debug.Assert(!overriddenMembers.IsDefault); 766Debug.Assert(!hiddenMembers.IsDefault); 880Debug.Assert(AccessCheck.IsSymbolAccessible(overriddenMember, overridingType, ref discardedUseSiteInfo)); 884Debug.Assert(overriddenMember.Kind == overridingMember.Kind); 934Debug.Assert(overridingMember.ObsoleteState != ThreeState.Unknown); 935Debug.Assert(leastOverriddenMember.ObsoleteState != ThreeState.Unknown); 981Debug.Assert(overridingMemberIsMethod); 1082Debug.Assert(diagnosticInfo is { }); 1266Debug.Assert(baseMethod.ParameterCount == overrideMethod.ParameterCount - overrideParameterOffset); 1370Debug.Assert(conversions.IncludeNullability); 1459Debug.Assert(reportMismatchInParameterType is { }); 1470Debug.Assert(baseMethod.ParameterCount == overrideMethod.ParameterCount - overrideParameterOffset); 1511Debug.Assert(reportMismatchInParameterType is { }); 1521Debug.Assert(baseMethod.ParameterCount == overrideMethod.ParameterCount - overrideParameterOffset); 1578Debug.Assert(overriddenOrHiddenMembers != null); 1579Debug.Assert(!overriddenOrHiddenMembers.OverriddenMembers.Any()); //since hidingMethod.IsOverride is false 1582Debug.Assert(!hiddenMembers.IsDefault);
Symbols\Source\SourceMemberFieldSymbol.cs (6)
87Debug.Assert(constToken.Kind() == SyntaxKind.ConstKeyword); 220Debug.Assert((result & ~(DeclarationModifiers.AccessibilityMask | DeclarationModifiers.Fixed | DeclarationModifiers.Unsafe | DeclarationModifiers.New)) == 0); 449Debug.Assert(fieldsBeingBound != null); 500Debug.Assert(refKind is RefKind.None or RefKind.Ref or RefKind.RefReadOnly); 519Debug.Assert(refKindToAssert == RefKind.None); // Otherwise we might need to report an error 520Debug.Assert(type.HasType || isVar);
Symbols\Source\SourceMemberMethodSymbol.cs (16)
113Debug.Assert((bits & ReturnsVoidIsSetBit) != 0); 121Debug.Assert((bits & ReturnsVoidIsSetBit) == 0); 122Debug.Assert(value || (bits & ReturnsVoidBit) == 0); 202Debug.Assert(!returnsVoid || returnsVoidIsSet); 284Debug.Assert(!IsMetadataVirtualLocked); 340Debug.Assert(containingType is not null); 341Debug.Assert(location is not null); 342Debug.Assert(containingType.DeclaringCompilation is not null); 470Debug.Assert(lockObject != null); 603Debug.Assert(!this.IsStatic); 750Debug.Assert(arrowExpression.Parent.Kind() == SyntaxKind.PropertyDeclaration || 756Debug.Assert(this is SynthesizedClosureMethod); 787Debug.Assert(current is InMethodBinder); 1032Debug.Assert(!this.IsConstructor()); // Constructors should use IsNullableEnabledForConstructorsAndInitializers() instead. 1092Debug.Assert(this.SyntaxNode.SyntaxTree == localTree); 1109Debug.Assert(bodySyntax != null);
Symbols\Source\SourceMethodSymbol.cs (2)
111Debug.Assert(target is not (LambdaSymbol or LocalFunctionSymbol)); 186Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
Symbols\Source\SourceMethodSymbolWithAttributes.cs (29)
54Debug.Assert(arrowExpression.Parent!.Kind() == SyntaxKind.PropertyDeclaration || 62Debug.Assert(recordDecl.IsKind(SyntaxKind.RecordDeclaration)); 280Debug.Assert(!ReferenceEquals(copyFrom, this)); 334Debug.Assert(arguments.SymbolPart == AttributeLocation.None || arguments.SymbolPart == AttributeLocation.Return); 464Debug.Assert(!forceComplete); 480Debug.Assert(!forceComplete); 493Debug.Assert(earlyData is { UnmanagedCallersOnlyAttributePresent: true }); 497Debug.Assert(lateData is null or { UnmanagedCallersOnlyAttributeData: null }); 513Debug.Assert(arguments.SymbolPart == AttributeLocation.None || arguments.SymbolPart == AttributeLocation.Return); 527Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 716Debug.Assert(this.IsConditional); 780Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 944Debug.Assert(arguments.AttributeSyntaxOpt is object); 953Debug.Assert(ContainingType is object); 1004Debug.Assert(arguments.Attribute.AttributeConstructor.Parameters is [{ Type.SpecialType: SpecialType.System_Int32 }, { Type.SpecialType: SpecialType.System_String }]); 1012Debug.Assert(arguments.AttributeSyntaxOpt is not null); 1113Debug.Assert(namespaceSegments.Length > 0); 1157Debug.Assert(attributeSyntax is object); 1313Debug.Assert(namespaceSegments.Length > 0); 1363Debug.Assert(_lazyCustomAttributesBag.IsEarlyDecodedWellKnownAttributeDataComputed); 1376Debug.Assert(arguments.AttributeSyntaxOpt != null); 1392Debug.Assert(reportedError); 1432Debug.Assert(attribute.AttributeClass is not null); 1462Debug.Assert(!boundAttributes.IsDefault); 1463Debug.Assert(!allAttributeSyntaxNodes.IsDefault); 1464Debug.Assert(boundAttributes.Length == allAttributeSyntaxNodes.Length); 1465Debug.Assert(symbolPart == AttributeLocation.None || symbolPart == AttributeLocation.Return); 1469Debug.Assert(_lazyCustomAttributesBag != null); 1470Debug.Assert(_lazyCustomAttributesBag.IsDecodedWellKnownAttributeDataComputed);
Symbols\Source\SourceModuleSymbol.cs (7)
58Debug.Assert((object)assemblySymbol != null); 148Debug.Assert(!_lazyAssembliesToEmbedTypesFrom.IsDefault); 161Debug.Assert(_lazyContainsExplicitDefinitionOfNoPiaLocalTypes != ThreeState.Unknown); 276Debug.Assert(_state.HasComplete(CompletionPart.StartValidatingReferencedAssemblies)); 523Debug.Assert(completed); 562Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 566Debug.Assert(arguments.SymbolPart == AttributeLocation.None);
Symbols\Source\SourceNamedTypeSymbol.cs (37)
291Debug.Assert(!_typeParameterInfo.LazyTypeParameterConstraintTypes.IsDefault); 313Debug.Assert(!_typeParameterInfo.LazyTypeParameterConstraintKinds.IsDefault); 354Debug.Assert(!binder.Flags.Includes(BinderFlags.GenericConstraintsClause)); 360Debug.Assert(constraints.Length == arity); 435Debug.Assert(!binder.Flags.Includes(BinderFlags.GenericConstraintsClause)); 442Debug.Assert(constraints.Length == arity); 506Debug.Assert(constraintClauses.Length == arity); 540Debug.Assert(originalConstraintTypes[j].Equals(mergedConstraintTypes[j], TypeCompareKind.ObliviousNullableModifierMatchesAny)); 659Debug.Assert(constraintClauses.Length == arity); 675Debug.Assert((constraint.Constraints & (TypeParameterConstraintKind.AllNonNullableKinds | TypeParameterConstraintKind.NotNull)) == 677Debug.Assert((mergedKind & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0 || 679Debug.Assert((constraint.Constraints & TypeParameterConstraintKind.AllReferenceTypeKinds) == (mergedKind & TypeParameterConstraintKind.AllReferenceTypeKinds) || 851Debug.Assert(completed); 854Debug.Assert(_lazyCustomAttributesBag.IsSealed); 1035Debug.Assert(attributeData.CommonConstructorArguments[0].Kind == TypedConstantKind.Type); 1056Debug.Assert(this.SpecialType == SpecialType.System_Object || this.DeclaringCompilation.IsAttributeType(this)); 1097Debug.Assert(arguments.AttributeSyntaxOpt is { }); 1102Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 1259Debug.Assert(_lazyIsExplicitDefinitionOfNoPiaLocalType != ThreeState.Unknown); 1302Debug.Assert(diagnose == (diagnosticsOpt != null)); 1303Debug.Assert(!attribute.HasErrors); 1305Debug.Assert(!this.IsErrorType()); 1345Debug.Assert(argument.Kind == TypedConstantKind.Type); 1392Debug.Assert(this.IsConditional); 1393Debug.Assert(!attribute.HasErrors); 1590Debug.Assert(!boundAttributes.IsDefault); 1591Debug.Assert(!allAttributeSyntaxNodes.IsDefault); 1592Debug.Assert(boundAttributes.Length == allAttributeSyntaxNodes.Length); 1593Debug.Assert(_lazyCustomAttributesBag != null); 1594Debug.Assert(_lazyCustomAttributesBag.IsDecodedWellKnownAttributeDataComputed); 1595Debug.Assert(symbolPart == AttributeLocation.None); 1601Debug.Assert(boundAttributes.Any()); 1651Debug.Assert(boundAttributes.Any()); 1661Debug.Assert(boundAttributes.Any()); 1797Debug.Assert(this.SpecialType == SpecialType.System_IntPtr || this.SpecialType == SpecialType.System_UIntPtr); 1846Debug.Assert(ObsoleteKind != ObsoleteAttributeKind.Uninitialized); 1847Debug.Assert(GetMembers().All(m => m.ObsoleteKind != ObsoleteAttributeKind.Uninitialized));
Symbols\Source\SourceNamedTypeSymbol_Bases.cs (5)
103Debug.Assert(!this.IsClassType() || localBase.IsObjectType() || baseLocation != null); 186Debug.Assert(!other.Equals(@interface, TypeCompareKind.ConsiderEverything)); 187Debug.Assert(other.Equals(@interface, TypeCompareKind.CLRSignatureCompareOptions)); 382Debug.Assert(baseTypeLocation != null); 527Debug.Assert((object)localBase != null);
Symbols\Source\SourceNamedTypeSymbol_Enum.cs (1)
96Debug.Assert((object)this.EnumUnderlyingType != null);
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (8)
88Debug.Assert(this.IsExtension); 89Debug.Assert(method.IsDefinition); 90Debug.Assert(method.ContainingType == (object)this); 126Debug.Assert(IsExtension); 144Debug.Assert(parameterList is not null); 152Debug.Assert(count > 0); 160Debug.Assert(extensionMember.GetIsNewExtensionMember()); 184Debug.Assert(result.ContainingType.ExtensionParameter is not null);
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (28)
33Debug.Assert((object)result == calculated); 37Debug.Assert(result.ExternAliases.SequenceEqual(calculated.ExternAliases)); 39Debug.Assert(result.Usings.SequenceEqual(calculated.Usings)); 51Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetImports(this, declarationSyntax, basesBeingResolved) == Imports.Empty); 120Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetExternAliases(this, declarationSyntax).IsEmpty); 130Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetExternAliases(this, declarationSyntax).IsEmpty); 151Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingAliases(this, declarationSyntax, basesBeingResolved).IsEmpty); 161Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingAliases(this, declarationSyntax, basesBeingResolved).IsEmpty); 193Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingAliasesMap(this, declarationSyntax, basesBeingResolved).IsEmpty); 215Debug.Assert(result.SequenceEqual(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingNamespacesOrTypes(this, declarationSyntax, basesBeingResolved))); 225Debug.Assert(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingNamespacesOrTypes(this, declarationSyntax, basesBeingResolved).IsEmpty); 447Debug.Assert(result.IsEmpty); 448Debug.Assert(diagnostics.IsEmptyWithoutResolution); 564Debug.Assert(!onlyGlobal); 580Debug.Assert(calculated.UsingAliases.IsEmpty); 581Debug.Assert(calculated.UsingAliasesMap?.IsEmpty ?? true); 582Debug.Assert(calculated.UsingNamespacesOrTypes.IsEmpty); 598Debug.Assert(calculated.UsingAliases.SequenceEqual(result.UsingAliases)); 600Debug.Assert(calculated.UsingNamespacesOrTypes.SequenceEqual(result.UsingNamespacesOrTypes)); 762Debug.Assert(directiveDiagnostics.DiagnosticBag is object); 763Debug.Assert(directiveDiagnostics.DependenciesBag is object); 945Debug.Assert(_state.HasComplete(CompletionPart.StartValidatingImports)); 969Debug.Assert(diagnostics.DiagnosticBag is object); 970Debug.Assert(diagnostics.DependenciesBag is object); 980Debug.Assert(declaringSymbol.IsGlobalNamespace); 1006Debug.Assert(declaringSymbol.IsGlobalNamespace); 1037Debug.Assert(target.IsGlobalNamespace); 1176Debug.Assert(_state.HasComplete(CompletionPart.StartValidatingImports));
Symbols\Source\SourceNamespaceSymbol.cs (4)
58Debug.Assert(mergedDeclaration != null); 239Debug.Assert(wasSetThisThread); 308Debug.Assert((object)nts != null || symbol is not TypeSymbol); 347Debug.Assert((object)nts?.OriginalDefinition == nts && (object)other.OriginalDefinition == other);
Symbols\Source\SourceOrdinaryMethodOrUserDefinedOperatorSymbol.cs (6)
84Debug.Assert(_lazyReturnType.CustomModifiers.IsEmpty); 94Debug.Assert(_lazyExplicitInterfaceImplementations.IsDefault); 132Debug.Assert(_lazyExplicitInterfaceImplementations.IsDefault); 143Debug.Assert(_lazyExplicitInterfaceImplementations.IsDefault); 146Debug.Assert(_lazyReturnType.CustomModifiers.IsEmpty); 166Debug.Assert(result == GetParameterCountFromSyntax());
Symbols\Source\SourceOrdinaryMethodSymbol.cs (25)
63Debug.Assert(diagnostics.DiagnosticBag is object); 78Debug.Assert(syntax.ReturnType is not ScopedTypeSyntax); 134Debug.Assert(returnTypeSyntax is not ScopedTypeSyntax); 173Debug.Assert(declaredConstraints.All(clause => clause.ConstraintTypes.IsEmpty)); 216Debug.Assert(parameterSyntax.Type != null); 280Debug.Assert(syntaxReferenceOpt != null); 301Debug.Assert(definition.IsPartialDefinition); 302Debug.Assert(implementation.IsPartialImplementation); 408Debug.Assert(PartialDefinitionPart is null); 458Debug.Assert(this.DeclaringSyntaxReferences.Length == 1); 486Debug.Assert(!ReferenceEquals(definition, implementation)); 597Debug.Assert(!ReferenceEquals(definition, implementation)); 598Debug.Assert(definition.Arity == implementation.Arity); 752Debug.Assert(isExplicitInterfaceImplementation); 823Debug.Assert(!IsStatic || !IsOverride); // Otherwise should have been reported and cleared earlier. 824Debug.Assert(!IsStatic || ContainingType.IsInterface || (!IsAbstract && !IsVirtual)); // Otherwise should have been reported and cleared earlier. 1026Debug.Assert(definition.IsPartialDefinition); 1027Debug.Assert(implementation.IsPartialImplementation); 1029Debug.Assert(definition._otherPartOfPartial is not { } alreadySetImplPart || alreadySetImplPart == implementation); 1030Debug.Assert(implementation._otherPartOfPartial is not { } alreadySetDefPart || alreadySetDefPart == definition); 1035Debug.Assert(definition._otherPartOfPartial == implementation); 1036Debug.Assert(implementation._otherPartOfPartial == definition); 1049Debug.Assert(!_typeParameterInfo.LazyTypeParameters.IsDefault); 1112Debug.Assert(syntax.ExplicitInterfaceSpecifier != null); 1124Debug.Assert(syntax.TypeParameterList != null);
Symbols\Source\SourceParameterSymbol.cs (5)
44Debug.Assert(owner is not LambdaSymbol); // therefore we don't need to deal with discard parameters 59Debug.Assert(!inModifiers.IsDefault); 111Debug.Assert((owner.Kind == SymbolKind.Method) || (owner.Kind == SymbolKind.Property) || owner is TypeSymbol { IsExtension: true }); 146Debug.Assert(!(ContainingSymbol is LocalFunctionSymbol)); 175Debug.Assert(filter == null);
Symbols\Source\SourceParameterSymbolBase.cs (2)
23Debug.Assert((object)containingSymbol != null); 24Debug.Assert(containingSymbol.ContainingAssembly != null);
Symbols\Source\SourcePropertyAccessorSymbol.cs (6)
37Debug.Assert(syntax.Kind() == SyntaxKind.GetAccessorDeclaration || 271Debug.Assert(explicitInterfaceImplementations.Length == 1); 311Debug.Assert(propertyAccessibility != Accessibility.NotApplicable); 594Debug.Assert(syntaxReferenceOpt != null); 651Debug.Assert(MethodKind == MethodKind.PropertySet); 834Debug.Assert(IsPartialDefinition);
Symbols\Source\SourcePropertySymbol.cs (18)
52Debug.Assert(!(getterUsesFieldKeyword || setterUsesFieldKeyword) || 144Debug.Assert(syntax.Type is not ScopedTypeSyntax); 196Debug.Assert(PartialDefinitionPart is null 300Debug.Assert(hasGetAccessorImplementation); // it's not clear how this even parsed as a property if it has no accessor list and no arrow expression. 435Debug.Assert(isExplicitInterfaceImplementation); 461Debug.Assert(location.SourceTree is not null); 521Debug.Assert(!(syntax.AccessorList is null && GetArrowExpression(syntax) != null)); 575Debug.Assert(typeSyntax is not ScopedTypeSyntax); 729Debug.Assert(this.IsPartialDefinition); 730Debug.Assert((object)this != implementation); 731Debug.Assert((object?)this.OtherPartOfPartial == implementation); 799Debug.Assert(this.ParameterCount == implementation.ParameterCount); 842Debug.Assert(definition.IsPartialDefinition); 843Debug.Assert(implementation.IsPartialImplementation); 845Debug.Assert(definition._otherPartOfPartial is not { } alreadySetImplPart || alreadySetImplPart == implementation); 846Debug.Assert(implementation._otherPartOfPartial is not { } alreadySetDefPart || alreadySetDefPart == definition); 851Debug.Assert(definition._otherPartOfPartial == implementation); 852Debug.Assert(implementation._otherPartOfPartial == definition);
Symbols\Source\SourcePropertySymbolBase.cs (38)
104Debug.Assert(!isExpressionBodied || !(hasAutoPropertyGet || hasAutoPropertySet)); 105Debug.Assert(!isExpressionBodied || !hasInitializer); 106Debug.Assert(!isExpressionBodied || accessorsHaveImplementation); 107Debug.Assert((modifiers & DeclarationModifiers.Required) == 0 || this is SourcePropertySymbol); 173Debug.Assert(memberName == DefaultIndexerName); 185Debug.Assert(!IsIndexer); 200Debug.Assert(_lazyDeclaredBackingField is null); 277Debug.Assert(isExplicitInterfaceImplementation || _lazyExplicitInterfaceImplementations.IsEmpty); 320Debug.Assert(property.PartialImplementationPart is null); 459Debug.Assert(IsIndexer); 463Debug.Assert(!IsExplicitInterfaceImplementation); 498Debug.Assert(rootBinderOpt is not null); 690Debug.Assert(_lazyExplicitInterfaceImplementations.IsEmpty); 784Debug.Assert(!IsPartial); 807Debug.Assert((object?)_lazyMergedBackingField.Value == backingField); 939Debug.Assert(_getMethod is object); 940Debug.Assert(_setMethod is object); 1022Debug.Assert(location != null); 1079Debug.Assert(!IsStatic || !IsOverride); // Otherwise should have been reported and cleared earlier. 1080Debug.Assert(!IsStatic || ContainingType.IsInterface || (!IsAbstract && !IsVirtual)); // Otherwise should have been reported and cleared earlier. 1206Debug.Assert(thisAccessor.MethodKind == MethodKind.PropertySet); 1254Debug.Assert(this.IsSealed && (GetMethod is null || SetMethod is null)); 1315Debug.Assert(!ReferenceEquals(copyFrom, this)); 1334Debug.Assert(completed); 1337Debug.Assert(_lazyCustomAttributesBag.IsSealed); 1525Debug.Assert(arguments.AttributeSyntaxOpt != null); 1528Debug.Assert(diagnostics.DiagnosticBag is object); 1532Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 1708Debug.Assert(!boundAttributes.IsDefault); 1709Debug.Assert(!allAttributeSyntaxNodes.IsDefault); 1710Debug.Assert(boundAttributes.Length == allAttributeSyntaxNodes.Length); 1711Debug.Assert(_lazyCustomAttributesBag != null); 1712Debug.Assert(_lazyCustomAttributesBag.IsDecodedWellKnownAttributeDataComputed); 1713Debug.Assert(symbolPart == AttributeLocation.None); 1742Debug.Assert(this.IsIndexer || this.GetIsNewExtensionMember()); 1783Debug.Assert(_state.HasComplete(CompletionPart.FinishPropertyEnsureSignature)); 1818Debug.Assert(completedOnThisThread); 1841Debug.Assert(completedOnThisThread);
Symbols\Source\SourceSimpleParameterSymbol.cs (1)
29Debug.Assert(locations.Length <= 1);
Symbols\Source\SourceTypeParameterSymbol.cs (16)
37Debug.Assert(!syntaxRefs.IsEmpty); 225Debug.Assert(!inProgress.Any() || ReferenceEquals(inProgress.Head.ContainingSymbol, this.ContainingSymbol)); 352Debug.Assert(filter == null); 369Debug.Assert(this.ContainingSymbol.IsContainingSymbolOfAllTypeParameters(this.EffectiveBaseClassNoUseSiteDiagnostics)); 370Debug.Assert(this.ContainingSymbol.IsContainingSymbolOfAllTypeParameters(this.DeducedBaseTypeNoUseSiteDiagnostics)); 429Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 430Debug.Assert(arguments.Diagnostics is BindingDiagnosticBag); 434Debug.Assert(arguments.SymbolPart == AttributeLocation.None); 521Debug.Assert(!HasValueTypeConstraint); 702Debug.Assert(!HasValueTypeConstraint); 829Debug.Assert(overriddenTypeParameters.Length == overridingTypeParameters.Length); 860Debug.Assert(overridingMethod.IsOverride); 866Debug.Assert(method.IsOverride); 881Debug.Assert(implementationMethod.IsExplicitInterfaceImplementation); 887Debug.Assert(explicitImplementations.Length <= 1); 1012Debug.Assert(map != null);
Symbols\Source\SourceUserDefinedConversionSymbol.cs (1)
97Debug.Assert(syntaxReferenceOpt != null);
Symbols\Source\SourceUserDefinedOperatorSymbol.cs (1)
99Debug.Assert(syntaxReferenceOpt != null);
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (7)
59Debug.Assert(!this.IsStatic); 123Debug.Assert(!(IsAbstract && IsExtern)); 227Debug.Assert(isExplicitInterfaceImplementation); 767Debug.Assert(!different.IsTypeParameter()); 931Debug.Assert(containingType.IsDefinition); 1023Debug.Assert(operatorDeclaration.ExplicitInterfaceSpecifier != null); 1028Debug.Assert(conversionDeclaration.ExplicitInterfaceSpecifier != null);
Symbols\Source\SynthesizedAttributeData.cs (3)
36Debug.Assert((object)wellKnownMember != null); 37Debug.Assert(!arguments.IsDefault); 38Debug.Assert(!namedArguments.IsDefault); // Frequently empty though.
Symbols\Source\SynthesizedSourceOrdinaryMethodSymbol.cs (1)
29Debug.Assert(Arity == 0);
Symbols\Source\ThisParameterSymbol.cs (1)
140Debug.Assert(containingType is not null);
Symbols\Source\TypeParameterBuilder.cs (1)
29Debug.Assert(syntaxRef.GetSyntax().IsKind(SyntaxKind.TypeParameter));
Symbols\Source\TypeParameterConstraintClause.cs (4)
85Debug.Assert(!constraintTypes.IsDefault); 118Debug.Assert((constraints & TypeParameterConstraintKind.ObliviousNullabilityIfReferenceType) == 0 || 135Debug.Assert(constraintClauses.Length == typeParameters.Length); 200Debug.Assert(constraintClauses.Length == typeParameters.Length);
Symbols\SpecializedSymbolCollections.cs (2)
16Debug.Assert(instance.Count == 0); 28Debug.Assert(instance.Count == 0);
Symbols\SubstitutedEventSymbol.cs (1)
20Debug.Assert(originalDefinition.IsDefinition);
Symbols\SubstitutedMethodSymbol.cs (8)
43Debug.Assert(containingSymbol is SubstitutedNamedTypeSymbol || containingSymbol is SubstitutedErrorTypeSymbol); 44Debug.Assert(TypeSymbol.Equals(originalDefinition.ContainingType, containingSymbol.OriginalDefinition, TypeCompareKind.ConsiderEverything2)); 49Debug.Assert((object)originalDefinition != null); 50Debug.Assert(originalDefinition.IsDefinition); 57Debug.Assert(ReferenceEquals(constructedFrom.ConstructedFrom, constructedFrom)); 109Debug.Assert(ReferenceEquals(_constructedFrom, this)); 123Debug.Assert(_lazyTypeParameters != null); 178Debug.Assert((object)notUsed == null && (object)OriginalDefinition.ReducedFrom != null);
Symbols\SubstitutedNamedTypeSymbol.cs (6)
60Debug.Assert(originalDefinition.IsDefinition); 61Debug.Assert(!originalDefinition.IsErrorType()); 70Debug.Assert(ReferenceEquals(constructedFrom.ConstructedFrom, constructedFrom)); 123Debug.Assert(_lazyTypeParameters != null); 174Debug.Assert(!ReferenceEquals(_lazyBaseType, ErrorTypeSymbol.UnknownResultType)); 286Debug.Assert(builder is object);
Symbols\SubstitutedParameterSymbol.cs (1)
35Debug.Assert(originalParameter.IsDefinition);
Symbols\SubstitutedTypeParameterSymbol.cs (1)
121Debug.Assert(!HasNotNullConstraint && !HasValueTypeConstraint);
Symbols\Symbol.cs (10)
54Debug.Assert(!this.RequiresCompletion); 61Debug.Assert(!this.RequiresCompletion); 290Debug.Assert(ContainingType.TypeKind != TypeKind.Submission); 407Debug.Assert(declaringCompilation != null); // require that it is a source symbol 903Debug.Assert(this.Kind == SymbolKind.NamedType || this.Kind == SymbolKind.Method); 909Debug.Assert(compilation != null); 1000Debug.Assert(!s.Contains("&")); 1043Debug.Assert(compilation != null); 1172Debug.Assert(!retVal); 1541Debug.Assert(attribute is SourceAttributeData);
Symbols\Symbol_Attributes.cs (32)
30Debug.Assert(!(this is IAttributeTargetSymbol)); //such types must override 218Debug.Assert(arguments.Diagnostics.DiagnosticBag is not null); 219Debug.Assert(arguments.AttributeSyntaxOpt is not null); 316Debug.Assert(!attributesToBind.IsDefault); 323Debug.Assert(!binders.IsDefault); 324Debug.Assert(binders.Length == attributesToBind.Length); 360Debug.Assert(!attributeDataArray.Contains((attr) => attr != null && attr.HasErrors)); 377Debug.Assert(!boundAttributes.Any(static (attr) => attr == null)); 400Debug.Assert(!earlyDecodingOnly); 411Debug.Assert(diagnostics.DiagnosticBag is not null); 417Debug.Assert(boundAttributeArray is not null); 421Debug.Assert(boundAttribute is not null); 444Debug.Assert(diagnostics.DiagnosticBag is not null); 469Debug.Assert(totalAttributesCount == boundAttributes.Length); 569Debug.Assert(compilation != null); 639Debug.Assert(bindersBuilder != null); 773Debug.Assert(boundAttributeTypes.Any()); 774Debug.Assert(attributesToBind.Any()); 775Debug.Assert(binders.Any()); 776Debug.Assert(attributeDataArray != null); 777Debug.Assert(!attributeDataArray.Contains((attr) => attr != null)); 799Debug.Assert(earlyAttributeDataOpt == null || !earlyAttributeDataOpt.HasErrors); 800Debug.Assert(boundAttributeOpt is null == earlyAttributeDataOpt is null); 816Debug.Assert(attributeSyntaxList.Any()); 817Debug.Assert(attributeTypes.Any()); 844Debug.Assert(binders.Any()); 845Debug.Assert(attributeSyntaxList.Any()); 846Debug.Assert(boundAttributes.Any()); 847Debug.Assert(binders.Length == boundAttributes.Length); 848Debug.Assert(attributeSyntaxList.Length == boundAttributes.Length); 894Debug.Assert(!attribute.HasErrors); 911Debug.Assert(this.Kind == SymbolKind.Method);
Symbols\SymbolCompletionState.cs (1)
50Debug.Assert(symbol.RequiresCompletion);
Symbols\SymbolDistinguisher.cs (3)
33Debug.Assert(symbol0 != symbol1); 161Debug.Assert((object)unwrappedSymbol == UnwrapSymbol(unwrappedSymbol)); 194Debug.Assert(unwrappedSymbol.Kind == SymbolKind.DynamicType || unwrappedSymbol.Kind == SymbolKind.ErrorType || unwrappedSymbol.Kind == SymbolKind.FunctionPointerType);
Symbols\SymbolExtensions.cs (5)
35Debug.Assert(type.TypeParameters.IsEmpty == (typeArguments.Length == 0)); 106Debug.Assert(!useSiteInfo.AccumulatesDependencies); 268Debug.Assert(!(symbol is TypeSymbol)); 819Debug.Assert(symbol is MethodSymbol or PropertySymbol); 830Debug.Assert(parameter.IsDefinition);
Symbols\Synthesized\GeneratedNameParser.cs (2)
179Debug.Assert((char)GeneratedNameKind.PrimaryConstructorParameter == 'P'); 200Debug.Assert(s_regexPatternString[0] == FileTypeNameStartChar);
Symbols\Synthesized\GeneratedNames.cs (48)
23Debug.Assert((char)GeneratedNameKind.AutoPropertyBackingField == 'k'); 29Debug.Assert((char)GeneratedNameKind.PrimaryConstructorParameter == 'P'); 35Debug.Assert((int)finalizeState < -2); 39Debug.Assert((char)GeneratedNameKind.IteratorFinallyMethod == 'm'); 51Debug.Assert(closureOrdinal >= -1); 52Debug.Assert(methodOrdinal >= 0); 75Debug.Assert((char)GeneratedNameKind.Extension == 'E'); 86Debug.Assert(generation >= 0); 87Debug.Assert(methodOrdinal >= -1); 94Debug.Assert((char)GeneratedNameKind.BaseMethodWrapper == 'n'); 100Debug.Assert(methodOrdinal >= -1); 101Debug.Assert(methodGeneration >= 0); 102Debug.Assert(lambdaOrdinal >= 0); 103Debug.Assert(lambdaGeneration >= 0); 112Debug.Assert(methodOrdinal >= -1); 113Debug.Assert(lambdaOrdinal >= 0); 120Debug.Assert(methodOrdinal >= -1); 121Debug.Assert(methodGeneration >= 0); 122Debug.Assert(lambdaOrdinal >= 0); 123Debug.Assert(lambdaGeneration >= 0); 138Debug.Assert(methodOrdinal >= -1); 139Debug.Assert(methodGeneration >= 0 || methodGeneration == -1 && methodOrdinal == -1); 140Debug.Assert(entityOrdinal >= -1); 141Debug.Assert(entityGeneration >= 0 || entityGeneration == -1 && entityOrdinal == -1); 142Debug.Assert(entityGeneration == -1 || entityGeneration >= methodGeneration); 143Debug.Assert(suffixTerminator != GeneratedNameConstants.IdSeparator); 211Debug.Assert((localName != null) == (kind == SynthesizedLocalKind.UserDefined)); 212Debug.Assert(slotIndex >= 0); 227Debug.Assert(localName.IndexOf('.') == -1); 254Debug.Assert((char)GeneratedNameKind.AwaiterField == 'u'); 260Debug.Assert((char)GeneratedNameKind.LambdaCacheField == '9'); 284Debug.Assert((char)GeneratedNameKind.DisplayClassLocalOrField == '8'); 291Debug.Assert((char)GeneratedNameKind.FixedBufferField == 'e'); 298Debug.Assert((char)GeneratedNameKind.StateMachineStateField == '1'); 304Debug.Assert((char)GeneratedNameKind.AsyncIteratorPromiseOfValueOrEndBackingField == 'v'); 310Debug.Assert((char)GeneratedNameKind.CombinedTokensField == 'x'); 316Debug.Assert((char)GeneratedNameKind.IteratorCurrentBackingField == '2'); 322Debug.Assert((char)GeneratedNameKind.DisposeModeField == 'w'); 328Debug.Assert((char)GeneratedNameKind.IteratorCurrentThreadIdField == 'l'); 334Debug.Assert((char)GeneratedNameKind.StateMachineStateIdField == 'I'); 340Debug.Assert((char)GeneratedNameKind.ThisProxyField == '4'); 351Debug.Assert((char)GeneratedNameKind.StateMachineParameterProxyField == '3'); 364Debug.Assert((char)GeneratedNameKind.DynamicCallSiteField == 'p'); 461Debug.Assert(name == MakeSynthesizedDelegateName(byRefs, returnsVoid, generation)); 467Debug.Assert((char)GeneratedNameKind.InlineArrayType == 'y'); 476Debug.Assert((char)GeneratedNameKind.ReadOnlyListType == 'z'); 492Debug.Assert((char)GeneratedNameKind.AsyncBuilderField == 't'); 532Debug.Assert((char)GeneratedNameKind.ReusableHoistedLocalField == '7');
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListEnumeratorTypeSymbol.cs (1)
115Debug.Assert(property is { GetMethod: not null, SetMethod: null });
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListProperty.cs (1)
21Debug.Assert(setAccessorBody is null == interfaceProperty.SetMethod is null);
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeParameterSymbol.cs (1)
17Debug.Assert(containingType.IsClassType());
Symbols\Synthesized\ReadOnlyListType\SynthesizedReadOnlyListTypeSymbol.cs (6)
252Debug.Assert(diagnosticInfo is { }); 480Debug.Assert(enumeratorType is not null); 740Debug.Assert(fieldType.IsTypeParameter()); 741Debug.Assert(parameterReference.Type.Equals(fieldType) || 773Debug.Assert(symbol is { }); 774Debug.Assert(_field.Type.OriginalDefinition.Equals(symbol.ContainingType, TypeCompareKind.AllIgnoreOptions));
Symbols\Synthesized\Records\SynthesizedPrimaryConstructor.cs (13)
26Debug.Assert(syntax.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.StructDeclaration); 27Debug.Assert(containingType.HasPrimaryConstructor); 28Debug.Assert(containingType is SourceNamedTypeSymbol); 29Debug.Assert(containingType is IAttributeTargetSymbol); 39Debug.Assert(syntax.ParameterList != null); 60Debug.Assert(syntaxReferenceOpt != null); 107Debug.Assert(typeDecl.ParameterList is not null); 143Debug.Assert(arguments.SymbolPart == AttributeLocation.Method); 152Debug.Assert(arguments.SymbolPart == AttributeLocation.Method); 160Debug.Assert(symbolPart is AttributeLocation.Method or AttributeLocation.Return); 166Debug.Assert(attributeDeclarationSyntax.Target is object); 225Debug.Assert(oldSet.Contains(p)); 229Debug.Assert(count == 0);
Symbols\Synthesized\Records\SynthesizedRecordBaseEquals.cs (1)
22Debug.Assert(!containingType.IsRecordStruct);
Symbols\Synthesized\Records\SynthesizedRecordClone.cs (3)
27Debug.Assert(!containingType.IsRecordStruct); 50Debug.Assert(modifiersAreValid(result)); 108Debug.Assert(!IsAbstract);
Symbols\Synthesized\Records\SynthesizedRecordCopyCtor.cs (2)
78Debug.Assert(IsImplicitlyDeclared); 81Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
Symbols\Synthesized\Records\SynthesizedRecordDeconstruct.cs (1)
26Debug.Assert(positionalMembers.All(p => p is PropertySymbol { GetMethod: not null } or FieldSymbol));
Symbols\Synthesized\Records\SynthesizedRecordEqualityContractProperty.cs (2)
48Debug.Assert(!containingType.IsRecordStruct); 99Debug.Assert(WellKnownMembers.IsSynthesizedAttributeOptional(WellKnownMember.System_Runtime_CompilerServices_CompilerGeneratedAttribute__ctor));
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperatorBase.cs (1)
44Debug.Assert(name == WellKnownMemberNames.EqualityOperatorName || name == WellKnownMemberNames.InequalityOperatorName);
Symbols\Synthesized\Records\SynthesizedRecordEquals.cs (3)
27Debug.Assert(equalityContract is null == containingType.IsRecordStruct); 69Debug.Assert(_equalityContract is not null); 93Debug.Assert(!other.Type.IsStructType());
Symbols\Synthesized\Records\SynthesizedRecordGetHashCode.cs (2)
23Debug.Assert(containingType.IsRecordStruct == equalityContract is null); 56Debug.Assert(_equalityContract is not null);
Symbols\Synthesized\Records\SynthesizedRecordPrintMembers.cs (3)
51Debug.Assert(modifiersAreValid(result)); 180Debug.Assert(!printableMembers.IsEmpty); 208Debug.Assert(value.Type is not null);
Symbols\Synthesized\Records\SynthesizedRecordPropertySymbol.cs (2)
61Debug.Assert(isAutoPropertyAccessor); 67Debug.Assert(isAutoPropertyAccessor);
Symbols\Synthesized\Records\SynthesizedRecordToString.cs (1)
32Debug.Assert(printMethod is object);
Symbols\Synthesized\RefKindVector.cs (2)
104Debug.Assert(i > 0); 137Debug.Assert(firstWord is not null);
Symbols\Synthesized\SynthesizedAccessorValueParameterSymbol.cs (3)
31Debug.Assert(accessor.Locations.Length <= 1); 109Debug.Assert(accessor.Locations.Length <= 1); 122Debug.Assert(accessor.Locations.Length <= 1);
Symbols\Synthesized\SynthesizedBackingFieldSymbol.cs (10)
34Debug.Assert(!string.IsNullOrEmpty(name)); 95Debug.Assert(!string.IsNullOrEmpty(name)); 96Debug.Assert(property.RefKind is RefKind.None or RefKind.Ref or RefKind.RefReadOnly); 155Debug.Assert(inferredAnnotation is not NullableAnnotation.Ignored); 158Debug.Assert((NullableAnnotation)_inferredNullableAnnotation is NullableAnnotation.NotAnnotated or NullableAnnotation.Annotated); 165Debug.Assert(InfersNullableAnnotation); 170Debug.Assert(_property.GetMethod is null); 238Debug.Assert((object)arguments.AttributeSyntaxOpt != null); 239Debug.Assert(arguments.Diagnostics is BindingDiagnosticBag); 243Debug.Assert(arguments.SymbolPart == AttributeLocation.None);
Symbols\Synthesized\SynthesizedContainer.cs (2)
29Debug.Assert(name != null); 37Debug.Assert(name != null);
Symbols\Synthesized\SynthesizedEmbeddedAttributeSymbol.cs (4)
42Debug.Assert(name is object); 43Debug.Assert(containingNamespace is object); 44Debug.Assert(containingModule is object); 45Debug.Assert(baseType is object);
Symbols\Synthesized\SynthesizedEmbeddedNativeIntegerAttributeSymbol.cs (1)
57Debug.Assert(_constructors.Length == AttributeDescription.NativeIntegerAttribute.Signatures.Length);
Symbols\Synthesized\SynthesizedEmbeddedNullableAttributeSymbol.cs (1)
61Debug.Assert(_constructors.Length == AttributeDescription.NullableAttribute.Signatures.Length);
Symbols\Synthesized\SynthesizedEmbeddedNullableContextAttributeSymbol.cs (1)
45Debug.Assert(_constructors.Length == AttributeDescription.NullableContextAttribute.Signatures.Length);
Symbols\Synthesized\SynthesizedEmbeddedNullablePublicOnlyAttributeSymbol.cs (1)
45Debug.Assert(_constructors.Length == AttributeDescription.NullablePublicOnlyAttribute.Signatures.Length);
Symbols\Synthesized\SynthesizedEntryPointSymbol.cs (13)
50Debug.Assert((object)containingType != null); 346Debug.Assert(userMain.ParameterCount == 0 || userMain.ParameterCount == 1); 376Debug.Assert( 449Debug.Assert(containingType.IsScriptClass); 450Debug.Assert(returnType.IsVoidType()); 477Debug.Assert(ctor.ParameterCount == 0); 480Debug.Assert(initializer.ParameterCount == 0); 489Debug.Assert(!initializer.ReturnType.IsDynamic()); 538Debug.Assert(containingType.IsSubmissionClass); 539Debug.Assert(!returnType.IsVoidType()); 568Debug.Assert(ctor.ParameterCount == 1); 571Debug.Assert(initializer.ParameterCount == 0); 610Debug.Assert(TypeSymbol.Equals(initializeResult.Type, _returnType.Type, TypeCompareKind.ConsiderEverything2));
Symbols\Synthesized\SynthesizedEventAccessorSymbol.cs (3)
32Debug.Assert(IsAbstract || IsExtern || IsFieldLikeEventAccessor()); 54Debug.Assert(PartialImplementationPart is null); 129Debug.Assert(TryGetBodyBinder() is null);
Symbols\Synthesized\SynthesizedFieldSymbol.cs (1)
32Debug.Assert((object)type != null);
Symbols\Synthesized\SynthesizedFieldSymbolBase.cs (2)
31Debug.Assert((object)containingType != null); 32Debug.Assert(!string.IsNullOrEmpty(name));
Symbols\Synthesized\SynthesizedGlobalMethodSymbol.cs (9)
31Debug.Assert(privateImplType is not null); 32Debug.Assert(name != null); 41Debug.Assert((object)returnType != null); 48Debug.Assert(returnType is not null); 49Debug.Assert(_returnType is null); 55Debug.Assert(!parameters.IsDefault); 56Debug.Assert(_parameters.IsDefault); 62Debug.Assert(!typeParameters.IsDefault); 63Debug.Assert(_typeParameters.IsDefault);
Symbols\Synthesized\SynthesizedImplementationMethod.cs (1)
36Debug.Assert(implementingType.IsDefinition);
Symbols\Synthesized\SynthesizedInlineArrayTypeSymbol.cs (2)
33Debug.Assert(arrayLength > 0); 201Debug.Assert(compilation is { });
Symbols\Synthesized\SynthesizedInstanceConstructor.cs (2)
22Debug.Assert((object)containingType != null); 84Debug.Assert(_containingType.TypeKind == TypeKind.Class);
Symbols\Synthesized\SynthesizedInteractiveInitializerMethod.cs (3)
28Debug.Assert(containingType.IsScriptClass); 172Debug.Assert(!this.IsStatic); 173Debug.Assert(!this.IsGenericMethod);
Symbols\Synthesized\SynthesizedIntrinsicOperatorSymbol.cs (3)
35Debug.Assert(leftType.Equals(returnType, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 42Debug.Assert((leftType.IsDynamic() || rightType.IsDynamic()) == returnType.IsDynamic()); 43Debug.Assert(_containingType.IsDynamic() == returnType.IsDynamic());
Symbols\Synthesized\SynthesizedLambdaCacheFieldSymbol.cs (2)
22Debug.Assert((object)type != null); 23Debug.Assert((object)topLevelMethod != null);
Symbols\Synthesized\SynthesizedLocal.cs (5)
49Debug.Assert(!type.IsVoidType()); 51Debug.Assert(refKind != RefKind.Out); 52Debug.Assert(containingMethodOpt is null || containingMethodOpt.DeclaringCompilation is not null); 155Debug.Assert(_syntaxOpt != null); 179Debug.Assert(!_isKnownToReferToTempIfReferenceType);
Symbols\Synthesized\SynthesizedParameterSymbol.cs (9)
33Debug.Assert(type.HasType); 34Debug.Assert(name != null); 35Debug.Assert(ordinal >= 0); 307Debug.Assert(!(oldParam is SynthesizedComplexParameterSymbol)); 360Debug.Assert(!refCustomModifiers.IsDefault); 361Debug.Assert(isParams || !refCustomModifiers.IsEmpty || baseParameterForAttributes is object || defaultValue is not null || hasUnscopedRefAttribute); 362Debug.Assert(baseParameterForAttributes is null || baseParameterForAttributes.ExplicitDefaultConstantValue == defaultValue); 420Debug.Assert(_baseParameterForAttributes is null); 429Debug.Assert(_baseParameterForAttributes is null);
Symbols\Synthesized\SynthesizedPrivateImplementationDetailsType.cs (2)
27Debug.Assert(globalNamespace.IsGlobalNamespace); 28Debug.Assert(objectType.IsObjectType());
Symbols\Synthesized\SynthesizedSealedPropertyAccessor.cs (4)
31Debug.Assert((object)property != null); 32Debug.Assert(property.IsSealed); 33Debug.Assert((object)overriddenAccessor != null); 95Debug.Assert(AccessCheck.IsSymbolAccessible(_overriddenAccessor, this.ContainingType, ref discardedUseSiteInfo));
Symbols\Synthesized\SynthesizedSimpleProgramEntryPointSymbol.cs (1)
32Debug.Assert(declaration.SyntaxReference.GetSyntax() is CompilationUnitSyntax);
Symbols\Synthesized\SynthesizedStaticConstructor.cs (1)
402Debug.Assert(ContainingType is SynthesizedClosureEnvironment);
Symbols\Synthesized\SynthesizedSubmissionConstructor.cs (2)
19Debug.Assert(containingType.TypeKind == TypeKind.Submission); 20Debug.Assert(diagnostics != null);
Symbols\Synthesized\SynthesizedThrowSwitchExpressionExceptionMethod.cs (1)
33Debug.Assert(unmatchedValue.Type.SpecialType == SpecialType.System_Object);
Symbols\Synthesized\TypeSubstitutedLocalSymbol.cs (4)
22Debug.Assert(originalVariable != null); 23Debug.Assert(type.HasType); 24Debug.Assert(containingSymbol != null); 25Debug.Assert(containingSymbol.DeclaringCompilation is not null);
Symbols\SynthesizedNamespaceSymbol.cs (2)
26Debug.Assert(containingNamespace is object); 27Debug.Assert(name is object);
Symbols\Tuples\TupleErrorFieldSymbol.cs (4)
50Debug.Assert(name != null); 57Debug.Assert((correspondingDefaultFieldOpt == null) == this.IsDefaultTupleElement); 58Debug.Assert(correspondingDefaultFieldOpt == null || correspondingDefaultFieldOpt.IsDefaultTupleElement); 195Debug.Assert(newOwner.IsTupleType && newOwner.TupleElementTypesWithAnnotations.Length > TupleElementIndex);
Symbols\Tuples\TupleFieldSymbol.cs (13)
46Debug.Assert(tupleElementIndex >= 0); 49Debug.Assert(!(underlyingField is TupleElementFieldSymbol)); 52Debug.Assert(!container.IsDefinition); 54Debug.Assert(container.IsTupleType); 57Debug.Assert(!locations.IsDefault); 211Debug.Assert(newOwner.IsTupleType); 267Debug.Assert(container.IsTupleType); 268Debug.Assert(underlyingField.ContainingType.IsTupleType); 269Debug.Assert(name != null); 272Debug.Assert((correspondingDefaultFieldOpt is null) == (NamedTypeSymbol.TupleMemberName(tupleElementIndex + 1) == name)); 273Debug.Assert(!(correspondingDefaultFieldOpt is TupleErrorFieldSymbol)); 332Debug.Assert(newOwner.IsTupleType); 333Debug.Assert(newOwner.TupleElements.Length == this._containingTuple.TupleElements.Length);
Symbols\Tuples\TupleTypeSymbol.cs (28)
41Debug.Assert(!shouldCheckConstraints || syntax is object); 42Debug.Assert(elementNames.IsDefault || elementTypesWithAnnotations.Length == elementNames.Length); 43Debug.Assert(!includeNullability || shouldCheckConstraints); 64Debug.Assert(syntax is object); 106Debug.Assert(tupleCompatibleType.IsTupleType); 128Debug.Assert(TupleElementTypesWithAnnotations.Length == newElementTypes.Length); 129Debug.Assert(newElementTypes.All(t => t.HasType)); 165Debug.Assert(IsTupleType); 166Debug.Assert(newElementNames.IsDefault || this.TupleElementTypesWithAnnotations.Length == newElementNames.Length); 172Debug.Assert(IsTupleType); 233Debug.Assert(chainedTupleTypeOpt is null == elementTypes.Length < ValueTupleRestPosition); 290Debug.Assert(allMissing || destinationNames.Length == sourceLength); 517Debug.Assert(relativeMember >= WellKnownMember.System_ValueTuple_T1__Item1 && relativeMember <= WellKnownMember.System_ValueTuple_TRest__ctor); 518Debug.Assert(type.IsDefinition); 571Debug.Assert(IsTupleType); 572Debug.Assert(currentMembers.All(m => !(m is TupleVirtualElementFieldSymbol))); 723Debug.Assert((object)oldUnderlying.OriginalDefinition == currentValueTuple.OriginalDefinition); 811Debug.Assert(relativeMember >= WellKnownMember.System_ValueTuple_T1__Item1 && relativeMember <= WellKnownMember.System_ValueTuple_TRest__ctor); 837Debug.Assert(fields.All(f => f is object)); 865Debug.Assert(names1.Length == names2.Length); 922Debug.Assert(underlyingType.IsTupleType); 923Debug.Assert(underlyingType.TupleElementNames.IsDefault); 969Debug.Assert(tuple.Equals(TupleUnderlyingType, TypeCompareKind.IgnoreTupleNames)); 1001Debug.Assert(tuple.Equals(TupleUnderlyingType, TypeCompareKind.IgnoreTupleNames)); 1033Debug.Assert(candidate.IsDefaultTupleElement); 1038Debug.Assert(builder.All(f => f is object)); 1082Debug.Assert((object)underlyingAssociatedField.ContainingSymbol == TupleUnderlyingType); 1083Debug.Assert(TupleUnderlyingType.GetMembers(underlyingAssociatedField.Name).IndexOf(underlyingAssociatedField) < 0);
Symbols\TypedConstantExtensions.cs (10)
32Debug.Assert(constant.Value is object); 42Debug.Assert(constant.ValueInternal is object); 49Debug.Assert(constant.Kind == TypedConstantKind.Enum); 53Debug.Assert(constant.ValueInternal is object); 69Debug.Assert(constant.Kind == TypedConstantKind.Enum); 140Debug.Assert(constant.ValueInternal is object); 142Debug.Assert(result is object); 148Debug.Assert(constant.Kind == TypedConstantKind.Enum); 218Debug.Assert(constant.ValueInternal is object); 220Debug.Assert(result is object);
Symbols\TypeMap.cs (7)
45Debug.Assert(allowAlpha || !from.Any(static tp => tp is SubstitutedTypeParameterSymbol && tp.ContainingSymbol is not SourceExtensionImplementationMethodSymbol)); // Tracked by https://github.com/dotnet/roslyn/issues/76130 : Follow up, will the SourceExtensionImplementationMethodSymbol type check still be necessary at the end 140Debug.Assert(TypeSymbol.Equals(oldOwner.ConstructedFrom, oldOwner, TypeCompareKind.ConsiderEverything2)); 146Debug.Assert(oldOwner.ConstructedFrom == oldOwner); 152Debug.Assert(oldOwner.ConstructedFrom == oldOwner); 153Debug.Assert(stopAt == null || stopAt.ConstructedFrom == stopAt); 185Debug.Assert( 197Debug.Assert(from.Length == to.Length);
Symbols\TypeParameterBounds.cs (4)
29Debug.Assert(!constraintTypes.IsDefault); 30Debug.Assert(!interfaces.IsDefault); 31Debug.Assert((object)effectiveBaseClass != null); 32Debug.Assert((object)deducedBaseType != null);
Symbols\TypeParameterSymbol.cs (6)
404Debug.Assert(constraint.TypeKind != TypeKind.TypeParameter); 451Debug.Assert(!constraintTypes.IsDefaultOrEmpty); 570Debug.Assert(fromNonTypeConstraints == null); 571Debug.Assert(fromTypes != true); 701Debug.Assert(this.Equals(other, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes)); 712Debug.Assert(nullableAnnotation != DefaultNullableAnnotation);
Symbols\TypeParameterSymbolExtensions.cs (2)
13Debug.Assert((object)typeParameter1 != null); 14Debug.Assert((object)typeParameter2 != null);
Symbols\TypeSymbol.cs (24)
253Debug.Assert((object)type != null); 254Debug.Assert(!type.IsTypeParameter()); 387Debug.Assert(InterfaceInfo.EmptyInterfacesAndTheirBaseInterfaces.IsEmpty); 734Debug.Assert((object)interfaceMember != null); 735Debug.Assert(!this.IsInterfaceType()); 770Debug.Assert(ignoreImplementationInInterfacesIfResultIsNotReady || !implementationInInterfacesMightChangeResult); 771Debug.Assert(!implementationInInterfacesMightChangeResult || result.Symbol is null); 817Debug.Assert(!implementingType.IsInterfaceType()); 818Debug.Assert(interfaceMember.Kind == SymbolKind.Method || interfaceMember.Kind == SymbolKind.Property || interfaceMember.Kind == SymbolKind.Event); 819Debug.Assert(interfaceMember.IsImplementableInterfaceMember()); 822Debug.Assert((object)interfaceType != null && interfaceType.IsInterface); 951Debug.Assert(!canBeImplementedImplicitlyInCSharp9 || (object)implementingBaseOpt == null); 1070Debug.Assert(!implementingType.IsInterfaceType()); 1087Debug.Assert((object)defaultImpl == null); 1088Debug.Assert((object)conflict2 != null); 1094Debug.Assert(((object)conflict2 == null)); 1393Debug.Assert(interfaceType.IsInterface); 1559Debug.Assert(!implementingType.IsInterfaceType()); 1560Debug.Assert(interfaceMethod.IsAccessor()); 1992Debug.Assert(false); 2096Debug.Assert((object)implementingType != null); 2110Debug.Assert(interfaceMethod.Arity == implicitImpl.Arity); 2308Debug.Assert(interfaceMember.Kind != SymbolKind.Method || (object)interfaceMember == ((MethodSymbol)interfaceMember).ConstructedFrom); 2540Debug.Assert(HasInlineArrayAttribute(out var length) && length > 0);
Symbols\TypeSymbolExtensions.cs (1)
586Debug.Assert(type is FunctionPointerTypeSymbol || type.IsDelegateType());
Symbols\TypeUnification.cs (4)
33Debug.Assert(substituted1.Type.Equals(substituted2.Type, TypeCompareKind.CLRSignatureCompareOptions)); 34Debug.Assert(substituted1.CustomModifiers.SequenceEqual(substituted2.CustomModifiers)); 107Debug.Assert(t1.Type.IsTypeParameter() || !t2.Type.IsTypeParameter()); 154Debug.Assert(!nt1.Equals(nt2, TypeCompareKind.CLRSignatureCompareOptions));
Symbols\TypeWithAnnotations.cs (24)
55Debug.Assert(defaultType?.IsNullableType() != true || defaultAnnotation == NullableAnnotation.Annotated); 56Debug.Assert(extensions != null); 92Debug.Assert(nullableAnnotation != NullableAnnotation.Ignored || typeSymbol.IsTypeParameter()); 196Debug.Assert(CustomModifiers.IsEmpty); 246Debug.Assert((object)type != null); 442Debug.Assert(NullableAnnotation != NullableAnnotation.Ignored); 450Debug.Assert(newTypeWithModifiers.NullableAnnotation.IsOblivious() || (typeSymbol.IsNullableType() && newTypeWithModifiers.NullableAnnotation.IsAnnotated())); 451Debug.Assert(newTypeWithModifiers.CustomModifiers.IsEmpty); 452Debug.Assert(NullableAnnotation != NullableAnnotation.Ignored); 484Debug.Assert(newTypeWithModifiers.Type is not IndexedTypeParameterSymbol || newTypeWithModifiers.NullableAnnotation == NullableAnnotation.Ignored); 496Debug.Assert(NullableAnnotation == NullableAnnotation.NotAnnotated); 512Debug.Assert((object)newTypeWithModifiers.DefaultType == newTypeWithModifiers.Type); 518Debug.Assert(newTypeWithModifiers.NullableAnnotation is NullableAnnotation.NotAnnotated); 528Debug.Assert(NullableAnnotation.IsOblivious()); 529Debug.Assert(newTypeWithModifiers.NullableAnnotation.IsOblivious()); 888Debug.Assert(!customModifiers.IsDefault); 964Debug.Assert(!customModifiers.IsDefault); 980Debug.Assert(defaultAnnotation == NullableAnnotation.Ignored); 986Debug.Assert(_resolved != Unresolved); 1050Debug.Assert(!asValueType); 1067Debug.Assert(!underlying.NullableAnnotation.IsAnnotated()); 1068Debug.Assert(underlying.TypeKind == TypeKind.TypeParameter); 1069Debug.Assert(underlying.CustomModifiers.IsEmpty); 1103Debug.Assert(resolvedType.IsNullableType() && CustomModifiers.IsEmpty);
Symbols\TypeWithState.cs (4)
33Debug.Assert(type?.IsNullableTypeOrTypeParameter() != true); 43Debug.Assert((object)type != null); 71Debug.Assert(state == NullableFlowState.NotNull || type?.CanContainNull() != false); 72Debug.Assert(state != NullableFlowState.MaybeDefault || type is null || type.IsTypeParameterDisallowingAnnotationInCSharp8());
Symbols\UnboundGenericType.cs (1)
89Debug.Assert(Arity == 0);
Symbols\UpdatedContainingSymbolLocal.cs (2)
27Debug.Assert(updatedContainingSymbol.DeclaringCompilation is not null); 28Debug.Assert(!assertContaining || updatedContainingSymbol.Equals(underlyingLocal.ContainingSymbol, TypeCompareKind.AllNullableIgnoreOptions));
Symbols\VarianceSafety.cs (6)
31Debug.Assert((object)interfaceType != null && interfaceType.IsInterface); 93Debug.Assert(container.IsInterfaceType()); 94Debug.Assert(container.TypeParameters.Any(static tp => tp.Variance != VarianceKind.None)); 105Debug.Assert(!container.IsDelegateType()); 301Debug.Assert(requireOutputSafety || requireInputSafety); 369Debug.Assert(requireOutputSafety || requireInputSafety);
Symbols\Wrapped\WrappedFieldSymbol.cs (1)
30Debug.Assert((object)underlyingField != null);
Symbols\Wrapped\WrappedNamedTypeSymbol.cs (1)
33Debug.Assert((object)underlyingType != null);
Symbols\Wrapped\WrappedParameterSymbol.cs (1)
28Debug.Assert((object)underlyingParameter != null);
Symbols\Wrapped\WrappedPropertySymbol.cs (1)
30Debug.Assert((object)underlyingProperty != null);
Symbols\Wrapped\WrappedTypeParameterSymbol.cs (1)
31Debug.Assert((object)underlyingTypeParameter != null);
Syntax\AttributeSyntax.cs (1)
25Debug.Assert(!String.IsNullOrEmpty(namedArgName));
Syntax\CSharpLineDirectiveMap.cs (8)
30Debug.Assert(ShouldAddDirective(directiveNode)); 188Debug.Assert(Entries[0].State == PositionState.Unmapped); 196Debug.Assert(entry.State != PositionState.Unknown && 237Debug.Assert(this.Entries[0].State == PositionState.Unmapped); 238Debug.Assert(this.Entries[0].MappedLine == this.Entries[0].UnmappedLine); 239Debug.Assert(this.Entries[0].MappedLine == 0); 240Debug.Assert(this.Entries[0].MappedPathOpt == null); 249Debug.Assert(entry.State != PositionState.Unknown &&
Syntax\CSharpPragmaWarningStateMap.cs (1)
152Debug.Assert(entries[i].CompareTo(entries[i + 1]) < 0);
Syntax\CSharpSyntaxNode.cs (3)
51Debug.Assert(result != null); 95Debug.Assert(tree != null); 388Debug.Assert(trivia.HasStructure);
Syntax\CSharpSyntaxRewriter.cs (2)
72Debug.Assert(leadingTrivia == null || !leadingTrivia.IsList || leadingTrivia.SlotCount > 0); 73Debug.Assert(trailingTrivia == null || !trailingTrivia.IsList || trailingTrivia.SlotCount > 0);
Syntax\CSharpSyntaxTree.cs (8)
134Debug.Assert(HasCompilationUnitRoot); 144Debug.Assert(HasCompilationUnitRoot); 165Debug.Assert(!_lazyDirectives.IsNull); 293Debug.Assert(currentPos < pos); 381Debug.Assert(root != null); 396Debug.Assert(root != null); 517Debug.Assert(compilationUnit._syntaxTree == null); 677Debug.Assert(map.Entries.Length >= 1);
Syntax\CSharpSyntaxTree.LazySyntaxTree.cs (1)
31Debug.Assert(options != null);
Syntax\CSharpSyntaxTree.ParsedSyntaxTree.cs (3)
43Debug.Assert(root != null); 44Debug.Assert(options != null); 45Debug.Assert(textOpt == null || textOpt.Encoding == encodingOpt && textOpt.ChecksumAlgorithm == checksumAlgorithm);
Syntax\InternalSyntax\CSharpSyntaxNode.cs (1)
84System.Diagnostics.Debug.Assert(index < 11); // Max. slots 11 (TypeDeclarationSyntax)
Syntax\InternalSyntax\SyntaxFactory.cs (4)
136Debug.Assert(SyntaxFacts.IsAnyToken(kind)); 137Debug.Assert(kind != SyntaxKind.IdentifierToken); 138Debug.Assert(kind != SyntaxKind.CharacterLiteralToken); 139Debug.Assert(kind != SyntaxKind.NumericLiteralToken);
Syntax\InternalSyntax\SyntaxFirstTokenReplacer.cs (2)
34Debug.Assert(replacer._foundOldToken); 47Debug.Assert(token == _oldToken);
Syntax\InternalSyntax\SyntaxLastTokenReplacer.cs (2)
33Debug.Assert(replacer._found); 52Debug.Assert(token == _oldToken);
Syntax\InternalSyntax\SyntaxToken.cs (2)
364System.Diagnostics.Debug.Assert(this.GetType() == typeof(SyntaxToken)); 370System.Diagnostics.Debug.Assert(this.GetType() == typeof(SyntaxToken));
Syntax\InternalSyntax\SyntaxTrivia.cs (1)
50Debug.Assert(this.FullWidth == this.Text.Length);
Syntax\LambdaUtilities.cs (7)
55Debug.Assert(lambdaBody.Parent is object); 63Debug.Assert(lambda.IsKind(SyntaxKind.LocalFunctionStatement)); 66Debug.Assert(IsLambda(lambda)); 75Debug.Assert(oldBody.Parent is object); 107Debug.Assert(oldJoin.LeftExpression == oldBody || oldJoin.RightExpression == oldBody); 113Debug.Assert(oldGroup.GroupExpression == oldBody || oldGroup.ByExpression == oldBody); 230Debug.Assert(selectOrGroupClause.Parent!.Parent is object);
Syntax\LookupPosition.cs (17)
128Debug.Assert(methodDecl != null); 142Debug.Assert(accessorDecl != null); 151Debug.Assert(delegateDecl != null); 158Debug.Assert(typeDecl != null); 165Debug.Assert(namespaceDecl != null); 172Debug.Assert(namespaceDecl != null); 179Debug.Assert(constructorDecl != null); 200Debug.Assert(methodDecl != null); 201Debug.Assert(IsInMethodDeclaration(position, methodDecl)); 231Debug.Assert(localFunction != null); 264Debug.Assert(statement != null); 284Debug.Assert(section != null); 294Debug.Assert(catchClause != null); 305Debug.Assert(filterClause != null); 312Debug.Assert(statement != null); 374Debug.Assert(statement != null); 475Debug.Assert(lambdaExpressionOrQueryNode.IsAnonymousFunction() || lambdaExpressionOrQueryNode.IsQuery());
Syntax\NamespaceDeclarationSyntaxReference.cs (1)
40Debug.Assert(node is CompilationUnitSyntax || node is BaseNamespaceDeclarationSyntax);
Syntax\NullableContextStateMap.cs (6)
55Debug.Assert(contexts[i - 1].Position < contexts[i].Position); 79Debug.Assert(index >= -1); 80Debug.Assert(index < _contexts.Length); 84Debug.Assert(_contexts[index].Position <= position); 85Debug.Assert(index == _contexts.Length - 1 || position < _contexts[index + 1].Position); 108Debug.Assert(context.Position <= span.Start);
Syntax\StructuredTriviaSyntax.cs (1)
19System.Diagnostics.Debug.Assert(parent == null || position >= 0);
Syntax\SyntaxEquivalence.cs (2)
36Debug.Assert(!topLevel || ignoreChildNode == null); 69Debug.Assert(before.RawKind == after.RawKind);
Syntax\SyntaxExtensions.cs (7)
133Debug.Assert(attributeSyntax.Parent is object); 142Debug.Assert(parent.Name.Prefix is null); 148Debug.Assert(parent.Name.Prefix is null); 198Debug.Assert(typeNode != null); 235Debug.Assert(node != null); 353Debug.Assert(expr.Kind() == SyntaxKind.TupleExpression || expr.Kind() == SyntaxKind.DeclarationExpression || expr.Kind() == SyntaxKind.IdentifierName); 443Debug.Assert(paramType is object);
Syntax\SyntaxFactory.cs (5)
1623Debug.Assert(leadingTrivia.Count == 1); 1626Debug.Assert(structure.Content.Count == 2); 1628Debug.Assert(elementSyntax.Attributes.Count == 1); 1912Debug.Assert(red._syntaxTree is null); 2258Debug.Assert(currentNode.Kind() == SyntaxKind.MemberBindingExpression ||
Syntax\SyntaxFacts.cs (1)
583Debug.Assert(node.Green == current || current is not Syntax.InternalSyntax.MemberDeclarationSyntax and not Syntax.InternalSyntax.TypeDeclarationSyntax);
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));
Syntax\SyntaxNodeExtensions.cs (5)
20Debug.Assert(syntax != null); 34Debug.Assert(syntax != null); 148Debug.Assert(node != null); 265Debug.Assert( 370Debug.Assert(invocation.Expression is not QualifiedNameSyntax);
Syntax\SyntaxNodeRemover.cs (2)
326Debug.Assert(node.Parent is object); 366Debug.Assert(node.Parent is object);
Syntax\SyntaxNormalizer.cs (3)
334Debug.Assert(openBraceToken.IsKind(SyntaxKind.OpenBraceToken)); 351Debug.Assert(closeBraceToken.IsKind(SyntaxKind.CloseBraceToken)); 464Debug.Assert(((PropertyDeclarationSyntax)currentToken.Parent).SemicolonToken == currentToken);
Syntax\SyntaxTreeDiagnosticEnumerator.cs (9)
61Debug.Assert(_syntaxTree is object); 111get { Debug.Assert(_current is object); return _current; } 135Debug.Assert(capacity > 0); 204Debug.Assert(_stack != null); 205Debug.Assert(index >= 0 && index < _count); 212Debug.Assert(_stack != null); 213Debug.Assert(_count > 0); 219Debug.Assert(_stack != null); 220Debug.Assert(_count > 0);
Utilities\FirstAmongEqualsSet.cs (1)
76Debug.Assert(_hashSet.Count == 0);
Utilities\InterceptableLocation.cs (5)
66Debug.Assert(checksum.Length == ContentHashLength); 67Debug.Assert(path is not null); 68Debug.Assert(position >= 0); 69Debug.Assert(lineNumberOneIndexed > 0); 70Debug.Assert(characterNumberOneIndexed > 0);
Utilities\TypeSymbolExtensions.cs (1)
213Debug.Assert(visited == null || !visited.Contains(type.OriginalDefinition));
Utilities\ValueSetFactory.BoolValueSetFactory.cs (1)
60Debug.Assert(relation == BinaryOperatorKind.Equal);
Utilities\ValueSetFactory.ByteTC.cs (2)
45Debug.Assert(value != byte.MaxValue); 51Debug.Assert(value != byte.MinValue);
Utilities\ValueSetFactory.CharTC.cs (2)
45Debug.Assert(value != char.MaxValue); 58Debug.Assert(value != char.MinValue);
Utilities\ValueSetFactory.DecimalTC.cs (8)
41Debug.Assert(value != decimal.MaxValue); 45Debug.Assert(scale == DecimalRep.FromValue(value).Normalize().scale); // assert that the input is normalized 53Debug.Assert(!(scale < 28 && low == transitionLow && mid == transitionMid && high == transitionHigh)); 59Debug.Assert(high > 0); // otherwise value == 0m 77Debug.Assert(scale > 0); // otherwise value == decimal.MaxValue 83Debug.Assert(new DecimalRep(low: low, mid: mid, high: high, isNegative: isNegative, scale: scale).Value <= value); 84Debug.Assert(result > value); 185Debug.Assert(scale <= maxScale);
Utilities\ValueSetFactory.DoubleTC.cs (2)
33Debug.Assert(!double.IsNaN(value)); 34Debug.Assert(value != double.PositiveInfinity);
Utilities\ValueSetFactory.EnumeratedValueSet.cs (3)
122Debug.Assert(object.ReferenceEquals(this._tc, other._tc)); 145Debug.Assert(object.ReferenceEquals(this._tc, other._tc)); 168Debug.Assert(object.ReferenceEquals(this._tc, other._tc));
Utilities\ValueSetFactory.EnumeratedValueSetFactory.cs (2)
43Debug.Assert(relation == BinaryOperatorKind.Equal); 51Debug.Assert(result.IsEmpty);
Utilities\ValueSetFactory.FloatingValueSet.cs (4)
61Debug.Assert(sample is { }); 65Debug.Assert(_hasNaN); 103Debug.Assert(object.ReferenceEquals(this._tc, other._tc)); 118Debug.Assert(object.ReferenceEquals(this._tc, other._tc));
Utilities\ValueSetFactory.IntTC.cs (2)
55Debug.Assert(value != int.MaxValue); 61Debug.Assert(value != MinValue);
Utilities\ValueSetFactory.LongTC.cs (2)
45Debug.Assert(value != long.MaxValue); 51Debug.Assert(value != long.MinValue);
Utilities\ValueSetFactory.NumericValueSet.cs (9)
33Debug.Assert(tc.Related(LessThanOrEqual, first, last)); 39Debug.Assert(intervals.Length == 0 || tc.Related(GreaterThanOrEqual, intervals[0].first, tc.MinValue)); 42Debug.Assert(tc.Related(LessThanOrEqual, intervals[i].first, intervals[i].last)); 46Debug.Assert(tc.Related(LessThan, tc.Next(intervals[i - 1].last), intervals[i].first)); 165Debug.Assert(this._tc.GetType() == other._tc.GetType()); 211Debug.Assert(tc.Related(LessThanOrEqual, first, last)); 212Debug.Assert(tc.Related(GreaterThanOrEqual, first, tc.MinValue)); 213Debug.Assert(tc.Related(LessThanOrEqual, last, tc.MaxValue)); 242Debug.Assert(this._tc.GetType() == other._tc.GetType());
Utilities\ValueSetFactory.SByteTC.cs (2)
44Debug.Assert(value != sbyte.MaxValue); 50Debug.Assert(value != sbyte.MinValue);
Utilities\ValueSetFactory.ShortTC.cs (2)
45Debug.Assert(value != short.MaxValue); 51Debug.Assert(value != short.MinValue);
Utilities\ValueSetFactory.SingleTC.cs (2)
33Debug.Assert(!float.IsNaN(value)); 34Debug.Assert(value != float.PositiveInfinity);
Utilities\ValueSetFactory.StringTC.cs (4)
20Debug.Assert(result != null); 26Debug.Assert(count > 0); 27Debug.Assert(scope >= count); 40Debug.Assert(next == count);
Utilities\ValueSetFactory.UIntTC.cs (2)
45Debug.Assert(value != uint.MaxValue); 57Debug.Assert(value != uint.MinValue);
Utilities\ValueSetFactory.ULongTC.cs (2)
45Debug.Assert(value != ulong.MaxValue); 51Debug.Assert(value != ulong.MinValue);
Utilities\ValueSetFactory.UShortTC.cs (2)
45Debug.Assert(value != ushort.MaxValue); 57Debug.Assert(value != ushort.MinValue);
Microsoft.CodeAnalysis.CSharp.CodeStyle (58)
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)
38Debug.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); 332Debug.Assert(char.IsSurrogate(ch)); 342Debug.Assert(tokenText[index] == '\\'); 355Debug.Assert(tokenText[index] == '\\'); 389Debug.Assert(tokenText[index] == '\\'); 408Debug.Assert(tokenText[index] == '\\'); 453Debug.Assert(uintChar is > 0x0000FFFF and <= 0x0010FFFF); 493Debug.Assert(character == 'x'); 525Debug.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.cs (10)
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); 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)
792Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 1178Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1234Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1264Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1444Debug.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 (19)
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\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
66Debug.Assert(diagnostic.Properties[Constants.Kind] == Constants.SingleIfStatementForm);
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)
176Debug.Assert(typeSymbol.IsTupleType); 178Debug.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.Emit3.UnitTests (2)
Semantics\ExtensionTests.cs (2)
20667Debug.Assert(false); 20718Debug.Assert(false);
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider (17)
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 (2)
91Debug.Assert(!sawSingleInvalidIdentifier); 102Debug.Assert(rank > 0);
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.CSharp.Features (123)
BraceCompletion\CurlyBraceCompletionService.cs (1)
109Debug.Assert(s_instances[(int)indentStyle]._indentStyle == indentStyle);
ChangeSignature\UnifiedArgumentSyntax.cs (2)
19Debug.Assert(argument.Kind() is SyntaxKind.Argument or SyntaxKind.AttributeArgument); 41Debug.Assert(nameColonSyntax is NameColonSyntax);
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.FixAllProvider.cs (1)
36Debug.Assert(fixAllContext.Scope == FixAllScope.Solution);
CodeRefactorings\InlineTemporary\InlineTemporaryCodeRefactoringProvider.cs (2)
363Debug.Assert(variableDeclaration.Variables.Count > 1); 364Debug.Assert(variableDeclaration.Variables.Contains(variableDeclarator));
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (4)
243Debug.Assert(!declaredNamespaceParts.IsDefault && !targetNamespaceParts.IsDefault); 320Debug.Assert(!compilationUnit.Members.Any(m => m is BaseNamespaceDeclarationSyntax)); 423Debug.Assert(part.Length > 0); 436Debug.Assert(part.Length > 0);
CodeRefactorings\UseExplicitOrImplicitType\AbstractUseTypeCodeRefactoringProvider.cs (1)
41Debug.Assert(declaration.Kind() is SyntaxKind.VariableDeclaration or SyntaxKind.ForEachStatement or SyntaxKind.DeclarationExpression);
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (4)
108Debug.Assert(leftTarget == isPatternExpression.Pattern); 109Debug.Assert(leftReceiver == isPatternExpression.Expression); 324Debug.Assert(containingPattern.Kind() is SyntaxKind.VarPattern or SyntaxKind.DeclarationPattern or SyntaxKind.RecursivePattern); 382Debug.Assert(!names.IsDefaultOrEmpty);
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (1)
105Debug.Assert(IsClassOrStructOrInterfaceOrRecord(typeDeclaration));
ConvertBetweenRegularAndVerbatimString\AbstractConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider.cs (1)
164Debug.Assert(!chars.IsDefault);
ConvertIfToSwitch\CSharpConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
110Debug.Assert(operation.SemanticModel is not null);
ConvertToRawString\ConvertStringToRawStringCodeRefactoringProvider.cs (1)
145Debug.Assert(equivalenceKey != null);
Debugging\BreakpointResolver.cs (1)
48Debug.Assert(text != null);
Diagnostics\Analyzers\CSharpSimplifyTypeNamesDiagnosticAnalyzer.cs (1)
53Debug.Assert(context.CodeBlock.DescendantNodesAndSelf().Contains(root));
EditAndContinue\BreakpointSpans.cs (5)
124Debug.Assert(startFallbackOpt != default || endOpt != default); 486Debug.Assert(typeDeclaration.ParameterList != null); 492Debug.Assert(typeDeclaration.ParameterList != null); 952Debug.Assert(((ArrowExpressionClauseSyntax)parent).Expression == expression); 956Debug.Assert(((SwitchExpressionArmSyntax)parent).Expression == expression);
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (36)
114Debug.Assert(((PropertyDeclarationSyntax)current).Initializer != null); 137Debug.Assert(current.Parent.IsKind(SyntaxKind.VariableDeclaration)); 161Debug.Assert(current.Parent.IsKind(SyntaxKind.CompilationUnit)); 222Debug.Assert(!isBody); 230Debug.Assert(position == ((DoStatementSyntax)node).WhileKeyword.SpanStart); 231Debug.Assert(!isBody); 238Debug.Assert(position == ((PropertyDeclarationSyntax)node).Initializer!.SpanStart); 246Debug.Assert(!isBody); 266Debug.Assert(span.End == switchExpression.CloseBraceToken.Span.End); 274Debug.Assert(position == switchExpression.Span.Start); 289Debug.Assert(position == ((SwitchExpressionArmSyntax)node).Expression.SpanStart); 290Debug.Assert(!isBody); 423Debug.Assert(oldBody is ExpressionSyntax or BlockSyntax); 424Debug.Assert(newBody is ExpressionSyntax or BlockSyntax); 586Debug.Assert(statementPart is DefaultStatementPart or (int)BlockPart.OpenBrace or (int)BlockPart.CloseBrace); 606Debug.Assert(statementPart == DefaultStatementPart); 615Debug.Assert(statementPart == DefaultStatementPart); 638Debug.Assert(statementPart == DefaultStatementPart); 658Debug.Assert(statementPart == DefaultStatementPart); 1115Debug.Assert(matchingNewContainingMemberOrType == null); 1290Debug.Assert(oldCopyConstructor != null || newCopyConstructor != null); 1308Debug.Assert(node.Parent.IsKind(SyntaxKind.AccessorList)); 1357Debug.Assert(oldNode.RawKind == newNode.RawKind); 1358Debug.Assert(SupportsMove(oldNode)); 1359Debug.Assert(SupportsMove(newNode)); 1417Debug.Assert(node is null or ParameterSyntax or TypeParameterSyntax or TypeParameterConstraintClauseSyntax); 1424Debug.Assert(otherNode != null); 1571Debug.Assert(oldParameters.Length is 1 or 2); 1572Debug.Assert(newParameters.Length is 1 or 2); 1939Debug.Assert(ordinal >= 0); 1947Debug.Assert(ordinal == 0); 2262Debug.Assert(((CommonForEachStatementSyntax)node).AwaitKeyword.IsKind(SyntaxKind.AwaitKeyword)); 2614Debug.Assert(current.Parent != null); 2630Debug.Assert(edit.Kind != EditKind.Update || edit.OldNode.RawKind == edit.NewNode.RawKind); 2766Debug.Assert(awaitExpression.IsKind(SyntaxKind.AwaitExpression)); 2876Debug.Assert(newActiveStatement.IsKind(SyntaxKind.WhenClause));
EditAndContinue\DeclarationBody\InstanceConstructorDeclarationBody.cs (3)
51Debug.Assert(partnerCtorBody == null || partnerCtorBody.HasExplicitInitializer); 61Debug.Assert(ExplicitBody != null); 64Debug.Assert(partnerCtorBody == null || partnerCtorBody.ExplicitBody != null);
EditAndContinue\DeclarationBody\PropertyOrIndexerAccessorDeclarationBody.cs (3)
84Debug.Assert(partnerDeclarationBody is null or PropertyOrIndexerAccessorDeclarationBody { HeaderActiveStatement: not null }); 91Debug.Assert(ExplicitBody != null); 92Debug.Assert(partnerDeclarationBody is null or PropertyOrIndexerAccessorDeclarationBody { ExplicitBody: not null });
EditAndContinue\SyntaxComparer.cs (4)
1508Debug.Assert(GetLabel(oldNode) == GetLabel(newNode) && GetLabel(oldNode) != IgnoredNode); 1544Debug.Assert(newNodeOrToken.IsToken == oldNodeOrToken.IsToken); 1553Debug.Assert(!SyntaxFactory.AreEquivalent(leftToken, rightToken) || distance == ExactMatchDist); 1561Debug.Assert(!SyntaxFactory.AreEquivalent(leftNode, rightNode) || distance == ExactMatchDist);
EditAndContinue\SyntaxUtilities.cs (3)
95Debug.Assert(allowLambda); 96Debug.Assert(syntax is ExpressionSyntax or BlockSyntax); 130Debug.Assert(false);
GenerateType\CSharpGenerateTypeService.cs (1)
628Debug.Assert(name is SimpleNameSyntax);
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (1)
82Debug.Assert(gotoOperation is { BranchKind: BranchKind.GoTo });
Highlighting\KeywordHighlighters\LoopHighlighter.cs (1)
82Debug.Assert(highlightBreaks || highlightContinues);
Highlighting\KeywordHighlighters\SwitchStatementHighlighter.cs (1)
60Debug.Assert(highlightBreaks || highlightGotos);
InitializeParameter\CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider_Update.cs (3)
30Debug.Assert(parameters.Length >= 1); 31Debug.Assert(fieldsOrProperties.Length >= 1); 32Debug.Assert(parameters.Length == fieldsOrProperties.Length);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceLocal.cs (2)
312Debug.Assert(matches.Contains(expression)); 378Debug.Assert(matches.Contains(expression));
Organizing\Organizers\MemberDeclarationsOrganizer.cs (1)
44Debug.Assert(originalList.Count == finalList.Count);
SignatureHelp\LightweightOverloadResolution.cs (3)
103Debug.Assert(foundParameterIndex < parameters.Length); 224Debug.Assert(parameterIndex >= 0); 225Debug.Assert(parameterIndex < method.Parameters.Length);
SignatureHelp\ObjectCreationExpressionSignatureHelpProvider.cs (2)
114Debug.Assert(type.TypeKind == TypeKind.Delegate); 115Debug.Assert(objectCreationExpression.ArgumentList is not null);
Snippets\AbstractCSharpForLoopSnippetProvider.cs (1)
78Debug.Assert(inlineExpressionType is not null);
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)
38Debug.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\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\InvokeDelegateWithConditionalAccess\InvokeDelegateWithConditionalAccessCodeFixProvider.cs (1)
66Debug.Assert(diagnostic.Properties[Constants.Kind] == Constants.SingleIfStatementForm);
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)
176Debug.Assert(typeSymbol.IsTupleType); 178Debug.Assert(elements.Length == parensDesignation.Variables.Count);
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpDeclarationComputer.cs (1)
110Debug.Assert(ctor.MethodKind == MethodKind.Constructor && typeDeclaration.ParameterList is object);
src\Compilers\CSharp\Portable\Syntax\LambdaUtilities.cs (7)
55Debug.Assert(lambdaBody.Parent is object); 63Debug.Assert(lambda.IsKind(SyntaxKind.LocalFunctionStatement)); 66Debug.Assert(IsLambda(lambda)); 75Debug.Assert(oldBody.Parent is object); 107Debug.Assert(oldJoin.LeftExpression == oldBody || oldJoin.RightExpression == oldBody); 113Debug.Assert(oldGroup.GroupExpression == oldBody || oldGroup.ByExpression == oldBody); 230Debug.Assert(selectOrGroupClause.Parent!.Parent is object);
UseExpressionBody\UseExpressionBodyCodeRefactoringProvider.cs (1)
192Debug.Assert(equivalenceKey != null);
UsePatternMatching\CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs (1)
46Debug.Assert(diagnostics.Length == 1);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\BetterCandidates.cs (1)
32Debug.Assert(TestOptions.Regular.LanguageVersion >= MessageID.IDS_FeatureImprovedOverloadCandidates.RequiredVersion());
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (1)
Parsing\ParsingTests.cs (1)
111Debug.Assert(node is object);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (13)
CSharpTestBase.cs (6)
2318Debug.Assert(bindingDiagnostics.DiagnosticBag is not null); 2324Debug.Assert(saveUICulture is not null); 2400Debug.Assert(typeName is not null); 2404Debug.Assert(type is not null); 2471Debug.Assert(builder.LocalSlotManager != null); 2904Debug.Assert(returnExpression == null || useBoolReturns);
CSharpTestSource.cs (7)
53Debug.Assert(string.IsNullOrEmpty(sourceFileName)); 56Debug.Assert(string.IsNullOrEmpty(sourceFileName)); 59Debug.Assert(string.IsNullOrEmpty(sourceFileName)); 62Debug.Assert(parseOptions == null); 63Debug.Assert(string.IsNullOrEmpty(sourceFileName)); 66Debug.Assert(parseOptions == null); 67Debug.Assert(string.IsNullOrEmpty(sourceFileName));
Microsoft.CodeAnalysis.CSharp.Workspaces (62)
Classification\Worker.cs (1)
71Debug.Assert(nodeOrToken.IsNode || nodeOrToken.IsToken);
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (1)
644Debug.Assert(IsExtensionMethod(methodDeclaration));
Recommendations\CSharpRecommendationServiceRunner.cs (1)
835Debug.Assert(!excludeInstance || !excludeStatic);
Simplification\CSharpSimplificationService.cs (1)
205Debug.Assert(tuple.IsKind(SyntaxKind.TupleExpression));
Simplification\CSharpSimplificationService.Expander.cs (3)
591Debug.Assert(name.StartsWith(originalSimpleName.Identifier.ValueText, StringComparison.Ordinal)); 894Debug.Assert(!replaceNode || rewrittenNode.Kind() == SyntaxKind.IdentifierName); 966Debug.Assert(rewrittenNode is SimpleNameSyntax);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (9)
59Debug.Assert(!token.ContainsDiagnostics); 332Debug.Assert(char.IsSurrogate(ch)); 342Debug.Assert(tokenText[index] == '\\'); 355Debug.Assert(tokenText[index] == '\\'); 389Debug.Assert(tokenText[index] == '\\'); 408Debug.Assert(tokenText[index] == '\\'); 453Debug.Assert(uintChar is > 0x0000FFFF and <= 0x0010FFFF); 493Debug.Assert(character == 'x'); 525Debug.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.cs (10)
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); 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)
792Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 1178Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1234Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1264Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1444Debug.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));
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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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 (36)
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);
Editor\EditorLayerExtensionManager.cs (1)
50Debug.Assert(exception is not OperationCanceledException);
InlineDiagnostics\InlineDiagnosticsTaggerProvider.cs (1)
52Debug.Assert(!string.IsNullOrWhiteSpace(diagnostic.Message));
InlineRename\InlineRenameSession.cs (3)
272Debug.Assert(buffer.GetRelatedDocuments().Count() == 1); 273Debug.Assert(buffer.IsReadOnly(0) == buffer.IsReadOnly(VisualStudio.Text.Span.FromBounds(0, buffer.CurrentSnapshot.Length))); // All or nothing. 646Debug.Assert(outcome.HasFlag(RenameLogMessage.UserActionOutcome.Canceled));
InlineRename\InlineRenameSession.OpenTextBufferManager.cs (1)
248Debug.Assert(trackingSpansTouched.Count() == 1);
InlineRename\UI\Adornment\RenameFlyoutViewModel.cs (1)
263Debug.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)
516Debug.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);
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (1)
194Debug.Assert(newFullText.ToString() == documentWithOriginalName.GetTextSynchronously(cancellationToken).ToString());
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)
59Debug.Assert(sta.StaThread == Thread.CurrentThread); 65Debug.Assert(SynchronizationContext.Current is DispatcherSynchronizationContext);
Microsoft.CodeAnalysis.EditorFeatures.Text (1)
Shared\Extensions\TextSpanExtensions.cs (1)
29Debug.Assert(snapshot != null);
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (38)
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 (4)
219Debug.Assert(corLibrary != null); 271Debug.Assert(modules.Count == identities.Count); 310Debug.Assert(referencedIndices.Count <= modules.Count); 311Debug.Assert(referencedIndices.Count <= referencedModules.Count);
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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
330Debug.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)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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.ExternalAccess.Razor.Features (1)
RazorMappingServiceWrapper.cs (1)
46Debug.Assert(i == changesCount);
Microsoft.CodeAnalysis.Features (482)
AddFileBanner\AbstractAddFileBannerCodeRefactoringProvider.cs (2)
155Debug.Assert(equivalenceKey != null); 164Debug.Assert(banner.Length > 0);
AddImport\SearchScopes\SearchScope.cs (1)
69Debug.Assert(areSimilar);
AddImport\SymbolResult.cs (1)
43Debug.Assert(DesiredNameDiffersFromSourceName());
BraceCompletion\AbstractBraceCompletionService.cs (1)
58Debug.Assert(context.HasCompletionForOpeningBrace(OpeningBrace));
CodeFixes\Configuration\ConfigurationUpdater.cs (6)
85Debug.Assert(configurationKind != ConfigurationKind.OptionValue || !string.IsNullOrEmpty(newOptionValueOpt)); 86Debug.Assert(!string.IsNullOrEmpty(newSeverity)); 87Debug.Assert(diagnosticToConfigure != null ^ categoryToBulkConfigure != null); 88Debug.Assert((categoryToBulkConfigure != null) == (configurationKind == ConfigurationKind.BulkConfigure)); 236Debug.Assert(!string.IsNullOrEmpty(optionName)); 237Debug.Assert(optionValue != null);
CodeFixes\Service\CodeFixService.cs (1)
481Debug.Assert(!isInteractive);
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (3)
116Debug.Assert(!diagnostics.IsDefault); 319Debug.Assert(orderedDocuments.Length > 1); 330Debug.Assert(currentDocument.Id == oldDocument.Id);
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (2)
62Debug.Assert(unambiguousFixes.All(d => d.Kind == AddImportFixKind.ProjectSymbol)); 169Debug.Assert(textChanges.Last().Span.IntersectsWith(insertSpan.End));
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (1)
280Debug.Assert(!removableCandidates.Contains(ancestor));
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (4)
163Debug.Assert(namespaces.Length == originalNamespaceDeclarations.Length); 559Debug.Assert(newNamespace != null); 597Debug.Assert(containersToAddImports.Length > 0); 752Debug.Assert(document.Id == refLoc.Document.Id);
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs (2)
53Debug.Assert(state.RelativeDeclaredNamespace != null); 65Debug.Assert(parts.IsEmpty || parts.Any(static s => s.IndexOfAny(Path.GetInvalidPathChars()) < 0));
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.State.cs (1)
202Debug.Assert(relativeTo != null && @namespace != null);
Completion\CompletionContext.cs (1)
98Debug.Assert(!Provider.IsExpandItemProvider);
Completion\CompletionHelper.cs (1)
273Debug.Assert(isItem1Expanded && match1.Kind == PatternMatchKind.Exact && !isItem2Expanded && match2.Kind > PatternMatchKind.Prefix ||
Completion\CompletionService.cs (1)
262Debug.Assert(item.Span == change.TextChange.Span || item.IsComplexTextEdit);
Completion\CompletionService_GetCompletions.cs (3)
141Debug.Assert(ValidatePossibleTriggerCharacterSet(trigger.Kind, triggeredProviders, document, text, caretPosition, options)); 257Debug.Assert(!completionContexts.IsDefaultOrEmpty); 266Debug.Assert(item != null);
Completion\FileSystemCompletionHelper.cs (1)
43Debug.Assert(searchPaths.All(PathUtilities.IsAbsolute));
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (1)
242Debug.Assert(targetSelectionSpan.End < destinationSpan.Start);
Completion\Providers\ImportCompletionProvider\ImportCompletionItem.cs (1)
96Debug.Assert(!attributeItem.TryGetProperty(AttributeFullName, out var _));
Completion\Providers\Scripting\GlobalAssemblyCacheCompletionHelper.cs (1)
25Debug.Assert(itemRules != null);
ConvertAnonymousType\AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs (2)
83Debug.Assert(anonymousObject != null); 84Debug.Assert(anonymousType != null);
ConvertIfToSwitch\AbstractConvertIfToSwitchCodeRefactoringProvider.Rewriting.cs (1)
54Debug.Assert(root is object); // we didn't remove the root
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (1)
191Debug.Assert(remainingArgCount > 0);
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (3)
268Debug.Assert(tupleExprOrTypeNode != null); 269Debug.Assert(tupleType != null); 370Debug.Assert(documentToUpdate.NodesToUpdate.IsDefault ||
Debugging\AbstractBreakpointResolver.cs (2)
174Debug.Assert(type != null); 175Debug.Assert(names.Length >= 2);
Debugging\DebugInformationReaderProvider.cs (1)
96Debug.Assert(OperatingSystem.IsWindows());
Diagnostics\DiagnosticsUpdatedArgs.cs (2)
34Debug.Assert(diagnostics.All(d => d.ProjectId == projectId && d.DocumentId == documentId)); 35Debug.Assert(kind != DiagnosticsUpdatedKind.DiagnosticsRemoved || diagnostics.IsEmpty);
Diagnostics\Service\DocumentAnalysisExecutor.cs (3)
145Debug.Assert(diags.Length == CompilationWithAnalyzers.GetEffectiveDiagnostics(diags, compilation).Count()); 146Debug.Assert(diagnostics.Length == Extensions.ConvertToLocalDiagnostics(diags, textDocument, span).Count()); 263Debug.Assert(isCompilerAnalyzer);
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.IncrementalMemberEditAnalyzer.cs (3)
60Debug.Assert(analyzers.All(analyzer => analyzer.SupportsSpanBasedSemanticDiagnosticAnalysis())); 173Debug.Assert(changedMember != null); 174Debug.Assert(analysisScope.Kind == AnalysisKind.Semantic);
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.StateManager.cs (2)
81Debug.Assert(analyzer != FileContentLoadAnalyzer.Instance && analyzer != GeneratorDiagnosticsPlaceholderAnalyzer.Instance); 90Debug.Assert(analyzer != FileContentLoadAnalyzer.Instance && analyzer != GeneratorDiagnosticsPlaceholderAnalyzer.Instance);
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (4)
203Debug.Assert(!incrementalAnalysis || kind == AnalysisKind.Semantic); 204Debug.Assert(!incrementalAnalysis || analyzers.All(analyzer => analyzer.SupportsSpanBasedSemanticDiagnosticAnalysis())); 209Debug.Assert(priorityProvider.MatchesPriority(analyzer)); 283Debug.Assert(span.Value.Length < text.Length);
DocumentationComments\AbstractDocumentationCommentSnippetService.cs (3)
186Debug.Assert(lines.Count > 2); 344Debug.Assert(lines.Count > 2); 351Debug.Assert(line.Start + lineOffset == startPosition);
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
243Debug.Assert(solution.WorkspaceKind is WorkspaceKind.Interactive or WorkspaceKind.MiscellaneousFiles);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (75)
587Debug.Assert(oldTree.Options.Equals(newTree.Options)); 656Debug.Assert(newActiveStatements.All(a => a != null)); 836Debug.Assert(!newActiveStatementSpans.IsDefault); 837Debug.Assert(oldActiveStatements.Length == newActiveStatements.Count); 838Debug.Assert(oldActiveStatements.Length == newExceptionRegions.Count); 1002Debug.Assert(!newActiveStatementSpans.IsDefault); 1003Debug.Assert(newActiveStatementSpans.IsEmpty || oldActiveStatements.Length == newActiveStatementSpans.Length); 1004Debug.Assert(oldActiveStatements.IsEmpty || oldActiveStatements.Length == newActiveStatements.Count); 1005Debug.Assert(newActiveStatements.Count == newExceptionRegions.Count); 1006Debug.Assert(oldMemberBody != null || newMemberBody != null); 1048Debug.Assert(oldDeclaration != null); 1054Debug.Assert(IsDeclarationWithSharedBody(oldDeclaration, oldMember)); 1068Debug.Assert(oldMemberBody != null); 1195Debug.Assert(oldMemberBody != null); 1196Debug.Assert(oldDeclaration != null); 1218Debug.Assert(lazyActiveOrMatchedLambdas != null); 1278Debug.Assert(oldEnclosingLambdaBody != null); 1279Debug.Assert(lazyActiveOrMatchedLambdas != null); 1324Debug.Assert(newSpan != default); 1334Debug.Assert(IsDeclarationWithSharedBody(oldDeclaration, oldMember)); 1445Debug.Assert(oldAncestors.Count == newAncestors.Count); 1636Debug.Assert(node != null); 1754Debug.Assert(hasAncestor && newAncestor != null); 1768Debug.Assert(hasAncestor && newAncestor != null); 2123Debug.Assert(editMap[newNode] is EditKind.Update or EditKind.Insert); 2185Debug.Assert(currentSegment.path != null); 2186Debug.Assert(lastOldStartLine >= 0); 2363Debug.Assert(previousOldEndLine >= 0); 2572Debug.Assert(inBreakState || newActiveStatementSpans.IsEmpty); 2598Debug.Assert(edit.OldNode is null || edit.NewNode is null || IsNamespaceDeclaration(edit.OldNode) == IsNamespaceDeclaration(edit.NewNode)); 2610Debug.Assert(oldSymbol is INamedTypeSymbol); 2611Debug.Assert(newSymbol is INamedTypeSymbol); 2628Debug.Assert(newTypeDeclaration != null); 2805Debug.Assert(oldSymbol is INamedTypeSymbol); 3083Debug.Assert(newDeclaration != null); 3084Debug.Assert(oldProperty.ContainingType.IsRecord); 3085Debug.Assert(newProperty.ContainingType.IsRecord); 3089Debug.Assert(synthesizedProperty.IsSynthesizedAutoProperty()); 3090Debug.Assert(synthesizedProperty.SetMethod != null); 3162Debug.Assert(newSymbol != null); 3389Debug.Assert(IsConstructorWithMemberInitializers(oldSymbol, cancellationToken) == IsConstructorWithMemberInitializers(newSymbol, cancellationToken)); 3390Debug.Assert(IsDeclarationWithInitializer(oldDeclaration) == IsDeclarationWithInitializer(newDeclaration)); 3560Debug.Assert(oldSymbol != null); 3561Debug.Assert(newSymbol != null); 3584Debug.Assert(member is IPropertySymbol or IMethodSymbol); 4054Debug.Assert(oldBody == null || oldDeclaration != null && oldMemberBody != null); 4055Debug.Assert(newBody == null || newDeclaration != null && newMemberBody != null); 4232Debug.Assert(ReturnTypesEquivalent(oldField, newField, exact: false)); 4254Debug.Assert(oldImportData.BestFitMapping == newImportData.BestFitMapping || 4309Debug.Assert(ReturnTypesEquivalent(oldMethod, newMethod, exact: false)); 4333Debug.Assert(ReturnTypesEquivalent(oldType.DelegateInvokeMethod, newType.DelegateInvokeMethod, exact: false)); 4343Debug.Assert(ReturnTypesEquivalent(oldProperty, newProperty, exact: false)); 4357Debug.Assert(ReturnTypesEquivalent(oldEvent, newEvent, exact: false)); 4458Debug.Assert(ParameterTypesEquivalent(oldMember.GetParameters(), newMember.GetParameters(), exact: true)); 4857Debug.Assert(recordType.IsRecord); 4871Debug.Assert(record.IsRecord); 4958Debug.Assert(oldSymbol != null); 5105Debug.Assert(newSymbol != null); 5290Debug.Assert(oldBody != null); 5291Debug.Assert(newBody != null); 5425Debug.Assert(oldCtor == null || MemberOrDelegateSignaturesEquivalent(oldCtor, newCtor, exact: false)); 5432Debug.Assert(newCtor.Parameters.IsEmpty); 5630Debug.Assert(IsNestedFunction(newLambda) == IsNestedFunction(oldLambda)); 6204Debug.Assert(!parameter.IsThis); 6248Debug.Assert(parameterKey.Syntax != null); 6369Debug.Assert(oldCapture.Kind == newCapture.Kind); 6443Debug.Assert(IsNestedFunction(newLambda)); 6444Debug.Assert(IsNestedFunction(oldLambda)); 6500Debug.Assert(local.Kind is not SymbolKind.RangeVariable); 6512Debug.Assert(node != null); 6600Debug.Assert(otherNode.SyntaxTree == otherRoot.SyntaxTree); 6601Debug.Assert(otherRoot.FullSpan.Contains(otherNode.SpanStart)); 6604Debug.Assert(otherNode.FullSpan.Length > 0); 6613Debug.Assert(otherNode.RawKind == rightNode.RawKind); 6617Debug.Assert(!leftChild.IsToken);
EditAndContinue\ActiveStatement.cs (1)
48Debug.Assert(!IsStale || !IsMethodUpToDate);
EditAndContinue\ActiveStatementsMap.cs (2)
51Debug.Assert(documentPathMap.All(entry => entry.Value.IsSorted(Comparer))); 182Debug.Assert(oldRoot.SyntaxTree == oldSyntaxTree);
EditAndContinue\CommittedSolution.cs (1)
298Debug.Assert(_solution.ContainsProject(documentId.ProjectId));
EditAndContinue\DebuggingSession.cs (4)
164Debug.Assert(!_isDisposed); 277Debug.Assert(project.SupportsEditAndContinue()); 777Debug.Assert(oldProject.SupportsEditAndContinue()); 778Debug.Assert(newProject.SupportsEditAndContinue());
EditAndContinue\DocumentActiveStatementChanges.cs (1)
28Debug.Assert(oldSpans[i].ExceptionRegions.Spans.Length == newExceptionRegions[i].Length);
EditAndContinue\DocumentAnalysisResults.cs (21)
122Debug.Assert(!rudeEdits.IsDefault); 123Debug.Assert(hasBlockingRudeEdits == (!rudeEdits.IsDefault && rudeEdits.HasBlockingRudeEdits())); 127Debug.Assert(activeStatementsOpt.IsDefault); 128Debug.Assert(semanticEditsOpt.IsDefault); 129Debug.Assert(exceptionRegionsOpt.IsDefault); 130Debug.Assert(lineEditsOpt.IsDefault); 131Debug.Assert(syntaxError != null || hasBlockingRudeEdits || !hasChanges); 132Debug.Assert(requiredCapabilities == EditAndContinueCapabilities.None); 136Debug.Assert(!activeStatementsOpt.IsDefault); 137Debug.Assert(syntaxError == null); 141Debug.Assert(semanticEditsOpt.IsDefault); 142Debug.Assert(exceptionRegionsOpt.IsDefault); 143Debug.Assert(lineEditsOpt.IsDefault); 144Debug.Assert(requiredCapabilities == EditAndContinueCapabilities.None); 148Debug.Assert(!semanticEditsOpt.IsDefault); 149Debug.Assert(!exceptionRegionsOpt.IsDefault); 150Debug.Assert(!lineEditsOpt.IsDefault); 153Debug.Assert(lineEditsOpt.Select(edit => edit.FileName).Distinct().Count() == lineEditsOpt.Length); 156Debug.Assert(lineEditsOpt.All(documentLineEdits => documentLineEdits.LineUpdates.IsSorted(Comparer<SourceLineUpdate>.Create( 159Debug.Assert(exceptionRegionsOpt.Length == activeStatementsOpt.Length); 160Debug.Assert(requiredCapabilities != EditAndContinueCapabilities.None);
EditAndContinue\DocumentSemanticModel.cs (1)
29Debug.Assert(syntaxTree.GetText().Length == 0);
EditAndContinue\EditAndContinueDiagnosticDescriptors.cs (1)
51Debug.Assert(!isNoEffect || severity == DiagnosticSeverity.Warning);
EditAndContinue\EditAndContinueDocumentAnalysesCache.cs (3)
163Debug.Assert(newMappedDocumentActiveSpan.UnmappedDocumentId == null || newMappedDocumentActiveSpan.UnmappedDocumentId == newDocument.Id); 177Debug.Assert(oldDocument == null || oldDocument.Project == oldProject); 178Debug.Assert(newDocument == null || newDocument.Project == newProject);
EditAndContinue\EditAndContinueMethodDebugInfoReader.cs (2)
48Debug.Assert(symReader != null); 49Debug.Assert(version >= 1);
EditAndContinue\EditSession.cs (11)
124Debug.Assert(emitResult.Success); 125Debug.Assert(emitResult.Baseline is not null); 508Debug.Assert(oldProject.Id == newProject.Id); 1319Debug.Assert(oldActiveStatements.Length == newExceptionRegions.Length); 1320Debug.Assert(newActiveStatements.Length == newExceptionRegions.Length); 1337Debug.Assert(!oldActiveStatement.IsStale); 1343Debug.Assert(string.Equals(oldSpan.Path, newSpan.Path, 1347Debug.Assert(oldActiveStatement.IsMethodUpToDate == newActiveStatement.IsMethodUpToDate); 1429Debug.Assert(newSpan.Span.End.Line - newSpan.Span.Start.Line == baseSpan.Span.End.Line - baseSpan.Span.Start.Line); 1430Debug.Assert(region.OldSpan.Span.End.Line - region.OldSpan.Span.Start.Line == baseSpan.Span.End.Line - baseSpan.Span.Start.Line); 1431Debug.Assert(newSpan.Path == region.OldSpan.Path);
EditAndContinue\EditSessionTelemetry.cs (1)
148Debug.Assert(_capabilities == EditAndContinueCapabilities.None || _capabilities == capabilities);
EditAndContinue\EmitSolutionUpdateResults.cs (4)
60Debug.Assert(SyntaxError.DataLocation != null); 61Debug.Assert(SyntaxError.Message != null); 165Debug.Assert(Solution != null); 166Debug.Assert(SyntaxError.Location.SourceTree != null);
EditAndContinue\ProjectChanges.cs (4)
46Debug.Assert(!semanticEdits.IsDefault); 47Debug.Assert(!lineChanges.IsDefault); 48Debug.Assert(!activeStatementChanges.IsDefault); 49Debug.Assert(requiredCapabilities != EditAndContinueCapabilities.None);
EditAndContinue\SemanticEditInfo.cs (4)
29Debug.Assert(runtimeRudeEdits == null || matchingNodes != null); 63Debug.Assert(!symbol.IsPartialDefinition()); 73Debug.Assert(!symbol.IsPartialDefinition()); 86Debug.Assert(!symbol.IsPartialDefinition());
EditAndContinue\TraceLog.cs (3)
63Debug.Assert(document.FilePath != null); 64Debug.Assert(document.Project.FilePath != null); 109Debug.Assert(document.FilePath != null);
EmbeddedLanguages\DateAndTime\LanguageServices\DateAndTimeLanguageDetector.cs (1)
169Debug.Assert(argName != null || argIndex != null);
EmbeddedLanguages\Json\JsonLexer.cs (5)
50Debug.Assert(chars.Length > 0); 62Debug.Assert(Position < Text.Length); 277Debug.Assert(IsAt("//")); 298Debug.Assert(IsAt("/*")); 311Debug.Assert(Position == Text.Length);
EmbeddedLanguages\Json\JsonNodes.cs (18)
21Debug.Assert(sequence != null); 22Debug.Assert(endOfFileToken.Kind == JsonKind.EndOfFile); 68Debug.Assert(textToken.Kind == JsonKind.TextToken); 95Debug.Assert(openBraceToken.Kind == JsonKind.OpenBraceToken); 96Debug.Assert(closeBraceToken.Kind == JsonKind.CloseBraceToken); 132Debug.Assert(openBracketToken.Kind == JsonKind.OpenBracketToken); 133Debug.Assert(sequence != null); 134Debug.Assert(closeBracketToken.Kind == JsonKind.CloseBracketToken); 167Debug.Assert(minusToken.Kind == JsonKind.MinusToken); 214Debug.Assert(commaToken.Kind == JsonKind.CommaToken); 240Debug.Assert(nameToken.Kind is JsonKind.StringToken or JsonKind.TextToken); 241Debug.Assert(colonToken.Kind == JsonKind.ColonToken); 242Debug.Assert(value != null); 280Debug.Assert(newKeyword.Kind == JsonKind.NewKeyword); 281Debug.Assert(nameToken.Kind == JsonKind.TextToken); 282Debug.Assert(openParenToken.Kind == JsonKind.OpenParenToken); 283Debug.Assert(sequence != null); 284Debug.Assert(closeParenToken.Kind == JsonKind.CloseParenToken);
EmbeddedLanguages\Json\JsonParser.cs (4)
123Debug.Assert(_lexer.Position == _lexer.Text.Length); 124Debug.Assert(_currentToken.Kind == JsonKind.EndOfFile); 409Debug.Assert(_currentToken.Kind == JsonKind.ColonToken); 471Debug.Assert(token.VirtualChars.Length > 0);
EmbeddedLanguages\Json\JsonParser.JsonNetSyntaxChecks.cs (2)
80Debug.Assert(chars.Length > 1); 111Debug.Assert(chars.Length > 1 && chars[0] == '0');
EmbeddedLanguages\Json\LanguageServices\AbstractJsonDetectionCodeFixProvider.cs (1)
49Debug.Assert(_info.IsAnyStringLiteral(stringLiteral.RawKind));
EmbeddedLanguages\RegularExpressions\RegexLexer.cs (6)
374Debug.Assert(Text[beforeSlash] == '\\'); 375Debug.Assert(Text[beforeSlash + 1].Value is 'x' or 'u'); 417Debug.Assert(Text[beforeSlash] == '\\'); 418Debug.Assert(IsOctalDigit(Text[start])); 428Debug.Assert(octalVal is >= 0 and <= 7); 444Debug.Assert(Position - start > 0);
EmbeddedLanguages\RegularExpressions\RegexNodes.cs (62)
21Debug.Assert(expression != null); 22Debug.Assert(endOfFileToken.Kind == RegexKind.EndOfFile); 76Debug.Assert(textToken.Kind == RegexKind.TextToken); 104Debug.Assert(openBracketToken.Kind == RegexKind.OpenBracketToken); 105Debug.Assert(components != null); 106Debug.Assert(closeBracketToken.Kind == RegexKind.CloseBracketToken); 147Debug.Assert(caretToken.Kind == RegexKind.CaretToken); 178Debug.Assert(left != null); 179Debug.Assert(minusToken.Kind == RegexKind.MinusToken); 180Debug.Assert(right != null); 216Debug.Assert(minusToken.Kind == RegexKind.MinusToken); 217Debug.Assert(characterClass != null); 269Debug.Assert(dotToken.Kind == RegexKind.DotToken); 308Debug.Assert(expression != null); 309Debug.Assert(asteriskToken.Kind == RegexKind.AsteriskToken); 340Debug.Assert(expression != null); 341Debug.Assert(plusToken.Kind == RegexKind.PlusToken); 372Debug.Assert(expression != null); 373Debug.Assert(questionToken.Kind == RegexKind.QuestionToken); 406Debug.Assert(quantifier != null); 407Debug.Assert(quantifier.Kind != RegexKind.LazyQuantifier); 408Debug.Assert(questionToken.Kind == RegexKind.QuestionToken); 440Debug.Assert(expression != null); 441Debug.Assert(openBraceToken.Kind == RegexKind.OpenBraceToken); 442Debug.Assert(firstNumberToken.Kind == RegexKind.NumberToken); 443Debug.Assert(closeBraceToken.Kind == RegexKind.CloseBraceToken); 489Debug.Assert(commaToken.Kind == RegexKind.CommaToken); 523Debug.Assert(commaToken.Kind == RegexKind.CommaToken); 524Debug.Assert(secondNumberToken.Kind == RegexKind.NumberToken); 558Debug.Assert(anchorToken.Kind is RegexKind.DollarToken or RegexKind.CaretToken); 585Debug.Assert(sequenceList.NodesAndTokens.Length > 0); 587Debug.Assert(sequenceList.NodesAndTokens[i].Kind == RegexKind.BarToken); 611Debug.Assert(openParenToken.Kind == RegexKind.OpenParenToken); 612Debug.Assert(closeParenToken.Kind == RegexKind.CloseParenToken); 629Debug.Assert(expression != null); 658Debug.Assert(questionToken.Kind == RegexKind.QuestionToken); 711Debug.Assert(colonToken.Kind == RegexKind.ColonToken); 712Debug.Assert(expression != null); 748Debug.Assert(colonToken.Kind == RegexKind.ColonToken); 749Debug.Assert(expression != null); 784Debug.Assert(equalsToken.Kind == RegexKind.EqualsToken); 785Debug.Assert(expression != null); 820Debug.Assert(exclamationToken.Kind == RegexKind.ExclamationToken); 821Debug.Assert(expression != null); 853Debug.Assert(lessThanToken.Kind == RegexKind.LessThanToken); 870Debug.Assert(equalsToken.Kind == RegexKind.EqualsToken); 871Debug.Assert(expression != null); 907Debug.Assert(exclamationToken.Kind == RegexKind.ExclamationToken); 908Debug.Assert(expression != null); 944Debug.Assert(greaterThanToken.Kind == RegexKind.GreaterThanToken); 945Debug.Assert(expression != null); 981Debug.Assert(expression != null); 1023Debug.Assert(minusToken.Kind == RegexKind.MinusToken); 1024Debug.Assert(expression != null); 1068Debug.Assert(result != null); 1086Debug.Assert(innerOpenParenToken.Kind == RegexKind.OpenParenToken); 1087Debug.Assert(innerCloseParenToken.Kind == RegexKind.CloseParenToken); 1129Debug.Assert(grouping != null); 1159Debug.Assert(backslashToken.Kind == RegexKind.BackslashToken); 1188Debug.Assert(typeToken.Kind == RegexKind.TextToken); 1417Debug.Assert(openBraceToken.Kind == RegexKind.OpenBraceToken); 1418Debug.Assert(closeBraceToken.Kind == RegexKind.CloseBraceToken);
EmbeddedLanguages\RegularExpressions\RegexParser.CaptureInfoAnalyzer.cs (1)
141Debug.Assert(!grouping.OpenParenToken.IsMissing);
EmbeddedLanguages\RegularExpressions\RegexParser.cs (24)
168Debug.Assert(_lexer.Position == _lexer.Text.Length); 169Debug.Assert(_currentToken.Kind == RegexKind.EndOfFile); 623Debug.Assert(token.Value == null); 917Debug.Assert(_currentToken.Kind == RegexKind.OpenParenToken); 1223Debug.Assert(openBracketToken.Kind == RegexKind.OpenBracketToken); 1244Debug.Assert(_currentToken.VirtualChars.Length == 1); 1382Debug.Assert(sequence.ChildCount > 0); 1384Debug.Assert(IsEscapedMinus(sequence.ChildAt(i).Node)); 1416Debug.Assert(RegexLexer.IsHexChar(ch)); 1477Debug.Assert(_currentToken.VirtualChars.Length == 1); 1563Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1576Debug.Assert(_currentToken.VirtualChars.Length == 1); 1609Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1622Debug.Assert(_currentToken.VirtualChars.Length == 1); 1647Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1662Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1701Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1723Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1724Debug.Assert(_lexer.Text[_lexer.Position].Value is '<' or '\''); 1806Debug.Assert(_lexer.Text[_lexer.Position - 1] == '\\'); 1810Debug.Assert(_currentToken.VirtualChars.Length == 1); 1817Debug.Assert(octalDigits.VirtualChars.Length > 0); 1884Debug.Assert(_currentToken.VirtualChars.Length == 1); 1930Debug.Assert(_lexer.Text[_lexer.Position - 1] is var ch && (ch == 'P' || ch == 'p'));
EmbeddedLanguages\StackFrame\StackFrameLexer.cs (1)
419Debug.Assert(virtualChars.Length > 0);
EmbeddedLanguages\StackFrame\StackFrameNodeDefinitions.cs (26)
91Debug.Assert(identifier.Kind is StackFrameKind.IdentifierToken or StackFrameKind.ConstructorToken); 107Debug.Assert(dotToken.Kind == StackFrameKind.DotToken); 108Debug.Assert(left.Kind is not StackFrameKind.Constructor); 180Debug.Assert(graveAccentToken.Kind == StackFrameKind.GraveAccentToken); 181Debug.Assert(numberToken.Kind == StackFrameKind.NumberToken); 222Debug.Assert(lessThanToken.Kind == StackFrameKind.LessThanToken); 223Debug.Assert(greaterThanToken.Kind == StackFrameKind.GreaterThanToken); 224Debug.Assert(!dollarToken.HasValue || dollarToken.Value.Kind == StackFrameKind.DollarToken); 273Debug.Assert(generatedNameSeparator.Kind == StackFrameKind.GeneratedNameSeparatorToken); 274Debug.Assert(identifier.Kind == StackFrameKind.IdentifierToken); 275Debug.Assert(pipeToken.Kind == StackFrameKind.PipeToken); 276Debug.Assert(suffix.Kind == StackFrameKind.GeneratedNameSuffixToken); 325Debug.Assert(!arrayRankSpecifiers.IsDefaultOrEmpty); 352Debug.Assert(!commaTokens.IsDefault); 353Debug.Assert(openBracket.Kind == StackFrameKind.OpenBracketToken); 354Debug.Assert(closeBracket.Kind == StackFrameKind.CloseBracketToken); 355Debug.Assert(commaTokens.All(static t => t.Kind == StackFrameKind.CommaToken)); 406Debug.Assert(openToken.Kind is StackFrameKind.OpenBracketToken or StackFrameKind.LessThanToken); 407Debug.Assert(typeArguments.Length > 0); 408Debug.Assert(openToken.Kind == StackFrameKind.OpenBracketToken ? closeToken.Kind == StackFrameKind.CloseBracketToken : closeToken.Kind == StackFrameKind.GreaterThanToken); 452Debug.Assert(identifier.Kind == StackFrameKind.IdentifierToken); 481Debug.Assert(openToken.Kind == StackFrameKind.OpenParenToken); 482Debug.Assert(closeToken.Kind == StackFrameKind.CloseParenToken); 521Debug.Assert(path.Kind == StackFrameKind.PathToken); 522Debug.Assert(colon.HasValue == line.HasValue); 523Debug.Assert(!line.HasValue || line.Value.Kind == StackFrameKind.NumberToken);
EmbeddedLanguages\StackFrame\StackFrameParser.cs (1)
174Debug.Assert(nameNode is StackFrameQualifiedNameNode or StackFrameSimpleNameNode);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingSolutionCrawlerRegistrationService.cs (2)
224Debug.Assert(set.Add(Default)); 230Debug.Assert(set.Add(kind));
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingAsyncDocumentWorkItemQueue.cs (1)
105Debug.Assert(existingWorkItem.Language == item.Language);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingAsyncWorkItemQueue.cs (1)
232Debug.Assert(!_cancellationMap.ContainsKey(key));
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs (1)
254Debug.Assert(!workItem.InvocationReasons.Contains(UnitTestingPredefinedInvocationReasons.Reanalyze) || workItem.SpecificAnalyzers.Count > 0);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (2)
181Debug.Assert(location.IsInSource); 280Debug.Assert(result);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingWorkItem.cs (1)
66Debug.Assert(documentId == null || documentId.ProjectId == projectId);
ExtractMethod\AbstractSyntaxTriviaService.cs (1)
30Debug.Assert(Enum.GetNames(typeof(TriviaLocation)).Length == TriviaLocationsCount);
FindUsages\DefinitionItemFactory.cs (2)
212Debug.Assert(originatingProjectId == null || originatingProjectId == info.ProjectId); 293Debug.Assert(location.IsInSource);
FullyQualify\AbstractFullyQualifyService.SymbolResult.cs (2)
48Debug.Assert(Symbol is INamespaceSymbol || !((INamedTypeSymbol)Symbol).IsGenericType); 49Debug.Assert(other.Symbol is INamespaceSymbol || !((INamedTypeSymbol)other.Symbol).IsGenericType);
GenerateType\AbstractGenerateTypeService.Editor.cs (3)
194Debug.Assert(targetProject.Language == LanguageNames.VisualBasic); 202Debug.Assert(_targetLanguageService != null); 541Debug.Assert(includeUsingsOrImports != null);
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (1)
328Debug.Assert(memberSymbol.TypeKind is TypeKind.Class or TypeKind.Struct);
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (3)
364Debug.Assert(parameters.Length >= 2); 365Debug.Assert(fieldsOrProperties.Length > 0); 366Debug.Assert(parameters.Length == fieldsOrProperties.Length);
InlineMethod\AbstractInlineMethodRefactoringProvider.MethodParametersInfo.cs (1)
500Debug.Assert(parameterSymbol is not null);
InvertIf\AbstractInvertIfCodeRefactoringProvider.cs (2)
380Debug.Assert(statementRange.FirstStatement == statementRange.LastStatement); 539Debug.Assert(subsequentSingleExitPoint is TStatementSyntax);
InvertIf\AbstractInvertIfCodeRefactoringProvider.StatementRange.cs (5)
20Debug.Assert(firstStatement != null); 21Debug.Assert(lastStatement != null); 22Debug.Assert(firstStatement.Parent != null); 23Debug.Assert(firstStatement.Parent == lastStatement.Parent); 24Debug.Assert(firstStatement.SpanStart <= lastStatement.SpanStart);
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
289Debug.Assert(symbol != null && !string.IsNullOrEmpty(targetNamespace));
MoveToNamespace\MoveToNamespaceCodeAction.cs (1)
62Debug.Assert(moveToNamespaceResult.Succeeded);
NavigateTo\AbstractNavigateToSearchService.CachedDocumentSearch.cs (1)
75Debug.Assert(priorityDocuments.All(d => projects.Contains(d.Project)));
NavigateTo\AbstractNavigateToSearchService.InProcess.cs (1)
253Debug.Assert(Enum.GetUnderlyingType(typeof(DeclaredSymbolInfoKind)) == typeof(byte));
NavigateTo\AbstractNavigateToSearchService.NormalSearch.cs (1)
161Debug.Assert(priorityDocuments.All(d => projects.Contains(d.Project)));
NavigateTo\NavigateToSearcher.cs (5)
118Debug.Assert(count >= 0); 119Debug.Assert(_remainingProgressItems >= 0); 128Debug.Assert(newValue >= 0); 177Debug.Assert(_remainingProgressItems == 0); 239Debug.Assert(searchRegularDocuments || searchGeneratedDocuments);
PdbSourceDocument\ImplementationAssemblyLookupService.cs (1)
210Debug.Assert(assemblyName is not null);
PdbSourceDocument\SourceLinkMap.cs (1)
201Debug.Assert(mappedUri.Suffix.Length == 0);
ReplaceDocCommentTextWithTag\AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider.cs (1)
214Debug.Assert(startInclusive > 0);
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (1)
440Debug.Assert(method.DeclaringSyntaxReferences.Length == 1);
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (1)
417Debug.Assert(property.DeclaringSyntaxReferences.Length == 1);
Shared\Extensions\DocumentExtensions.cs (1)
37Debug.Assert(document.GetRequiredSyntaxRootSynchronously(CancellationToken.None) == root);
Snippets\AbstractSnippetService.cs (1)
61Debug.Assert(!_identifierToProviderMap.TryGetValue(providerData.Identifier, out var _));
SplitOrMergeIfStatements\Consecutive\AbstractMergeConsecutiveIfStatementsCodeRefactoringProvider.cs (1)
124Debug.Assert(ifGenerator.GetElseIfAndElseClauses(firstIfOrElseIf).Length == 0);
SplitOrMergeIfStatements\Consecutive\AbstractSplitIntoConsecutiveIfStatementsCodeRefactoringProvider.cs (1)
83Debug.Assert(ifGenerator.GetElseIfAndElseClauses(ifOrElseIf).Length == 0);
SplitOrMergeIfStatements\Nested\AbstractMergeNestedIfStatementsCodeRefactoringProvider.cs (2)
127Debug.Assert(blockFacts.IsStatementContainer(ifOrElseIf)); 204Debug.Assert(blockFacts.GetStatementContainer(outerIfStatement) is object);
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)
70Debug.Assert(customTags.Length == tags.Length); 74Debug.Assert(customTags[i] == tags[i]); 80Debug.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 (2)
109Debug.Assert(fieldStateMap.ContainsKey(field.OriginalDefinition)); 219Debug.Assert(IsCandidateField(field));
src\Analyzers\Core\Analyzers\RemoveUnnecessaryParentheses\AbstractRemoveUnnecessaryParenthesesDiagnosticAnalyzer.cs (1)
104Debug.Assert(preference.Value == ParenthesesPreference.NeverIfUnnecessary ||
src\Analyzers\Core\Analyzers\RemoveUnnecessarySuppressions\AbstractRemoveUnnecessaryPragmaSuppressionsDiagnosticAnalyzer.cs (3)
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\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\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 (6)
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); 726Debug.Assert(removeAssignments);
src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (1)
285Debug.Assert(syntaxFacts.IsElementAccessExpression(elementAccess));
src\Compilers\Core\AnalyzerDriver\DeclarationComputer.cs (1)
61Debug.Assert(assemblyScopedNamespaceSymbol.ConstituentNamespaces.Length == 1);
src\Compilers\Core\AnalyzerDriver\DeclarationInfo.cs (2)
17Debug.Assert(declaredNode != null); 18Debug.Assert(!executableCodeBlocks.IsDefault);
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\Dependencies\CodeAnalysis.Debugging\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));
src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoReader.cs (5)
257Debug.Assert(nameBuilder.Length == 0); 397Debug.Assert(!allModuleInfoImportStrings.IsDefault); 421Debug.Assert(!importStrings.IsDefault); 492Debug.Assert(!importStrings.IsDefault); 511Debug.Assert(!importStrings.IsDefault);
src\Dependencies\CodeAnalysis.Debugging\StateMachineHoistedLocalScope.cs (2)
26Debug.Assert(startOffset >= 0); 27Debug.Assert(endOffset > startOffset || startOffset == 0 && endOffset == 0);
src\Dependencies\CodeAnalysis.Debugging\TupleElementNamesInfo.cs (1)
22Debug.Assert(!elementNames.IsDefault);
SyncNamespaces\AbstractSyncNamespacesService.cs (1)
38Debug.Assert(projects.All(project => project.Language == projects[0].Language));
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (2)
119Debug.Assert(fieldDocument.Project == propertyDocument.Project); 200Debug.Assert(fieldDocument.Project == propertyDocument.Project);
ValueTracking\ValueTracker.OperationCollector.cs (1)
112Debug.Assert(operation is
Wrapping\BinaryExpression\AbstractBinaryExpressionWrapper.cs (2)
74Debug.Assert(exprsAndOperators.Length >= 3); 79Debug.Assert(((i % 2) == 0 && item.IsNode) ||
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)
163Debug.Assert(minor == -1);
EditAndContinue\SyntaxMapDescription.cs (1)
63Debug.Assert(OldNodeSpans.Length == 1);
Microsoft.CodeAnalysis.InteractiveHost (137)
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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (2)
203Debug.Assert(!this.IsLocked); 212Debug.Assert(this.IsOwnedByMe);
Microsoft.CodeAnalysis.LanguageServer.Protocol (10)
Extensions\ProtocolConversions.cs (2)
240Debug.Assert(!path.Split(System.IO.Path.DirectorySeparatorChar).Any(p => p == "." || p == "..")); 472Debug.Assert(document.FilePath != null);
Features\EditAndContinue\EditAndContinueDiagnosticSource_OpenDocument.cs (2)
69Debug.Assert(data.DataLocation != null); 70Debug.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 (2)
523Debug.Assert(change.Span == defaultSpan); 680Debug.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 (490)
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\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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\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)
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 517Debug.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) || 507Debug.Assert(parameterIndex >= 0); 508Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
48Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
42Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
36Debug.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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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\RoslynParallel.NetFramework.cs (7)
115Debug.Assert(source != null); 116Debug.Assert(scheduler != null); 117Debug.Assert(body != null); 280Debug.Assert(source != null); 281Debug.Assert(scheduler != null); 282Debug.Assert(body != null); 544Debug.Assert(!Cancellation.IsCancellationRequested);
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)
330Debug.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)
341Debug.Assert(desiredGroupIndex >= 0); 342Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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 (487)
DeclarePublicApiAnalyzer.cs (2)
130Debug.Assert(errors.Count == 0); 247Debug.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\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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\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)
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 517Debug.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) || 507Debug.Assert(parameterIndex >= 0); 508Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
48Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
42Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
36Debug.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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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\RoslynParallel.NetFramework.cs (7)
115Debug.Assert(source != null); 116Debug.Assert(scheduler != null); 117Debug.Assert(body != null); 280Debug.Assert(source != null); 281Debug.Assert(scheduler != null); 282Debug.Assert(body != null); 544Debug.Assert(!Cancellation.IsCancellationRequested);
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)
330Debug.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.Rebuild (3)
CSharpCompilationFactory.cs (2)
32Debug.Assert(optionsReader.GetLanguageName() == LanguageNames.CSharp); 39Debug.Assert(optionsReader.GetLanguageName() == LanguageNames.CSharp);
VisualBasicCompilationFactory.cs (1)
39Debug.Assert(optionsReader.GetLanguageName() == LanguageNames.VisualBasic);
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 (483)
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\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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\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)
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 517Debug.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) || 507Debug.Assert(parameterIndex >= 0); 508Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
48Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
42Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
36Debug.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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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\RoslynParallel.NetFramework.cs (7)
115Debug.Assert(source != null); 116Debug.Assert(scheduler != null); 117Debug.Assert(body != null); 280Debug.Assert(source != null); 281Debug.Assert(scheduler != null); 282Debug.Assert(body != null); 544Debug.Assert(!Cancellation.IsCancellationRequested);
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)
330Debug.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.Scripting (63)
Hosting\AssemblyLoader\MetadataShadowCopy.cs (2)
34Debug.Assert(primaryModule != null); 35Debug.Assert(metadataCopy != null);
Hosting\AssemblyLoader\MetadataShadowCopyProvider.cs (5)
42Debug.Assert(@public != null); 43Debug.Assert(@private != null); 583Debug.Assert(assemblyDirectory != null); 584Debug.Assert(assemblyFileName != null); 585Debug.Assert(culture != null);
Hosting\AssemblyLoader\ShadowCopy.cs (3)
27Debug.Assert(stream != null); 28Debug.Assert(originalPath != null); 29Debug.Assert(fullPath != null);
Hosting\CommandLine\CommandLineRunner.cs (6)
34Debug.Assert(console != null); 35Debug.Assert(compiler != null); 36Debug.Assert(scriptCompiler != null); 37Debug.Assert(objectFormatter != null); 138Debug.Assert(scriptOptions is not null); 366Debug.Assert(text != null);
Hosting\CommandLine\ConsoleIO.cs (2)
23Debug.Assert(output != null); 24Debug.Assert(input != null);
Hosting\InteractiveScriptGlobals.cs (2)
59Debug.Assert(outputWriter != null); 60Debug.Assert(objectFormatter != null);
Hosting\ObjectFormatter\CommonObjectFormatter.Visitor.cs (2)
327Debug.Assert(obj != null); 644Debug.Assert(array.Rank > 1);
Hosting\ObjectFormatter\CommonObjectFormatter.Visitor.FormattedMember.cs (1)
28Debug.Assert((name != null) || (index >= 0));
Hosting\ObjectFormatter\ObjectFormatterHelpers.cs (2)
277Debug.Assert(type != null); 410Debug.Assert(str != null && start >= 0 && end >= start);
Hosting\Resolvers\NuGetPackageResolver.cs (1)
25Debug.Assert(parts.Length > 0);
Hosting\Resolvers\RuntimeMetadataReferenceResolver.cs (1)
149Debug.Assert(!paths.IsDefault);
Script.cs (5)
41Debug.Assert(sourceText != null); 42Debug.Assert(options != null); 43Debug.Assert(compiler != null); 44Debug.Assert(builder != null); 403Debug.Assert(!preceding.IsDefault);
ScriptBuilder.cs (1)
62Debug.Assert(assemblyLoader != null);
ScriptExecutionState.cs (3)
63Debug.Assert(index >= 0 && index < SubmissionStateCount); 74Debug.Assert(_frozen == 0); 75Debug.Assert((exceptionHolderOpt != null) == (catchExceptionOpt != null));
ScriptOptions.cs (5)
160Debug.Assert(filePath != null); 161Debug.Assert(!references.IsDefault); 162Debug.Assert(!namespaces.IsDefault); 163Debug.Assert(metadataResolver != null); 164Debug.Assert(sourceResolver != null);
ScriptState.cs (3)
44Debug.Assert(executionState != null); 45Debug.Assert(script != null); 104Debug.Assert(state != null);
ScriptVariable.cs (2)
24Debug.Assert(instance != null); 25Debug.Assert(field != null);
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\Shared\GlobalAssemblyCacheHelpers\ClrGlobalAssemblyCache.cs (3)
249Debug.Assert(info.pszCurrentAssemblyPathBuf != null); 250Debug.Assert(info.pszCurrentAssemblyPathBuf[info.cchBuf - 1] == '\0'); 253Debug.Assert(result.IndexOf('\0') == -1);
src\Compilers\Shared\GlobalAssemblyCacheHelpers\FusionAssemblyIdentity.cs (10)
203Debug.Assert(propertyId == PropertyId.NULL_PUBLIC_KEY_TOKEN || propertyId == PropertyId.NULL_PUBLIC_KEY); 215Debug.Assert(hr == FUSION_E_INVALID_NAME); 345Debug.Assert(data.IndexOf('\0') == -1); 349Debug.Assert(p[data.Length] == '\0'); 507Debug.Assert(displayName != null); 515Debug.Assert(result != null); 533Debug.Assert(candidateVersion != null); 538Debug.Assert(bestVersion != null); 547Debug.Assert(candidateCulture != null); 552Debug.Assert(bestCulture != null);
Microsoft.CodeAnalysis.Test.Utilities (65)
Assert\AssertEx.cs (1)
1013Debug.Assert(value is object);
Assert\AssertXml.cs (1)
160Debug.Assert(shallowComparer.Equals(pair.Item1, pair.Item2)); // Shouldn't have been pushed otherwise.
Assert\DiffUtil.cs (2)
201Debug.Assert(lengthA >= 0 && lengthB >= 0); 215Debug.Assert(lcsLength <= max);
CommonTestBase.cs (4)
354Debug.Assert(assemblyName == null || assemblyIdentity == null || assemblyIdentity.Name == assemblyName); 440Debug.Assert(sourceFileNames == null || sourceFileNames.Length == files.Length); 680Debug.Assert(semanticModel != null); 705Debug.Assert(node.Parent is not null);
Compilation\ControlFlowGraphVerifier.cs (3)
738Debug.Assert(region.EnclosingRegion.NestedRegions[1].Kind == ControlFlowRegionKind.Finally); 1305Debug.Assert(lastBlockOrdinal <= region.LastBlockOrdinal); 1320Debug.Assert(firstBlockOrdinal >= region.FirstBlockOrdinal);
Compilation\FlowAnalysis\BasicBlockReachabilityDataFlowAnalyzer.cs (2)
41Debug.Assert(currentIsReachable); 56Debug.Assert(currentIsReachable);
Compilation\OperationTreeVerifier.cs (3)
326Debug.Assert(!string.IsNullOrEmpty(header)); 337Debug.Assert(!string.IsNullOrEmpty(header)); 384Debug.Assert(operation.ChildOperations.All(o => o != null));
CompilationVerifier.cs (3)
405Debug.Assert(assemblyName.Name is not null); 562Debug.Assert(errorArgument.Value != null); 825Debug.Assert(symbol is not null);
Diagnostics\DiagnosticExtensions.cs (1)
316Debug.Assert(newCompilation.SemanticModelProvider != null);
Diagnostics\OptionsDiagnosticAnalyzer.cs (1)
24Debug.Assert(expectedOptions.AnalyzerConfigOptionsProvider.GetType() == typeof(CompilerAnalyzerConfigOptionsProvider));
FX\EnsureEnglishUICulture.cs (1)
49Debug.Assert(_threadId == Environment.CurrentManagedThreadId);
FX\EnsureInvariantCulture.cs (1)
28Debug.Assert(_threadId == Environment.CurrentManagedThreadId);
FX\ProcessUtilities.cs (1)
87Debug.Assert(process.HasExited);
Metadata\DynamicAnalysisDataReader.cs (1)
231Debug.Assert(previousStartColumn == 0);
Metadata\ILBuilderVisualizer.cs (2)
143Debug.Assert(builder.LocalSlotManager != null); 183Debug.Assert(builder.LocalSlotManager != null);
Mocks\Silverlight.cs (1)
79Debug.Assert("7C-EC-85-D7-BE-A7-79-8E" == BitConverter.ToString(publicKeyToken.ToArray()));
Mocks\StdOle.cs (1)
66Debug.Assert("B0-3F-5F-7F-11-D5-0A-3A" == BitConverter.ToString(publicKeyToken.ToArray()));
Platform\Desktop\CLRHelpers.cs (1)
59Debug.Assert(!MonoHelpers.IsRunningOnMono());
Platform\Desktop\DesktopRuntimeUtil.cs (1)
81Debug.Assert(!rawAssembly.IsDefault);
Platform\Desktop\RuntimeAssemblyManager.cs (2)
337Debug.Assert(assembly != null); 338Debug.Assert(!rawModule.IsDefault);
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);
TargetFrameworkUtil.cs (2)
292Debug.Assert(GetReferences(TargetFramework.NetCoreApp).SequenceEqual(NetCoreApp.References)); 293Debug.Assert(GetReferences(TargetFramework.NetFramework).SequenceEqual(NetFramework.References));
TempFiles\TempDirectory.cs (2)
25Debug.Assert(path != null); 26Debug.Assert(root != null);
TempFiles\TempFile.cs (1)
25Debug.Assert(PathUtilities.IsAbsolute(path));
TestableCompiler.cs (1)
214Debug.Assert(fileSystem.UsingMap);
TestableFile.cs (2)
31Debug.Assert(!memoryFile.Exists); 40Debug.Assert(memoryFile.Exists);
TestHelpers.cs (2)
96Debug.Assert(!result.Contains("--")); 109Debug.Assert(code is Microsoft.CodeAnalysis.CSharp.ErrorCode ||
Win32Res.cs (4)
242System.Diagnostics.Debug.Assert((reader.BaseStream.Position & 3) == 0); 250System.Diagnostics.Debug.Assert(length > valueLength); 254System.Diagnostics.Debug.Assert(type == 1); //string 268System.Diagnostics.Debug.Assert(length == (reader.BaseStream.Position - startPos));
Microsoft.CodeAnalysis.Threading.Package (108)
AsyncBatchingWorkQueue`2.cs (1)
240Debug.Assert(_entireQueueCancellationToken.IsCancellationRequested);
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (2)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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);
Microsoft.CodeAnalysis.UnitTests (20)
Collections\HashSet\ISet_Generic_Tests`1.cs (1)
650Debug.Assert(enumerable != null);
Collections\ImmutablesTestBase.cs (1)
205Debug.Assert(generator != null);
Collections\List\TestBase.Generic.cs (5)
105Debug.Assert(count >= numberOfMatchingElements); 106Debug.Assert(count >= numberOfDuplicateElements); 165Debug.Assert(queue.Count == count); 214Debug.Assert(list.Count == count); 298Debug.Assert(set.Count == count);
CryptoBlobParserTests.cs (1)
31Debug.Assert(privateKeyOpt.HasValue);
MetadataReferences\FusionAssemblyIdentityComparer.cs (1)
65Debug.Assert(ignoreVersion);
MetadataReferences\FusionAssemblyPortabilityPolicy.cs (1)
46Debug.Assert(PathUtilities.IsAbsolute(appConfigPath));
src\Compilers\Shared\GlobalAssemblyCacheHelpers\FusionAssemblyIdentity.cs (10)
203Debug.Assert(propertyId == PropertyId.NULL_PUBLIC_KEY_TOKEN || propertyId == PropertyId.NULL_PUBLIC_KEY); 215Debug.Assert(hr == FUSION_E_INVALID_NAME); 345Debug.Assert(data.IndexOf('\0') == -1); 349Debug.Assert(p[data.Length] == '\0'); 507Debug.Assert(displayName != null); 515Debug.Assert(result != null); 533Debug.Assert(candidateVersion != null); 538Debug.Assert(bestVersion != null); 547Debug.Assert(candidateCulture != null); 552Debug.Assert(bestCulture != null);
Microsoft.CodeAnalysis.VisualBasic (462)
Analysis\Analyzer.vb (1)
26Debug.Assert(diagnostics IsNot Nothing)
Analysis\FlowAnalysis\AbstractFlowPass.Regions.vb (3)
54Debug.Assert(Me._firstInRegion IsNot Nothing) 65Debug.Assert(Me._regionPlace = RegionPlace.Before) 73Debug.Assert(IsInside)
Analysis\FlowAnalysis\DataFlowPass.VariableIdentifier.vb (2)
24Debug.Assert(symbol IsNot Nothing) 48Debug.Assert(obj IsNot Nothing)
Analysis\FlowAnalysis\FlowAnalysisInfo.vb (5)
25Debug.Assert(_compilation IsNot Nothing) 26Debug.Assert(_symbol IsNot Nothing) 27Debug.Assert(_node IsNot Nothing) 48Debug.Assert(_firstInRegion IsNot Nothing) 49Debug.Assert(_lastInRegion IsNot Nothing)
Analysis\FlowAnalysis\ReadWriteWalker.vb (1)
202Debug.Assert(node.RangeVariables.Length = 1)
Binding\BlockBaseBinder.vb (1)
46Debug.Assert(Not locals.IsEmpty)
BoundTree\BoundExpressionExtensions.vb (9)
151Debug.Assert(node.IsSupportingAssignment()) 410Debug.Assert(expression IsNot Nothing) 423Debug.Assert(expression IsNot Nothing) 459Debug.Assert(type IsNot Nothing OrElse node.Kind = BoundKind.Literal OrElse node.Kind = BoundKind.Parenthesized) 474Debug.Assert(node.Type Is Nothing) 637Debug.Assert(node.IsValue) 638Debug.Assert(Not node.IsLValue) 639Debug.Assert(Not node.IsPropertyOrXmlPropertyAccess() OrElse node.GetAccessKind() = PropertyAccessKind.Get) 640Debug.Assert(Not node.IsLateBound() OrElse node.GetLateBoundAccessKind() = LateBoundAccessKind.Get)
BoundTree\BoundLateInvocation.vb (3)
18Debug.Assert(newAccessKind = LateBoundAccessKind.Unknown OrElse 33Debug.Assert((AccessKind And LateBoundAccessKind.Call) = 0 OrElse (AccessKind And Not LateBoundAccessKind.Call) = 0) 36Debug.Assert(DirectCast(Member, BoundLateMemberAccess).AccessKind = Me.AccessKind)
BoundTree\BoundSequence.vb (2)
27Debug.Assert(Me.ValueOpt IsNot Nothing) 47Debug.Assert(val.IsValue AndAlso Not val.IsLValue AndAlso val.Type IsNot Nothing)
CodeGen\ResumableStateMachineStateAllocator.vb (1)
77Debug.Assert(f.CompilationState IsNot Nothing)
Compilation\DocumentationComments\DocumentationCommentCompiler.Namespace.vb (1)
30Debug.Assert(Me._assemblyName IsNot Nothing)
Compilation\DocumentationComments\DocumentationCommentWalker.vb (5)
46Debug.Assert(symbol IsNot Nothing) 47Debug.Assert(syntaxTree IsNot Nothing) 48Debug.Assert(diagnostics IsNot Nothing) 59Debug.Assert(node IsNot Nothing) 60Debug.Assert(name IsNot Nothing)
Compilation\DocumentationComments\DocWriter.vb (2)
55Debug.Assert(Me._indentDepth >= 0) 118Debug.Assert(depth >= 0)
Compilation\DocumentationComments\UnprocessedDocumentationCommentFinder.vb (2)
35Debug.Assert(diagnostics IsNot Nothing) 142Debug.Assert(parent IsNot Nothing)
Declarations\SingleNamespaceDeclaration.vb (1)
84Debug.Assert(Not singleDeclarations.IsEmpty)
Lowering\Diagnostics\DiagnosticsPass.vb (4)
32Debug.Assert(node IsNot Nothing) 33Debug.Assert(containingSymbol IsNot Nothing) 174Debug.Assert(info.ExpressionPlaceholder IsNot Nothing) 211Debug.Assert(_expressionsBeingVisited.Peek Is node)
Lowering\Diagnostics\DiagnosticsPass_ExpressionLambdas.vb (5)
117Debug.Assert(placeholder IsNot Nothing) 128Debug.Assert(assignment.LeftOnTheRightOpt Is Nothing) 297Debug.Assert(operand IsNot Nothing AndAlso 308Debug.Assert(Me.IsInExpressionLambda) 309Debug.Assert(lambda IsNot Nothing)
Lowering\ExpressionLambdaRewriter\ExpressionLambdaRewriter.vb (22)
137Debug.Assert(block.Statements(0).Kind <> BoundKind.SequencePoint) 138Debug.Assert(block.Statements.Length = 1 OrElse 176Debug.Assert(False) 308Debug.Assert(saveRecursionDepth = _recursionDepth) 406Debug.Assert(origReceiverOpt IsNot Nothing OrElse fieldIsShared) 412Debug.Assert(origReceiverOpt IsNot Nothing) 433Debug.Assert(origReceiverOpt IsNot Nothing OrElse propertyIsShared) 439Debug.Assert(origReceiverOpt IsNot Nothing) 440Debug.Assert(origReceiverOpt.Kind <> BoundKind.MyBaseReference AndAlso origReceiverOpt.Kind <> BoundKind.MyClassReference) 456Debug.Assert(node.RelaxationLambdaOpt Is Nothing) 457Debug.Assert(node.RelaxationReceiverPlaceholderOpt Is Nothing) 458Debug.Assert(node.MethodGroupOpt Is Nothing) 532Debug.Assert(arg.Type Is Me.Int32Type) 543Debug.Assert(expressions(i).Type Is Me.Int32Type) 593Debug.Assert(initializers(i).Kind = BoundKind.AssignmentOperator) 596Debug.Assert(assignment.LeftOnTheRightOpt Is Nothing) 605Debug.Assert(DirectCast(assignment.Left, BoundPropertyAccess).AccessKind = PropertyAccessKind.Set) 611Debug.Assert(leftSymbol IsNot Nothing) 615Debug.Assert(initializer.PlaceholderOpt IsNot Nothing) 617Debug.Assert(leftSymbol.Kind = SymbolKind.Field OrElse leftSymbol.Kind = SymbolKind.Property) 642Debug.Assert(initializers(i).Kind = BoundKind.Call) 683Debug.Assert(properties.Length = node.Arguments.Length)
Lowering\ExpressionLambdaRewriter\ExpressionLambdaRewriter_ConditionalExpresion.vb (2)
185Debug.Assert((conversion.ConversionKind And ConversionKind.UserDefined) <> 0) 208Debug.Assert((innerConversion And ConversionKind.NarrowingNullable) = ConversionKind.NarrowingNullable)
Lowering\ExpressionLambdaRewriter\ExpressionLambdaRewriter_Conversion.vb (9)
25Debug.Assert(node.ExtendedInfoOpt Is Nothing) 34Debug.Assert(node.RelaxationLambdaOpt Is Nothing) 43Debug.Assert(node.RelaxationLambdaOpt Is Nothing) 96Debug.Assert(semantics = ConversionSemantics.Default) 149Debug.Assert(semantics <> ConversionSemantics.TryCast) 159Debug.Assert(semantics <> ConversionSemantics.TryCast) 177Debug.Assert(semantics <> ConversionSemantics.TryCast) 187Debug.Assert(semantics <> ConversionSemantics.TryCast) 295Debug.Assert(semantics <> ConversionSemantics.TryCast)
Lowering\ExpressionLambdaRewriter\ExpressionLambdaRewriter_UnaryOperator.vb (1)
34Debug.Assert((node.OperatorKind And UnaryOperatorKind.UserDefined) = 0)
Lowering\LambdaRewriter\LambdaRewriter.Analysis.vb (6)
138Debug.Assert(Not node.HasErrors) 301Debug.Assert(node.LambdaSymbol IsNot Nothing) 338Debug.Assert(node.RelaxationLambdaOpt Is Nothing) 349Debug.Assert(node.RelaxationLambdaOpt Is Nothing) 360Debug.Assert(conversion.ExtendedInfoOpt Is Nothing) 417Debug.Assert(container IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_AnonymousTypeCreationExpression.vb (2)
21Debug.Assert(fieldsCount > 0) 80Debug.Assert(local IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_AsNewLocalDeclarations.vb (4)
21Debug.Assert(localDeclaration.InitializerOpt Is Nothing) 53Debug.Assert(node.Syntax IsNot Nothing) 54Debug.Assert(node.Syntax.Kind = SyntaxKind.VariableDeclarator) 82Debug.Assert(objectInitializer.PlaceholderOpt IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_AssignmentOperator.vb (13)
27Debug.Assert(midResult.Original Is node.LeftOnTheRightOpt OrElse 42Debug.Assert((accessKind And PropertyAccessKind.Set) <> 0) 43Debug.Assert(((accessKind And PropertyAccessKind.Get) = 0) = (node.LeftOnTheRightOpt Is Nothing)) 78Debug.Assert(assignmentTarget.IsLValue) 91Debug.Assert(assignmentTarget Is setNode) 140Debug.Assert(node.LeftOnTheRightOpt Is Nothing) 207Debug.Assert(setNode.AccessKind = PropertyAccessKind.Set) 253Debug.Assert((accessKind And LateBoundAccessKind.Set) <> 0) 254Debug.Assert(((accessKind And LateBoundAccessKind.Get) = 0) = (node.LeftOnTheRightOpt Is Nothing)) 427Debug.Assert((conversionKind And ConversionKind.UserDefined) = 0) 462Debug.Assert(node.Left.IsLValue AndAlso node.LeftOnTheRightOpt IsNot Nothing AndAlso 499Debug.Assert(temporaries.IsDefault) 500Debug.Assert(copyBack.IsDefault)
Lowering\LocalRewriter\LocalRewriter_Call.vb (6)
200Debug.Assert(temporaries.IsDefault OrElse changed) 262Debug.Assert(originalArgument.GetAccessKind() = If( 268Debug.Assert(originalArgument.GetLateBoundAccessKind() = (LateBoundAccessKind.Get Or LateBoundAccessKind.Set)) 274Debug.Assert(originalArgument.GetAccessKind() = PropertyAccessKind.Unknown) 277Debug.Assert(originalArgument.GetLateBoundAccessKind() = LateBoundAccessKind.Unknown) 316Debug.Assert(secondUse.IsLValue)
Lowering\LocalRewriter\LocalRewriter_ConditionalAccess.vb (8)
33Debug.Assert(node.Type IsNot Nothing) 71Debug.Assert(newPlaceholderId <> 0) 107Debug.Assert(newPlaceholderId <> 0) 142Debug.Assert(needWhenNotNullPart OrElse needWhenNullPart) 148Debug.Assert(receiver Is Nothing) 149Debug.Assert(newPlaceHolder Is Nothing) 153Debug.Assert(receiver Is Nothing) 156Debug.Assert(receiver Is Nothing)
Lowering\LocalRewriter\LocalRewriter_DoLoop.vb (4)
16Debug.Assert(node IsNot Nothing) 30Debug.Assert(node.ConditionOpt IsNot Nothing AndAlso node.ConditionIsTop) 64Debug.Assert(node.ConditionOpt IsNot Nothing AndAlso Not node.ConditionIsTop) 148Debug.Assert(node.ConditionOpt Is Nothing)
Lowering\LocalRewriter\LocalRewriter_FieldOrPropertyInitializer.vb (2)
117Debug.Assert(node.MemberAccessExpressionOpt IsNot Nothing) 126Debug.Assert(objectInitializer.PlaceholderOpt IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_ForEach.vb (3)
586Debug.Assert(enumeratorInfo.EnumeratorPlaceholder IsNot Nothing) 670Debug.Assert(Not needTryFinally) 757Debug.Assert(rewrittenDisposeConversion IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_ForTo.vb (5)
37Debug.Assert(node.OperatorsOpt Is Nothing) 454Debug.Assert(rewrittenInitCondition IsNot Nothing) 511Debug.Assert(rewrittenLoopCondition IsNot Nothing) 563Debug.Assert(controlVariable.IsLValue) 657Debug.Assert(operatorsOpt Is Nothing OrElse positiveFlag IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_HostObjectMemberReference.vb (1)
14Debug.Assert(_previousSubmissionFields IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_LateInvocation.vb (2)
50Debug.Assert(invocation.AccessKind = LateBoundAccessKind.Get) 51Debug.Assert(receiverExpression.Kind <> BoundKind.LateMemberAccess)
Lowering\LocalRewriter\LocalRewriter_ObjectCreation.vb (10)
44Debug.Assert(Conversions.ConversionExists(conv)) 140Debug.Assert(method IsNot Nothing) 184Debug.Assert(node.PlaceholderOpt IsNot Nothing) 240Debug.Assert(tempLocalSymbol Is Nothing) 241Debug.Assert(tempLocal Is Nothing) 254Debug.Assert(tempLocalSymbol IsNot Nothing) 255Debug.Assert(tempLocal IsNot Nothing) 306Debug.Assert(node.PlaceholderOpt IsNot Nothing) 360Debug.Assert(assignment.LeftOnTheRightOpt Is Nothing) 418Debug.Assert(sequence.ValueOpt IsNot Nothing AndAlso sequence.ValueOpt.Kind = BoundKind.ObjectCreationExpression)
Lowering\LocalRewriter\LocalRewriter_PreviousSubmissionReference.vb (1)
17Debug.Assert(_previousSubmissionFields IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_Query.vb (2)
121Debug.Assert(firstUnmappedRangeVariable = nodeRangeVariables.Length) 235Debug.Assert(node.GroupPlaceholderOpt IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_RaiseEvent.vb (2)
30Debug.Assert(receiver.Kind = BoundKind.FieldAccess) 36Debug.Assert(fieldAccessReceiver Is Nothing OrElse
Lowering\LocalRewriter\LocalRewriter_RedimClause.vb (1)
18Debug.Assert(node.ArrayTypeOpt IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_Return.vb (4)
48Debug.Assert(node.FunctionLocalOpt IsNot Nothing) 85Debug.Assert(node.FunctionLocalOpt Is Nothing) 108Debug.Assert(node.ExitLabelOpt Is Nothing) 109Debug.Assert(node.FunctionLocalOpt Is Nothing)
Lowering\LocalRewriter\LocalRewriter_SelectCase.vb (19)
102Debug.Assert(node.WasCompilerGenerated) 205Debug.Assert(statementBuilder IsNot Nothing) 206Debug.Assert(Not caseBlocks.IsDefault) 260Debug.Assert(startFrom <= caseBlocks.Length) 270Debug.Assert(generateUnstructuredExceptionHandlingResumeCode = ShouldGenerateUnstructuredExceptionHandlingResumeCode(curCaseBlock)) 285Debug.Assert(curCaseBlock.Syntax.Kind = SyntaxKind.CaseElseBlock) 289Debug.Assert(startFrom = caseBlocks.Length - 1) 298Debug.Assert(curCaseBlock.Syntax.Kind = SyntaxKind.CaseBlock) 325Debug.Assert(node.Syntax.Kind = SyntaxKind.CaseStatement) 326Debug.Assert(node.ConditionOpt IsNot Nothing) 333Debug.Assert(node.Syntax.Kind = SyntaxKind.CaseElseStatement) 341Debug.Assert(Not node.HasErrors) 343Debug.Assert(node.RecommendSwitchTable) 355Debug.Assert(simpleCaseClause.ValueOpt IsNot Nothing) 356Debug.Assert(simpleCaseClause.ConditionOpt Is Nothing) 363Debug.Assert(relationalCaseClause.OperatorKind = BinaryOperatorKind.Equals) 364Debug.Assert(relationalCaseClause.ValueOpt IsNot Nothing) 365Debug.Assert(relationalCaseClause.ConditionOpt Is Nothing) 373Debug.Assert(constant IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_Try.vb (2)
16Debug.Assert(_unstructuredExceptionHandling.Context Is Nothing) 168Debug.Assert((Me._flags And RewritingFlags.AllowCatchWithErrorLineNumberReference) <> 0)
Lowering\LocalRewriter\LocalRewriter_UnaryOperators.vb (4)
49Debug.Assert((binary.OperatorKind And BinaryOperatorKind.Lifted) <> 0) 123Debug.Assert(opKind = UnaryOperatorKind.Not) 147Debug.Assert(opKind = UnaryOperatorKind.Minus) 288Debug.Assert(temps Is Nothing AndAlso inits Is Nothing)
Lowering\LocalRewriter\LocalRewriter_UnstructuredExceptionHandling.vb (13)
65Debug.Assert(node.ContainsOnError OrElse node.ContainsResume) 67Debug.Assert(_unstructuredExceptionHandling.Context Is Nothing) 70Debug.Assert(_unstructuredExceptionHandling.OnErrorResumeNextCount = 0) 366Debug.Assert(node.OnErrorKind = OnErrorStatementKind.GoToZero) 373Debug.Assert(Not node.WasCompilerGenerated) 435Debug.Assert(node.ResumeKind = ResumeStatementKind.Plain) 439Debug.Assert(Not node.WasCompilerGenerated) 450Debug.Assert(InsideValidUnstructuredExceptionHandlingResumeContext()) 458Debug.Assert(InsideValidUnstructuredExceptionHandlingResumeContext()) 481Debug.Assert(TypeOf statement.Syntax Is ExpressionSyntax) 536Debug.Assert(statement.Syntax.Kind = SyntaxKind.ModifiedIdentifier AndAlso 543Debug.Assert((statement.Syntax.Kind = SyntaxKind.RedimClause AndAlso 549Debug.Assert(TypeOf statement.Syntax Is ExecutableStatementSyntax)
Lowering\LocalRewriter\LocalRewriter_Using.vb (1)
124Debug.Assert(node.ResourceExpressionOpt IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_With.vb (6)
57Debug.Assert(Not locals.IsDefault) 58Debug.Assert(Not initializers.IsDefault) 59Debug.Assert(placeholder IsNot Nothing) 60Debug.Assert(replaceWith IsNot Nothing) 148Debug.Assert(currentType IsNot Nothing) 177Debug.Assert(fieldType IsNot Nothing)
Lowering\LocalRewriter\LocalRewriter_XmlLiteralFixupData.vb (1)
45Debug.Assert(Not Me.IsEmpty)
Lowering\MethodToClassRewriter\MethodToClassRewriter.MyBaseMyClassWrapper.vb (4)
61Debug.Assert(receiver IsNot Nothing) 62Debug.Assert(receiver.IsMyClassReference() OrElse receiver.IsMyBaseReference()) 63Debug.Assert(method IsNot Nothing) 84Debug.Assert(isMyBase OrElse receiver.Kind = BoundKind.MyClassReference)
Lowering\SynthesizedSubmissionFields.vb (1)
30Debug.Assert(compilation IsNot Nothing)
Lowering\SyntheticBoundNodeFactory.vb (11)
72Debug.Assert(compilationState IsNot Nothing) 358Debug.Assert(Conversions.IsWideningConversion(conversion)) 609Debug.Assert(thenClause IsNot Nothing AndAlso elseClause IsNot Nothing) 618Debug.Assert(ifTrue IsNot Nothing) 619Debug.Assert(ifFalse IsNot Nothing) 624Debug.Assert(expression IsNot Nothing) 625Debug.Assert(Not expression.IsNothingLiteral) ' Not supported yet 635Debug.Assert(expression IsNot Nothing) 666Debug.Assert(parts IsNot Nothing AndAlso parts.Length > 0) 1025Debug.Assert((convKind And ConversionKind.UserDefined) = 0) 1126Debug.Assert(Me.CurrentMethod IsNot Nothing)
Semantics\Operators.vb (48)
307Debug.Assert(opInfo.ParamCount <> 0) 308Debug.Assert(diagnosticsOpt Is Nothing OrElse assemblyBeingBuiltOpt IsNot Nothing) 354Debug.Assert(opInfo.IsBinary) 505Debug.Assert((opCode And UnaryOperatorKind.IntrinsicOpMask) = opCode AndAlso opCode <> UnaryOperatorKind.Error) 709Debug.Assert(operand IsNot Nothing) 710Debug.Assert(resultType IsNot Nothing) 801Debug.Assert((op And UnaryOperatorKind.IntrinsicOpMask) = UnaryOperatorKind.Not) 863Debug.Assert((opCode And BinaryOperatorKind.OpMask) = opCode AndAlso opCode <> BinaryOperatorKind.Error) 1029Debug.Assert(left IsNot Nothing) 1030Debug.Assert(right IsNot Nothing) 1031Debug.Assert(resultType IsNot Nothing) 1096Debug.Assert((operatorKind And BinaryOperatorKind.CompareText) = 0) 1113Debug.Assert(result IsNot Nothing) 1129Debug.Assert((op And BinaryOperatorKind.OpMask) = op) 1130Debug.Assert(Not integerOverflow) 1131Debug.Assert(Not divideByZero) 1302Debug.Assert((op And BinaryOperatorKind.OpMask) = op) 1424Debug.Assert((op And BinaryOperatorKind.OpMask) = op) 1425Debug.Assert(Not divideByZero) 1510Debug.Assert((op And BinaryOperatorKind.OpMask) = op) 1581Debug.Assert((op And BinaryOperatorKind.OpMask) = op) 2042Debug.Assert(bestMatch Is Nothing) 2105Debug.Assert(Not suppressViabilityChecks) 2108Debug.Assert(currentIndex = i) 2122Debug.Assert(Not suppressViabilityChecks) 2148Debug.Assert(bestMatch Is Nothing) 2184Debug.Assert(bestMatch Is Nothing) 2185Debug.Assert(Not bestMatchIsAmbiguous) 2246Debug.Assert(bestMatch IsNot Nothing) 2252Debug.Assert(bestMatch Is Nothing) 2379Debug.Assert(bestMatch Is Nothing) 2452Debug.Assert(Not suppressViabilityChecks) 2456Debug.Assert(currentIndex = i) 2472Debug.Assert(Not (Conversions.IsWideningConversion(conversionIn) AndAlso Conversions.IsWideningConversion(conversionOut))) 2478Debug.Assert(Not suppressViabilityChecks) 2504Debug.Assert(bestMatch Is Nothing) 2523Debug.Assert(Conversions.IsNarrowingConversion(conversionOut)) 2526Debug.Assert(Conversions.IsNarrowingConversion(conversionIn)) 2531Debug.Assert(Conversions.IsWideningConversion(conversionOut) AndAlso Not Conversions.IsIdentityConversion(conversionOut)) 2544Debug.Assert(Conversions.IsNarrowingConversion(conversionOut)) 2577Debug.Assert(bestMatch Is Nothing) 2578Debug.Assert(Not bestMatchIsAmbiguous) 2664Debug.Assert(bestMatch IsNot Nothing) 2806Debug.Assert(result > 0) 2821Debug.Assert(forth = "E"c OrElse forth = "e"c) 3171Debug.Assert(method.ParameterCount = If(argument2 Is Nothing, 1, 2)) 3172Debug.Assert(method.Arity = 0) 3173Debug.Assert(Not method.IsSub)
Semantics\OverloadResolution.vb (97)
155Debug.Assert(method IsNot Nothing) 395Debug.Assert([property] IsNot Nothing) 595Debug.Assert((value And SmallFieldMask.InferenceLevelMask) = value) 637Debug.Assert(RequiresNarrowingConversion) 656Debug.Assert(relaxationLevel <= ConversionKind.DelegateRelaxationLevelNarrowing) 698Debug.Assert((value And SmallFieldMask.InferenceErrorReasonsMask) = value) 714Debug.Assert((value And (Not SmallFieldMask.State)) = 0) 929Debug.Assert(methodGroup.ResultKind = LookupResultKind.Good OrElse methodGroup.ResultKind = LookupResultKind.Inaccessible) 1057Debug.Assert(applicableNarrowingCandidateCount = 0) 1086Debug.Assert(propertyGroup.ResultKind = LookupResultKind.Good OrElse propertyGroup.ResultKind = LookupResultKind.Inaccessible) 1116Debug.Assert(asyncLambdaSubToFunctionMismatch Is Nothing) 1166Debug.Assert(argumentNames.IsDefault OrElse argumentNames.Length = arguments.Length) 1258Debug.Assert(applicableNarrowingCandidates < applicableCandidates) 1261Debug.Assert(applicableCandidates > 0) 1403Debug.Assert(existingWins Xor newWins) ' Both cannot win! 1433Debug.Assert(newCandidate.State = CandidateAnalysisResultState.Applicable) 1437Debug.Assert(newCandidate.Candidate.ParameterCount >= argumentCount OrElse newCandidate.IsExpandedParamArrayForm) 1438Debug.Assert(argumentNames.IsDefault OrElse argumentNames.Length > 0) 1439Debug.Assert(Not operatorResolution OrElse argumentNames.IsDefault) 1456Debug.Assert(existingCandidate.Candidate.ParameterCount >= argumentCount OrElse existingCandidate.IsExpandedParamArrayForm) 1471Debug.Assert(Not operatorResolution) 1478Debug.Assert(Not operatorResolution) 1481Debug.Assert(argumentNames.IsDefault) ' We matched the virtual signature above 1482Debug.Assert(argumentCount = existingCandidate.Candidate.ParameterCount) 1499Debug.Assert(argumentNames.IsDefault) ' We matched the virtual signature above 1519Debug.Assert(argumentNames.IsDefault OrElse signatureMatch) 1756Debug.Assert(cmp = ApplicabilityComparisonResult.LeftIsMoreApplicable) 1778Debug.Assert(cmp = ApplicabilityComparisonResult.LeftIsMoreApplicable) 1816Debug.Assert(Not (leftWins AndAlso rightWins)) 1823Debug.Assert(rightWins) 1833Debug.Assert(applicableCandidates >= 0) 2120Debug.Assert(indexesOfApplicableCandidates.Count = applicableCandidates) 2193Debug.Assert(leftWins Xor rightWins) 2297Debug.Assert(left.ArgsToParamsOpt.IsDefault = right.ArgsToParamsOpt.IsDefault) 2344Debug.Assert(cmp = ApplicabilityComparisonResult.EquallyApplicable) 2348Debug.Assert(Not (leftHasMoreApplicableParameterType AndAlso rightHasMoreApplicableParameterType)) 2378Debug.Assert(argument Is Nothing OrElse argument.Kind <> BoundKind.OmittedArgument) 2600Debug.Assert(left.ArgsToParamsOpt.IsDefault = right.ArgsToParamsOpt.IsDefault) 2635Debug.Assert(argument Is Nothing OrElse argument.Kind <> BoundKind.OmittedArgument) 2712Debug.Assert(current.Candidate.IsOperator) 2719Debug.Assert(contender.Candidate.IsOperator) 2736Debug.Assert(applicableCandidates > 1) ' source and lifted operators are not equally applicable. 2743Debug.Assert(current.Candidate.IsOperator) 2750Debug.Assert(contender.Candidate.IsOperator) 2835Debug.Assert(applicableCandidates > 0) 2876Debug.Assert(applicableCandidates = 1) 2898Debug.Assert((conv And ConversionKind.UserDefined) = 0) 3006Debug.Assert(applicableCandidates > 0) 3037Debug.Assert(Not arguments.IsDefault) 3038Debug.Assert(argumentNames.IsDefault OrElse (argumentNames.Length > 0 AndAlso argumentNames.Length = arguments.Length)) 3039Debug.Assert(Not candidate.ArgumentMatchingDone) 3040Debug.Assert(candidate.State = CandidateAnalysisResultState.Applicable) 3129Debug.Assert(argumentNames(i) Is Nothing OrElse argumentNames(i).Length > 0) 3222Debug.Assert(Not arguments.IsDefault) 3223Debug.Assert(argumentNames.IsDefault OrElse (argumentNames.Length > 0 AndAlso argumentNames.Length = arguments.Length)) 3224Debug.Assert(Not candidate.ArgumentMatchingDone) 3225Debug.Assert(candidate.State = CandidateAnalysisResultState.Applicable) 3238Debug.Assert(Not candidate.IgnoreExtensionMethods) 3306Debug.Assert(paramArrayArgument Is Nothing OrElse paramArrayArgument.Kind <> BoundKind.OmittedArgument) 3327Debug.Assert(paramArrayArgument.IsNothingLiteral()) 3352Debug.Assert(candidate.IsExpandedParamArrayForm) 3517Debug.Assert(defaultArgument Is Nothing) 3681Debug.Assert(delegateInvoke IsNot Nothing) 3685Debug.Assert(bound IsNot Nothing) 3757Debug.Assert(Not argument.HasErrors) 3861Debug.Assert(results IsNot Nothing) 3862Debug.Assert(argumentNames.IsDefault OrElse (argumentNames.Length > 0 AndAlso argumentNames.Length = arguments.Length)) 3956Debug.Assert(isExtensionMethod = info2.Candidate.IsExtensionMethod) 3989Debug.Assert(accessibilityCmp = 0) 4045Debug.Assert(candidate IsNot Nothing) 4046Debug.Assert(appliesToNormalForm OrElse appliesToParamArrayForm) 4172Debug.Assert(candidate.AppliesToNormalForm <> candidate.AppliesToParamArrayForm) 4226Debug.Assert(triedToAddSomething) 4263Debug.Assert(newCandidate.State <> CandidateAnalysisResultState.Applicable) 4285Debug.Assert(newCandidate.State = CandidateAnalysisResultState.Applicable) 4289Debug.Assert(newCandidate.Candidate.ParameterCount >= argumentCount OrElse newCandidate.IsExpandedParamArrayForm) 4290Debug.Assert(argumentNames.IsDefault OrElse argumentNames.Length > 0) 4291Debug.Assert(Not operatorResolution OrElse argumentNames.IsDefault) 4307Debug.Assert(Not operatorResolution) 4348Debug.Assert(existingCandidate.Candidate.ParameterCount >= argumentCount OrElse existingCandidate.IsExpandedParamArrayForm) 4356Debug.Assert(Not operatorResolution) 4363Debug.Assert(Not operatorResolution) 4366Debug.Assert(argumentCount = existingCandidate.Candidate.ParameterCount) 4367Debug.Assert(argumentNames.IsDefault) ' We matched the virtual signature above 4388Debug.Assert(argumentNames.IsDefault) ' We matched the virtual signature above 4408Debug.Assert(argumentNames.IsDefault OrElse signatureMatch) 4437Debug.Assert(Not existingWins OrElse Not newWins) ' Both cannot win! 4512Debug.Assert(Not existingCandidate.Candidate.IsLifted) 4657Debug.Assert(left.ArgsToParamsOpt.IsDefault = right.ArgsToParamsOpt.IsDefault) 4725Debug.Assert((saveTrack And TypeParameterKind.Method) = 0 OrElse (leftHasLeastGenericParameterAgainstMethod AndAlso rightHasLeastGenericParameterAgainstMethod)) 4726Debug.Assert((saveTrack And TypeParameterKind.Type) = 0 OrElse (leftHasLeastGenericParameterAgainstType AndAlso rightHasLeastGenericParameterAgainstType)) 4761Debug.Assert(argument.Kind <> BoundKind.OmittedArgument) 4837Debug.Assert(left.ArgsToParamsOpt.IsDefault = right.ArgsToParamsOpt.IsDefault) 4869Debug.Assert(leftParamWins <> rightParamWins) 4890Debug.Assert(Not leftWins OrElse Not rightWins) 4958Debug.Assert(leftArgWins <> rightArgWins) 4980Debug.Assert(Not leftWins OrElse Not rightWins)
Semantics\TypeInference\Graph.vb (4)
84Debug.Assert(node.Graph Is Me) 96Debug.Assert(Contains(source)) 97Debug.Assert(Contains(target)) 182Debug.Assert(node.AlgorithmData.StronglyConnectedComponent Is Nothing)
Semantics\TypeInference\TypeInferenceCollection.vb (4)
326Debug.Assert(rank <> -1) ' Can we get different ranks at all? If we can, we should investigate if we can do something better than just give up. 492Debug.Assert(Conversions.IsWideningConversion(inConversion) AndAlso Conversions.IsWideningConversion(outConversion) AndAlso 563Debug.Assert(type IsNot Nothing) 629Debug.Assert(names1.Length = names2.Length)
Symbols\AnonymousTypes\AnonymousTypeManager_Templates.vb (4)
37Debug.Assert(Me._sourceLocationsSeen.ContainsKey(location)) 267Debug.Assert(type IsNot Nothing) 268Debug.Assert(type.IsAnonymousType) 330Debug.Assert(result <> 0)
Symbols\ConstraintsHelper.vb (16)
117Debug.Assert(explicitKind = DirectTypeConstraintKind.ExplicitType) 134Debug.Assert(explicitKind = DirectTypeConstraintKind.ExplicitType) 501Debug.Assert(Not type.IsTupleType) 502Debug.Assert(typeArgumentsSyntax.Count = type.Arity) 622Debug.Assert(typeParameters.Length = typeArguments.Length) 652Debug.Assert(((constructedSymbol Is Nothing) AndAlso (substitution Is Nothing)) OrElse 747Debug.Assert(info.Severity = DiagnosticSeverity.Error) 843Debug.Assert(Not baseType.IsInterfaceType()) 844Debug.Assert(baseType.TypeKind <> TypeKind.TypeParameter) 905Debug.Assert(Not IsBad) 936Debug.Assert(typeParameter.HasConstructorConstraint) 994Debug.Assert((typeParameter Is Nothing) OrElse typeParameter.HasReferenceTypeConstraint) 1015Debug.Assert((typeParameter Is Nothing) OrElse typeParameter.HasValueTypeConstraint) 1166Debug.Assert(type.TypeKind = TypeKind.Class OrElse type.TypeKind = TypeKind.Structure) 1208Debug.Assert(constraintType IsNot Nothing) 1250Debug.Assert(method.ConstructedFrom <> method)
Symbols\EventSymbol.vb (1)
195Debug.Assert(Me.IsDefinition)
Symbols\Metadata\PE\MemberRefMetadataDecoder.vb (3)
30Debug.Assert(containingType IsNot Nothing) 63Debug.Assert(cumulativeArity <= position) 87Debug.Assert(typeArgument Is Nothing)
Symbols\Metadata\PE\SymbolFactory.vb (1)
121Debug.Assert(genericParameters.Length > 0)
Symbols\MethodSignatureComparer.vb (3)
393Debug.Assert((comparisons And SymbolComparisonResults.ArityMismatch) <> 0) 816Debug.Assert(containingType.TypeSubstitution Is Nothing OrElse TypeOf method Is SignatureOnlyMethodSymbol) 847Debug.Assert(typeParameters2.Length = arity)
Symbols\ObsoleteAttributeHelpers.vb (7)
72Debug.Assert(context IsNot Nothing) 73Debug.Assert(symbol IsNot Nothing) 131Debug.Assert(data IsNot Nothing) 139Debug.Assert(Not data.IsUninitialized) 142Debug.Assert(data.Message Is Nothing) 143Debug.Assert(Not data.IsError) 149Debug.Assert(Not data.IsError)
Symbols\Source\ImplementsHelper.vb (9)
43Debug.Assert(GetExplicitInterfaceImplementations(sourceSym).Contains(implementedSym)) 73Debug.Assert(implementedSym IsNot Nothing) 96Debug.Assert(implementsClause IsNot Nothing) 134Debug.Assert(implementedMember.Kind = SymbolKind.Event) 330Debug.Assert(candidatesCount = 0) 425Debug.Assert(implementingSym.Kind = implementedSym.Kind) 564Debug.Assert(TypeOf interfaceMember Is PropertySymbol OrElse 569Debug.Assert(interfaceType IsNot Nothing AndAlso interfaceType.IsInterface) 642Debug.Assert(Not currType.Dangerous_IsFromSomeCompilationIncludingRetargeting)
Symbols\Source\ImplicitNamedTypeSymbol.vb (2)
30Debug.Assert(declaration.Kind = DeclarationKind.ImplicitClass OrElse declaration.Kind = DeclarationKind.Submission OrElse declaration.Kind = DeclarationKind.Script) 191Debug.Assert(Me.IsScriptClass OrElse Me.IsImplicitClass)
Symbols\Source\OverloadingHelper.vb (1)
29Debug.Assert(kind = SymbolKind.Method OrElse kind = SymbolKind.Property)
Symbols\Source\OverrideHidingHelper.vb (11)
24Debug.Assert(container.IsDefinition) ' Don't do this on constructed types 121Debug.Assert(Not exactMatch OrElse exactMatchIgnoringCustomModifiers) 350Debug.Assert(container.IsDefinition) 387Debug.Assert(Not (hidingMember.IsAccessor() AndAlso hiddenMember.IsAccessor)) 450Debug.Assert(hidingMember.Locations(0).IsInSource) 469Debug.Assert(hidingMember.Locations(0).IsInSource) 621Debug.Assert(Not (TypeOf overridingSym Is MethodSymbol AndAlso DirectCast(DirectCast(overridingSym, Symbol), MethodSymbol).ConstructedFrom <> overridingSym)) 625Debug.Assert(Not (TypeOf overridingSym Is MethodSymbol AndAlso 687Debug.Assert(Not (TypeOf overridingSym Is MethodSymbol AndAlso 719Debug.Assert(stopLookup) 835Debug.Assert(overriddenMembersResult IsNot Nothing)
Symbols\Source\SourceDeclareMethodSymbol.vb (4)
36Debug.Assert(MyBase.MethodKind = MethodKind.DeclareMethod) 37Debug.Assert(platformInvokeInfo IsNot Nothing) 60Debug.Assert(_lazyMetadataName IsNot Nothing) 69Debug.Assert(old Is Nothing OrElse old = metadataName)
Symbols\Source\SourceLabelSymbol.vb (2)
27Debug.Assert(labelNameToken.Kind = SyntaxKind.IdentifierToken OrElse labelNameToken.Kind = SyntaxKind.IntegerLiteralToken) 63Debug.Assert(TypeOf parentNode Is LabelStatementSyntax)
Symbols\Source\SourcePropertySymbol.vb (14)
70Debug.Assert(container IsNot Nothing) 71Debug.Assert(syntaxRef IsNot Nothing) 72Debug.Assert(location IsNot Nothing) 315Debug.Assert(syntax.Kind = SyntaxKind.ModifiedIdentifier) 376Debug.Assert(type IsNot Nothing) 417Debug.Assert(_lazyMetadataName IsNot Nothing) 426Debug.Assert(old Is Nothing OrElse old = metadataName) 822Debug.Assert(IsDefinition) 941Debug.Assert(Not implementedProperties.IsDefault) 1050Debug.Assert(ExplicitInterfaceImplementations.Contains(implementedProperty)) 1079Debug.Assert(accessor IsNot Nothing) 1182Debug.Assert(syntaxTree IsNot Nothing) 1183Debug.Assert(block IsNot Nothing) 1232Debug.Assert(attributeData IsNot Nothing)
Symbols\Source\SynthesizedFieldSymbol.vb (3)
37Debug.Assert(containingType IsNot Nothing) 38Debug.Assert(implicitlyDefinedBy IsNot Nothing) 39Debug.Assert(type IsNot Nothing)
Symbols\Source\SynthesizedMainTypeEntryPoint.vb (1)
55Debug.Assert(binder.IsDefaultInstancePropertyAllowed)
Symbols\Source\SynthesizedMyGroupCollectionPropertyAccessorSymbol.vb (1)
29Debug.Assert(createOrDisposeMethod IsNot Nothing AndAlso createOrDisposeMethod.Length > 0)
Symbols\Source\SynthesizedStaticLocalBackingField.vb (1)
40Debug.Assert(implicitlyDefinedBy.IsStatic)
Symbols\SynthesizedSymbols\SynthesizedClonedTypeParameterSymbol.vb (2)
41Debug.Assert(correspondingMethodTypeParameter.IsDefinition) 42Debug.Assert(correspondingMethodTypeParameter.ContainingSymbol <> container)
Symbols\SynthesizedSymbols\SynthesizedOverridingWitheventsProperty.vb (2)
191Debug.Assert(_baseProperty.Parameters.IsEmpty) 198Debug.Assert(_baseProperty.ParameterCount = 0)
Symbols\TypeSymbolExtensions.vb (1)
691Call Global.System.Diagnostics.Debug.Assert(matchingInterface.Arity = 1)
Microsoft.CodeAnalysis.Workspaces (670)
Classification\ClassifierHelper.cs (5)
192Debug.Assert(!span.TextSpan.IsEmpty); 289Debug.Assert(firstSemanticPartSpan.OverlapsWith(syntacticPartSpan)); 290Debug.Assert(lastSemanticPartSpan.OverlapsWith(syntacticPartSpan)); 307Debug.Assert(semanticPart1Span.OverlapsWith(syntacticPartSpan)); 308Debug.Assert(semanticPart1Span.OverlapsWith(syntacticPartSpan));
CodeActions\CodeAction.cs (1)
606Debug.Assert(nestedActions.Length > 0);
CodeFixes\CodeFix.cs (1)
52Debug.Assert(!diagnostics.IsDefaultOrEmpty);
CodeFixes\FixAllOccurrences\FixAllState.cs (1)
39Debug.Assert(diagnosticSpan.HasValue || scope is not FixAllScope.ContainingMember or FixAllScope.ContainingType);
CodeFixes\FixAllOccurrences\TextChangeMerger.cs (6)
46Debug.Assert(newDocument.Id == _oldDocument.Id); 158Debug.Assert(IsPureInsertion(change)); 159Debug.Assert(overlappingSpans.Count == 0); 203Debug.Assert(!IsPureInsertion(change)); 213Debug.Assert(!IsPureInsertion(change)); 233Debug.Assert(!IsPureInsertion(change));
CodeFixesAndRefactorings\CommonFixAllState.cs (1)
33Debug.Assert(document == null || document.Project == project);
Diagnostics\CompilationWithAnalyzersPair.cs (1)
61Debug.Assert(HostAnalyzers.Contains(analyzer));
Diagnostics\DiagnosticAnalysisResult.cs (5)
53Debug.Assert(!others.IsDefault); 54Debug.Assert(!syntaxLocals.Values.Any(item => item.IsDefault)); 55Debug.Assert(!semanticLocals.Values.Any(item => item.IsDefault)); 56Debug.Assert(!nonLocals.Values.Any(item => item.IsDefault)); 164Debug.Assert(textDocument?.SupportsDiagnostics() == true);
Diagnostics\DiagnosticAnalysisResultBuilder.cs (1)
126Debug.Assert(dummy == null);
Diagnostics\DiagnosticAnalysisResultMap.cs (1)
39Debug.Assert(telemetryInfo.IsEmpty || telemetryInfo.Count == analysisResult.Count);
Diagnostics\DiagnosticArguments.cs (4)
82Debug.Assert(documentId != null || documentSpan == null); 83Debug.Assert(documentId != null || documentAnalysisKind == null); 84Debug.Assert(documentAnalysisKind is null or 86Debug.Assert(projectAnalyzerIds.Length > 0 || hostAnalyzerIds.Length > 0);
Diagnostics\DocumentAnalysisScope.cs (4)
28Debug.Assert(kind is AnalysisKind.Syntax or AnalysisKind.Semantic); 29Debug.Assert(!projectAnalyzers.IsDefault); 30Debug.Assert(!hostAnalyzers.IsDefault); 31Debug.Assert(!projectAnalyzers.IsEmpty || !hostAnalyzers.IsEmpty);
Diagnostics\Extensions.cs (4)
278Debug.Assert(diagnostics.All(d => d.Location.SourceTree == tree)); 290Debug.Assert(diagnostics.All(d => d.Location.SourceTree == tree)); 343Debug.Assert(documentAnalysisScope.ProjectAnalyzers.ToSet().IsSubsetOf(compilationWithAnalyzers.ProjectAnalyzers)); 344Debug.Assert(documentAnalysisScope.HostAnalyzers.ToSet().IsSubsetOf(compilationWithAnalyzers.HostAnalyzers));
Differencing\AbstractSyntaxComparer.cs (1)
189Debug.Assert(label != IgnoredNode || isLeaf);
Differencing\Edit.cs (3)
24Debug.Assert((oldNode == null || oldNode.Equals(null)) == (kind == EditKind.Insert)); 25Debug.Assert((newNode == null || newNode.Equals(null)) == (kind == EditKind.Delete)); 27Debug.Assert(comparer == null ||
Differencing\EditScript.cs (5)
72Debug.Assert(Comparer.TreesEqual(x, Root2)); 163Debug.Assert(Comparer.TreesEqual(w, Root1)); 164Debug.Assert(Comparer.TreesEqual(x, Root2)); 233Debug.Assert(Comparer.TreesEqual(a, Root1)); 234Debug.Assert(Comparer.TreesEqual(b, Root2));
Differencing\LongestCommonSubsequence.cs (12)
92Debug.Assert(previous != null); 97Debug.Assert(minDepth > 0); 98Debug.Assert(minDepth <= maxDepth); 113Debug.Assert(start >= 0); 114Debug.Assert(start + length <= _array.Length); 260Debug.Assert(hasNext); 285Debug.Assert(yEnd > yMid); 313Debug.Assert(hasNext); 338Debug.Assert(yEnd > yMid); 374Debug.Assert(oldLength >= 0 && newLength >= 0); 397Debug.Assert(lcsLength <= max); 484Debug.Assert(xEnd == yEnd + k);
Differencing\Match.cs (13)
104Debug.Assert(nodes1.Length == nodes2.Length); 167Debug.Assert(maxAcceptableDistance is >= ExactMatchDistance and <= MaxDistance); 223Debug.Assert(Comparer.GetLabel(ancestor1) <= Comparer.GetLabel(node1)); 264Debug.Assert(added); 282Debug.Assert(Comparer.TreesEqual(node1, OldRoot)); 283Debug.Assert(Comparer.TreesEqual(node2, NewRoot)); 298Debug.Assert(Comparer.TreesEqual(node2, NewRoot)); 299Debug.Assert(!result || Comparer.TreesEqual(partner1, OldRoot)); 305Debug.Assert(Comparer.TreesEqual(node2, NewRoot)); 312Debug.Assert(Comparer.TreesEqual(node1, OldRoot)); 313Debug.Assert(!result || Comparer.TreesEqual(partner2, NewRoot)); 319Debug.Assert(Comparer.TreesEqual(node1, OldRoot)); 325Debug.Assert(Comparer.TreesEqual(node2, NewRoot));
Differencing\Match.LongestCommonSubsequence.cs (1)
20Debug.Assert(match != null);
Differencing\SequenceEdit.cs (3)
21Debug.Assert(oldIndex >= -1); 22Debug.Assert(newIndex >= -1); 23Debug.Assert(newIndex != -1 || oldIndex != -1);
Differencing\TreeComparer.cs (1)
99Debug.Assert(hasParent);
Editing\SyntaxGenerator.cs (1)
1905Debug.Assert(!parts.IsEmpty());
ExtensionManager\ServicesLayerExtensionManager.cs (1)
19Debug.Assert(exception is not OperationCanceledException);
FindSymbols\FindReferences\DependentTypeFinder.cs (4)
146Debug.Assert(project.SupportsCompilation); 260Debug.Assert(infos.Count > 0); 294Debug.Assert(project.SupportsCompilation); 564Debug.Assert(pooledInstance.Count == 0);
FindSymbols\FindReferences\Finders\PropertySymbolReferenceFinder.cs (1)
255Debug.Assert(syntaxFacts.IsIndexerMemberCref(node));
FindSymbols\FindReferences\FindReferencesSearchEngine_FindReferencesInDocuments.cs (1)
27Debug.Assert(_options.UnidirectionalHierarchyCascade);
FindSymbols\FindReferences\MetadataUnifyingSymbolHashSet.cs (1)
22Debug.Assert(instance.Count == 0);
FindSymbols\IStreamingFindReferencesProgress.cs (1)
38Debug.Assert(symbols.All(s => s.Kind == symbols[0].Kind));
FindSymbols\SymbolFinder.cs (1)
199Debug.Assert(solution.WorkspaceKind is WorkspaceKind.Interactive or WorkspaceKind.MiscellaneousFiles);
FindSymbols\SymbolTree\SymbolTreeInfo.cs (6)
434Debug.Assert(Checksum.Equals(other.Checksum)); 435Debug.Assert(_nodes.Length == other._nodes.Length); 442Debug.Assert(_inheritanceMap.Keys.Count == other._inheritanceMap.Keys.Count); 450Debug.Assert(values1.Length == values2.Length); 453Debug.Assert(values1[j] == values2[j]); 479Debug.Assert(baseNameIndex >= 0);
FindSymbols\SymbolTree\SymbolTreeInfo.Node.cs (2)
57Debug.Assert(node.Name == this.Name); 58Debug.Assert(node.ParentIndex == this.ParentIndex);
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (3)
516Debug.Assert(typeDefinition.Kind == MetadataDefinitionKind.Type); 801Debug.Assert(node.Name == null); 808Debug.Assert(node.Name != null);
FindSymbols\SymbolTree\SymbolTreeInfo_Serialization.cs (1)
46Debug.Assert(read.Checksum == checksum);
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (8)
363Debug.Assert(identifiers.Comparer == StringComparer.OrdinalIgnoreCase); 364Debug.Assert(escapedIdentifiers.Comparer == StringComparer.OrdinalIgnoreCase); 371Debug.Assert(identifiers.Comparer == StringComparer.Ordinal); 372Debug.Assert(escapedIdentifiers.Comparer == StringComparer.Ordinal); 379Debug.Assert(identifiers.Comparer == StringComparer.OrdinalIgnoreCase); 380Debug.Assert(escapedIdentifiers.Comparer == StringComparer.OrdinalIgnoreCase); 387Debug.Assert(identifiers.Comparer == StringComparer.Ordinal); 388Debug.Assert(escapedIdentifiers.Comparer == StringComparer.Ordinal);
LanguageServices\DeclaredSymbolFactoryService\ArityUtilities.cs (1)
18Debug.Assert(arity > 0);
Log\HistogramLogAggregator.cs (1)
64Debug.Assert(bucketSize > 0 && maxBucketValue > 0 && bucketCount > 0);
Log\KeyValueLogMessage.cs (1)
218Debug.Assert(str != null && !str.Contains(PairSeparator) && !str.Contains(KeyValueSeparator) && !str.Contains(ItemSeparator));
Log\RoslynEventSource.LogBlock.cs (4)
64Debug.Assert(message != null || entityForMessage != null); 110Debug.Assert(_message != null); 111Debug.Assert(!_startLogged); 136Debug.Assert(_message != null);
Options\GlobalOptionService.cs (2)
122Debug.Assert(optionKey.Option is IOption2 { Definition.StorageMapping: null }); 228Debug.Assert(!changedOptions.IsEmpty);
Options\LegacyWorkspaceOptionService.cs (2)
41Debug.Assert(key.Option is not IOption2); 56Debug.Assert(internallyDefinedOptions.All(entry => OptionSet.IsInternalOptionValue(entry.Value)));
Options\Option.cs (1)
59Debug.Assert(storageLocations.All(l => l is not IEditorConfigValueSerializer));
Options\OptionSet.cs (1)
31Debug.Assert(IsPublicOptionValue(result));
Options\PerLanguageOption.cs (1)
51Debug.Assert(storageLocations.All(l => l is not IEditorConfigValueSerializer));
PatternMatching\CamelCaseResult.cs (1)
31Debug.Assert(matchedSpansInReverse == null || matchedSpansInReverse.Count == matchCount);
PatternMatching\PatternMatcher.cs (2)
542Debug.Assert(firstMatch.HasValue); 543Debug.Assert(contiguous.HasValue);
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
84Debug.Assert(location.ComplexifiedTargetSpan.Contains(location.ConflictCheckSpan) || location.Type == RelatedLocationType.UnresolvableConflict);
Rename\RenameUtilities.cs (2)
264Debug.Assert(subSpan.Start <= replaceInsideString.Length); 265Debug.Assert(subSpan.End <= replaceInsideString.Length);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (1)
425Debug.Assert(renameText.Length == match.Length);
Serialization\SerializableSourceText.cs (2)
75Debug.Assert(storageHandle is null != text is null); 83Debug.Assert(contentChecksum == Checksum.Create(computedContentHash));
Shared\Extensions\ISymbolExtensions.cs (3)
580Debug.Assert(copy != node); 581Debug.Assert(copy.Parent == null); // Otherwise, when we give it one, it will be copied. 598Debug.Assert(sourceAttributes.Current.Name == targetAttributes.Current.Name);
Shared\Extensions\ProjectExtensions.cs (1)
24Debug.Assert(location.Kind == LocationKind.ExternalFile);
Shared\Extensions\SemanticModelExtensions.cs (1)
110Debug.Assert(tokenParent is not null);
Shared\Utilities\BloomFilter.cs (2)
182Debug.Assert(numberOfCharsLeft == 0); 237Debug.Assert(index <= 3);
Shared\Utilities\XmlFragmentParser.cs (2)
199Debug.Assert(charCount > 0); 204Debug.Assert(destCount >= 0);
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\DiagnosticAnalyzer\AnalyzerAssemblyLoader.cs (1)
193Debug.Assert(GeneratedPathComparer.Equals(_originalPathInfoMap[originalPath].ResolvedPath, resolvedPath));
src\Compilers\Core\Portable\DiagnosticAnalyzer\ProgramFilesAnalyzerPathResolver.cs (2)
43Debug.Assert(IsAnalyzerPathHandled(originalAnalyzerPath)); 49Debug.Assert(IsAnalyzerPathHandled(originalAnalyzerPath));
src\Compilers\Core\Portable\DiagnosticAnalyzer\ShadowCopyAnalyzerPathResolver.cs (1)
222Debug.Assert(AnalyzerAssemblyLoader.GeneratedPathComparer.Equals(shadowCopyPath, task.Result));
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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count));
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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)
330Debug.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)
341Debug.Assert(desiredGroupIndex >= 0); 342Debug.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);
TemporaryStorage\TemporaryStorageService.cs (1)
298Debug.Assert(*src == 0xFEFF);
TemporaryStorage\TemporaryStorageService.MemoryMappedInfo.cs (1)
88Debug.Assert(streamAccessor.Target.CanRead);
Utilities\Documentation\XmlDocumentationProvider.cs (1)
154Debug.Assert(PathUtilities.IsAbsolute(filePath));
Workspace\Host\Metadata\WorkspaceMetadataFileReferenceResolver.cs (2)
21Debug.Assert(metadataService != null); 22Debug.Assert(pathResolver != null);
Workspace\ProjectSystem\ProjectSystemProject.BatchingDocumentCollection.cs (2)
207Debug.Assert(_project._gate.CurrentCount == 0); 247Debug.Assert(_project._gate.CurrentCount == 0);
Workspace\ProjectSystem\ProjectSystemProject.cs (2)
1253Debug.Assert(_gate.CurrentCount == 0); 1323Debug.Assert(_gate.CurrentCount == 0);
Workspace\ProjectSystem\ProjectSystemProjectOptionsProcessor.cs (1)
131Debug.Assert(!arguments.IsDefault);
Workspace\Solution\ProjectDependencyGraph.cs (8)
494Debug.Assert(projectIds.Count >= referencesMap.Count); 495Debug.Assert(referencesMap.Keys.All(projectIds.Contains)); 516Debug.Assert(projectIds.Count >= reverseReferencesMap.Count); 517Debug.Assert(reverseReferencesMap.Keys.All(projectIds.Contains)); 523Debug.Assert(reverseReferencesMap.ContainsKey(referencedProject)); 524Debug.Assert(reverseReferencesMap[referencedProject].Contains(project)); 533Debug.Assert(forwardReferencesMap.ContainsKey(referencingProject)); 534Debug.Assert(forwardReferencesMap[referencingProject].Contains(project));
Workspace\Solution\ProjectDependencyGraph_RemoveAllProjectReferences.cs (1)
94Debug.Assert(references.IsSupersetOf(referencedProjectIds));
Workspace\Solution\ProjectDependencyGraph_RemoveProjectReference.cs (2)
85Debug.Assert(references.Contains(referencedProjectId)); 139Debug.Assert(references.Contains(projectId));
Workspace\Solution\ProjectState.cs (7)
736Debug.Assert(attributes.Version != Attributes.Version); 890Debug.Assert(!documents.Any(d => DocumentStates.Contains(d.Id))); 902Debug.Assert(!documents.Any(d => AdditionalDocumentStates.Contains(d.Id))); 914Debug.Assert(!documents.Any(d => AnalyzerConfigDocumentStates.Contains(d.Id))); 993Debug.Assert(!oldDocuments.SequenceEqual(newDocuments)); 1019Debug.Assert(!oldDocuments.SequenceEqual(newDocuments)); 1042Debug.Assert(!oldDocuments.SequenceEqual(newDocuments));
Workspace\Solution\SolutionCompilationState.CompilationTracker.CompilationTrackerState.cs (2)
197Debug.Assert(object.ReferenceEquals(finalCompilationWithGeneratedDocuments, compilationWithoutGeneratedDocuments)); 284Debug.Assert(tmp == projectId);
Workspace\Solution\SolutionCompilationState.cs (7)
616Debug.Assert(addedDocumentInfos.IsEmpty); 617Debug.Assert(removedDocumentInfos.IsEmpty); 1056Debug.Assert(stateChange.NewSolutionState != this.SolutionState); 1071Debug.Assert(stateChange.NewSolutionState != this.SolutionState); 1086Debug.Assert(stateChange.NewSolutionState != this.SolutionState); 1100Debug.Assert(stateChange.OldProjectState != stateChange.NewProjectState); 1119Debug.Assert(stateChange.OldProjectState != stateChange.NewProjectState);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (2)
108Debug.Assert(symbol.Kind is SymbolKind.Assembly or SymbolKind.NetModule or SymbolKind.DynamicType); 511Debug.Assert(this.ProjectState.IsSubmission);
Workspace\Solution\SolutionCompilationState.SkeletonReferenceCache.cs (2)
149Debug.Assert(version != VersionStamp.Default); 164Debug.Assert(version != VersionStamp.Default);
Workspace\Solution\SolutionState.cs (6)
168Debug.Assert(SortedProjectStates.Select(static state => state.Id).SetEquals(ProjectIds)); 169Debug.Assert(SortedProjectStates.Select(static state => state.Id).SetEquals(_dependencyGraph.ProjectIds)); 172Debug.Assert(SortedProjectStates.IsSorted()); 1140Debug.Assert(oldProject != newProject); 1153Debug.Assert(oldProject != newProject); 1164Debug.Assert(oldProject != newProject);
Workspace\Solution\StateChecksums.cs (1)
521Debug.Assert(state.TryGetStateChecksums(out var stateChecksum) && this == stateChecksum);
Workspace\Solution\TextDocumentStates.cs (1)
61Debug.Assert(map.KeyComparer == DocumentIdComparer.Instance);
Workspace\Solution\VersionStamp.cs (1)
125Debug.Assert(_globalIncrement != GlobalVersionMarker);
Workspace\Workspace.cs (22)
2093Debug.Assert(CanApplyChange(ApplyChangesKind.AddProject)); 2104Debug.Assert(CanApplyChange(ApplyChangesKind.RemoveProject)); 2119Debug.Assert(CanApplyChange(ApplyChangesKind.ChangeCompilationOptions) || 2137Debug.Assert(CanApplyChange(ApplyChangesKind.ChangeParseOptions) || 2150Debug.Assert(CanApplyChange(ApplyChangesKind.AddProjectReference)); 2161Debug.Assert(CanApplyChange(ApplyChangesKind.RemoveProjectReference)); 2172Debug.Assert(CanApplyChange(ApplyChangesKind.AddMetadataReference)); 2183Debug.Assert(CanApplyChange(ApplyChangesKind.RemoveMetadataReference)); 2194Debug.Assert(CanApplyChange(ApplyChangesKind.AddAnalyzerReference)); 2205Debug.Assert(CanApplyChange(ApplyChangesKind.RemoveAnalyzerReference)); 2216Debug.Assert(CanApplyChange(ApplyChangesKind.AddSolutionAnalyzerReference)); 2227Debug.Assert(CanApplyChange(ApplyChangesKind.RemoveSolutionAnalyzerReference)); 2238Debug.Assert(CanApplyChange(ApplyChangesKind.AddDocument)); 2249Debug.Assert(CanApplyChange(ApplyChangesKind.RemoveDocument)); 2260Debug.Assert(CanApplyChange(ApplyChangesKind.ChangeDocument)); 2271Debug.Assert(CanApplyChange(ApplyChangesKind.ChangeDocumentInfo)); 2282Debug.Assert(CanApplyChange(ApplyChangesKind.AddAdditionalDocument)); 2293Debug.Assert(CanApplyChange(ApplyChangesKind.RemoveAdditionalDocument)); 2304Debug.Assert(CanApplyChange(ApplyChangesKind.ChangeAdditionalDocument)); 2315Debug.Assert(CanApplyChange(ApplyChangesKind.AddAnalyzerConfigDocument)); 2326Debug.Assert(CanApplyChange(ApplyChangesKind.RemoveAnalyzerConfigDocument)); 2337Debug.Assert(CanApplyChange(ApplyChangesKind.ChangeAnalyzerConfigDocument));
Workspace\Workspace_Editor.cs (2)
577Debug.Assert(oldDocument.Kind is TextDocumentKind.AdditionalDocument or TextDocumentKind.AnalyzerConfigDocument); 778Debug.Assert(oldDocument.Kind is TextDocumentKind.AdditionalDocument or TextDocumentKind.AnalyzerConfigDocument);
Workspace\WorkspaceEventMap.cs (1)
40Debug.Assert(originalHandlers != newHandlers);
Microsoft.CodeAnalysis.Workspaces.MSBuild (11)
MSBuild\MSBuildWorkspace.cs (10)
317Debug.Assert(_applyChangesBuildHostProcessManager == null); 332Debug.Assert(_applyChangesBuildHostProcessManager != null); 333Debug.Assert(_applyChangesProjectFile == null); 453Debug.Assert(_applyChangesProjectFile != null); 501Debug.Assert(encoding != null); 513Debug.Assert(_applyChangesProjectFile != null); 652Debug.Assert(_applyChangesProjectFile != null); 667Debug.Assert(_applyChangesProjectFile != null); 680Debug.Assert(_applyChangesProjectFile != null); 692Debug.Assert(_applyChangesProjectFile != null);
src\Workspaces\MSBuild\BuildHost\Rpc\Contracts\ProjectFileReference.cs (1)
38Debug.Assert(!aliases.IsDefault);
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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count));
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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.MSBuild.UnitTests (1)
WorkspaceTestBase.cs (1)
42Debug.Assert(fileContent is string or byte[]);
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 (2)
Differencing\TestNode.cs (2)
25Debug.Assert(value is >= 0 and <= MaxValue); 26Debug.Assert(label is >= 0 and <= MaxLabel);
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.StrongName (1)
Utils.cs (1)
286Debug.Assert(segment.Count > 0);
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.Caching.StackExchangeRedis (8)
RedisCache.cs (8)
217Debug.Assert(cache is not null); 281Debug.Assert(_cache is not null); 304Debug.Assert(_cache is not null); 321Debug.Assert(_cache is not null); 348Debug.Assert(_cache is not null); 435Debug.Assert(cache is not null); 490Debug.Assert(cache is not null); 754Debug.Assert(cache is not null);
Microsoft.Extensions.Logging.AzureAppServices (1)
BlobLoggerProvider.cs (1)
81System.Diagnostics.Debug.Assert(tryGetBuffer);
Microsoft.Extensions.Logging.Generators (1)
LoggerMessageGenerator.Parser.cs (1)
798Debug.Assert(searchedBrace is '{' or '}');
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 (9)
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 (2)
40Debug.Assert(info.MarshallingAttributeInfo is ManagedHResultExceptionMarshallingInfo); 68Debug.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.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.VisualBasic.Core (48)
Microsoft\VisualBasic\Collection.vb (6)
78Debug.Assert(BeforeNode IsNot Nothing) 93Debug.Assert(AfterNode IsNot Nothing) 156Debug.Assert(node IsNot Nothing) 170Debug.Assert(node Is Nothing) 213Debug.Assert(node IsNot Nothing) 337Debug.Assert(CultureInfo IsNot Nothing)
Microsoft\VisualBasic\CompilerServices\LateBinding.vb (2)
293Debug.Assert(OperatingSystem.IsWindows()) 851Debug.Assert(False)
Microsoft\VisualBasic\CompilerServices\Operators.vb (12)
148Debug.Assert(comparison = CompareClass.Less OrElse 167Debug.Assert(comparison = CompareClass.Less OrElse 186Debug.Assert(comparison = CompareClass.Less OrElse 205Debug.Assert(comparison = CompareClass.Less OrElse 224Debug.Assert(comparison = CompareClass.Less OrElse 243Debug.Assert(comparison = CompareClass.Less OrElse 262Debug.Assert(comparison = CompareClass.Less OrElse 281Debug.Assert(comparison = CompareClass.Less OrElse 300Debug.Assert(comparison = CompareClass.Less OrElse 319Debug.Assert(comparison = CompareClass.Less OrElse 338Debug.Assert(comparison = CompareClass.Less OrElse 357Debug.Assert(comparison = CompareClass.Less OrElse
Microsoft\VisualBasic\CompilerServices\OverloadResolution.vb (1)
1348Debug.Assert(parameter IsNot Nothing AndAlso parameterType IsNot Nothing)
Microsoft\VisualBasic\CompilerServices\Symbols.vb (1)
1390Debug.Assert(rawMethod IsNot Nothing)
Microsoft\VisualBasic\CompilerServices\Utils.vb (2)
261Debug.Assert(Not (TypeOf member1 Is MethodBase) OrElse 323Debug.Assert(typeParam.IsGenericParameter)
Microsoft\VisualBasic\CompilerServices\VB6BinaryFile.vb (1)
184Diagnostics.Debug.Assert(Not m_Encoding Is Nothing)
Microsoft\VisualBasic\CompilerServices\VB6File.vb (13)
672Diagnostics.Debug.Assert(Not m_Encoding Is Nothing) 1026Diagnostics.Debug.Assert(Not m_Encoding Is Nothing) 1037Diagnostics.Debug.Assert(Not m_Encoding Is Nothing) 1049Diagnostics.Debug.Assert(ByteLength <= lengthToWrite) 1057Diagnostics.Debug.Assert(m_Encoding.GetByteCount(s) = lengthToWrite) 1070Diagnostics.Debug.Assert(Not m_Encoding Is Nothing) 1090Diagnostics.Debug.Assert(Not m_Encoding Is Nothing) 1108Diagnostics.Debug.Assert(Not m_Encoding Is Nothing) 1852Debug.Assert(m_Encoding.GetByteCount(sTemp) = ByteLength) 1859Diagnostics.Debug.Assert(Not m_Encoding Is Nothing) 1867Debug.Assert(m_Encoding.GetByteCount(sTemp) = FixedStringLength) 1877Debug.Assert(ByteLength <= FixedStringLength) 1891Debug.Assert(ByteLength = m_Encoding.GetByteCount(sTemp) AndAlso ByteLength <= FixedStringLength)
Microsoft\VisualBasic\CompilerServices\VB6InputFile.vb (1)
60Diagnostics.Debug.Assert(Not m_Encoding Is Nothing)
Microsoft\VisualBasic\CompilerServices\VB6OutputFile.vb (2)
86Diagnostics.Debug.Assert(Not m_Encoding Is Nothing) 108Diagnostics.Debug.Assert(Not m_Encoding Is Nothing)
Microsoft\VisualBasic\CompilerServices\VB6RandomFile.vb (1)
417Diagnostics.Debug.Assert(Not m_Encoding Is Nothing)
Microsoft\VisualBasic\CompilerServices\VBBinder.vb (1)
1060Diagnostics.Debug.Assert(AmbiguousCount > 0)
Microsoft\VisualBasic\FileIO\FileSystem.vb (3)
1313Debug.Assert(ByteCount <= ByteBuffer.Length) 1600Debug.Assert([Enum].IsDefined(Operation)) 1601Debug.Assert([Enum].IsDefined(TargetType))
Microsoft\VisualBasic\Helpers\ForEachEnum.vb (2)
69Debug.Assert(Not mAtBeginning) 80Debug.Assert(mNext Is Nothing)
Microsoft.VisualStudio.IntegrationTest.Setup (1)
TestExtensionManager.cs (1)
26Debug.Assert(exception is not OperationCanceledException);
Microsoft.VisualStudio.LanguageServices (86)
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)
146Debug.Assert(_isNavigating_doNotAccessDirectly != 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)
205Debug.Assert(_generateTypeDialogOptions.TypeKindOptions != TypeKindOptions.None); 428Debug.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)
179Debug.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)
141Debug.Assert(diagnostics.All(d => d.IsBuildDiagnostic()));
TaskList\ProjectExternalErrorReporter.cs (3)
48Debug.Assert(projectId != null); 49Debug.Assert(errorCodePrefix != null); 50Debug.Assert(workspace != null);
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 == SemanticSearchUtilities.GetQueryDocumentId(workspace.CurrentSolution));
MSBuild (7)
FileUtilities.cs (2)
742Debug.Assert(allowedExtensions?.Length > 0); 750Debug.Assert(!String.IsNullOrEmpty(extension) && extension[0] == '.');
WindowsFileSystem.cs (2)
138Debug.Assert(hr != WindowsNative.ErrorFileNotFound); 200Debug.Assert(hr != WindowsNative.ErrorSuccess);
WindowsNative.cs (3)
158Debug.Assert(Status == EnumerateDirectoryStatus.UnknownError); 168Debug.Assert(Status != EnumerateDirectoryStatus.UnknownError && 178Debug.Assert(Status != EnumerateDirectoryStatus.Success);
MSBuildTaskHost (16)
BinaryTranslator.cs (1)
630Debug.Assert(count == 2);
Concurrent\ConcurrentDictionary.cs (9)
128Debug.Assert(_comparer.GetHashCode(key) == hashcode); 162Debug.Assert(_comparer.GetHashCode(key) == hashcode); 191Debug.Assert((prev == null && node == tables._buckets[bucketNo]) || prev._next == node); 374Debug.Assert(newLength % 2 != 0); 458Debug.Assert(bucketNo >= 0 && bucketNo < bucketCount); 470Debug.Assert(bucketNo >= 0 && bucketNo < bucketCount); 471Debug.Assert(lockNo >= 0 && lockNo < lockCount); 481Debug.Assert(fromInclusive <= toExclusive); 506Debug.Assert(fromInclusive <= toExclusive);
Concurrent\ConcurrentQueue.cs (2)
167Debug.Assert(head._frozenForEnqueues); 231Debug.Assert(next == s._nextSegment);
EnvironmentUtilities.cs (2)
44Debug.Assert(processId != 0); 75Debug.Assert(processPath != null);
FileUtilities.cs (2)
742Debug.Assert(allowedExtensions?.Length > 0); 750Debug.Assert(!String.IsNullOrEmpty(extension) && extension[0] == '.');
Replay (8)
src\Compilers\Core\CommandLine\BuildProtocol.cs (1)
504Debug.Assert(reason is object);
src\Compilers\Core\Portable\InternalUtilities\Debug.cs (3)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
src\Compilers\Shared\BuildServerConnection.cs (4)
68Debug.Assert(workingDirectory is object); 179Debug.Assert(pipeName is object); 708Debug.Assert(Stream is null); 746Debug.Assert(Stream is not null);
Roslyn.Diagnostics.Analyzers (491)
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\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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\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)
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 517Debug.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) || 507Debug.Assert(parameterIndex >= 0); 508Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
48Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
42Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
36Debug.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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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\RoslynParallel.NetFramework.cs (7)
115Debug.Assert(source != null); 116Debug.Assert(scheduler != null); 117Debug.Assert(body != null); 280Debug.Assert(source != null); 281Debug.Assert(scheduler != null); 282Debug.Assert(body != null); 544Debug.Assert(!Cancellation.IsCancellationRequested);
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)
330Debug.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)
341Debug.Assert(desiredGroupIndex >= 0); 342Debug.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 (55)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (9)
59Debug.Assert(!token.ContainsDiagnostics); 332Debug.Assert(char.IsSurrogate(ch)); 342Debug.Assert(tokenText[index] == '\\'); 355Debug.Assert(tokenText[index] == '\\'); 389Debug.Assert(tokenText[index] == '\\'); 408Debug.Assert(tokenText[index] == '\\'); 453Debug.Assert(uintChar is > 0x0000FFFF and <= 0x0010FFFF); 493Debug.Assert(character == 'x'); 525Debug.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.cs (10)
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); 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)
792Debug.Assert(rewrittenBitwiseNotExpression.Kind() == SyntaxKind.BitwiseNotExpression); 1178Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1234Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1264Debug.Assert(currentOld.Kind() == currentNew.Kind()); 1444Debug.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));
Roslyn.Test.PdbUtilities (10)
EditAndContinue\EditAndContinueTest.cs (2)
193Debug.Assert(oldSymbol != null); 194Debug.Assert(newSymbol != null);
EditAndContinue\EditAndContinueTest.GenerationInfo.cs (1)
34Debug.Assert(diff is null ^ compilationVerifier is null);
EditAndContinue\EditAndContinueTest.GenerationVerifier.cs (6)
145Debug.Assert(generationInfo.CompilationDifference != null); 152Debug.Assert(generationInfo.CompilationDifference != null); 165Debug.Assert(generationInfo.CompilationDifference != null); 187Debug.Assert(generationInfo.CompilationDifference != null); 196Debug.Assert(generationInfo.CompilationDifference != null); 211Debug.Assert(generationInfo.CompilationDifference != null);
Reader\MockSymUnmanagedReader.cs (1)
362Debug.Assert((bufferLength == 0) || (bufferLength == count));
RulesetToEditorconfigConverter (2)
src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (2)
102Debug.Assert(rulesetNode.Name == RuleSetNodeName); 131Debug.Assert(rulesetNode.Name == RuleSetNodeName);
SemanticSearch.BuildTask (10)
GenerateFilteredReferenceAssembliesTask.cs (10)
325Debug.Assert(id is [_, ':', ..]); 382Debug.Assert(headers.PEHeader != null); 423Debug.Assert(metadataReader.GetGuid(moduleDef.Mvid) == ReadGuid(writableStream)); 468Debug.Assert((TypeAttributes)ReadUInt32(writer.BaseStream) == typeDef.Attributes); 471Debug.Assert(BitConverter.IsLittleEndian); 502Debug.Assert((MethodAttributes)ReadUInt16(writer.BaseStream) == def.Attributes); 505Debug.Assert(BitConverter.IsLittleEndian); 536Debug.Assert((FieldAttributes)ReadUInt16(writer.BaseStream) == def.Attributes); 539Debug.Assert(BitConverter.IsLittleEndian); 554Debug.Assert(stream.Read(buffer, 0, buffer.Length) == buffer.Length);
Shared (15)
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);
ServerSentEvents\Helpers.cs (2)
53Debug.Assert(value.Length <= buffer.Length); 67Debug.Assert(maxByteCount <= buffer.Length);
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);
Stress.ApiService (3)
Program.cs (3)
313Debug.Assert(activity is not null); 317Debug.Assert(innerActivity is not null); 336Debug.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.Json.SourceGeneration (53)
Helpers\RoslynExtensions.cs (6)
24Debug.Assert(type.FullName != null); 158Debug.Assert(baseType.IsGenericTypeDefinition()); 215Debug.Assert(member is IFieldSymbol or IPropertySymbol); 221Debug.Assert(member is IFieldSymbol or IPropertySymbol); 222Debug.Assert(otherMember is IFieldSymbol or IPropertySymbol); 357Debug.Assert(inputType.IsNullableType());
JsonSourceGenerator.Emitter.cs (15)
102Debug.Assert(_typeIndex.Count == 0); 103Debug.Assert(_propertyNames.Count == 0); 104Debug.Assert(!_emitGetConverterForNullablePropertyMethod); 159Debug.Assert(contextClasses.Count > 0); 248Debug.Assert(typeMetadata.ConverterType != null); 269Debug.Assert(typeMetadata.NullableUnderlyingType != null); 326Debug.Assert(!(typeGenerationSpec.ClassType == ClassType.Dictionary && collectionKeyType == null)); 331Debug.Assert(collectionValueType != null); 368Debug.Assert(keyTypeFQN != null); 372Debug.Assert(keyTypeFQN != null); 414Debug.Assert(typeGenerationSpec.CollectionValueType != null); 467Debug.Assert(typeGenerationSpec.CollectionKeyType != null); 468Debug.Assert(typeGenerationSpec.CollectionValueType != null); 720Debug.Assert(paramCount > 0); 823Debug.Assert(!_propertyNames.TryGetValue(effectiveJsonPropertyName, out string? existingName) || existingName == propertyNameFieldName);
JsonSourceGenerator.Parser.cs (25)
55Debug.Assert(_contextClassLocation != null); 85Debug.Assert(_knownSymbols.JsonSerializerContextType != null); 88Debug.Assert(_typesToGenerate.Count == 0); 89Debug.Assert(_generatedTypes.Count == 0); 90Debug.Assert(_contextClassLocation is null); 93Debug.Assert(contextTypeSymbol != null); 96Debug.Assert(_contextClassLocation is not null); 116Debug.Assert(rootSerializableTypes.Count > 0); 151Debug.Assert(_generatedTypes.Count > 0); 195Debug.Assert(typeSymbol != null); 203Debug.Assert(typeDeclarations?.Count > 0); 234Debug.Assert(_knownSymbols.JsonSerializableAttributeType != null); 235Debug.Assert(_knownSymbols.JsonSourceGenerationOptionsAttributeType != null); 294Debug.Assert(attributeData.ConstructorArguments.Length == 1 & attributeData.ConstructorArguments[0].Type?.Name is nameof(JsonSerializerDefaults)); 460Debug.Assert(attributeData.ConstructorArguments.Length == 1); 487Debug.Assert(attributeLocation != null); 564Debug.Assert(_knownSymbols.JsonStringEnumConverterOfTType != null); 732Debug.Assert(attributeData.ConstructorArguments.Length > 0); 763Debug.Assert(!SymbolEqualityComparer.Default.Equals(type, _knownSymbols.MemoryByteType)); 771Debug.Assert(!SymbolEqualityComparer.Default.Equals(type, _knownSymbols.ReadOnlyMemoryByteType)); 1128Debug.Assert(memberInfo is IFieldSymbol or IPropertySymbol); 1248Debug.Assert(memberInfo is IFieldSymbol or IPropertySymbol); 1467Debug.Assert(constructor != null); 1575Debug.Assert(_knownSymbols.JsonConverterAttributeType.IsAssignableFrom(attributeData.AttributeClass)); 1583Debug.Assert(attributeData.ConstructorArguments.Length == 1 && attributeData.ConstructorArguments[0].Value is null or ITypeSymbol);
src\libraries\Common\src\SourceGenerators\SourceWriter.cs (1)
66Debug.Assert(_indentation == 0 && _sb.Length > 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.Json\Common\JsonSeparatorNamingPolicy.cs (1)
18Debug.Assert(char.IsPunctuation(separator));
System.Text.RegularExpressions.Generator (156)
RegexGenerator.cs (1)
92Debug.Assert(state is DiagnosticData);
RegexGenerator.Emitter.cs (42)
399Debug.Assert(chars.Length > 3); 739Debug.Assert(minRequiredLength >= 0); 1012Debug.Assert(!string.IsNullOrEmpty(substring)); 1019Debug.Assert(!string.IsNullOrEmpty(substring)); 1023Debug.Assert(!string.IsNullOrEmpty(regexTree.FindOptimizations.FixedDistanceLiteral.String)); 1092Debug.Assert(opts.FindMode is FindNextStartingPositionMode.LeadingStrings_LeftToRight or FindNextStartingPositionMode.LeadingStrings_OrdinalIgnoreCase_LeftToRight); 1138Debug.Assert(regexTree.FindOptimizations.FixedDistanceSets is { Count: > 0 }); 1187Debug.Assert(primarySet.Chars.Length > 0); 1285Debug.Assert(setIndex is 0 or 1); 1291Debug.Assert(needLoop); 1326Debug.Assert(regexTree.FindOptimizations.FixedDistanceSets is { Count: > 0 }); 1329Debug.Assert(set.Distance == 0); 1336Debug.Assert(!set.Negated); 1360Debug.Assert(regexTree.FindOptimizations.LiteralAfterLoop is not null); 1363Debug.Assert(target.LoopNode.Kind is RegexNodeKind.Setloop or RegexNodeKind.Setlazy or RegexNodeKind.Setloopatomic); 1364Debug.Assert(target.LoopNode.N == int.MaxValue); 1634Debug.Assert(requiredLength > 0); 1670Debug.Assert(childCount >= 2); 1677Debug.Assert(node.Parent is not null); 1739Debug.Assert(startingLiteralNode.IsSetFamily); 1810Debug.Assert(numChars != 0); 2109Debug.Assert(sliceStaticPos == 0); 2936Debug.Assert(rm.Analysis.MayBacktrack(node.Child(0))); 3135Debug.Assert(!rtl || offset is null); 3136Debug.Assert(!rtl || !clauseOnly); 3204Debug.Assert((node.Options & RegexOptions.RightToLeft) == 0 || sliceStaticPos == 0); 3205Debug.Assert(sliceStaticPos >= 0); 3270Debug.Assert(node.Str is not null); 3276Debug.Assert(str.Length >= 2); 3277Debug.Assert(!clauseOnly || (!emitLengthCheck && !rightToLeft)); 3281Debug.Assert(emitLengthCheck); 3338Debug.Assert(node.M < node.N); 3479Debug.Assert(node.M < node.N); 3807Debug.Assert(sliceStaticPos == 0); 3873Debug.Assert(entriesPerIteration >= 1); 4143Debug.Assert(node.N > node.M); 4260Debug.Assert(node.M == 0 && node.N == 1); 4435Debug.Assert(sliceStaticPos == 0); 4568Debug.Assert(startingStackpos is not null); 4699Debug.Assert(args.Length is >= 1); 4751Debug.Assert(args.Length is >= 1); 5187Debug.Assert(rangeLower.LowInclusive != rangeUpper.LowInclusive);
RegexGenerator.Parser.cs (1)
128Debug.Assert(regexMemberSymbol is IPropertySymbol);
src\libraries\Common\src\System\HexConverter.cs (1)
167Debug.Assert(chars.Length >= bytes.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)
337Debug.Assert(whitespaceSet.Contains((char)i) == char.IsWhiteSpace((char)i)); 409Debug.Assert(!set.IsEmpty); 701Debug.Assert(c != 0); 869Debug.Assert(count <= evaluated); 913Debug.Assert(set1Negated == set2Negated); 947Debug.Assert(!IsNegated(set1) && !IsNegated(set2)); 998Debug.Assert((uint)comparison <= char.MaxValue); 1063Debug.Assert(twoChars.Length >= 2); 1149Debug.Assert(!hasSubtraction); 1278Debug.Assert(ch < 128); 1296Debug.Assert(ch < 128); 1467Debug.Assert(curcat < 0); 1552Debug.Assert(chars[index] < chars[index + 1]); 1632Debug.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); 332Debug.Assert(rootNode.Kind == RegexNodeKind.Capture); 333Debug.Assert(rootNode.Parent is null); 334Debug.Assert(rootNode.ChildCount() == 1); 560Debug.Assert(Kind is RegexNodeKind.Alternate or RegexNodeKind.Concatenate); 577Debug.Assert(Kind == RegexNodeKind.Group); 582Debug.Assert(u.ChildCount() == 1); 605Debug.Assert(Kind == RegexNodeKind.Atomic); 606Debug.Assert(ChildCount() == 1); 647Debug.Assert(branches is not null && branches.Count != 0); 767Debug.Assert(Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop); 876Debug.Assert(Kind is RegexNodeKind.Set or RegexNodeKind.Setloop or RegexNodeKind.Setloopatomic or RegexNodeKind.Setlazy); 877Debug.Assert(!string.IsNullOrEmpty(Str)); 925Debug.Assert(Kind == RegexNodeKind.Alternate); 1077Debug.Assert(alternation.Kind == RegexNodeKind.Alternate); 1078Debug.Assert(alternation.Children is List<RegexNode> { Count: >= 2 }); 1098Debug.Assert(children[startingIndex].Children is List<RegexNode> { Count: >= 2 }); 1176Debug.Assert(node.Kind == RegexNodeKind.Alternate); 1177Debug.Assert(node.ChildCount() >= 2); 1219Debug.Assert(alternation.Kind == RegexNodeKind.Alternate); 1220Debug.Assert(alternation.Children is List<RegexNode> { Count: >= 2 }); 1251Debug.Assert(startingSpan.Length > 0); 1280Debug.Assert(startingNode.Kind == RegexNodeKind.Multi); 1281Debug.Assert(startingNode.Str!.Length > 0); 1304Debug.Assert(startingSpan.Length > 0); 1327Debug.Assert(startingSpan.Length == 1); 1328Debug.Assert(startingSpan[0] == node.Ch); 1334Debug.Assert(node.Kind == RegexNodeKind.Multi); 1335Debug.Assert(node.Str.AsSpan().StartsWith(startingSpan, StringComparison.Ordinal)); 1389Debug.Assert(Kind is RegexNodeKind.One or RegexNodeKind.Multi || (IsOneFamily && M > 0)); 1390Debug.Assert((Options & RegexOptions.RightToLeft) == 0); 1449Debug.Assert(lowInclusive < highInclusive); 1485Debug.Assert(@string is not null); 1491Debug.Assert(setChars is not null); 1504Debug.Assert(Kind == RegexNodeKind.Concatenate); 1546Debug.Assert(Kind == RegexNodeKind.Concatenate); 1547Debug.Assert(Children is List<RegexNode>); 1629Debug.Assert(Kind == RegexNodeKind.Concatenate); 1630Debug.Assert(Children is List<RegexNode>); 1740Debug.Assert(matchingCharsInMulti < nextNode.Str.Length); 1834Debug.Assert(Children is List<RegexNode>); 1939Debug.Assert(node.Kind is RegexNodeKind.Loop or RegexNodeKind.Lazyloop); 1973Debug.Assert(Kind is RegexNodeKind.PositiveLookaround or RegexNodeKind.NegativeLookaround); 1974Debug.Assert(ChildCount() == 1); 2001Debug.Assert(Kind == RegexNodeKind.BackreferenceConditional); 2002Debug.Assert(ChildCount() is 1 or 2); 2019Debug.Assert(Kind == RegexNodeKind.ExpressionConditional); 2020Debug.Assert(ChildCount() is 2 or 3); 2073Debug.Assert(subsequent.Kind != RegexNodeKind.Group); 2297Debug.Assert(childCount >= 2); 2330Debug.Assert(ChildCount() == 1); 2414Debug.Assert(childCount >= 2); 2468Debug.Assert(ChildCount() == 1); 2697Debug.Assert(max >= 2); 2742Debug.Assert(Children is List<RegexNode>); 2753Debug.Assert(Children != null); 2754Debug.Assert(index < ChildCount()); 2784Debug.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); 1129Debug.Assert(node.ChildCount() >= 2); 1175Debug.Assert( 1406Debug.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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 41/// Generally <see cref="Debug.Assert(bool)"/> is a sufficient method for enforcing DEBUG
Text.Analyzers (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\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)
15/// <inheritdoc cref="Debug.Assert(bool)"/> 17public static void Assert([DoesNotReturnIf(false)] bool condition) => Debug.Assert(condition); 41/// 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)
648Debug.Assert(data.All(d => d.Count() == count)); 1017Debug.Assert(local.Length == size);
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (16)
83Debug.Assert(items != null); 484Debug.Assert(self.Length == other.Length); 515Debug.Assert(self.Length == other.Length); 548Debug.Assert(!array.IsDefault); 549Debug.Assert(predicateWithArg != null ^ predicateWithoutArg != null); 568Debug.Assert(i > 0); 584Debug.Assert(i > 0); 587Debug.Assert(builder == null); 600Debug.Assert(!all); 601Debug.Assert(!none); 610Debug.Assert(none); 900Debug.Assert(builder.Count > 1); 944Debug.Assert(members.Length > 0); 959Debug.Assert(count < members.Length); 971Debug.Assert(builder.Count == count); 1279Debug.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)
493Debug.Assert(builder.Count == 0); 609Debug.Assert(start >= 0 && length >= 0); 610Debug.Assert(start + length <= items.Count); 629Debug.Assert(start >= 0 && length >= 0); 630Debug.Assert(start + length <= items.Length); 644Debug.Assert(start >= 0 && length >= 0); 645Debug.Assert(start + length <= items.Length); 669Debug.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\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)
505Debug.Assert(SymbolEqualityComparer.Default.Equals(method.ContainingType.OriginalDefinition, systemThreadingInterlocked)); 517Debug.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) || 507Debug.Assert(parameterIndex >= 0); 508Debug.Assert(parameterIndex < arguments.Length);
src\RoslynAnalyzers\Utilities\Compiler\Options\AggregateCategorizedAnalyzerConfigOptions.cs (1)
48Debug.Assert(ReferenceEquals(this, Empty) || !_perTreeOptions.IsEmpty);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildItemOptionNames.cs (1)
42Debug.Assert(typeof(MSBuildItemOptionNames).GetFields().Single(f => f.Name == itemOptionName) != null);
src\RoslynAnalyzers\Utilities\Compiler\Options\MSBuildPropertyOptionNames.cs (1)
36Debug.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)
31Debug.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)
261Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 263Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 285Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 287Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 297Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 299Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 307Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 309Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 319Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalNode)); 321Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newNode)); 572Debug.Assert(previousOriginalNode == null || previousOriginalNode.Parent == currentOriginalNode); 573Debug.Assert(previousReplacedNode == null || previousReplacedNode.Parent == currentReplacedNode); 627Debug.Assert(this.SemanticRootOfOriginalExpression.DescendantNodesAndSelf().Contains(originalExpression)); 629Debug.Assert(this.SemanticRootOfReplacedExpression.DescendantNodesAndSelf().Contains(newExpression)); 1081Debug.Assert(signature1Parameters.Length == signature2Parameters.Length); 1082Debug.Assert(specifiedArguments.Length <= signature1Parameters.Length || 1167Debug.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\RoslynParallel.NetFramework.cs (7)
115Debug.Assert(source != null); 116Debug.Assert(scheduler != null); 117Debug.Assert(body != null); 280Debug.Assert(source != null); 281Debug.Assert(scheduler != null); 282Debug.Assert(body != null); 544Debug.Assert(!Cancellation.IsCancellationRequested);
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)
330Debug.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)
341Debug.Assert(desiredGroupIndex >= 0); 342Debug.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);
vbc (9)
src\Compilers\Core\CommandLine\BuildProtocol.cs (1)
504Debug.Assert(reason is object);
src\Compilers\Shared\BuildClient.cs (4)
158Debug.Assert(serverResult.Value.RanOnServer); 239Debug.Assert(buildResponse != null); 274Debug.Assert(false); 354Debug.Assert(PlatformInformation.IsWindows);
src\Compilers\Shared\BuildServerConnection.cs (4)
68Debug.Assert(workingDirectory is object); 179Debug.Assert(pipeName is object); 708Debug.Assert(Stream is null); 746Debug.Assert(Stream is not null);
VBCSCompiler (25)
src\Compilers\Core\CommandLine\BuildProtocol.cs (1)
504Debug.Assert(reason is object);
src\Compilers\Server\VBCSCompiler\MetadataCache.cs (1)
75Debug.Assert(fileKey.HasValue);
src\Compilers\Server\VBCSCompiler\NamedPipeClientConnectionHost.cs (9)
27Debug.Assert(connection is null || exception is null); 54Debug.Assert(_cancellationTokenSource is null); 55Debug.Assert(_listenTasks is null); 56Debug.Assert(_queue is null); 85Debug.Assert(_cancellationTokenSource is object); 86Debug.Assert(_queue is object); 87Debug.Assert(_listenTasks is object); 142Debug.Assert(_cancellationTokenSource is object); 143Debug.Assert(_queue is object);
src\Compilers\Server\VBCSCompiler\ServerDispatcher.cs (6)
148Debug.Assert(_gcTask is null); 149Debug.Assert(_timeoutTask is null); 222Debug.Assert(_state == State.Running); 223Debug.Assert(_clientConnectionHost.IsListening); 249Debug.Assert(_listenTask != null); 283Debug.Assert(current.Status == TaskStatus.RanToCompletion);
src\Compilers\Shared\BuildClient.cs (4)
158Debug.Assert(serverResult.Value.RanOnServer); 239Debug.Assert(buildResponse != null); 274Debug.Assert(false); 354Debug.Assert(PlatformInformation.IsWindows);
src\Compilers\Shared\BuildServerConnection.cs (4)
68Debug.Assert(workingDirectory is object); 179Debug.Assert(pipeName is object); 708Debug.Assert(Stream is null); 746Debug.Assert(Stream is not null);
VBCSCompiler.UnitTests (1)
NamedPipeTestUtil.cs (1)
68Debug.Assert(sharedServer is object);