FrameworkFork\Microsoft.Xml\Xml\BinaryXml\SqlUtils.cs (24)
143Debug.Assert(rguiData.Length == 4);
168Debug.Assert(rgulU.Length == s_cNumeMax);
175Debug.Assert(iulD != 0, "iulD != 0", "Divided by zero!");
176Debug.Assert(iulD > 0, "iulD > 0", "Invalid data: less than zero");
177Debug.Assert(ciulU > 0, "ciulU > 0", "No data in the array");
313Debug.Assert(dwlAccum < s_ulInt32Base, "dwlAccum < x_lInt32Base", "");
338Debug.Assert(dwlAccum < s_ulInt32Base);
357Debug.Assert(dwlAccum < s_ulInt32Base, "dwlAccum < x_dwlBaseUI4", "Integer overflow");
407Debug.Assert(dwlAccum < dwlDivisor);
409Debug.Assert((dwlAccum / dwlDivisor) < s_ulInt32Base);
433Debug.Assert(dwlAccum < s_ulInt32Base);
452Debug.Assert(bPrec <= s_maxPrecision && bPrec > 0, "bPrec <= MaxPrecision && bPrec > 0", "Invalid numeric precision");
458Debug.Assert(uiDigit < 10);
572Debug.Assert(m_bScale <= s_NUMERIC_MAX_PRECISION, "m_bScale <= NUMERIC_MAX_PRECISION", "In AssertValid");
573Debug.Assert(m_bScale <= m_bPrec, "m_bScale <= m_bPrec", "In AssertValid");
574Debug.Assert(m_bScale >= 0, "m_bScale >= 0", "In AssertValid");
575Debug.Assert(m_bPrec > 0, "m_bPrec > 0", "In AssertValid");
576Debug.Assert(CLenFromPrec(m_bPrec) >= m_bLen, "CLenFromPrec(m_bPrec) >= m_bLen", "In AssertValid");
577Debug.Assert(m_bLen <= s_cNumeMax, "m_bLen <= x_cNumeMax", "In AssertValid");
584Debug.Assert(m_bLen == 1, "m_bLen == 1", "In AssertValid");
589Debug.Assert(rglData[iulData] == 0, "rglData[iulData] == 0", "In AssertValid");
644Debug.Assert(val >= 0 && val < 100);
650Debug.Assert(val > -10000 && val < 10000);
662Debug.Assert(val >= 0 && val < 1000);
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathNode.cs (13)
158Debug.Assert(HasCollapsedText, "Do not call CollapsedLinePosition unless HasCollapsedText is true.");
213Debug.Assert(localName == null || (object)Document.NameTable.Get(localName) == (object)localName, "localName must be atomized.");
225Debug.Assert(localName == null || (object)Document.NameTable.Get(localName) == (object)localName, "localName must be atomized.");
363Debug.Assert(info != null && idxParent <= UInt16.MaxValue);
374Debug.Assert(lineNumOffset >= 0 && lineNumOffset <= MaxLineNumberOffset, "Line number offset too large or small: " + lineNumOffset);
375Debug.Assert(linePosOffset >= 0 && linePosOffset <= MaxLinePositionOffset, "Line position offset too large or small: " + linePosOffset);
385Debug.Assert(posOffset >= 0 && posOffset <= MaxCollapsedPositionOffset, "Collapsed text line position offset too large or small: " + posOffset);
402Debug.Assert(NodeType == XPathNodeType.Element);
413Debug.Assert(NodeType == XPathNodeType.Element);
441Debug.Assert(pageSibling != null && idxSibling != 0 && idxSibling <= UInt16.MaxValue, "Bad argument");
442Debug.Assert(_idxSibling == 0, "SetSibling should not be called more than once.");
460Debug.Assert(pageSimilar != null && idxSimilar != 0 && idxSimilar <= UInt16.MaxValue, "Bad argument");
461Debug.Assert(_idxSimilar == 0, "SetSimilarElement should not be called more than once.");
FrameworkFork\Microsoft.Xml\Xml\Cache\XPathNodeHelper.cs (32)
30Debug.Assert(pageElem[idxElem].NodeType == XPathNodeType.Element);
74Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
79Debug.Assert(pageNode[idxNode].NodeType == XPathNodeType.Attribute);
93Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
113Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
123Debug.Assert(idx != 0);
141Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
164Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
182Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
183Debug.Assert(idxNode <= UInt16.MaxValue);
184Debug.Assert(pageNode[0].PageInfo.PageNumber <= Int16.MaxValue);
197Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
203Debug.Assert(idx != 0);
231Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
264Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
302Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
315Debug.Assert(typ != XPathNodeType.Attribute && typ != XPathNodeType.Namespace);
334Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
335Debug.Assert(pageNode[idxNode].NodeType != XPathNodeType.Attribute);
371Debug.Assert(idxAnc != 0 && pageAnc != null);
397Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
427Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
454Debug.Assert(pageNode != null && idxNode != 0, "Cannot pass null argument(s)");
516Debug.Assert(pageCurrent != null && idxCurrent != 0, "Cannot pass null argument(s)");
613Debug.Assert(pageCurrent != null && idxCurrent != 0, "Cannot pass null argument(s)");
614Debug.Assert(typ != XPathNodeType.Text, "Text should be handled by GetTextFollowing in order to take into account collapsed text.");
615Debug.Assert(page[idx].NodeType != XPathNodeType.Attribute, "Current node should never be an attribute or namespace--caller should handle this case.");
652Debug.Assert(!page[idx].IsAttrNmsp, "GetContentFollowing should never return attributes or namespaces.");
671Debug.Assert(pageCurrent != null && idxCurrent != 0, "Cannot pass null argument(s)");
672Debug.Assert(!page[idx].IsAttrNmsp, "Current node should never be an attribute or namespace--caller should handle this case.");
749Debug.Assert(pageNode[idxNode].HasAttribute || pageNode[idxNode].HasContentChild, "Caller must check HasAttribute/HasContentChild on parent before calling GetChild.");
750Debug.Assert(pageNode[idxNode].HasAttribute || !pageNode[idxNode].HasCollapsedText, "Text child is virtualized and therefore is not present in the physical node page.");
FrameworkFork\Microsoft.Xml\Xml\Core\XmlTextReaderImpl.cs (200)
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);
774Debug.Assert(baseUriStr == string.Empty, "BaseURI can come either from XmlParserContext or from the constructor argument, not from both");
822Debug.Assert(xmlFragment != null);
848default: Debug.Assert(false); goto case XmlNodeType.None;
1218Debug.Assert(false, "Invalid InitInputType");
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);
2071Debug.Assert(_v1Compat, "XmlTextReaderImpl.Normalization property cannot be accessed on reader created via XmlReader.Create.");
2076Debug.Assert(_v1Compat, "XmlTextReaderImpl.Normalization property cannot be changed on reader created via XmlReader.Create.");
2104Debug.Assert(_v1Compat, "XmlTextReaderImpl.WhitespaceHandling property cannot be accessed on reader created via XmlReader.Create.");
2109Debug.Assert(_v1Compat, "XmlTextReaderImpl.WhitespaceHandling property cannot be changed on reader created via XmlReader.Create.");
2128Debug.Assert(_v1Compat, "XmlTextReaderImpl.DtdProcessing property cannot be accessed on reader created via XmlReader.Create.");
2133Debug.Assert(_v1Compat, "XmlTextReaderImpl.DtdProcessing property cannot be changed on reader created via XmlReader.Create.");
2185Debug.Assert(_v1Compat, "XmlTextReaderImpl.ResetState cannot be called on reader created via XmlReader.Create.");
2226Debug.Assert(_v1Compat, "XmlTextReaderImpl.GetRemainder cannot be called on reader created via XmlReader.Create.");
2228Debug.Assert(_stringBuilder.Length == 0);
2268Debug.Assert(_v1Compat, "XmlTextReaderImpl.ReadChars cannot be called on reader created via XmlReader.Create.");
2269Debug.Assert(_outerReader is XmlTextReader);
2310Debug.Assert(_v1Compat, "XmlTextReaderImpl.ReadBase64 cannot be called on reader created via XmlReader.Create.");
2311Debug.Assert(_outerReader is XmlTextReader);
2347Debug.Assert(_v1Compat, "XmlTextReaderImpl.ReadBinHex cannot be called on reader created via XmlReader.Create.");
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);
3123Debug.Assert(false, "Unhandled DtdProcessing enumeration value.");
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);
3352Debug.Assert(_ps.appendMode, "UnDecodeChars cannot be called after ps.appendMode has been changed to false");
3354Debug.Assert(_ps.charsUsed >= _ps.charPos, "The current position must be in the valid character range.");
3362Debug.Assert(_charactersInDocument >= _ps.charsUsed - _ps.charPos,
3370Debug.Assert(_charactersFromEntities >= _ps.charsUsed - _ps.charPos,
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);
3587Debug.Assert(false, "We should get an exception again.");
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);
4724Debug.Assert(false, "We should never get to this point.");
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);
5015Debug.Assert(val == XmlComplianceUtil.CDataNormalize(val), "The attribute value is not CDATA normalized!");
5090Debug.Assert(_curNode.type == XmlNodeType.Element);
5227Debug.Assert(_stringBuilder.Length == 0);
5438Debug.Assert(false, "We should never get to this point.");
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);
7166Debug.Assert(false, "We should never get to this point.");
7169Debug.Assert(_ps.isEof);
7272Debug.Assert(false, "We should never get to this point.");
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);
8110Debug.Assert(_xmlResolver.SupportsType(uri, typeof(Stream)), "Stream must always be a supported type in XmlResolver");
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);
8653Debug.Assert(count == charsParsed || _incReadDecoder.IsFull, "Check if decoded consumed all characters unless it's full.");
8670Debug.Assert(IncrementalRead() == 0, "Previous call of IncrementalRead should eat up all characters!");
8676Debug.Assert(_fragmentType == XmlNodeType.Attribute);
8693Debug.Assert(_parsingFunction == ParsingFunction.InReadAttributeValue);
8720Debug.Assert(_stringBuilder.Length == 0);
8734Debug.Assert(_ps.eolNormalized, "Entity replacement text for attribute values should be EOL-normalized!");
8788Debug.Assert(false, "We should never get to this point.");
8843Debug.Assert(false, "We should never get to this point.");
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);
9143Debug.Assert(context.NameTable == null || context.NameTable == nt, "This check should have been done in XmlParserContext constructor.");
9159Debug.Assert(_nameTableFromSettings == false);
9187Debug.Assert(_dtdInfo == null);
9246Debug.Assert(_curNode.type == XmlNodeType.Whitespace && newNodeType == XmlNodeType.SignificantWhitespace, "Incorrect node type change!");
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\schema\XmlValueConverter.cs (8)
287Debug.Assert(schemaType != null && datatype != null, "schemaType or schemaType.Datatype may not be null");
297Debug.Assert(schemaType.Datatype.Variety != XmlSchemaDatatypeVariety.List, "schemaType must be list's item type, not list itself");
321Debug.Assert(false, "Type code " + typeCode + " is not supported.");
529Debug.Assert(_typeCode == XmlTypeCode.Item, "If SchemaType is null, then TypeCode may only be Item, Node, or AnyAtomicType");
3451Debug.Assert(!(atomicConverter is XmlListConverter) || ((XmlListConverter)atomicConverter).atomicConverter == null,
3583Debug.Assert(enumSrc != null, "Value passed to ToArray must implement IEnumerable");
3611Debug.Assert(enumSrc != null, "Value passed to ToArray must implement IEnumerable");
3678Debug.Assert(schemaType.DerivedBy == XmlSchemaDerivationMethod.Union);
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
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.
301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
302Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty");
447Debug.Assert(comparer is not null);
518Debug.Assert(_buckets.Length > 0);
521Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType));
574Debug.Assert(comparer is not null);
616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
648Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
649Debug.Assert(newSize >= _entries.Length);
707Debug.Assert(_entries.Length > 0, "entries should be non-empty");
711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
784Debug.Assert(_entries.Length > 0, "entries should be non-empty");
788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count);
204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
205Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized");
258Debug.Assert(comparer is not null);
296Debug.Assert(entries.Length > 0, "entries should be non-empty");
302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null);
326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
901Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
902Debug.Assert(newSize >= _entries.Length);
1023Debug.Assert(_buckets.Length > 0);
1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
1063Debug.Assert(comparer is not null);
1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first");
1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Compiler\DependencyAnalysis\GenericLookupResult.cs (49)
30Debug.Assert(owningTypeDefinition.Instantiation.Length == TypeInstantiation.Length);
31Debug.Assert(MethodInstantiation.IsNull || MethodInstantiation.Length == 0);
36Debug.Assert(_canonicalOwner is MethodDesc);
38Debug.Assert(owningMethodDefinition.Instantiation.Length == MethodInstantiation.Length);
44Debug.Assert(owningType.Instantiation.Length == TypeInstantiation.Length);
49Debug.Assert(owningMethodDefinition.OwningType.Instantiation.IsNull
120Debug.Assert(InstantiationIsConcrete(dictionary.TypeInstantiation));
121Debug.Assert(InstantiationIsConcrete(dictionary.MethodInstantiation));
167Debug.Assert(x.GetType() == y.GetType());
172Debug.Assert(result != 0);
178Debug.Assert(x.GetType() != y.GetType());
196Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?");
208Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any));
255Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?");
266Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any));
313Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?");
324Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any));
371Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?");
387Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any));
434Debug.Assert(method.IsRuntimeDeterminedExactMethod, "Concrete method in a generic dictionary?");
447Debug.Assert(instantiatedMethod.IsCanonicalMethod(CanonicalFormKind.Any));
499Debug.Assert(field.OwningType.IsRuntimeDeterminedSubtype, "Concrete field in a generic dictionary?");
510Debug.Assert(!instantiatedField.OwningType.IsCanonicalSubtype(CanonicalFormKind.Any));
555Debug.Assert(method.IsRuntimeDeterminedExactMethod, "Concrete method in a generic dictionary?");
569Debug.Assert(instantiatedMethod.IsCanonicalMethod(CanonicalFormKind.Any));
620Debug.Assert(method.IsRuntimeDeterminedExactMethod);
638Debug.Assert(instantiatedMethod.IsCanonicalMethod(CanonicalFormKind.Any));
703Debug.Assert(method.IsRuntimeDeterminedExactMethod);
704Debug.Assert(method.IsVirtual);
705Debug.Assert(method.HasInstantiation || method.OwningType.IsInterface);
733Debug.Assert(instantiatedMethod.IsCanonicalMethod(CanonicalFormKind.Any));
783Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete static base in a generic dictionary?");
784Debug.Assert(type is MetadataType);
795Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any));
840Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete static base in a generic dictionary?");
841Debug.Assert(type is MetadataType);
852Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any));
896Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete static base in a generic dictionary?");
897Debug.Assert(type is MetadataType);
908Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any));
953Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?");
964Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any));
1005Debug.Assert(type.IsRuntimeDeterminedSubtype, "Concrete type in a generic dictionary?");
1016Debug.Assert(!instantiatedType.IsCanonicalSubtype(CanonicalFormKind.Any));
1064Debug.Assert(_constraintType.IsRuntimeDeterminedSubtype || _constrainedMethod.IsRuntimeDeterminedExactMethod, "Concrete type in a generic dictionary?");
1065Debug.Assert(!_constrainedMethod.HasInstantiation || !_directCall, "Direct call to constrained generic method isn't supported");
1094Debug.Assert(!instantiatedConstrainedMethod.IsCanonicalMethod(CanonicalFormKind.Any));
1095Debug.Assert(!instantiatedConstraintType.IsCanonicalSubtype(CanonicalFormKind.Any));
1134Debug.Assert(instantiatedConstraintType.IsValueType || (instantiatedConstrainedMethod.OwningType.IsInterface && instantiatedConstrainedMethod.Signature.IsStatic));
Compiler\DependencyAnalysis\NativeLayoutVertexNode.cs (46)
39Debug.Assert(Marked);
87Debug.Assert(SavedVertex == null || ReferenceEquals(SavedVertex, value));
163Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
171Debug.Assert(_instantiationArgsSig == null || (_instantiationArgsSig != null && _method.Instantiation.Length == _instantiationArgsSig.Length));
284Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
295Debug.Assert(_signature.Length == _parametersSig.Length);
337Debug.Assert(type.IsDefType);
361Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
386Debug.Fail("UNREACHABLE");
405Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
422Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
433Debug.Fail("UNREACHABLE");
445Debug.Assert(type.HasInstantiation && !type.IsGenericDefinition);
465Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
480Debug.Assert(!type.IsRuntimeDeterminedSubtype);
481Debug.Assert(!type.HasInstantiation || type.IsGenericDefinition);
497Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
527Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
644Debug.Assert(method.HasInstantiation);
666Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
674Debug.Assert(NeedsEntrypoint(_method));
709Debug.Assert(nodeFactory.LazyGenericsPolicy.UsesLazyGenerics(owningMethod));
710Debug.Assert(owningMethod.IsCanonicalMethod(CanonicalFormKind.Any));
711Debug.Assert(owningMethod.HasInstantiation);
716Debug.Assert(nodeFactory.LazyGenericsPolicy.UsesLazyGenerics(owningType));
717Debug.Assert(owningType.IsCanonicalSubtype(CanonicalFormKind.Any));
727Debug.Assert(owningMethod.HasInstantiation);
765Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
770Debug.Assert(associatedLayout.Marked);
809Debug.Assert(method.HasInstantiation);
810Debug.Assert(!method.IsGenericMethodDefinition);
811Debug.Assert(method.IsCanonicalMethod(CanonicalFormKind.Any));
812Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) == method, "Assert that the canonical method passed in is in standard canonical form");
849Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
886Debug.Assert(type.IsCanonicalSubtype(CanonicalFormKind.Any));
887Debug.Assert(type.ConvertToCanonForm(CanonicalFormKind.Specific) == type, "Assert that the canonical type passed in is in standard canonical form");
897Debug.Assert(GenericTypesTemplateMap.IsArrayTypeEligibleForTemplate(type));
899Debug.Assert(defType.Instantiation.Length == 1);
1007Debug.Assert(Marked, "WriteVertex should only happen for marked vertices");
1288Debug.Assert(method.HasInstantiation);
1331Debug.Assert(method.HasInstantiation);
1371Debug.Assert(field.OwningType.IsRuntimeDeterminedSubtype);
1465Debug.Assert(_constrainedMethod.OwningType.IsInterface);
1466Debug.Assert(!_constrainedMethod.HasInstantiation || !directCall);
1531Debug.Assert(SignatureKind is FixupSignatureKind.GenericConstrainedMethod);
1537Debug.Assert(SignatureKind is FixupSignatureKind.NonGenericStaticConstrainedMethod or FixupSignatureKind.NonGenericInstanceConstrainedMethod);
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WasmObjectWriter.cs (29)
92Debug.Assert(added,
189Debug.Assert(bytesWritten == encodeSize);
280Debug.Assert(section != null || alignment == 1, $"Section: {sectionIndex} is not a WebcilSection but alignment {alignment} requested");
422Debug.Assert(BitOperations.IsPow2(webcilSection.MinAlignment) && BitOperations.IsPow2(WebcilSectionAlignment) &&
456Debug.Assert(peCliHeaderRva != 0);
462Debug.Assert(peDebugRva != 0);
469Debug.Assert(webcilSections.Length > 0);
470Debug.Assert(webcilSections[webcilSections.Length - 1].Name.ToString() == "reloc");
520Debug.Assert(_sections.Sections.Count == sectionIndex);
537Debug.Assert(MethodCount == totalMethodCount);
560Debug.Assert(added, $"Duplicate global name: {name}");
565Debug.Assert(written == size);
618Debug.Assert(writer.SectionIndex == _sections.Count - 1, "The .reloc section must be the last section we emit.");
648Debug.Assert(outputFileStream.CanSeek, $"EmitObjectFile requires seekable output stream");
724Debug.Assert(section.Header.SizeOfRawData - bytesWritten == section.Padding, $"Unexpected padding: {section.Header.SizeOfRawData - bytesWritten} != {section.Padding}");
742Debug.Assert(webcilStream.Position == _webcilSegment.GetFlatMappedSize(), $"Total Size Mismatch: {webcilStream.Position} != {_webcilSegment.GetFlatMappedSize()}");
791Debug.Assert(_sections[sectionIndex] is WebcilSection);
825Debug.Assert(_sections[pending.SectionIndex] is WebcilSection);
827Debug.Assert(pending.Offset >= 0, "Pending base relocation has a negative offset.");
833Debug.Assert(targetRva != 0); // this section should have been assigned a non-zero VirtualAddress at this point.
870Debug.Assert(curSectionAsWebcil is null || sectionStart != 0);
887Debug.Assert(IsWithinSection(virtualRelocOffset, curSectionAsWebcil));
901Debug.Assert(IsWithinSection(virtualSymbolImageOffset, symbolWebcilSection));
939Debug.Assert(symbolWebcilSection != null);
943Debug.Assert(symbolWebcilSection != null);
948Debug.Assert(symbolWebcilSection != null);
952Debug.Assert(symbolWebcilSection != null);
993Debug.Assert(symbol.IndexSpace == WasmIndexSpace.Tag);
1088Debug.Assert(_definedGlobals.ContainsKey("webcilVersion"));
src\runtime\src\coreclr\tools\Common\Internal\Runtime\RiscVLoongArch64FpStruct.cs (30)
61Debug.Assert(index < 2);
63Debug.Assert(size == sizeof(float) || size == sizeof(double));
65Debug.Assert(size >= 1 && size <= 8);
66Debug.Assert((size & (size - 1)) == 0, "size needs to be a power of 2");
72Debug.Assert((int)PosIntFloat == (int)PosFloatInt + 1, "FloatInt and IntFloat need to be adjacent");
73Debug.Assert((int)PosSizeShift2nd == (int)PosSizeShift1st + 2, "SizeShift1st and 2nd need to be adjacent");
87Debug.Assert(nElements == 1, "HasImpliedRepeatedFields must have returned a false, it can't be an array");
91Debug.Assert(nFlattenedFieldsPerElement == 1 || nFlattenedFieldsPerElement == 2);
101Debug.Assert(elementTypeIndex == 0);
102Debug.Assert(typeIndex == 1);
105Debug.Assert((int)FpStruct.IntFloat == ((int)FpStruct.FloatInt << 1),
107Debug.Assert((int)FpStruct.SizeShift2ndMask == ((int)FpStruct.SizeShift1stMask << 2),
115Debug.Assert(info.Size1st() == info.Size2nd());
176Debug.Assert(nFields == 1);
182Debug.Assert(nElements > 0, "InlineArray length must be > 0");
196Debug.Assert(arch is TargetArchitecture.RiscV64 or TargetArchitecture.LoongArch64);
209Debug.Assert(nFields == 1 || nFields == 2);
221Debug.Assert((info.flags & (OnlyOne | BothFloat)) == 0);
222Debug.Assert((info.flags & FloatInt) == 0 || info.Size1st() == sizeof(float) || info.Size1st() == sizeof(double));
223Debug.Assert((info.flags & IntFloat) == 0 || info.Size2nd() == sizeof(float) || info.Size2nd() == sizeof(double));
227Debug.Assert(nFields == 2);
232Debug.Assert((info.flags & FloatInt) != 0);
233Debug.Assert((info.flags & (IntFloat | SizeShift2ndMask)) == 0);
234Debug.Assert(info.offset2nd == 0);
237Debug.Assert(nFields == ((info.flags & OnlyOne) != 0 ? 1 : 2));
239Debug.Assert(floatFlags != 0);
240Debug.Assert(((uint)floatFlags & ((uint)floatFlags - 1)) == 0,
246Debug.Assert(end1st <= info.offset2nd || end2nd <= info.offset1st, "fields must not overlap");
248Debug.Assert(info.offset1st + info.Size1st() <= td.GetElementSize().AsInt);
249Debug.Assert(info.offset2nd + info.Size2nd() <= td.GetElementSize().AsInt);
Collections\RetrievableEntryHashSet\RetrievableEntryHashSet.cs (10)
235Debug.Assert(String.Equals(name, value.Key, StringComparison.Ordinal));
263Debug.Assert(_buckets != null, "m_buckets was null but m_lastIndex > 0");
284Debug.Assert(String.Equals(entry.Key, entry.Value.Key, StringComparison.Ordinal));
398Debug.Assert(String.Equals(entry.Key, entry.Value.Key, StringComparison.Ordinal));
604Debug.Assert(String.Equals(entry.Key, entry.Value.Key, StringComparison.Ordinal));
703Debug.Assert(_count >= 0, "m_count is negative");
714Debug.Assert(_buckets != null, "m_buckets was null but m_count > 0");
740Debug.Assert(newSlots.Length <= _slots.Length, "capacity increased after TrimExcess");
760Debug.Assert(_buckets == null, "Initialize was called but m_buckets was non-null");
776Debug.Assert(_buckets != null, "IncreaseCapacity called on a set with no elements");
src\5057ed6cf5d6323b\SegmentedDictionary`2.cs (21)
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.
301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
302Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty");
447Debug.Assert(comparer is not null);
518Debug.Assert(_buckets.Length > 0);
521Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType));
574Debug.Assert(comparer is not null);
616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
648Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
649Debug.Assert(newSize >= _entries.Length);
707Debug.Assert(_entries.Length > 0, "entries should be non-empty");
711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
784Debug.Assert(_entries.Length > 0, "entries should be non-empty");
788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\msbuild\artifacts\.packages\microsoft.codeanalysis.collections\5.0.0-1.25277.114\contentFiles\cs\net9.0\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count);
204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
205Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized");
258Debug.Assert(comparer is not null);
296Debug.Assert(entries.Length > 0, "entries should be non-empty");
302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null);
326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
901Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
902Debug.Assert(newSize >= _entries.Length);
1023Debug.Assert(_buckets.Length > 0);
1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
1063Debug.Assert(comparer is not null);
1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first");
1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
DiagnosticAnalyzer\AnalyzerDriver.cs (60)
78Debug.Assert(_lazyAnalyzerExecutor != null);
88Debug.Assert(_lazyCurrentCompilationData != null);
106Debug.Assert(_lazyUnsuppressedAnalyzers != null);
123Debug.Assert(_lazyPerSymbolAnalyzerActionsCache != null);
142Debug.Assert(_lazyCompilationEndAnalyzers != null);
164Debug.Assert(_lazyAnalyzerGateMap != null);
178Debug.Assert(!_lazyGeneratedCodeAnalysisFlagsMap.IsDefault);
198Debug.Assert(_lazyNonConfigurableAndCustomConfigurableAnalyzers != null);
212Debug.Assert(_lazySymbolStartAnalyzers != null);
226Debug.Assert(_lazyTreatAllCodeAsNonGeneratedCode.HasValue);
245Debug.Assert(_lazyGeneratedCodeFilesMap != null);
259Debug.Assert(_lazyGeneratedCodeSymbolsForTreeMap != null);
273Debug.Assert(_lazySuppressedAnalyzersForTreeMap != null);
289Debug.Assert(_lazySuppressedDiagnosticIdsForUnsuppressedAnalyzers != null);
303Debug.Assert(_lazyIsGeneratedCodeSymbolMap != null);
348Debug.Assert(_lazyCompilationEventQueue != null);
362Debug.Assert(_lazyDiagnosticQueue != null);
376Debug.Assert(!severityFilter.Contains(ReportDiagnostic.Suppress));
377Debug.Assert(!severityFilter.Contains(ReportDiagnostic.Default));
404Debug.Assert(_lazyInitializeTask == null);
473Debug.Assert(_lazyInitializeTask == null);
474Debug.Assert(compilation.SemanticModelProvider != null);
706Debug.Assert(analysisScope != null);
728Debug.Assert(faultedTask.IsFaulted);
993Debug.Assert(severity != ReportDiagnostic.Default);
1017Debug.Assert(compilation.ContainsSyntaxTree(tree));
1024Debug.Assert(!reportedDiagnostics.IsEmptyWithoutResolution);
1048Debug.Assert(HasDiagnosticSuppressors);
1049Debug.Assert(!reportedDiagnostics.IsEmpty);
1050Debug.Assert(_programmaticSuppressions != null);
1051Debug.Assert(_diagnosticsProcessedForProgrammaticSuppressions != null);
1081Debug.Assert(suppressableDiagnostics.Contains(diagnostic));
1082Debug.Assert(!diagnostic.IsSuppressed);
1084Debug.Assert(suppressedDiagnostic.IsSuppressed);
1262Debug.Assert(location.SourceTree != null);
1282Debug.Assert(declaredSymbols != null);
1299Debug.Assert(GeneratedCodeSymbolsForTreeMap != null);
1300Debug.Assert(_lazyGeneratedCodeAttribute != null);
1322Debug.Assert(existingGeneratedCodeSymbols.SetEquals(generatedCodeSymbols));
1443Debug.Assert(_lazyInitializeTask != null);
1455Debug.Assert(_lazyPrimaryTask != null);
1618Debug.Assert(CompilationEventQueue.IsCompleted, "TryDequeueAsync should provide a value unless the AsyncQueue<T> is completed.");
1794Debug.Assert(!subsetProcessedAnalyzers.IsDefault);
1832Debug.Assert(AnalyzerActions.SymbolStartActionsCount > 0);
1883Debug.Assert(completedAnalyzers.Count < analysisScope.Analyzers.Length);
1964Debug.Assert(compilationEvent is CompilationStartedEvent || compilationEvent is CompilationCompletedEvent);
2171Debug.Assert(AnalyzerActions.SymbolStartActionsCount > 0);
2172Debug.Assert(SymbolStartAnalyzers.Contains(analyzer));
2262Debug.Assert(!IsDiagnosticAnalyzerSuppressed(analyzer, analyzerExecutor.Compilation.Options, analyzerManager, analyzerExecutor, analysisScope, severityFilter, cancellationToken));
2287Debug.Assert(!IsDiagnosticAnalyzerSuppressed(analyzer, analyzerExecutor.Compilation.Options, analyzerManager, analyzerExecutor, analysisScope, severityFilter, cancellationToken));
2352Debug.Assert(_lazyDoNotAnalyzeGeneratedCode.HasValue);
2621Debug.Assert(shouldExecuteSyntaxNodeActions || shouldExecuteOperationActions || shouldExecuteCodeBlockActions || shouldExecuteOperationBlockActions);
2622Debug.Assert(!isInGeneratedCode || !DoNotAnalyzeGeneratedCode);
3032Debug.Assert(!operationBlock.Parent.IsImplicit);
3039Debug.Assert(operationBlock.Kind is OperationKind.Invocation or OperationKind.Invalid);
3040Debug.Assert(operationBlock.Parent.IsImplicit);
3041Debug.Assert(operationBlock.Parent.Parent is IConstructorBodyOperation ctorBody &&
3043Debug.Assert(!operationBlock.Parent.Parent.IsImplicit);
3050Debug.Fail($"Expected operation with kind '{operationBlock.Kind}' to be the root operation with null 'Parent', but instead it has a non-null Parent with kind '{operationBlock.Parent.Kind}'");
3061Debug.Assert(operationsToAnalyze.ToImmutableHashSet().Count == operationsToAnalyze.Count);
DiagnosticAnalyzer\AnalyzerExecutor.cs (40)
136Debug.Assert((addNonCategorizedDiagnostic != null) ^ (addCategorizedLocalDiagnostic != null));
137Debug.Assert((addCategorizedLocalDiagnostic != null) == (addCategorizedNonLocalDiagnostic != null));
233Debug.Assert(_analyzerExecutionTimeMap != null);
339Debug.Assert(startAction.Analyzer == symbolScope.Analyzer);
362Debug.Assert(_addSuppression != null);
403Debug.Assert(compilationEvent is CompilationStartedEvent || compilationEvent is CompilationCompletedEvent);
450Debug.Assert(getTopMostNodeForAnalysis != null);
451Debug.Assert(!filterSpan.HasValue || filterTree != null);
573Debug.Assert(getTopMostNodeForAnalysis != null);
574Debug.Assert(!isGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(analyzer));
575Debug.Assert(!IsAnalyzerSuppressedForSymbol(analyzer, symbolDeclaredEvent.Symbol, cancellationToken));
576Debug.Assert(!filterSpan.HasValue || filterTree != null);
687Debug.Assert(file.SourceTree != null);
743Debug.Assert(file.AdditionalFile != null);
787Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(syntaxNodeAction.Analyzer));
788Debug.Assert(!IsAnalyzerSuppressedForTree(syntaxNodeAction.Analyzer, node.SyntaxTree, cancellationToken));
811Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(operationAction.Analyzer));
812Debug.Assert(!IsAnalyzerSuppressedForTree(operationAction.Analyzer, executionData.SemanticModel.SyntaxTree, cancellationToken));
861Debug.Assert(!executableCodeBlocks.IsEmpty);
975Debug.Assert(!operationBlocks.IsEmpty);
1056Debug.Assert(declaredNode != null);
1057Debug.Assert(executionData.DeclaredSymbol != null);
1058Debug.Assert(CanHaveExecutableCodeBlock(executionData.DeclaredSymbol));
1059Debug.Assert(startActions.Any() || endActions.Any() || actions.Any());
1181Debug.Assert(nodeActionsByKind.Any());
1182Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(executionData.Analyzer));
1183Debug.Assert(!IsAnalyzerSuppressedForTree(executionData.Analyzer, executionData.SemanticModel.SyntaxTree, cancellationToken));
1284Debug.Assert(operationActionsByKind != null);
1285Debug.Assert(operationActionsByKind.Any());
1286Debug.Assert(!executionData.IsGeneratedCode || !_shouldSkipAnalysisOnGeneratedCode(executionData.Analyzer));
1287Debug.Assert(!IsAnalyzerSuppressedForTree(executionData.Analyzer, executionData.SemanticModel.SyntaxTree, cancellationToken));
1327Debug.Assert(((IFieldSymbol)symbol).AssociatedSymbol == null);
1386Debug.Assert(false);
1538Debug.Assert(IsAnalyzerExceptionDiagnostic(exceptionDiagnostic));
1576Debug.Assert(_addNonCategorizedDiagnostic != null);
1581Debug.Assert(_addNonCategorizedDiagnostic == null);
1582Debug.Assert(_addCategorizedNonLocalDiagnostic != null);
1618Debug.Assert(_addNonCategorizedDiagnostic != null);
1690Debug.Assert(_analyzerExecutionTimeMap != null);
1701Debug.Assert(operation.Parent == null);
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
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.
301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
302Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty");
447Debug.Assert(comparer is not null);
518Debug.Assert(_buckets.Length > 0);
521Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType));
574Debug.Assert(comparer is not null);
616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
648Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
649Debug.Assert(newSize >= _entries.Length);
707Debug.Assert(_entries.Length > 0, "entries should be non-empty");
711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
784Debug.Assert(_entries.Length > 0, "entries should be non-empty");
788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count);
204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
205Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized");
258Debug.Assert(comparer is not null);
296Debug.Assert(entries.Length > 0, "entries should be non-empty");
302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null);
326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
901Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
902Debug.Assert(newSize >= _entries.Length);
1023Debug.Assert(_buckets.Length > 0);
1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
1063Debug.Assert(comparer is not null);
1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first");
1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
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.
301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
302Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty");
447Debug.Assert(comparer is not null);
518Debug.Assert(_buckets.Length > 0);
521Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType));
574Debug.Assert(comparer is not null);
616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
648Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
649Debug.Assert(newSize >= _entries.Length);
707Debug.Assert(_entries.Length > 0, "entries should be non-empty");
711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
784Debug.Assert(_entries.Length > 0, "entries should be non-empty");
788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count);
204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
205Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized");
258Debug.Assert(comparer is not null);
296Debug.Assert(entries.Length > 0, "entries should be non-empty");
302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null);
326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
901Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
902Debug.Assert(newSize >= _entries.Length);
1023Debug.Assert(_buckets.Length > 0);
1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
1063Debug.Assert(comparer is not null);
1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first");
1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
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.
301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
302Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty");
447Debug.Assert(comparer is not null);
518Debug.Assert(_buckets.Length > 0);
521Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType));
574Debug.Assert(comparer is not null);
616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
648Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
649Debug.Assert(newSize >= _entries.Length);
707Debug.Assert(_entries.Length > 0, "entries should be non-empty");
711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
784Debug.Assert(_entries.Length > 0, "entries should be non-empty");
788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count);
204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
205Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized");
258Debug.Assert(comparer is not null);
296Debug.Assert(entries.Length > 0, "entries should be non-empty");
302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null);
326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
901Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
902Debug.Assert(newSize >= _entries.Length);
1023Debug.Assert(_buckets.Length > 0);
1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
1063Debug.Assert(comparer is not null);
1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first");
1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAbstractValue.cs (1)
154Debug.Assert(index >= 0);
src\roslyn\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\roslyn\src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (103)
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);
1302Debug.Fail($"Unexpected 'null' target type for '{operation.Syntax}'");
1358Debug.Assert(PredicateAnalysis);
1364Debug.Assert(PredicateAnalysis);
1388Debug.Assert(PredicateAnalysis);
1389Debug.Assert(operation.Kind is OperationKind.BinaryOperator or
1424Debug.Assert(Equals(savedCurrentAnalysisData, CurrentAnalysisData), "Expected no updates to CurrentAnalysisData");
1436Debug.Assert(result);
1439Debug.Assert(HasPredicatedDataForEntity(flowCaptureReferenceEntity));
1453Debug.Assert(!ReferenceEquals(truePredicatedData, CurrentAnalysisData));
1458Debug.Assert(!ReferenceEquals(falsePredicatedData, CurrentAnalysisData));
1462Debug.Assert(Equals(savedCurrentAnalysisData, CurrentAnalysisData), "Expected no updates to CurrentAnalysisData");
1491Debug.Assert(IsContractCheckArgument((IArgumentOperation)operation));
1529Debug.Assert(targetEntity.CaptureId != null);
1546Debug.Assert(PredicateAnalysis);
1547Debug.Assert(FlowBranchConditionKind != ControlFlowConditionKind.None);
1641Debug.Fail($"Unknown pattern kind '{isPatternOperation.Pattern.Kind}'");
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);
3158Debug.Assert(operation.Initializer == null, "Object or collection initializer must have been lowered in the CFG");
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 _));
3828Debug.Assert(operation.Kind == OperationKind.YieldReturn, "IReturnOperation must have been lowered in the CFG");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
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.
301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
302Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty");
447Debug.Assert(comparer is not null);
518Debug.Assert(_buckets.Length > 0);
521Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType));
574Debug.Assert(comparer is not null);
616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
648Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
649Debug.Assert(newSize >= _entries.Length);
707Debug.Assert(_entries.Length > 0, "entries should be non-empty");
711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
784Debug.Assert(_entries.Length > 0, "entries should be non-empty");
788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count);
204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
205Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized");
258Debug.Assert(comparer is not null);
296Debug.Assert(entries.Length > 0, "entries should be non-empty");
302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null);
326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
901Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
902Debug.Assert(newSize >= _entries.Length);
1023Debug.Assert(_buckets.Length > 0);
1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
1063Debug.Assert(comparer is not null);
1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first");
1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(
Binder\Binder_Conversions.cs (146)
69Debug.Assert(result is BoundConversion || (conversion.IsIdentity && ((object)result == source) || source.NeedsToBeConverted()) || hasErrors);
74Debug.Assert(filterConversion(conversion, result));
75Debug.Assert(BoundNode.GetConversion(result, placeholder1) == conversion);
81Debug.Assert(BoundNode.GetConversion(result2, placeholder2) == conversion);
234Debug.Assert(destination.SpecialType != SpecialType.System_String);
258Debug.Assert(!conversion.Exists);
277Debug.Assert(conversion.IsCollectionExpression
300Debug.Assert(source.Type is null);
301Debug.Assert(!conversion.Exists);
311Debug.Assert(inConversionGroupFlags == InConversionGroupFlags.Unspecified);
344Debug.Assert(source == (object)methodGroup || !conversion.IsValid);
363Debug.Assert(!conversion.IsMethodGroup);
379Debug.Assert(conversion.UnderlyingConversions.Length == 1);
442Debug.Assert(elementConversions.Length == sourceTypes.Length);
465Debug.Assert(conversion.UnderlyingConversions.IsDefault);
474Debug.Assert(syntax.SyntaxTree is object);
482Debug.Assert(conversion.ConstrainedToTypeOpt is TypeParameterSymbol);
523Debug.Assert(source.Type is { });
526Debug.Assert(elementField is { });
545Debug.Assert(destination.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_Span_T), TypeCompareKind.AllIgnoreOptions));
562Debug.Assert(source.Type is not null);
563Debug.Assert(destination.IsSpan() || destination.IsReadOnlySpan());
584Debug.Assert(destination.IsReadOnlySpan());
596Debug.Assert(destination.IsReadOnlySpan());
653Debug.Assert(type.IsSpan() || type.IsReadOnlySpan());
654Debug.Assert(type.IsDefinition);
663Debug.Assert(spanType.IsSpan() && readonlySpanType.IsReadOnlySpan());
664Debug.Assert(spanType.IsDefinition && readonlySpanType.IsDefinition);
686Debug.Assert(source.IsSpan() || source.IsReadOnlySpan());
687Debug.Assert(destination.IsReadOnlySpan());
688Debug.Assert(!source.IsDefinition && !destination.IsDefinition);
695Debug.Assert(!source.IsReadOnlySpan() || !sameElementTypes);
703Debug.Assert(source.IsReadOnlySpan() && destination.IsReadOnlySpan());
704Debug.Assert(source.IsDefinition && destination.IsDefinition);
731Debug.Assert(readOnlySpanType.IsReadOnlySpan());
732Debug.Assert(!readOnlySpanType.IsDefinition);
733Debug.Assert(((NamedTypeSymbol)readOnlySpanType).TypeArgumentsWithAnnotationsNoUseSiteDiagnostics[0].SpecialType is SpecialType.System_Char);
786Debug.Assert(destination.Equals(Compilation.GetWellKnownType(WellKnownType.System_IFormattable), TypeCompareKind.ConsiderEverything) ||
826Debug.Assert(expr is BoundObjectCreationExpressionBase { WasTargetTyped: true } or
831Debug.Assert(expr is not BoundBadExpression { ChildBoundNodes: var children } || !children.Any((child, node) => child.Syntax == node.Syntax, node));
942Debug.Assert(_conversion.Kind is ConversionKind.NoConversion);
950Debug.Assert(elementType is { });
961Debug.Assert(result.WasCompilerGenerated == _node.IsParamsArrayOrCollection);
962Debug.Assert(result.IsParamsArrayOrCollection == _node.IsParamsArrayOrCollection);
972Debug.Assert(elementType is { });
1038Debug.Assert(_node.WithElement is null);
1039Debug.Assert(inProgressConstructor is not null);
1047Debug.Assert(collectionCreation is BoundObjectCreationExpressionBase or BoundBadExpression);
1159Debug.Assert(elements.Length == elementConversions.Length);
1160Debug.Assert(elementConversions.All(c => c.Exists));
1191Debug.Assert(enumeratorInfo is { });
1192Debug.Assert(enumeratorInfo.ElementType is { }); // ElementType is set always, even for IEnumerable.
1268Debug.Assert(@this._targetType.IsArrayInterface(out _));
1280Debug.Assert(isMutableArray);
1370Debug.Assert(projection.Arity == 0);
1371Debug.Assert(projection.ParameterCount == 0 || !projection.Parameters.Last().IsParams);
1387Debug.Assert(collectionBuilderMethods.All(t => t.Name == methodName));
1420Debug.Assert(!projectionCall.Expanded);
1503Debug.Assert(result);
1507Debug.Assert(result);
1637Debug.Assert(parameterType.OriginalDefinition.Equals(Compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions));
1649Debug.Assert(!collectionBuilderMethod.IsExtensionBlockMember());
1664Debug.Assert(!isParamsModifierValidation || syntax is ParameterSyntax);
1666Debug.Assert(!isParamsModifierValidation);
1669Debug.Assert(!hasWithElement);
1690Debug.Assert(!hasWithElement);
1835Debug.Assert(!targetType.IsDynamic());
1914Debug.Assert(boundExpression.HasErrors);
1954Debug.Assert(methodGroup.ReceiverOpt is not null);
1955Debug.Assert(methodGroup.ReceiverOpt.Type is not null);
1971Debug.Assert(false); // Should not get here given the 'acceptOnlyMethods' argument value used in 'ResolveMethodGroup' call above
1995Debug.Assert(resolution.AnalyzedArguments.HasDynamicArgument);
2011Debug.Assert(finalApplicableCandidates.Length != 1 || finalApplicableCandidates[0].IsApplicable);
2032Debug.Assert(!IsDisallowedExtensionInOlderLangVer(addMethods[0]));
2038Debug.Assert(!resolution.OverloadResolutionResult.Succeeded);
2061Debug.Assert(methodGroup.ReceiverOpt is not null);
2091Debug.Assert(receiverType is not null);
2152Debug.Assert(constructed is not null);
2185Debug.Assert(node != null);
2186Debug.Assert(methodGroup != null);
2187Debug.Assert(methodGroup.Error == null);
2188Debug.Assert(methodGroup.Methods.Count > 0);
2249Debug.Assert(call.HasErrors);
2250Debug.Assert(call.Method.Name == "Add");
2253Debug.Assert(false); // Add test if we hit this assert.
2266Debug.Assert(!collectionInitializer.DefaultArguments[argIndex]);
2281Debug.Assert(false);
2364Debug.Assert(elementTypeWithAnnotations.Type is null); // GetCollectionExpressionTypeKind() does not set elementType for these cases.
2376Debug.Assert(elementTypeWithAnnotations.HasType);
2386Debug.Assert(elementType is { });
2434Debug.Assert(reportedErrors);
2456Debug.Assert(targetTyped || destination.IsErrorType() || destination.Equals(source.Type, TypeCompareKind.ConsiderEverything));
2495Debug.Assert(targetTyped || destination.IsErrorType() || destination.Equals(source.Type, TypeCompareKind.ConsiderEverything));
2528Debug.Assert(conversionGroup != null);
2529Debug.Assert(conversionGroup.Conversion == conversion);
2530Debug.Assert(conversion.IsUserDefined);
2579Debug.Assert(conversion.BestUserDefinedConversionAnalysis is object); // All valid user-defined conversions have this populated
2601Debug.Assert(toParameterTypeConversion.IsNullable);
2602Debug.Assert(toParameterTypeConversion.IsExplicit);
2603Debug.Assert(toParameterTypeConversion.UnderlyingConversions[0].IsIdentity);
2647Debug.Assert(toConversion.Exists);
2653Debug.Assert(fromReturnTypeConversion.IsNullable);
2654Debug.Assert(fromReturnTypeConversion.IsImplicit);
2655Debug.Assert(!fromReturnTypeConversion.UnderlyingConversions[0].IsIdentity);
2717Debug.Assert(conversionGroup != null);
2718Debug.Assert(conversionGroup.Conversion == conversion);
2719Debug.Assert(conversion.IsUnion);
2742Debug.Assert(conversion.BestUnionConversionAnalysis is object); // All valid union conversions have this populated
2746Debug.Assert(analysis.Kind == UserDefinedConversionAnalysisKind.ApplicableInNormalForm);
2747Debug.Assert(analysis.Operator is { ParameterCount: 1 } and ({ MethodKind: MethodKind.Constructor } or { MethodKind: MethodKind.Ordinary, IsStatic: true, ContainingType.IsInterface: true }));
2748Debug.Assert(TypeSymbol.Equals(analysis.FromType, analysis.Operator.GetParameterType(0), TypeCompareKind.AllIgnoreOptions));
2749Debug.Assert(TypeSymbol.Equals(destination.StrippedType(), analysis.Operator.MethodKind == MethodKind.Constructor ? analysis.Operator.ContainingType : analysis.Operator.ReturnType, TypeCompareKind.AllIgnoreOptions));
2750Debug.Assert(TypeSymbol.Equals(destination.StrippedType(), analysis.ToType, TypeCompareKind.AllIgnoreOptions));
2751Debug.Assert(analysis.TargetConversion is { IsIdentity: true } or { IsNullable: true, IsImplicit: true });
2752Debug.Assert(source.Type?.IsDynamic() != true);
2841Debug.Assert(conversion.Kind == ConversionKind.FunctionType);
2842Debug.Assert(source.Kind is BoundKind.MethodGroup or BoundKind.UnboundLambda);
2843Debug.Assert(syntax.IsFeatureEnabled(MessageID.IDS_FeatureInferredDelegateType));
2847Debug.Assert(delegateType is { });
2863Debug.Assert((inConversionGroupFlags & InConversionGroupFlags.FunctionTypeDelegate) == 0);
2893Debug.Assert((inConversionGroupFlags & InConversionGroupFlags.FunctionTypeDelegateToTarget) == 0);
2947Debug.Assert(conversion.UnderlyingConversions.IsDefault);
3004Debug.Assert(delegateType is not null);
3008Debug.Assert(lambdaSymbol.ParameterCount == delegateParameters.Length);
3094Debug.Assert(conversion.IsStackAlloc);
3127Debug.Assert(conversion.IsTupleLiteralConversion ||
3132Debug.Assert(conversion.IsNullable == destination.IsNullableType());
3144Debug.Assert(conversionWithoutNullable.IsTupleLiteralConversion);
3182Debug.Assert(targetElementTypes.Length == arguments.Length, "converting a tuple literal to incompatible type?");
3204Debug.Assert((inConversionGroupFlags & InConversionGroupFlags.TupleLiteral) == 0);
3222Debug.Assert((inConversionGroupFlags & InConversionGroupFlags.TupleLiteralExplicitIdentity) == 0);
3364Debug.Assert(memberSymbol is not MethodSymbol { MethodKind: not MethodKind.Constructor } ||
3375Debug.Assert(!invokedAsExtensionMethod);
3379Debug.Assert(!invokedAsExtensionMethod || (receiverOpt != null));
3518Debug.Assert(delegateType is NamedTypeSymbol { TypeKind: TypeKind.Delegate, DelegateInvokeMethod: { HasUseSiteError: false } }
3529Debug.Assert(!isExtensionMethod || (receiverOpt != null));
3536Debug.Assert(methodParameters.Length == numParams + (isExtensionMethod ? 1 : 0));
3542Debug.Assert(!(isExtensionMethod || (method.IsExtensionBlockMember() && !method.IsStatic)) ||
3625Debug.Fail("This method should have been eliminated in overload resolution!");
3685Debug.Assert(method.IsExtensionBlockMember());
3709Debug.Assert(Conversions.IsAssignableFromMulticastDelegate(delegateOrFuncPtrType, ref discardedUseSiteInfo) || delegateOrFuncPtrType.TypeKind == TypeKind.Delegate || delegateOrFuncPtrType.TypeKind == TypeKind.FunctionPointer);
3710Debug.Assert(conversion.Method is object);
3755Debug.Assert(!selectedMethod.HasUseSiteError, "Shouldn't have reached this point if there were use site errors.");
3792Debug.Assert(conversion.IsValid); // i.e. if it exists, then it is valid.
3907Debug.Assert(!sourceValue.IsBad);
3914Debug.Assert(underlyingType.SpecialType != SpecialType.None);
Binder\Binder_Expressions.cs (303)
220Debug.Assert(expr != null);
221Debug.Assert(resultKind != LookupResultKind.Viable);
343Debug.Assert(op.NoCommonTypeError != 0);
448Debug.Assert(expr.Kind is BoundKind.UnboundLambda or BoundKind.MethodGroup);
478Debug.Assert((object)this.ContainingMemberOrLambda == field);
486Debug.Assert(initializerBinder != null);
536Debug.Assert(this.InParameterDefaultValue);
537Debug.Assert(this.ContainingMemberOrLambda.Kind == SymbolKind.Method
543Debug.Assert(defaultValueBinder != null);
561Debug.Assert(initializerBinder != null);
629Debug.Assert(node != null);
877Debug.Assert(false, "Unexpected SyntaxKind " + node.Kind());
1185Debug.Assert(elementNames.Count == inferredElementNames.Count);
1482Debug.Assert(ContainingType is { });
1506Debug.Assert((this.Flags & BinderFlags.InContextualAttributeBinder) != 0);
1533Debug.Assert(!result || lookupResult.Symbols.Count > 0);
1566Debug.Assert(symbol is null or LocalSymbol or LocalFunctionSymbol or RangeVariableSymbol or TypeParameterSymbol);
1649Debug.Assert(node != null);
1687Debug.Assert(node.Arity == typeArgumentList.Count);
1708Debug.Assert(members.Count > 0);
1711Debug.Assert(!IsTypeOrValueExpression(receiver));
1740Debug.Assert(isError); // Should have been reported by GetSymbolOrMethodOrPropertyGroup.
1820Debug.Assert(SyntaxFacts.IsInvoked(id) == invoked);
1885Debug.Assert(!primaryConstructor.GetCapturedParameters().ContainsKey(shadowedParameter)); // How could we capture a shadowed parameter?
1912Debug.Assert((options & LookupOptions.NamespacesOrTypesOnly) == 0);
1941Debug.Assert(node.Identifier.IsUnderscoreToken());
2006Debug.Assert(members.Count > 0);
2049Debug.Assert(!symbol.ContainingSymbol.Equals(containingMethod));
2116Debug.Assert(primaryCtor is null ||
2135Debug.Assert(parameter.Type.IsRefLikeOrAllowsRefLikeType());
2158Debug.Assert(parameter.Type.IsRefLikeOrAllowsRefLikeType());
2518Debug.Assert(node.ContainsDiagnostics);
2535Debug.Assert(result.IsSingleViable, "If this happens, we need to deal with multiple label definitions.");
2579Debug.Assert(node != null);
2607Debug.Assert(location is not null);
2617Debug.Assert(this.ContainingMemberOrLambda is not null);
2681Debug.Assert(node.OperatorToken.IsKind(SyntaxKind.CaretToken));
2880Debug.Assert(conversion.IsUserDefined || conversion.IsUnion);
2889Debug.Assert(originalUserDefinedConversions.Length == 0,
2965Debug.Assert((object)operand.Type != null);
3006Debug.Assert(targetTypeWithAnnotations.HasType && targetTypeWithAnnotations.IsNullableType());
3007Debug.Assert((object)operand.Type != null && !operand.Type.IsNullableType());
3256Debug.Assert(isVar != declType.HasType);
3272Debug.Assert(declarationExpression.IsOutVarDeclaration());
3296Debug.Assert(localSymbol.DeclarationKind == LocalDeclarationKind.OutVariable);
3414Debug.Assert(argumentSyntax is ArgumentSyntax || argumentSyntax is AttributeArgumentSyntax);
3526Debug.Assert(result.ConversionForArg(arg).IsIdentity);
3527Debug.Assert(!argument.NeedsToBeConverted());
3528Debug.Assert(!expanded || result.ParameterFromArgument(arg) != parameters.Length - 1);
3537Debug.Assert(paramsArgsBuilder is null);
3554Debug.Assert(analyzedArguments.RefKinds.Count == 0 || analyzedArguments.RefKinds.Count == arguments.Count);
3555Debug.Assert(analyzedArguments.Names.Count == 0 || analyzedArguments.Names.Count == arguments.Count);
3556Debug.Assert(argsToParamsOpt.IsDefault || argsToParamsOpt.Length == arguments.Count);
3577Debug.Assert(argument is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true });
3598Debug.Assert(parameterTypeWithAnnotations.HasType);
3603Debug.Assert(kind.IsIdentity);
3631Debug.Assert(arguments[arg].Kind is not
3660Debug.Assert(methodResult.Result.ParamsElementTypeOpt.HasType);
3661Debug.Assert(methodResult.Result.ParamsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel);
3683Debug.Assert(collectionArgs.Length != 0);
3688Debug.Assert(firstParamsArgument != -1);
3689Debug.Assert(collectionArgs.Length == 1 || firstParamsArgument + collectionArgs.Length == arguments.Count);
3702Debug.Assert(argsToParamsBuilder is not null || argsToParamsOpt.IsDefault);
3753Debug.Assert(unconvertedString is BoundUnconvertedInterpolatedString or BoundBinaryOperator { IsUnconvertedInterpolatedStringAddition: true });
3755Debug.Assert(interpolatedStringConversion.IsInterpolatedStringHandler);
3756Debug.Assert(handlerType is NamedTypeSymbol { IsInterpolatedStringHandlerType: true });
3763Debug.Assert(handlerParameterIndexes.IsEmpty);
3777Debug.Assert(arguments is not null);
3810Debug.Assert(handlerParameterIndexes.All((index, paramLength) => index >= BoundInterpolatedStringArgumentPlaceholder.ExtensionReceiver && index < paramLength,
3829Debug.Assert(handlerArgumentIndexesBuilder[handlerParameterIndex] is BoundInterpolatedStringArgumentPlaceholder.UnspecifiedParameter);
3862Debug.Assert(argumentIndex != interpolatedStringArgNum);
3869Debug.Assert(receiver!.Type is not null);
3874Debug.Assert(methodResult.Member.IsExtensionBlockMember());
3876Debug.Assert(receiverParameter is not null);
3930Debug.Assert(receiver != null);
3995Debug.Assert(!available);
4008Debug.Assert(argNumber > 0);
4020Debug.Assert(argNumber >= 0); // can be 0 for receiver of extension method
4029Debug.Assert(argNumber > 0);
4289Debug.Assert(rank > 0);
4290Debug.Assert(dimension > 0 && dimension <= rank);
4291Debug.Assert(exprBuilder != null);
4362Debug.Assert(!boundInitExpr.IsDefault);
4372Debug.Assert(boundInitExprIndex >= 0 && boundInitExprIndex < boundInitExpr.Length);
4397Debug.Assert(boundInitExprIndex >= 0 && boundInitExprIndex < boundInitExpr.Length);
4400Debug.Assert(init.HasAnyErrors);
4401Debug.Assert(init.Type.IsErrorType());
4510Debug.Assert(creationSyntax == null ||
4513Debug.Assert(initSyntax != null);
4514Debug.Assert((object)type != null);
4515Debug.Assert(boundInitExprOpt.IsDefault || creationSyntax.Kind() == SyntaxKind.ImplicitArrayCreationExpression);
4667Debug.Assert(node is StackAllocArrayCreationExpressionSyntax || node is ImplicitStackAllocArrayCreationExpressionSyntax);
4692Debug.Assert(node is StackAllocArrayCreationExpressionSyntax or ImplicitStackAllocArrayCreationExpressionSyntax);
4730Debug.Assert(node != null);
4769Debug.Assert(node.IsKind(SyntaxKind.ImplicitStackAllocArrayCreationExpression) || node.IsKind(SyntaxKind.StackAllocArrayCreationExpression));
4815Debug.Assert(expression != null);
4833Debug.Assert(expression != null);
4859Debug.Assert(type == SpecialType.System_UInt32 || type == SpecialType.System_UInt64);
4894Debug.Assert(argumentListBinder.IsSemanticModelBinder);
4926Debug.Assert((object)constructor != null);
4927Debug.Assert(constructor.MethodKind == MethodKind.Constructor ||
4929Debug.Assert(diagnostics != null);
4943Debug.Assert(constructorReturnType.IsVoidType()); //true of all constructors
4962Debug.Assert((object)initializerType != null ||
4998Debug.Assert(initializerArgumentListOpt.Parent.Kind() == SyntaxKind.ThisConstructorInitializer);
5104Debug.Assert(initializerType.IsErrorType() ||
5165Debug.Assert(!resultMember.IsExtensionBlockMember());
5294Debug.Assert(result is not BoundBadExpression { ChildBoundNodes: var children } || !children.Any((child, node) => child.Syntax == node, node));
5422Debug.Assert(expression.Type is { });
5429Debug.Assert(conversion.IsValid);
5437Debug.Assert(length > 0);
5584Debug.Assert(!type.IsGenericOrNonGenericExpressionType(out _));
5671Debug.Assert(!conv.IsExtensionMethod);
5672Debug.Assert(conv.IsValid); // i.e. if it exists, then it is valid.
5739Debug.Assert(type.TypeKind is TypeKind.Class or TypeKind.Struct);
5783Debug.Assert(typeSyntax is not null);
5802Debug.Assert(syntax != null);
5803Debug.Assert((object)type != null);
5833Debug.Assert(syntax != null);
5834Debug.Assert((object)type != null);
5840Debug.Assert(syntax.Parent.Parent.Kind() != SyntaxKind.WithInitializerExpression);
5841Debug.Assert(rhsValueKind == BindValueKind.RValue);
5860Debug.Assert(initializerSyntax.Kind() == SyntaxKind.ObjectInitializerExpression ||
5862Debug.Assert((object)initializerType != null);
5906Debug.Assert((object)boundLeft.Type != null);
6235Debug.Assert(!boundMember.NeedsToBeConverted());
6257Debug.Assert(boundMember.HasAnyErrors);
6271Debug.Assert(memberNameMap != null);
6281Debug.Assert(memberInitializerSyntax.Kind() == SyntaxKind.SimpleAssignmentExpression);
6415Debug.Assert(initializerSyntax.Kind() == SyntaxKind.CollectionInitializerExpression);
6416Debug.Assert(initializerSyntax.Expressions.Any());
6417Debug.Assert((object)initializerType != null);
6569Debug.Assert(node.Kind() == SyntaxKind.ComplexElementInitializerExpression);
6600Debug.Assert(!boundElementInitializerExpressions.IsEmpty);
6619Debug.Assert(collectionInitializerAddMethodBinder.HasCollectionExpressionApplicableAddMethod(elementInitializer, implicitReceiver.Type, addMethods: out _, d));
6633Debug.Assert(collectionInitializerAddMethodBinder != null);
6634Debug.Assert(collectionInitializerAddMethodBinder.Flags.Includes(BinderFlags.CollectionInitializerAddMethod));
6635Debug.Assert(implicitReceiver != null);
6636Debug.Assert((object)implicitReceiver.Type != null);
6702Debug.Assert(addMethodInvocation.Kind == BoundKind.BadExpression);
6748Debug.Assert(enumeratorInfo.ElementType is { }); // ElementType is set always, even for IEnumerable.
6795Debug.Assert((object)constructor != null);
6796Debug.Assert(constructor.MethodKind == MethodKind.Constructor || constructor.MethodKind == MethodKind.StaticConstructor);
6823Debug.Assert((object)this.Compilation.Assembly != null);
6879Debug.Assert(finalApplicableCandidates[0].IsApplicable);
6967Debug.Assert(!method.IsExtensionBlockMember());
7102Debug.Assert((object)type != null);
7128Debug.Assert((object)interfaceType != null);
7129Debug.Assert(interfaceType.IsInterfaceType());
7130Debug.Assert((object)coClassType != null);
7131Debug.Assert(TypeSymbol.Equals(interfaceType.ComImportCoClass, coClassType, TypeCompareKind.ConsiderEverything2));
7132Debug.Assert(coClassType.TypeKind == TypeKind.Class || coClassType.TypeKind == TypeKind.Error);
7571Debug.Assert(!value.GetType().GetTypeInfo().IsEnum);
7576Debug.Assert(
7597Debug.Assert(node.Kind() == SyntaxKind.Utf8StringLiteralExpression);
7598Debug.Assert(node.Token.Kind() is SyntaxKind.Utf8StringLiteralToken or SyntaxKind.Utf8SingleLineRawStringLiteralToken or SyntaxKind.Utf8MultiLineRawStringLiteralToken);
7642Debug.Assert(node != null);
7643Debug.Assert(invoked == SyntaxFacts.IsInvoked(node));
7655Debug.Assert(node.Kind() == SyntaxKind.PointerMemberAccessExpression);
7709Debug.Assert((left.Parent is MemberAccessExpressionSyntax { RawKind: (int)SyntaxKind.SimpleMemberAccessExpression } memberAccess && memberAccess.Expression == left) ||
7721Debug.Assert(left.Arity == 0);
7780Debug.Assert(!leftType.IsDynamic());
7781Debug.Assert(IsPotentialColorColorReceiver(left, leftType));
7787Debug.Assert(!IsPotentialColorColorReceiver(left, leftType));
7790Debug.Assert(leftType.Equals(boundValue.Type, TypeCompareKind.ConsiderEverything));
7791Debug.Assert(leftSymbol == (boundValue.ExpressionSymbol ?? ((BoundConversion)boundValue).Operand.ExpressionSymbol));
7913Debug.Assert(node != null);
7914Debug.Assert(boundLeft != null);
7948Debug.Assert((object)leftType == null);
8090Debug.Assert(sym.Kind == SymbolKind.NamedType);
8106Debug.Assert(symbols.Count > 0);
8107Debug.Assert(symbols[0].Kind == SymbolKind.NamedType);
8116Debug.Assert(lookupResult.IsClear, "If there's a legitimate reason for having candidates without a reason, then we should produce something intelligent in such cases.");
8117Debug.Assert(lookupResult.Error == null);
8142Debug.Assert(boundLeft is BoundTypeExpression);
8143Debug.Assert((object)leftType != null);
8218Debug.Assert(!resolution.IsNonMethodExtensionMember(out _));
8226Debug.Assert(!resolution.IsEmpty);
8271Debug.Assert(typeArgumentsOpt.IsDefault);
8294Debug.Assert(propertySymbol.ContainingType.ExtensionParameter is not null);
8326Debug.Assert(rightArity == (typeArgumentsWithAnnotations.IsDefault ? 0 : typeArgumentsWithAnnotations.Length));
8606Debug.Assert(receiver != null);
8607Debug.Assert(extensionMethodArguments.Arguments.Count == 0);
8608Debug.Assert(extensionMethodArguments.Names.Count == 0);
8609Debug.Assert(extensionMethodArguments.RefKinds.Count == 0);
8651Debug.Assert(node != null);
8652Debug.Assert(left != null);
8653Debug.Assert(lookupResult.IsMultiViable);
8654Debug.Assert(lookupResult.Symbols.Any());
8664Debug.Assert(members.Count > 0);
8690Debug.Assert(symbol.Kind != SymbolKind.Method);
8773Debug.Assert(left.Type is not null);
8774Debug.Assert(!left.Type.IsDynamic());
8775Debug.Assert((options & ~(OverloadResolution.Options.IsMethodGroupConversion |
8868Debug.Assert(left.Type is not null);
8889Debug.Assert(arity == 0 || lookupResult.Symbols.All(s => s.Kind != SymbolKind.Property));
8902Debug.Assert(actualReceiverArguments is not null);
8937Debug.Assert(actualReceiverArguments is not null);
8946Debug.Assert(propertyResult?.HasAnyApplicableMember == true);
8957Debug.Assert(actualReceiverArguments is not null);
9004Debug.Assert(propertyResult is not null);
9029Debug.Assert(lookupResult.Kind == LookupResultKind.Viable);
9060Debug.Assert(receiverType is not null);
9185Debug.Assert(left is not null);
9193Debug.Assert(left.Type is not null);
9194Debug.Assert(!left.Type.IsDynamic());
9195Debug.Assert(!left.Type.IsArray());
9196Debug.Assert(left.Type.SpecialType != SpecialType.System_String);
9246Debug.Assert(receiver.Type is not null);
9247Debug.Assert(lookupResult.IsClear);
9282Debug.Assert(left is not null);
9290Debug.Assert(left.Type is not null);
9291Debug.Assert(!left.Type.IsDynamic());
9292Debug.Assert(!left.Type.IsArray());
9293Debug.Assert(left.Type.SpecialType != SpecialType.System_String);
9330Debug.Assert(receiver.Type is not null);
9350Debug.Assert(actualExtensionIntIndexerOrSliceArguments is null);
9368Debug.Assert(!argumentPlaceholders.IsDefault);
9406Debug.Assert(lengthOrCountProperty.ContainingType.ExtensionParameter is not null);
9426Debug.Assert(receiver.Type is not null);
9547Debug.Assert(receiver.Type is not null);
9556Debug.Assert(argKind is IndexOrRangeArgKind.Range);
9575Debug.Assert(receiver.Type is not null);
9669Debug.Assert(receiver.Type is not null);
9730Debug.Assert(!candidate.IsStatic);
9783Debug.Assert(resolutionResult.Result.ConversionForArg(0).Exists);
9966Debug.Assert((object)underlyingType != null);
9991Debug.Assert(propertySymbol.GetCallerUnsafeMode(ConsList<FieldSymbol>.Empty) == CallerUnsafeMode.None ||
10013Debug.Assert(symbol is not TypeSymbol);
10079Debug.Assert(eventSymbol.GetCallerUnsafeMode(ConsList<FieldSymbol>.Empty) == CallerUnsafeMode.None ||
10175Debug.Assert(!methodOrPropertyGroup.Any());
10180Debug.Assert(result.Kind != LookupResultKind.Empty);
10181Debug.Assert(!result.Symbols.Any(s => s.IsIndexer()));
10227Debug.Assert(methodOrPropertyGroup.Any() || ((object)other != null));
10257Debug.Assert(members.Count > 0);
10262Debug.Assert(members.All(m => m.Kind == member.Kind));
10270Debug.Assert(members.All(m => !m.IsIndexer()));
10299Debug.Assert(receiver.Type?.IsFunctionPointer() != true, "There should have been an error reported for indexing into a function pointer.");
10316Debug.Assert(propertyGroup.ReceiverOpt is not null);
10366Debug.Assert(expr.Type.TryGetInlineArrayElementField() is not null);
10382Debug.Assert(tryInlineArrayAccess);
10383Debug.Assert(diagnosticsForBindElementAccessCore.DiagnosticBag is { });
10610Debug.Assert(node != null);
10611Debug.Assert(expr != null);
10612Debug.Assert((object)expr.Type != null);
10613Debug.Assert(arguments != null);
10641Debug.Assert(node != null);
10642Debug.Assert(expr != null);
10643Debug.Assert(arguments != null);
10702Debug.Assert(convertedArguments.Length == 1);
10724Debug.Assert(index != null);
10829Debug.Assert(expr != null);
10830Debug.Assert((object)targetType != null);
10846Debug.Assert(result != null); // If this ever fails (it shouldn't), then put a null-check around the diagnostics update.
10853Debug.Assert(node != null);
10854Debug.Assert(expr != null);
10855Debug.Assert(analyzedArguments != null);
10869Debug.Assert(expr.Type.IsPointerType());
10915Debug.Assert(node != null);
10916Debug.Assert(expr != null);
10917Debug.Assert((object?)expr.Type != null);
10918Debug.Assert(analyzedArguments != null);
10934Debug.Assert(symbol.IsIndexer());
11005Debug.Assert(property.ParameterCount > 0);
11023Debug.Assert(receiver is not null);
11051Debug.Assert(receiver is not null);
11117Debug.Assert(receiver is not null);
11134Debug.Assert(finalApplicableCandidates[0].IsApplicable);
11260Debug.Assert(receiver is not null);
11261Debug.Assert(receiver.Type is not null);
11299Debug.Assert(argKind != IndexOrRangeArgKind.None);
11300Debug.Assert(lengthOrCountAccess is BoundPropertyAccess);
11301Debug.Assert(indexerOrSliceAccess is BoundIndexerAccess or BoundCall);
11302Debug.Assert(indexerOrSliceAccess.Type is not null);
11365Debug.Assert(argKind != IndexOrRangeArgKind.None);
11376Debug.Assert(actualExtensionIntIndexerOrSliceArguments is null);
11496Debug.Assert(receiverPlaceholder.Type is not null);
11499Debug.Assert(receiverPlaceholder.Type is not null);
11524Debug.Assert(lookupResult.IsClear);
11604Debug.Assert((options & ~(OverloadResolution.Options.IsMethodGroupConversion |
11636Debug.Assert(node.LookupError == null);
11696Debug.Assert(!methodResolution.HasAnyApplicableMethod);
11697Debug.Assert(!extensionMethodResolution.HasAnyApplicableMethod);
11698Debug.Assert(!methodResolution.IsEmpty);
11699Debug.Assert(!extensionMethodResolution.IsEmpty);
11713Debug.Assert(!extensionMethodResolution.IsEmpty);
11731Debug.Assert((options & ~(OverloadResolution.Options.IsMethodGroupConversion |
11864Debug.Assert(node.ReceiverOpt!.Type is not null); // extensions are only considered on member access
11882Debug.Assert(extensionMember is not null);
11921Debug.Assert(methods.Count != 0);
12080Debug.Assert(node.ReceiverOpt!.Type is not null); // extensions are only considered on member access
12096Debug.Assert(extensionMember is not null);
12209Debug.Assert(ContainingMemberOrLambda is { });
12210Debug.Assert(parameterRefKinds.IsDefault || parameterRefKinds.Length == parameterTypes.Length);
12211Debug.Assert(parameterDefaultValues.IsDefault || parameterDefaultValues.Length == parameterTypes.Length);
12212Debug.Assert(returnType.Type is { }); // Expecting System.Void rather than null return type.
12213Debug.Assert(!hasParams || parameterTypes.Length != 0);
12302Debug.Assert((location == null) ^ (node == null));
12356Debug.Assert((object)receiverType != null);
12475Debug.Assert(node != null);
12476Debug.Assert(node.Expression != null);
12482Debug.Assert(receiver != null);
12491Debug.Assert(conditionalAccessNode != null);
Binder\Binder_Statements.cs (94)
59Debug.Assert(node != null);
151Debug.Assert(result.WasCompilerGenerated == false ||
156Debug.Assert(result.Syntax is StatementSyntax, "BoundStatement should be associated with a statement syntax.");
158Debug.Assert(System.Linq.Enumerable.Contains(result.Syntax.AncestorsAndSelf(), node), @"Bound statement (or one of its parents)
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);
763Debug.Assert(expr is object);
764Debug.Assert(expr.Type is object);
765Debug.Assert(expr.Type.IsRefLikeType || hasAwait); // pattern dispose lookup is only valid on ref structs or asynchronous usings
793Debug.Assert(
803Debug.Assert(typeSyntax is not ScopedTypeSyntax);
805Debug.Assert(declType.HasType || isVar);
965Debug.Assert(declarator != null);
991Debug.Assert(declarator != null);
992Debug.Assert(declTypeOpt.HasType || isVar);
993Debug.Assert(typeSyntax != null);
1076Debug.Assert(declTypeOpt.HasType);
1229Debug.Assert(!ReferenceEquals(declType, null));
1230Debug.Assert(declType.IsPointerType());
1366Debug.Assert(initializer != null);
1410Debug.Assert(node != null);
1411Debug.Assert(node.Left != null);
1412Debug.Assert(node.Right != null);
1486Debug.Assert(op1 != null);
1487Debug.Assert(op2 != null);
1493Debug.Assert(!op1.NeedsToBeConverted()
1555Debug.Assert(op1 != null);
1556Debug.Assert(op2 != null);
1560Debug.Assert(op1.Type is { });
1593Debug.Assert(leftEscape.Equals(rightEscape) || op1.Type.IsRefLikeOrAllowsRefLikeType());
1601Debug.Assert(op1.Kind != BoundKind.Parameter); // If the assert fails, add a corresponding test.
1649Debug.Assert(false);
1657Debug.Assert(methodInvocationInfo.MethodInfo.Method is not null);
1861Debug.Assert((object)receiver.Type != null);
1872Debug.Assert(node != null);
1917Debug.Assert(binder != null);
1968Debug.Assert((object)targetType != null);
1969Debug.Assert(expression != null);
2048Debug.Assert((object)targetType != null);
2049Debug.Assert(anonymousFunction != null);
2105Debug.Assert(targetType.IsExpressionTree());
2112Debug.Assert(targetType.IsGenericOrNonGenericExpressionType(out _));
2150Debug.Assert(delegateType is not null);
2208Debug.Assert(diagnostics.DiagnosticBag?.Count is not 0);
2231Debug.Assert(anonymousFunction.HasExplicitlyTypedParameterList);
2235Debug.Assert(anonymousFunction.ParameterCount == delegateParameters.Length);
2241Debug.Assert(!lambdaParameterType.IsErrorType());
2263Debug.Assert(ErrorFacts.PreventsSuccessfulDelegateConversion(bindingResult.Diagnostics.Diagnostics));
2270Debug.Assert(false, "Missing case in lambda conversion error reporting");
2281Debug.Assert(!conversion.IsImplicit || !conversion.IsValid);
2315Debug.Assert(conversion.IsUserDefined || conversion.IsUnion);
2324Debug.Assert(originalUserDefinedConversions.Length == 0,
2353Debug.Assert(operand != null);
2354Debug.Assert((object)targetType != null);
2445Debug.Assert(reportedError);
2465Debug.Assert(reportedError);
2487Debug.Assert(operand.HasAnyErrors && operand.Kind != BoundKind.UnboundLambda, "Missing a case in implicit conversion error reporting");
2605Debug.Assert(b != null);
2790Debug.Assert(node != null);
2807Debug.Assert(node != null);
2810Debug.Assert(loopBinder != null);
2822Debug.Assert(loopBinder != null);
2835Debug.Assert(loopBinder != null);
2853Debug.Assert(typeSyntax is not ScopedTypeSyntax || localKind is LocalDeclarationKind.RegularVariable or LocalDeclarationKind.UsingVariable);
2873Debug.Assert(declType.HasType || isVar);
2877Debug.Assert(count > 0);
2965Debug.Assert(name != null);
3215Debug.Assert(returnRefKind == RefKind.None);
3292Debug.Assert(node != null);
3340Debug.Assert((object)type != null);
3376Debug.Assert(((object)type == null) || !type.IsErrorType());
3418Debug.Assert(binder != null);
3426Debug.Assert(local.Type.IsErrorType() || (TypeSymbol.Equals(local.Type, type, TypeCompareKind.ConsiderEverything2)));
3568Debug.Assert(expressionSyntax != null || !IsValidExpressionBody(expressionSyntax, expression));
3658Debug.Assert(bodyBinder != null);
3679Debug.Assert(bodyBinder != null);
3691Debug.Assert(bodyBinder != null);
3693Debug.Assert(body.Kind() != SyntaxKind.RefExpression);
3771Debug.Assert(typeDecl.ParameterList is object);
3772Debug.Assert(typeDecl.Kind() is SyntaxKind.RecordDeclaration or SyntaxKind.ClassDeclaration or SyntaxKind.RecordStructDeclaration or SyntaxKind.StructDeclaration);
3779Debug.Assert(initializerBinder != null);
3800Debug.Assert(initializerInvocation.HasAnyErrors || constructorInitializer.IsConstructorInitializer(), "Please keep this bound node in sync with BoundNodeExtensions.IsConstructorInitializer.");
3813Debug.Assert(bodyBinder != null);
3878Debug.Assert(!this.ContainingMember().IsImplicitlyDeclared);
3880Debug.Assert(initializerInvocation.HasAnyErrors || constructorInitializer.IsConstructorInitializer(), "Please keep this bound node in sync with BoundNodeExtensions.IsConstructorInitializer.");
3897Debug.Assert(initializerInvocation.HasAnyErrors || constructorInitializer.IsConstructorInitializer(), "Please keep this bound node in sync with BoundNodeExtensions.IsConstructorInitializer.");
3921Debug.Assert(sourceConstructor?.SyntaxNode is TypeDeclarationSyntax
Binder\Binder_Symbols.cs (44)
42Debug.Assert(isVar == symbol.IsDefault);
62Debug.Assert((keyword != ConstraintContextualKeyword.None) == symbol.IsDefault);
83Debug.Assert(isVar == symbol.IsDefault);
277Debug.Assert(UnwrapAliasNoDiagnostics(symbol) is NamespaceSymbol);
325Debug.Assert(diagnostics != null);
400Debug.Assert(!result.IsDefault);
1136Debug.Assert(syntax != null);
1137Debug.Assert(diagnostics != null);
1319Debug.Assert(lookupResult.Error != null);
1362Debug.Assert(typeArguments.Count > 0);
1458Debug.Assert(members.Count > 0);
1563Debug.Assert(lookupResult?.IsClear != false);
1602Debug.Assert(symbol.IsExtensionBlockMember());
1639Debug.Assert(!typeArguments.IsEmpty);
1721Debug.Assert((object)typeSymbol != null, "Expect an error type if special type isn't found");
1729Debug.Assert((object)typeSymbol != null, "Expect an error type if special type isn't found");
1794Debug.Assert(symbol.IsDefinition);
1859Debug.Assert((object)typeSymbol != null, "Expect an error type if well-known type isn't found");
1867Debug.Assert((object)typeSymbol != null, "Expect an error type if well-known type isn't found");
1889Debug.Assert((object)typeSymbol != null, "Expect an error type if well-known type isn't found");
1905Debug.Assert((syntax != null) ^ (location != null));
2027Debug.Assert(where != null);
2028Debug.Assert(diagnostics != null);
2050Debug.Assert(!best.IsNone);
2051Debug.Assert(!secondBest.IsNone);
2066Debug.Assert(best.IsFromAddedModule);
2109Debug.Assert(!(srcSymbol.Kind == SymbolKind.Namespace && mdSymbol.Kind == SymbolKind.Namespace));
2117Debug.Assert(!Symbol.Equals(originalSymbols[best.Index], originalSymbols[secondBest.Index], TypeCompareKind.ConsiderEverything) || options.IsAttributeTypeLookup(),
2120Debug.Assert(!Symbol.Equals(first, second, TypeCompareKind.ConsiderEverything) || !Symbol.Equals(originalSymbols[best.Index], originalSymbols[secondBest.Index], TypeCompareKind.ConsiderEverything),
2161Debug.Assert(!best.IsFromCorLibrary);
2173Debug.Assert(best.IsFromCompilation);
2209Debug.Assert(secondBest.IsFromAddedModule);
2220Debug.Assert(best.IsFromAddedModule);
2244Debug.Assert(arg2.ContainingAssembly == Compilation.Assembly);
2275Debug.Assert(originalSymbols[best.Index].Name != originalSymbols[secondBest.Index].Name ||
2404Debug.Assert(symbols.Count > 0);
2524Debug.Assert(location != BestSymbolLocation.None);
2551Debug.Assert(secondLocation != 0);
2598Debug.Assert(!first.IsNone);
2599Debug.Assert(!second.IsNone);
2661Debug.Assert(qualifierOpt.IsNamespace);
2667Debug.Assert(aliasOpt == null || aliasOpt == SyntaxFacts.GetText(SyntaxKind.GlobalKeyword));
2733Debug.Assert((object)forwardedType.ContainingAssembly != null, "How did we find a cycle if there was no forwarding?");
2764Debug.Assert(false);
Binder\Binder.ValueChecks.cs (104)
93Debug.Assert(method is ErrorMethodSymbol or { HasUnsupportedMetadata: true });
156Debug.Assert(indexerAccess.AccessorKind != AccessorKind.Set);
172Debug.Assert(objectCreation.Constructor is not null);
188Debug.Assert(unaryOperator.MethodOpt is not null);
205Debug.Assert(binaryOperatorMethod is not null);
260Debug.Assert(incrementOperator.MethodOpt is not null);
277Debug.Assert(method is not null);
306Debug.Assert(propertyAccess.AutoPropertyAccessorKind != AccessorKind.Set);
353Debug.Assert(parameter.RefKind.IsWritableReference() && parameter.Type.IsRefLikeOrAllowsRefLikeType());
354Debug.Assert(GetParameterValEscapeLevel(parameter).HasValue);
395Debug.Assert(!isArgList || parameter is null);
662Debug.Assert(parameters.Length == indexer.Parameters.Length);
743Debug.Assert(expr.Syntax.Kind() != SyntaxKind.Argument || valueKind == BindValueKind.RefOrOut);
748Debug.Assert(valueKind == BindValueKind.RefOrOut);
752Debug.Assert(valueKind is (BindValueKind.Assignable or BindValueKind.RefOrOut or BindValueKind.RefAssignable) || diagnostics.DiagnosticBag is null || diagnostics.HasAnyResolvedErrors());
854Debug.Assert(!resolution.IsNonMethodExtensionMember(out _));
873Debug.Assert(methodGroup.ResultKind != LookupResultKind.Viable);
880Debug.Assert(methodGroup.LookupError != null);
938Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter());
1109Debug.Assert(!RequiresRefAssignableVariable(valueKind));
1404Debug.Assert(!RequiresAssignableVariable(BindValueKind.AddressOf));
1423Debug.Assert(parameterSymbol.RefKind != RefKind.None || !RequiresRefAssignableVariable(valueKind));
1431Debug.Assert(backingField.RefKind == RefKind.None);
1432Debug.Assert(!RequiresRefAssignableVariable(valueKind));
1436Debug.Assert(backingField.RefKind == RefKind.None);
1469Debug.Assert(valueKind != BindValueKind.AddressOf); // If this assert fails, we probably should report ErrorCode.ERR_InvalidAddrOp
1573Debug.Assert(parameterSymbol.RefKind == RefKind.None || isRefScoped || refSafeToEscape.IsReturnOnly);
1655Debug.Assert(valueKind == BindValueKind.RefAssignable);
1666Debug.Assert(fieldAccess.ReceiverOpt is null or BoundTypeExpression);
1671Debug.Assert(fieldAccess.ReceiverOpt is not null);
1805Debug.Assert(fieldAccess.ReceiverOpt is { });
1862Debug.Assert(!RequiresVariableReceiver(receiver, eventSymbol));
1912Debug.Assert(receiver != null);
1997Debug.Assert((object)propertySymbol != null);
1998Debug.Assert(propertySyntax != null);
2010Debug.Assert(propertySymbol.TypeWithAnnotations.HasType);
2214Debug.Assert(member.Kind != SymbolKind.Property);
2215Debug.Assert(member.Kind != SymbolKind.Event);
2267Debug.Assert(AllParametersConsideredInEscapeAnalysisHaveArguments(in methodInvocationInfo));
2430Debug.Assert(extensionParameter is not null);
2440Debug.Assert(methodInvocationInfo.HasAnyErrors, "Got a null receiver for a non-static extension method without errors?");
2481Debug.Assert(AllParametersConsideredInEscapeAnalysisHaveArguments(in methodInvocationInfo));
2668Debug.Assert(receiver.Type is { });
2669Debug.Assert(methodInvocationInfo.ReceiverIsSubjectToCloning != ThreeState.Unknown);
2673Debug.Assert(receiver is not BoundValuePlaceholderBase && method is not null && receiver.Type?.IsReferenceType == false);
2701Debug.Assert(argIndex == argsOpt.Length - 1);
2884Debug.Assert(methodInfo.Method?.IsExtensionMethod != false);
2913Debug.Assert(parameter?.IsThis != true);
2918Debug.Assert(escapeLevel == EscapeLevel.ReturnOnly);
3144Debug.Assert(symbol is null or SourceLocalSymbol or GlobalExpressionVariable);
3359Debug.Assert(underlyingParameter.IsThis);
3360Debug.Assert(underlyingParameter.RefKind != RefKind.Out); // Shouldn't get here for a constructor
3361Debug.Assert(underlyingParameter.ContainingSymbol is MethodSymbol);
3436Debug.Assert((object)local != null);
3437Debug.Assert(kind != BindValueKind.RValue);
3598Debug.Assert((object)field != null);
3599Debug.Assert(field.RefKind == RefKind.None ? RequiresAssignableVariable(kind) : RequiresRefAssignableVariable(kind));
3600Debug.Assert(field.Type != (object)null);
3604Debug.Assert(kind != BindValueKind.AddressOf); // If this assert fails, we probably should report ErrorCode.ERR_InvalidAddrOp
3634Debug.Assert((object)symbol != null);
3635Debug.Assert(RequiresAssignableVariable(kind));
3671Debug.Assert(expr.Type is not null);
3752Debug.Assert(false);
3757Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything));
3885Debug.Assert(GetInlineArrayAccessEquivalentSignatureMethod(elementAccess, out _, out _).RefKind == RefKind.None);
3893Debug.Assert(equivalentSignatureMethod.RefKind != RefKind.None);
3921Debug.Assert(expr is BoundConversion conversion &&
3928Debug.Assert(expr is BoundUnaryOperator unaryOperator &&
3935Debug.Assert(expr is BoundBinaryOperator binaryOperator &&
3942Debug.Assert(expr is BoundUserDefinedConditionalLogicalOperator logicalOperator &&
3948Debug.Assert(expr is BoundCompoundAssignmentOperator compoundAssignmentOperator &&
3955Debug.Assert(expr is BoundIncrementOperator incrementOperator &&
3977Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter());
3981Debug.Assert(GetRefEscape(expr).IsConvertibleTo(escapeTo));
4051Debug.Assert(false);
4056Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything));
4186Debug.Assert(GetInlineArrayAccessEquivalentSignatureMethod(elementAccess, out _, out _).RefKind == RefKind.None);
4194Debug.Assert(equivalentSignatureMethod.RefKind != RefKind.None);
4264Debug.Assert((!conversion.Conversion.IsUserDefined && !conversion.Conversion.IsUnion) ||
4270Debug.Assert(expr is BoundUnaryOperator unaryOperator &&
4277Debug.Assert(expr is BoundBinaryOperator binaryOperator &&
4284Debug.Assert(expr is BoundUserDefinedConditionalLogicalOperator logicalOperator &&
4290Debug.Assert(expr is BoundCompoundAssignmentOperator compoundAssignmentOperator &&
4297Debug.Assert(expr is BoundIncrementOperator incrementOperator &&
4368Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything));
4416Debug.Assert(false);
4594Debug.Assert(conversion.ConversionKind != ConversionKind.StackAllocToSpanType, "StackAllocToSpanType unexpected");
4620Debug.Assert(operatorMethod is not null);
4642Debug.Assert(increment.OperatorKind.IsUserDefined());
4645Debug.Assert(prefix || increment.OperatorKind.Operator() is UnaryOperatorKind.PostfixIncrement or UnaryOperatorKind.PostfixDecrement);
4790Debug.Assert(elementType.Type is { });
4799Debug.Assert(elementType.Type is { });
4803Debug.Assert(expr.CollectionCreation is not null);
4848Debug.Assert(spreadElement.HasErrors
4863Debug.Assert(element.HasErrors);
5037Debug.Assert(!checkingReceiver || expr.Type.IsValueType || expr.Type.IsTypeParameter());
5041Debug.Assert(GetValEscape(expr).IsConvertibleTo(escapeTo));
5069Debug.Assert(thisParam.Type.Equals(((BoundThisReference)expr).Type, TypeCompareKind.ConsiderEverything));
5174Debug.Assert(false);
5373Debug.Assert(conversion.ConversionKind != ConversionKind.StackAllocToSpanType, "StackAllocToSpanType unexpected");
5409Debug.Assert(operatorMethod is not null);
5436Debug.Assert(increment.OperatorKind.IsUserDefined());
5439Debug.Assert(prefix || increment.OperatorKind.Operator() is UnaryOperatorKind.PostfixIncrement or UnaryOperatorKind.PostfixDecrement);
5765Debug.Assert(conversion.Conversion.IsInlineArray);
Binder\DecisionDagBuilder.cs (104)
372Debug.Assert(pattern.UnionMatchingMode == UnionMatchingMode.None);
373Debug.Assert(input.UnionValue is null ?
387Debug.Assert(input.UnionValue is null);
435Debug.Assert(unionValue.Symbol is PropertySymbol);
440Debug.Assert(IsUnionValue(result, out _));
569Debug.Assert(input.Index == 0);
602Debug.Assert(variableAccess.Type!.Equals(input.Type, TypeCompareKind.AllIgnoreOptions) || variableAccess.Type.IsErrorType());
758Debug.Assert(IsUnionHasValue(temp, out _));
761Debug.Assert(test is Tests.One { Test: BoundDagValueTest });
803Debug.Assert(IsUnionTryGetValueReturn(boolResult, out _, out _, out _));
806Debug.Assert(test is Tests.One { Test: var tryGetValueResultTest } && IsUnionTryGetValueTest(tryGetValueResultTest, out _, out _, out _));
844Debug.Assert(!conversion.IsUserDefined);
845Debug.Assert(!conversion.IsUnion);
904Debug.Assert(constant.Value.Type is not null || constant.HasErrors);
923Debug.Assert(input.Source is BoundDagPropertyEvaluation { IsLengthOrCount: true });
1009Debug.Assert(subpattern is { IsLengthOrCount: false });
1067Debug.Assert(subpattern.HasAnyErrors);
1095Debug.Assert(subpattern.HasAnyErrors);
1170Debug.Assert(bin.HasErrors ||
1185Debug.Assert(type is { });
1233Debug.Assert(_suitableForLowering || !_forLowering);
1239Debug.Assert(kvp.Key == kvp.Value);
1385Debug.Assert(!first.IsImpossible);
1460Debug.Assert(state.SelectedTest is null);
1488Debug.Assert(state.FalseBranch is null);
1489Debug.Assert(trueBranch is not null);
1490Debug.Assert(state.TrueBranch is not null);
1500Debug.Assert(stateForCases.Index == state.TrueBranch.Cases[case2].Index);
1505Debug.Assert(case2 >= state.TrueBranch.Cases.Count || stateForCases.Index != state.TrueBranch.Cases[case2].Index);
1544Debug.Assert(trueBranch is not null);
1545Debug.Assert(falseBranch is not null);
1610Debug.Assert(_defaultLabel != null);
1611Debug.Assert(defaultDecision != null);
1621Debug.Assert(wasAcyclic, "wasAcyclic"); // force failure in debug builds
1893Debug.Assert(e.IsLengthOrCount);
1899Debug.Assert(input.Index == 0);
1914Debug.Assert(input.Index == 0);
2210Debug.Assert(testUnionInstance != null);
2211Debug.Assert(testKind != UnionTestKind.TypeTest || testTargetType is not null);
2222Debug.Assert(otherUnionInstance != null);
2223Debug.Assert(otherKind != UnionTestKind.TypeTest || otherTargetType is not null);
2265Debug.Assert(testTargetType is not null);
2266Debug.Assert(otherTargetType is not null);
2377Debug.Assert((hasValueTest.Value == ConstantValue.True || hasValueTest.Value == ConstantValue.False));
2396Debug.Assert(isTrue); // The only form of the test that we construct
2522Debug.Assert(s1LengthTemp.IsEquivalentTo(s2LengthTemp));
2589Debug.Assert(s1.Input.Source is BoundDagTypeEvaluation);
2590Debug.Assert(s2.Input.Source is BoundDagTypeEvaluation);
2676Debug.Assert(input.Index == 0);
2961Debug.Assert(arrayBuilder != null);
3067Debug.Assert(dagState.Cases.IsDefault);
3068Debug.Assert(dagState.RemainingValues is null);
3069Debug.Assert(dagState.SelectedTest is null);
3070Debug.Assert(dagState.TrueBranch is null);
3071Debug.Assert(dagState.FalseBranch is null);
3072Debug.Assert(dagState.Dag is null);
3278Debug.Assert((conditionToUseFinalResult is null) == (tempsUpdatedResult is null));
3279Debug.Assert((conditionToUseFinalResult is null) || (tempsUpdatedResult is One(BoundDagIndexerEvaluation)));
3316Debug.Assert(rewriteResult.TempsUpdatedResult is not null);
3354Debug.Assert(!b.TempContainingValue.Equals(useValueFrom));
3523Debug.Assert(t.Value.Discriminator == ConstantValueTypeDiscriminator.Int32);
3524Debug.Assert(t.Relation == BinaryOperatorKind.GreaterThanOrEqual);
3525Debug.Assert(t.Value.Int32Value >= 0);
3538Debug.Assert(t.Value.Discriminator == ConstantValueTypeDiscriminator.Int32);
3542Debug.Assert(t.Value.Discriminator == ConstantValueTypeDiscriminator.Int32);
3566Debug.Assert(value >= 0); // Tests with negative values should never be created.
3567Debug.Assert(offset >= 0); // The number of elements in a list is always non-negative.
3581Debug.Assert(tempMap.IsEmpty);
3607Debug.Assert(savedTempMap == tempsUpdatedResultTempMap);
3618Debug.Assert(removeEvaluationLeavesInputUnchanged(tempsUpdatedResult, builder, state, tempMap, e));
3623Debug.Assert(!finalResult.Equals(tempsUpdatedResult) || tempsUpdatedResultTempMap == tempMap);
3624Debug.Assert(condition is null ||
3628Debug.Assert(Test is not BoundDagIndexerEvaluation ||
3646Debug.Fail("Unexpected change in temp map during conditional removal of indexer evaluation.");
3713Debug.Assert(!eval.Input.Equals(e1.Input));
3762Debug.Assert(oldTemp.Type.Equals(newTemp.Type, TypeCompareKind.AllIgnoreOptions));
3794Debug.Assert(!typeEval.Equals(e1));
3860Debug.Fail("Do not expect to get in a situation when a type evaluation removal initiates a temp rewrite.");
3882Debug.Assert(s1LengthTemp.IsEquivalentTo(s2LengthTemp));
3892Debug.Assert(state.RemainingValues.ContainsKey(s1LengthTemp));
3896Debug.Assert(!lengthValues.IsEmpty);
3935Debug.Assert(passThrough.Input.Source is BoundDagTypeEvaluation);
4018Debug.Assert(test is not BoundDagEvaluation);
4046Debug.Assert(!values.IsEmpty);
4105Debug.Assert(test is BoundDagTypeTest, "New type of non-evaluation test added, please update filter for this");
4151Debug.Assert(sample is not null);
4174Debug.Assert(Input.Source is not BoundDagPropertyEvaluation { IsLengthOrCount: true } e ||
4244Debug.Assert(remainingTests.Length > 1);
4376Debug.Assert(tempMapToRestore == tempMap);
4386Debug.Assert(testsToAssemble.Count != 0); // If we have a child to rewrite, we must have a parent to reassemble.
4432Debug.Assert(testsToAssemble.Peek().Kind == ReassembleKind.And);
4442Debug.Assert(rewriteResult.TempsUpdatedResult is not null);
4448Debug.Assert(leftToRewriteBuilder.Count < childCount);
4475Debug.Assert(rewriteResult.ConditionToUseFinalResult is not null);
4476Debug.Assert(rewriteResult.TempsUpdatedResult is not null);
4547Debug.Assert(!skip);
4548Debug.Assert(!skip);
4616Debug.Assert(obj is SequenceTests);
4644Debug.Assert(t2 is SequenceTests seq && seq.RemainingTests.Length == sequence.RemainingTests.Length);
4778Debug.Assert(!remainingTests.Any(t => t is AndSequence));
4785Debug.Assert(t2 is not (True or False));
4884Debug.Assert(!remainingTests.Any(t => t is OrSequence));
4891Debug.Assert(t2 is not (True or False));
4943Debug.Assert(builder.Count == count);
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (143)
65Debug.Assert(instance.Count == 0);
285Debug.Assert(!methodTypeParameters.IsDefault);
286Debug.Assert(methodTypeParameters.Length > 0);
287Debug.Assert(!formalParameterTypes.IsDefault);
288Debug.Assert(formalParameterRefKinds.IsDefault || formalParameterRefKinds.Length == formalParameterTypes.Length);
289Debug.Assert(!arguments.IsDefault);
345Debug.Assert(ordinals is null || ordinals.Values.Count() == ordinals.Values.Distinct().Count());
346Debug.Assert(ordinals is null || methodTypeParameters.All(tp => ordinals.ContainsKey(tp)));
354Debug.Assert(_nullableAnnotationLowerBounds.All(annotation => annotation.IsNotAnnotated()));
443Debug.Assert(0 <= index && index < _formalParameterTypes.Length);
498Debug.Assert(ValidIndex(methodTypeParameterIndex));
504Debug.Assert(type.HasType);
539Debug.Assert(IsUnfixedTypeParameter(methodTypeParameterWithAnnotations));
554Debug.Assert(ValidIndex(methodTypeParameterIndex));
562Debug.Assert((object)delegateOrFunctionPointerType != null);
563Debug.Assert(delegateOrFunctionPointerType.IsDelegateType() || delegateOrFunctionPointerType is FunctionPointerTypeSymbol);
603Debug.Assert(!_formalParameterTypes.IsDefault);
604Debug.Assert(!_arguments.IsDefault);
671Debug.Assert(targetType is { });
705Debug.Assert(target.Type is { });
744Debug.Assert(sourceArguments.Length == destTypes.Length);
802Debug.Assert(res != InferenceResult.NoProgress);
931Debug.Assert((object)argument.Type == null, "should not need to dig into elements if tuple has natural type");
941Debug.Assert(sourceArguments.Length == destTypes.Length);
1128Debug.Assert(ValidIndex(iParam));
1129Debug.Assert(ValidIndex(jParam));
1141Debug.Assert(IsUnfixed(iParam));
1142Debug.Assert(IsUnfixed(jParam));
1194Debug.Assert(_dependencies == null);
1198Debug.Assert(0 == (int)Dependency.Unknown);
1215Debug.Assert(_dependencies != null);
1221Debug.Assert(0 <= iParam && iParam < _methodTypeParameters.Length);
1222Debug.Assert(0 <= jParam && jParam < _methodTypeParameters.Length);
1234Debug.Assert(_dependencies != null);
1235Debug.Assert(ValidIndex(iParam));
1236Debug.Assert(ValidIndex(jParam));
1270Debug.Assert(_dependencies != null);
1291Debug.Assert(_dependencies != null);
1306Debug.Assert(_dependencies != null);
1324Debug.Assert(ValidIndex(iParam));
1339Debug.Assert(ValidIndex(iParam));
1352Debug.Assert(ValidIndex(iParam));
1371Debug.Assert(expression != null);
1372Debug.Assert(target.HasType);
1404Debug.Assert(source != null);
1405Debug.Assert(target.HasType);
1418Debug.Assert((object)delegateType.DelegateInvokeMethod != null && !delegateType.DelegateInvokeMethod.HasUseSiteError,
1432Debug.Assert(inferredReturnType.Type is not FunctionTypeSymbol);
1440Debug.Assert(source != null);
1441Debug.Assert((object)target != null);
1472Debug.Assert(method is { HasUseSiteError: false },
1523Debug.Assert(!resolution.IsNonMethodExtensionMember(out _));
1549Debug.Assert(source != null);
1550Debug.Assert(target.HasType);
1604Debug.Assert(source != null);
1605Debug.Assert(target.HasType);
1640Debug.Assert(source.HasType);
1641Debug.Assert(target.HasType);
1694Debug.Assert(source.HasType);
1695Debug.Assert(target.HasType);
1709Debug.Assert(source.HasType);
1710Debug.Assert(target.HasType);
1741Debug.Assert(source is not null);
1742Debug.Assert(target is not null);
1768Debug.Assert(type.IsSpan() || type.IsReadOnlySpan());
1804Debug.Assert(source.HasType);
1805Debug.Assert(target.HasType);
1833Debug.Assert(source.HasType);
1834Debug.Assert(target.HasType);
1860Debug.Assert(source.HasType);
1861Debug.Assert(target.HasType);
1944Debug.Assert((object)source != null);
1945Debug.Assert((object)target != null);
1946Debug.Assert(TypeSymbol.Equals(source.OriginalDefinition, target.OriginalDefinition, TypeCompareKind.ConsiderEverything2));
1954Debug.Assert(sourceTypeArguments.Count == targetTypeArguments.Count);
1971Debug.Assert(source.HasType);
1972Debug.Assert(target.HasType);
2065Debug.Assert(source.HasType);
2066Debug.Assert(target.HasType);
2080Debug.Assert((object)source != null);
2081Debug.Assert((object)target != null);
2115Debug.Assert((object)source != null);
2116Debug.Assert((object)target != null);
2153Debug.Assert(source is not null);
2154Debug.Assert(target is not null);
2196Debug.Assert((object)source != null);
2197Debug.Assert((object)target != null);
2260Debug.Assert((object)source != null);
2261Debug.Assert((object)target != null);
2305Debug.Assert((object)source != null);
2306Debug.Assert((object)target != null);
2386Debug.Assert((object)source != null);
2387Debug.Assert((object)target != null);
2388Debug.Assert(TypeSymbol.Equals(source.OriginalDefinition, target.OriginalDefinition, TypeCompareKind.ConsiderEverything2));
2398Debug.Assert(typeParameters.Count == sourceTypeArguments.Count);
2399Debug.Assert(typeParameters.Count == targetTypeArguments.Count);
2480Debug.Assert(source.HasType);
2481Debug.Assert(target.HasType);
2514Debug.Assert(source.Type.IsReferenceType || source.Type.IsFunctionPointer());
2541Debug.Assert(source.HasType);
2542Debug.Assert(target.HasType);
2555Debug.Assert(source.HasType);
2556Debug.Assert(target.HasType);
2597Debug.Assert(sourceWithAnnotations.HasType);
2598Debug.Assert(targetWithAnnotations.HasType);
2657Debug.Assert((object)source != null);
2658Debug.Assert((object)target != null);
2686Debug.Assert((object)source != null);
2687Debug.Assert((object)target != null);
2736Debug.Assert((object)source != null);
2737Debug.Assert((object)target != null);
2738Debug.Assert(TypeSymbol.Equals(source.OriginalDefinition, target.OriginalDefinition, TypeCompareKind.ConsiderEverything2));
2748Debug.Assert(typeParameters.Count == sourceTypeArguments.Count);
2749Debug.Assert(typeParameters.Count == targetTypeArguments.Count);
2829Debug.Assert(IsUnfixed(iParam));
2851Debug.Assert(best.Type.Type.Equals(withoutNullability.Type, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
2883Debug.Assert(!containsFunctionTypes(exact));
2884Debug.Assert(!containsFunctionTypes(upper));
2974Debug.Assert(!best.Equals(candidate, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
2994Debug.Assert(compilation is not null); // Tracked by https://github.com/dotnet/roslyn/issues/80658
3062Debug.Assert((object)target != null);
3063Debug.Assert(target.IsDelegateType());
3064Debug.Assert((object)target.DelegateInvokeMethod != null && !target.DelegateInvokeMethod.HasUseSiteError,
3066Debug.Assert(!target.DelegateInvokeMethod.ReturnsVoid);
3070Debug.Assert(!HasUnfixedParamInInputType(source, target));
3156Debug.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);
3263Debug.Assert((object)method != null);
3264Debug.Assert(method.Arity > 0);
3265Debug.Assert(!arguments.IsDefault);
3274Debug.Assert(!method.GetParameterType(0).IsDynamic());
3301Debug.Assert(!_formalParameterTypes.IsDefault);
3302Debug.Assert(_formalParameterTypes.Length >= 1);
3303Debug.Assert(!_arguments.IsDefault);
3304Debug.Assert(_arguments.Length >= 1);
3323Debug.Assert(IsUnfixed(iParam));
3393Debug.Assert(conversions.IncludeNullability ||
3424Debug.Assert(variance == VarianceKind.In || variance == VarianceKind.Out);
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (41)
68Debug.Assert(_bestResultState == ThreeState.True && _bestResult.Result.IsValid);
93Debug.Assert(_bestResultState == ThreeState.True);
133Debug.Assert(HasAnyApplicableMember);
176Debug.Assert(false, "How did we manage to get two methods in the overload resolution results that were both better than every other method?");
224Debug.Assert(!this.Succeeded, "Don't ask for diagnostic info on a successful overload resolution result.");
227Debug.Assert(arguments.Arguments.All(a => a.Display != null));
432Debug.Assert(!supportedRequiredParameterMissingConflicts);
495Debug.Assert(arguments.Names[badArg].HasValue);
535Debug.Assert(firstSupported.Member is MethodSymbol { MethodKind: MethodKind.Constructor });
544Debug.Assert(firstSupported.Member is MethodSymbol { Name: "Add" });
606Debug.Assert(diagInfo != null);
607Debug.Assert(diagInfo.Severity == DiagnosticSeverity.Error);
620Debug.Assert(firstSupported.Result.Kind == MemberResolutionKind.WrongCallingConvention);
635Debug.Assert(bad.Member.GetUseSiteInfo().DiagnosticInfo.Severity == DiagnosticSeverity.Error,
792Debug.Assert(arguments.Arguments.Count > 0);
832Debug.Assert(arguments.Names.Count > badArg);
833Debug.Assert(arguments.Names[badArg].HasValue);
835Debug.Assert(badName != null);
852Debug.Assert(arguments.Names.Count > badArg);
853Debug.Assert(arguments.Names[badArg].HasValue);
855Debug.Assert(badName != null);
866Debug.Assert(result.Result.BadArgumentsOpt.TrueBits().Count() == 1);
867Debug.Assert(arguments.Names[result.Result.FirstBadArgument].HasValue);
869Debug.Assert(name != null);
892Debug.Assert(arguments.Names.Count > badArg);
893Debug.Assert(arguments.Names[badArg].HasValue);
895Debug.Assert(badName != null);
938Debug.Assert(badMember.Kind == SymbolKind.Method);
939Debug.Assert(((MethodSymbol)(object)badMember).IsVararg);
1235Debug.Assert(refArg == RefKind.None);
1340Debug.Assert(argument.Kind != BoundKind.OutDeconstructVarPendingInference);
1341Debug.Assert(argument.Kind != BoundKind.OutVariablePendingInference);
1342Debug.Assert(argument.Kind != BoundKind.DiscardExpression || argument.HasExpressionType());
1343Debug.Assert(argument.Display != null);
1347Debug.Assert((arg == 0) && (parm == arg));
1348Debug.Assert(!badArg.Result.ConversionForArg(parm).IsImplicit);
1359Debug.Assert((object)parameter == unwrapIfParamsCollection(badArg, parameter, isLastParameter), "If they ever differ, just call the method when constructing the diagnostic.");
1423Debug.Assert(badArg.Result.ParamsElementTypeOpt.Type != (object)ErrorTypeSymbol.EmptyParamsCollectionElementTypeSentinel);
1442Debug.Assert(nWorse == 0, "How is it that there is exactly one applicable but worse method, and exactly zero applicable best methods? What was better than this thing?");
1503Debug.Assert(nValid == 0, "Why are we doing error reporting on an overload resolution problem that had one valid result?");
1507Debug.Assert(false, "Add tests if this is triggered. https://github.com/dotnet/roslyn/issues/80507");
BoundTree\BoundNode.cs (21)
75Debug.Assert(
139Debug.Assert((_attributes & BoundNodeAttributes.HasErrors) == 0,
157Debug.Assert(original is BoundExpression || !original.IsSuppressed);
185Debug.Assert((_attributes & BoundNodeAttributes.WasCompilerGeneratedIsChecked) == 0,
195Debug.Assert((_attributes & BoundNodeAttributes.CompilerGenerated) == 0,
207Debug.Assert((_attributes & BoundNodeAttributes.WasCompilerGeneratedIsChecked) == 0,
240Debug.Assert((_attributes & BoundNodeAttributes.WasTopLevelNullabilityChecked) == 0,
304Debug.Assert((_attributes & BoundNodeAttributes.IsSuppressed) == 0, "flag should not be set twice or reset");
326Debug.Assert((_attributes & BoundNodeAttributes.WasConverted) == 0, "WasConverted flag should not be set twice or reset");
342Debug.Assert((_attributes & BoundNodeAttributes.WasPropertyBackingFieldAccessChecked) == 0, "should not be set twice or reset");
360Debug.Assert(value || !IsParamsArrayOrCollection);
361Debug.Assert(!value ||
366Debug.Assert(!value ||
468Debug.Assert(possiblyUserDefined.Conversion.IsUserDefined);
495Debug.Assert(possiblyUnion.Conversion.IsUnion);
519Debug.Assert((boundConversion.InConversionGroupFlags & InConversionGroupFlags.LoweredFormOfUserDefinedConversionForExpressionTree) != 0);
562Debug.Assert(false, "duplicate local " + local.GetDebuggerDisplay());
573Debug.Assert(false, "missing local " + local.GetDebuggerDisplay());
582Debug.Assert(false, "undeclared local " + local.GetDebuggerDisplay());
618Debug.Assert(added);
635Debug.Assert(removed);
CodeGen\EmitExpression.cs (120)
79Debug.Assert(_recursionDepth == 1);
84Debug.Assert(_recursionDepth == 1);
233Debug.Assert(used);
238Debug.Assert(used);
243Debug.Assert(!used);
248Debug.Assert(used);
253Debug.Assert(used);
258Debug.Assert(used);
263Debug.Assert(used);
268Debug.Assert(used);
273Debug.Assert(used);
278Debug.Assert(used);
313Debug.Assert(used);
359Debug.Assert(expression.Kind != BoundKind.BadExpression);
376Debug.Assert(!expression.Type.IsReferenceType);
377Debug.Assert(!expression.Type.IsValueType);
408Debug.Assert(!receiverType.IsValueType ||
415Debug.Assert(receiverType.IsVerifierReference());
519Debug.Assert(receiver.Type.IsNullableType());
572Debug.Assert(receiverTemp == null);
575Debug.Assert(receiverTemp == null || receiver.IsDefaultValue());
613Debug.Assert(walker._result.HasValue);
631Debug.Assert(!_result.HasValue);
640Debug.Assert(!_result.HasValue);
651Debug.Assert(!expression.Type.IsValueType);
674Debug.Assert(temp == null, "makeref should not create temps");
691Debug.Assert((object)getTypeMethod != null);
721Debug.Assert(refKind is RefKind.In or RefKind.Ref or RefKind.Out or RefKindExtensions.StrictIn);
727Debug.Assert(refKind is RefKind.In || argument.Type.IsDynamic() || argument is BoundFieldAccess { FieldSymbol.RefKind: not RefKind.None }, "passing args byref should not clone them into temps");
746Debug.Assert(refKind is RefKind.Ref or RefKind.Out or RefKindExtensions.StrictIn);
758Debug.Assert(temp == null, "If the operand is addressable, then a temp shouldn't be required.");
810Debug.Assert((object)meth != null);
817Debug.Assert(thisType.TypeKind != TypeKind.TypeParameter);
867Debug.Assert(sequence.Value.Kind != BoundKind.TypeExpression || !used);
957Debug.Assert(arguments.Length == parameters.Length ||
959Debug.Assert(parameters.All(p => p.RefKind == RefKind.None) || !argRefKindsOpt.IsDefault, "there are nontrivial parameters, so we must have argRefKinds");
961Debug.Assert(argRefKindsOpt.IsDefault || argRefKindsOpt.Length == arguments.Length ||
985Debug.Assert(argRefKind == parameters[i].RefKind ||
996Debug.Assert(parameters[i].RefKind != RefKind.RefReadOnlyParameter,
1010Debug.Assert(arguments[i].Kind == BoundKind.ArgListOperator);
1150Debug.Assert(!field.IsConst || field.ContainingType.SpecialType == SpecialType.System_Decimal,
1193Debug.Assert(FieldLoadMustUseRef(receiver), "only clr-ambiguous structs use temps here");
1260Debug.Assert(!field.IsVolatile, "volatile valuetype fields are unexpected");
1432Debug.Assert(parameter.Type.Equals(parameter.ParameterSymbol.Type, TypeCompareKind.AllIgnoreOptions) ||
1540Debug.Assert(receiver.Type.IsVerifierReference(), "this is not a reference");
1541Debug.Assert(receiver.Kind != BoundKind.BaseReference, "base should always use call");
1669Debug.Assert(method.IsImplicitlyDeclared);
1670Debug.Assert(TypeSymbol.Equals(method.ContainingType, receiver.Type, TypeCompareKind.ConsiderEverything2));
1671Debug.Assert(receiver.Kind == BoundKind.ThisReference);
1686Debug.Assert(method.IsStatic);
1755Debug.Assert(!box);
1763Debug.Assert(addressKind.GetValueOrDefault() != AddressKind.Constrained);
1764Debug.Assert(!parentCallReceiverType.IsVerifierValue());
1765Debug.Assert(parentCallKind != CallKind.ConstrainedCallVirt);
1769Debug.Assert(!box);
1770Debug.Assert(!parentCallReceiverType.IsVerifierReference());
1805Debug.Assert(receiverUseKind == UseKind.UsedAsValue);
1815Debug.Assert(receiverUseKind == UseKind.UsedAsValue);
1820Debug.Assert(!parentCallReceiverType.IsVerifierReference());
1824Debug.Assert(receiverUseKind == UseKind.UsedAsValue);
1825Debug.Assert(!HasHome(nested, addressKind.GetValueOrDefault()));
1868Debug.Assert(!method.IsStatic && !method.IsDefaultValueTypeConstructor() && method.RequiresInstanceReceiver);
1908Debug.Assert(TypeSymbol.Equals(receiverType, methodContainingType, TypeCompareKind.ObliviousNullableModifierMatchesAny));
1953Debug.Assert((callKind != CallKind.ConstrainedCallVirt) || (addressKind.GetValueOrDefault() == AddressKind.Constrained) || receiverType.IsVerifierValue());
1976Debug.Assert(!box);
1977Debug.Assert(!receiverType.IsVerifierReference());
2022Debug.Assert(receiver.Type.IsVerifierReference());
2033Debug.Assert(receiver.Type.IsVerifierReference());
2046Debug.Assert(false, "Taking this code path is likely unexpected.");
2205Debug.Assert(!b.OperatorKind.IsUserDefined());
2218Debug.Assert(!conv.ConversionKind.IsUserDefinedConversion());
2219Debug.Assert(!conv.ConversionKind.IsUnionConversion());
2236Debug.Assert(methodContainingType.IsVerifierValue(), "only struct calls can be readonly");
2351Debug.Assert(method.ContainingType.IsVerifierValue(), "this is not a value type");
2399Debug.Assert(expression.Type.SpecialType == SpecialType.System_Int32 ||
2732Debug.Assert(temp == null, "in-place init target should not create temps");
2739Debug.Assert(TargetIsNotOnHeap(target), "cannot read-back the target since it could have been modified");
2746Debug.Assert(TargetIsNotOnHeap(target), "in-place construction target should not be on heap");
2761Debug.Assert(temp == null, "in-place ctor target should not create temps");
2855Debug.Assert(temp == null, "temp is unexpected when assigning to a field");
2939Debug.Assert(temp == null, "taking ref of this should not create a temp");
2950Debug.Assert(temp == null, "taking ref of Dup should not create a temp");
2959Debug.Assert(left.IsRef);
2962Debug.Assert(temp == null, "taking ref of this should not create a temp");
2995Debug.Assert(left.Method.RefKind != RefKind.None);
3006Debug.Assert(left.FunctionPointer.Signature.RefKind != RefKind.None);
3061Debug.Assert(lhs.Kind != BoundKind.Parameter || exprTempsAfter <= exprTempsBefore);
3179Debug.Assert(((BoundDup)expression).RefKind != RefKind.None);
3184Debug.Assert(((BoundConditionalOperator)expression).IsRef);
3202Debug.Assert(((BoundCall)expression).Method.RefKind != RefKind.None);
3207Debug.Assert(((BoundFunctionPointerInvocation)expression).FunctionPointer.Signature.RefKind != RefKind.None);
3258Debug.Assert(thisRef.Type.IsValueType);
3454Debug.Assert((object)operand.Type != null);
3473Debug.Assert(asOp.OperandPlaceholder is null);
3474Debug.Assert(asOp.OperandConversion is null);
3483Debug.Assert((object)targetType != null);
3535Debug.Assert(expression.Type.SpecialType == SpecialType.System_Decimal ||
3580Debug.Assert((object)getTypeMethod != null); // Should have been checked during binding
3601Debug.Assert(node.Method.IsDefinition);
3602Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32);
3619Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32);
3633Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32);
3647Debug.Assert(field.IsDefinition);
3656Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32);
3692Debug.Assert(throwMethod != null);
3735Debug.Assert(node.Type.SpecialType == SpecialType.System_Int32);
3746Debug.Assert((object)getMethod != null);
3754Debug.Assert(getMethod.ParameterCount == 2);
3773Debug.Assert((object)getField != null);
3781Debug.Assert(getField.ParameterCount == 2);
3810Debug.Assert(expr.ConstantValueOpt == null, "Constant value should have been emitted directly");
3908Debug.Assert(expr.LeftConversion is null, "coalesce with nontrivial left conversions are lowered into conditional.");
3909Debug.Assert(expr.Type.IsReferenceType);
3989Debug.Assert(conversionKind != ConversionKind.NullLiteral && conversionKind != ConversionKind.DefaultLiteral);
4056Debug.Assert(to.IsVerifierReference());
4076Debug.Assert(!type.IsRefLikeType);
4129Debug.Assert(useKind == UseKind.Unused, "Using the return value of a void method.");
4130Debug.Assert(_method.GenerateDebugInfo, "Implied by this.emitSequencePoints");
4169Debug.Assert(method.RefKind != RefKind.None);
4175Debug.Assert(load.Type is { TypeKind: TypeKind.FunctionPointer });
CodeGen\Optimizer.cs (44)
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());
614Debug.Assert(EvalStackIsEmpty(), "entering blocks when evaluation stack is not empty?");
793Debug.Assert(localUsedWalker.IsLocalUsedIn(assignment.Right), "who assigns the temp?");
868Debug.Assert(_assignmentLocal == null);
928Debug.Assert(_context != ExprContext.AssignmentTarget, "assignment expression cannot be a target of another assignment");
938Debug.Assert(_context == ExprContext.Value ||
972Debug.Assert(
978Debug.Assert(!isIndirectAssignment, "indirect assignment is a read, not a write");
1039Debug.Assert(!node.IsRef ||
1046Debug.Assert(lhs.Type.IsValueType, "'this' is assignable only in structs");
1066Debug.Assert(((BoundCall)lhs).Method.RefKind == RefKind.Ref, "only ref returning methods are assignable");
1070Debug.Assert(((BoundFunctionPointerInvocation)lhs).FunctionPointer.Signature.RefKind == RefKind.Ref, "only ref returning function pointers are assignable");
1074Debug.Assert(((BoundConditionalOperator)lhs).IsRef, "only ref ternaries are assignable");
1078Debug.Assert(((BoundAssignmentOperator)lhs).IsRef, "only ref assignments are assignable");
1084Debug.Assert(!IsIndirectAssignment(node.Update(((BoundSequence)node.Left).Value, node.Right, node.IsRef, node.Type)),
1179Debug.Assert(method.IsStatic);
1268Debug.Assert(!arguments.IsDefault);
1269Debug.Assert(!parameters.IsDefault);
1271Debug.Assert(arguments.Length == parameters.Length || arguments.Length == parameters.Length + 1);
1331Debug.Assert(node.InitializerExpressionOpt == null);
1400Debug.Assert(false, "we should not have label expressions at this stage");
1406Debug.Assert(false, "we should not have is-pattern expressions at this stage");
1412Debug.Assert(node.CaseExpressionOpt == null, "we should not have label expressions at this stage");
1431Debug.Assert(EvalStackIsEmpty());
1538Debug.Assert(!binary.OperatorKind.IsDynamic());
1552Debug.Assert((object)binary == node);
1573Debug.Assert(!node.OperatorKind.IsDynamic());
1582Debug.Assert(node.LeftPlaceholder is null);
1583Debug.Assert(node.LeftConversion is null);
1887Debug.Assert(local.RefKind == RefKind.None, "cannot take a ref of a ref");
1934Debug.Assert(local == empty || locInfo.StackAtDeclaration == StackDepth());
1955Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.OptimizerTemp);
1960Debug.Assert(local == empty || locInfo.StackAtDeclaration == StackDepth());
1968Debug.Assert(local.SynthesizedKind != SynthesizedLocalKind.OptimizerTemp);
2023Debug.Assert(local.SynthesizedKind == SynthesizedLocalKind.LoweringTemp, "only lowering temps may be sometimes reused");
2162Debug.Assert(!binary.OperatorKind.IsDynamic());
2173Debug.Assert((object)binary == node);
2205Debug.Assert(node.InitializerExpressionOpt == null);
2245Debug.Assert(locInfo.LocalDefs.Any((d) => _nodeCounter == d.Start && _nodeCounter <= d.End));
Compilation\CSharpSemanticModel.cs (73)
62Debug.Assert(node != null);
206Debug.Assert(expression != null);
255Debug.Assert(binder != null);
256Debug.Assert(binder.IsSemanticModelBinder);
257Debug.Assert(expression != null);
258Debug.Assert(bindingOption != SpeculativeBindingOption.BindAsTypeOrNamespace || expression is TypeSyntax);
267Debug.Assert(bindingOption == SpeculativeBindingOption.BindAsExpression);
739Debug.Assert(boundNode == null || crefSymbols.IsDefault);
765Debug.Assert(CanGetSemanticInfo(attribute, isSpeculative: true));
793Debug.Assert(CanGetSemanticInfo(constructorInitializer, isSpeculative: true));
865Debug.Assert(CanGetSemanticInfo(constructorInitializer, isSpeculative: true));
926Debug.Assert(CanGetSemanticInfo(cref, isSpeculative: true));
1069Debug.Assert(boundNode == null || crefSymbols.IsDefault);
1216Debug.Assert(boundNode == null || crefSymbols.IsDefault);
1236Debug.Assert(result == null || result.IsSemanticModelBinder);
1328Debug.Assert(IsInTree(node));
1346Debug.Assert(position == fullSpan.Start);
1354Debug.Assert(node.Width == 0);
1373Debug.Assert(position == CheckAndAdjustPosition(position), "Expected adjusted position");
1581Debug.Assert((options & LookupOptions.UseBaseReferenceAccessibility) == 0, "Use the useBaseReferenceAccessibility parameter.");
1586Debug.Assert(!options.IsAttributeTypeLookup()); // Not exposed publicly.
1606Debug.Assert((object)container == null);
1677Debug.Assert((options & LookupOptions.NamespacesOrTypesOnly) == 0);
1678Debug.Assert((options & LookupOptions.NamespaceAliasesOnly) == 0);
1679Debug.Assert((options & LookupOptions.LabelsOnly) == 0);
1696Debug.Assert(symbol.IsExtensionBlockMember());
1755Debug.Assert(results != null);
1758Debug.Assert((options & LookupOptions.AllMethodsOnArityZero) == 0);
2323Debug.Assert((object)symbol != null);
2361Debug.Assert((object)symbol != null);
3314Debug.Assert(catchClause.Kind() == SyntaxKind.CatchClause);
3438Debug.Assert(boundNode is not BoundTypeOrValueExpression, "The Binder is expected to resolve the member access in the most appropriate way, even in an error scenario.");
3495Debug.Assert((object)indexerAccess.Indexer != null);
3544Debug.Assert((object)symbol != null);
3595Debug.Assert(conditional.ExpressionSymbol is null);
3601Debug.Assert(boundNodeForSyntacticParent == null);
3613Debug.Assert(resultKind != LookupResultKind.Viable);
3647Debug.Assert(dynamicInvocation.ExpressionSymbol is null);
3655Debug.Assert(collectionInit.ExpressionSymbol is null);
3663Debug.Assert(dynamicIndexer.ExpressionSymbol is null);
3670Debug.Assert((object)boundNode.ExpressionSymbol == null);
3686Debug.Assert(boundObjectCreation.ConstructorsGroup.Contains(boundObjectCreation.Constructor));
3832Debug.Assert((object)unaryOperator.MethodOpt == null && unaryOperator.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty);
3855Debug.Assert((object)increment.MethodOpt == null && increment.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty);
3880Debug.Assert((object)binaryOperator.BinaryOperatorMethod == null && binaryOperator.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty);
3919Debug.Assert(returnType.IsDynamic());
3923Debug.Assert(rightType.IsDynamic());
3928Debug.Assert(leftType.IsDynamic());
3953Debug.Assert((object)compoundAssignment.Operator.Method == null && compoundAssignment.OriginalUserDefinedOperatorsOpt.IsDefaultOrEmpty);
4012Debug.Assert(resultKind != LookupResultKind.Viable ||
4047Debug.Assert(lowestBoundNode != null);
4048Debug.Assert(binderOpt != null || IsInTree(lowestBoundNode.Syntax));
4052Debug.Assert(lowestBoundNode.Syntax != null);
4073Debug.Assert(resultKind != LookupResultKind.Viable);
4084Debug.Assert(candidateConstructors.Contains(constructorOpt));
4090Debug.Assert(resultKind != LookupResultKind.Viable);
4108Debug.Assert(binderOpt != null || IsInTree(boundNode.Syntax));
4139Debug.Assert(symbol.IsIndexer(), "Only indexers can have name " + WellKnownMemberNames.Indexer);
4265Debug.Assert(binderOpt != null || IsInTree(boundNode.Syntax));
4417Debug.Assert(binderOpt != null || IsInTree(boundNode.Syntax));
4500Debug.Assert(SyntaxFacts.IsNamedArgumentName(identifierNameSyntax));
4600Debug.Assert(nonHiddenMethods.Any()); // Something must be hiding, so can't all be hidden.
4636Debug.Assert(receiver != null);
4750Debug.Assert(members.Count > 0);
4757Debug.Assert((members.Count == 0) == (resultKind == LookupResultKind.Empty));
4758Debug.Assert(members.Count == filteredMembers.Count);
4769Debug.Assert(!methods.IsDefault);
4783Debug.Assert((object)receiverType != null);
4804Debug.Assert((object)method != null);
4808Debug.Assert(call.Arguments.Length > 0);
4821Debug.Assert((object)method != null);
4956Debug.Assert(((options & SymbolInfoOptions.PreferConstructorsToType) != 0) !=
4958Debug.Assert(((options & SymbolInfoOptions.ResolveAliases) != 0) !=
Compilation\MemberSemanticModel.cs (58)
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);
364Debug.Assert(!current.CanHaveAssociatedLocalBinder());
374Debug.Assert(binder != null);
402Debug.Assert(binder != null);
412Debug.Assert(binder != null);
418Debug.Assert(binder != null);
429Debug.Assert(binder != null);
537Debug.Assert(node == GetBindableSyntaxNode(node));
559Debug.Assert(node == GetBindableSyntaxNode(node));
840Debug.Assert(parameter != null);
875Debug.Assert(parameter != null);
876Debug.Assert(lambda != null && lambda.IsAnonymousFunction());
893Debug.Assert(this.GetMemberModel(lambda) == null, "Did not find a unique LambdaSymbol for lambda in member.");
992Debug.Assert(enumeratorInfoOpt != null || boundForEach.HasAnyErrors);
1052Debug.Assert(boundConversion != null);
1070Debug.Assert(boundDeconstruction != null || boundForEach.HasAnyErrors);
1140Debug.Assert(index >= 0);
1141Debug.Assert(index < anonymousObjectCreation.Initializers.Count);
1234Debug.Assert(highestBoundNode != null);
1246Debug.Assert(highestBoundNode.Kind != BoundKind.UnboundLambda);
1263Debug.Assert(IsInTree(node), "Since the node is in the tree, we can always recompute the binder later");
1286Debug.Assert(IsInTree(node), "Since the node is in the tree, we can always recompute the binder later");
1298Debug.Assert(IsInTree(node), "Since the node is in the tree, we can always recompute the binder later");
1416Debug.Assert(node != null);
1424Debug.Assert(current != null, "Why are we being asked to find an enclosing lambda outside of our root?");
1480Debug.Assert(_nodeMapLock.IsWriteLockHeld || _nodeMapLock.IsReadLockHeld);
1498Debug.Assert(_nodeMapLock.IsWriteLockHeld);
1512Debug.Assert(syntax != _root || _guardedBoundNodeMap.ContainsKey(bound.Syntax));
1529Debug.Assert(_nodeMapLock.IsWriteLockHeld);
1548Debug.Assert(syntax != _root || _guardedBoundNodeMap.ContainsKey(bound.Syntax));
1556Debug.Assert((manager is null && (!IsNullableAnalysisEnabled() || syntax != Root || syntax is TypeSyntax ||
1574Debug.Assert(node != null);
1580Debug.Assert(current != null, "How did we get outside the root?");
1709Debug.Assert(bindingRoot.Contains(enclosingLambdaOrQuery));
1751Debug.Assert(lambdaOrQuery != nodeToBind);
1786Debug.Assert(boundInnerLambdaOrQuery != null);
1804Debug.Assert(result != null);
1945Debug.Assert(containingLambda.IsAnonymousFunction());
1946Debug.Assert(LookupPosition.IsInAnonymousFunctionOrQuery(position, containingLambda));
1997Debug.Assert(!isNullableAnalysisEnabled ||
2043Debug.Assert(Compilation.IsNullableAnalysisEnabledAlways);
2071Debug.Assert(binder is SimpleProgramBinder);
2121Debug.Assert(node == GetBindableSyntaxNode(node));
2286Debug.Assert(parent.Kind() == SyntaxKind.VariableDeclaration);
2365Debug.Assert(bindableParent != null);
2393Debug.Assert(symbol is LocalSymbol or ParameterSymbol or MethodSymbol { MethodKind: MethodKind.LambdaMethod });
2462Debug.Assert(!(binder is IncrementalBinder));
2519Debug.Assert(!block.WasCompilerGenerated);
2583Debug.Assert(alternative is BoundIfStatement);
Compiler\ClsComplianceChecker.cs (40)
44Debug.Assert(diagnostics.DependenciesBag is null || diagnostics.DependenciesBag is ConcurrentSet<AssemblySymbol>);
93System.Diagnostics.Debug.Assert(symbol is SourceAssemblySymbol);
122System.Diagnostics.Debug.Assert(warningLocation != null || !moduleDeclaredCompliance.HasValue || (i == 0 && _filterTree != null),
243Debug.Assert(!symbol.IsImplicitClass);
279System.Diagnostics.Debug.Assert(IsAccessibleOutsideAssembly(constructor), "Should be implied by IsAccessibleIfContainerIsAccessible");
424System.Diagnostics.Debug.Assert(
430System.Diagnostics.Debug.Assert(!symbol.IsAccessor());
499System.Diagnostics.Debug.Assert(!IsTrue(GetDeclaredOrInheritedCompliance(symbol)), "Only call on non-compliant symbols");
514System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol)), "Only call on compliant symbols");
532System.Diagnostics.Debug.Assert((object)baseType != null || symbol.SpecialType == SpecialType.System_Object || symbol.IsExtension, "Only object or extension has no base.");
543System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol)), "Only call on compliant symbols");
546System.Diagnostics.Debug.Assert((object)containingType == null || !containingType.IsImplicitClass);
555System.Diagnostics.Debug.Assert(typeParameters.IsEmpty || IsTrue(GetDeclaredOrInheritedCompliance(context)), "Only call on compliant symbols");
574System.Diagnostics.Debug.Assert(parameters.IsEmpty || IsTrue(GetDeclaredOrInheritedCompliance(context)), "Only call on compliant symbols");
587System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol)), "Only call on compliant symbols");
665System.Diagnostics.Debug.Assert(syntaxRef.SyntaxTree.HasCompilationUnitRoot);
713System.Diagnostics.Debug.Assert(IsTrue(GetDeclaredOrInheritedCompliance(symbol)), "Only call on compliant symbols");
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');
1116System.Diagnostics.Debug.Assert(symbol.Kind == SymbolKind.NamedType || !((symbol is TypeSymbol)),
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);
1209System.Diagnostics.Debug.Assert(args.Length == 1, "We already checked the signature and HasErrors.");
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);
FlowAnalysis\NullableWalker.cs (372)
82Debug.Assert(variables.Id == variableNullableStates.Id);
149Debug.Assert(TypeSymbol.Equals(RValueType.Type, LValueType.Type, TypeCompareKind.ConsiderEverything));
166Debug.Assert(!StateForLambda.HasValue);
369Debug.Assert(TypeAllowsConditionalState(visitResult.RValueType.Type)
490Debug.Assert(_targetTypedAnalysisCompletionOpt is null or { Count: 0 });
514Debug.Assert(!TrackingRegions);
515Debug.Assert(!useDelegateInvokeParameterTypes || delegateInvokeMethodOpt is object);
516Debug.Assert(baseOrThisInitializer is null or { MethodKind: MethodKind.Constructor });
584Debug.Assert(_resultForPlaceholdersOpt.Count == 0);
591Debug.Assert(AreCloseEnough(placeholder.Type, result.RValueType.Type));
592Debug.Assert(expression != null || placeholder.Kind == BoundKind.InterpolatedStringArgumentPlaceholder);
601Debug.Assert(_resultForPlaceholdersOpt is { });
603Debug.Assert(removed);
609Debug.Assert(placeholder is { });
691Debug.Assert(_useConstructorExitWarnings);
1035Debug.Assert(requiredMember.IsRequired());
1507Debug.Assert(node.SyntaxTree is object);
1553Debug.Assert(method.IsConstructor());
1874Debug.Assert(diagnostics != null);
1875Debug.Assert(getterNullResilienceData is null || symbol is SourcePropertyAccessorSymbol { MethodKind: MethodKind.PropertyGet });
1876Debug.Assert(getterNullResilienceData is null || !useConstructorExitWarnings);
1900Debug.Assert(!walker.IsConditionalState);
1918Debug.Assert(snapshotBuilderOpt is null || symbol is object);
1925Debug.Assert(walker._variables.Id == initialState.Value.Id);
1931Debug.Assert(!badRegion);
1952Debug.Assert(result.RequiredAnalysis == requiredAnalysis);
1968Debug.Assert(!IsConditionalState);
1991Debug.Assert(node is object);
2041Debug.Assert(slot > 0);
2136Debug.Assert(member?.RequiresInstanceReceiver() ?? true);
2155Debug.Assert(node.HasErrors ||
2275Debug.Assert(containingSlot == 0);
2672Debug.Assert(!IsConditionalState);
2726Debug.Assert(ErrorFacts.NullableWarnings.Contains(MessageProvider.Instance.GetIdForErrorCode((int)errorCode)));
2735Debug.Assert(targetSlot > 0);
2736Debug.Assert(EmptyStructTypeCache.IsTrackableStructType(targetType));
2762Debug.Assert(false, "If this assert fires, please add a unit test for the scenario.");
2778Debug.Assert(targetContainerSlot > 0);
2779Debug.Assert(skipSlot > 0);
2863Debug.Assert(slot > 0);
2884Debug.Assert(targetSlot > 0);
2888Debug.Assert(actualType is { });
2896Debug.Assert(conversion.Kind is ConversionKind.Identity or ConversionKind.ImplicitReference);
2929Debug.Assert(false);
2957Debug.Assert(targetSlot > 0);
2958Debug.Assert(valueSlot > 0);
2966Debug.Assert(member.Kind == SymbolKind.Field || member.Kind == SymbolKind.Property || member.Kind == SymbolKind.Event);
3040Debug.Assert(!IsConditionalState);
3094Debug.Assert(!IsConditionalState);
3200Debug.Assert((object)returnType != LambdaSymbol.ReturnTypeIsBeingInferred);
3249Debug.Assert(node.Type.IsErrorType() || type.Type.IsErrorType());
3281Debug.Assert(!TrackingRegions);
3348Debug.Assert(newBodiesVisited);
3438Debug.Assert((object?)variables.Container == container);
3450Debug.Assert(!useDelegateInvokeParameterTypes || delegateInvokeMethod is object);
3451Debug.Assert(!useDelegateInvokeReturnType || delegateInvokeMethod is object);
3573Debug.Assert(!IsConditionalState);
3599Debug.Assert(!IsConditionalState);
3713Debug.Assert(!IsConditionalState);
3748Debug.Assert(type.Type.IsErrorType());
3767Debug.Assert(node is BoundExpression or BoundPattern);
3768Debug.Assert(!IsConditionalState);
3785Debug.Assert((object?)resultType.Type != _invalidType.Type);
3786Debug.Assert(AreCloseEnough(resultType.Type, node.Type));
3884Debug.Assert(!_completingTargetTypedExpression);
3993Debug.Assert(reinferenceResult.Completion != null);
4009Debug.Assert(collectionBuilderElementsPlaceholder != null);
4031Debug.Assert(reinferenceResult.Completion != null);
4052Debug.Assert(allTypeArguments.Length == call.Method.Arity, "Guaranteed by GetCollectionBuilderMethods");
4091Debug.Assert(node.Placeholder is { });
4095Debug.Assert(initializer.ArgsToParamsOpt.IsDefault);
4166Debug.Assert(completion is not null);
4180Debug.Assert(TypeSymbol.Equals(strippedTargetCollectionType, node.Type, TypeCompareKind.AllIgnoreOptions));
4239Debug.Assert(foundIterationType);
4244Debug.Assert(!targetElementType.HasType);
4258Debug.Assert(node.ExpressionPlaceholder is { });
4259Debug.Assert(node.EnumeratorInfoOpt is { });
4271Debug.Assert(node.HasErrors);
4272Debug.Assert(node.Conversion is null);
4273Debug.Assert(node.EnumeratorInfoOpt is null);
4281Debug.Assert(!IsConditionalState);
4293Debug.Assert(isTargetTyped == argumentsCompletion is not null);
4324Debug.Assert(argumentsCompletion is not null);
4325Debug.Assert(initialStateInferenceCompletion is not null);
4330Debug.Assert(argumentsCompletion is null);
4331Debug.Assert(initialStateInferenceCompletion is null);
4332Debug.Assert(initializerCompletion is null);
4348Debug.Assert(resultState == NullableFlowState.NotNull);
4353Debug.Assert(TypeSymbol.Equals(resultTypeWithAnnotations.Type, node.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4391Debug.Assert(node.Kind is BoundKind.ObjectCreationExpression or BoundKind.DynamicObjectCreationExpression or BoundKind.NewT or BoundKind.NoPiaObjectCreationExpression);
4482Debug.Assert(completion is null);
4483Debug.Assert(resultState == NullableFlowState.NotNull);
4491Debug.Assert(containingSlot > 0);
4505Debug.Assert(iUnionValuePropertySlot > 0);
4518Debug.Assert(!delayCompletionForType || containingSlot == -1);
4568Debug.Assert(!delayCompletionForType || containingSlot == -1);
4608Debug.Assert(symbol is not null);
4631Debug.Assert(argumentsCompletion is null);
4632Debug.Assert(initializationCompletion is null);
4642Debug.Assert(objectInitializer.MemberSymbol is not null);
4660Debug.Assert(argumentResults[0].LValueType.Type.Equals(containingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4669Debug.Assert(initializationCompletion is null || symbol is not null);
4673Debug.Assert(result is null);
4685Debug.Assert(!delayCompletionForType || slot == -1);
4701Debug.Assert(nestedCompletion is null);
4726Debug.Assert(!delayCompletionForType || conversionCompletion is null);
4733Debug.Assert(GetTypeOrReturnTypeWithAnnotations(symbol).HasType);
4745Debug.Assert(conversionCompletion is not null);
4749Debug.Assert(conversionCompletion is null);
4762Debug.Assert(result is null);
4779Debug.Assert(TypeSymbol.Equals(objectInitializer.Type, GetTypeOrReturnType(symbol), TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4807Debug.Assert(TypeSymbol.Equals(objectInitializer.Type, GetTypeOrReturnType(symbol), TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4854Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4855Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.LValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4871Debug.Assert(visitArgumentsCompletion is not null);
4875Debug.Assert(visitArgumentsCompletion is null);
4876Debug.Assert(reinferredMethod is object);
4912Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.RValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4913Debug.Assert(TypeSymbol.Equals(containingType, receiverResult.LValueType.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
4990Debug.Assert(node.Type is object);
5008Debug.Assert((object)placeholder != null);
5014Debug.Assert(!IsConditionalState);
5015Debug.Assert(node.Type.IsAnonymousType);
5192Debug.Assert(namedType.Name == "Span");
5193Debug.Assert(namedType.OriginalDefinition.Arity == 1);
5199Debug.Assert(namedType.Name == "Span");
5200Debug.Assert(namedType.OriginalDefinition.Arity == 1);
5309Debug.Assert(!IsConditionalState);
5313Debug.Assert(!IsConditionalState);
5314Debug.Assert(!node.Expression.Type!.IsValueType);
5343Debug.Assert(!IsConditionalState);
5347Debug.Assert(!IsConditionalState);
5348Debug.Assert(expressionType is not null);
5349Debug.Assert(expressionType.IsValueType);
5423Debug.Assert(!IsConditionalState);
5581Debug.Assert(binary.Type.SpecialType == SpecialType.System_Boolean);
5614Debug.Assert(!IsConditionalState);
5649Debug.Assert(operand == expr);
5667Debug.Assert(!IsConditionalState);
5671Debug.Assert(binary.Type!.SpecialType == SpecialType.System_Boolean);
5797Debug.Assert(!IsConditionalState);
5898Debug.Assert(operand != null);
6146Debug.Assert(targetType.Type.ContainsErrorType() ||
6158Debug.Assert(TypeSymbol.Equals(targetType.Type, rightResult.Type, TypeCompareKind.AllIgnoreOptions));
6169Debug.Assert(!IsConditionalState);
6220Debug.Assert(rightType is object);
6227Debug.Assert(!conversion.IsUserDefined);
6228Debug.Assert(!conversion.IsUnion);
6233Debug.Assert(!conversion.IsUserDefined);
6234Debug.Assert(!conversion.IsUnion);
6257Debug.Assert(conversionResult.Type is not null);
6286Debug.Assert(targetType.HasType);
6298Debug.Assert(!IsConditionalState);
6336Debug.Assert(!IsConditionalState);
6382Debug.Assert(innerCondAccess.Receiver is not (BoundConditionalAccess or BoundConversion));
6394Debug.Assert(expr is BoundExpression);
6404Debug.Assert(expr is BoundExpression);
6475Debug.Assert(node is not BoundConditionalOperator { WasTargetTyped: true }, """
6565Debug.Assert(!wasTargetTyped);
6572Debug.Assert(node is BoundUnconvertedConditionalOperator);
6573Debug.Assert(node.HasErrors || _returnTypesOpt is not null || _disableDiagnostics);
6665Debug.Assert(!isRef);
6677Debug.Assert(isRef);
6809Debug.Assert(node.InvokedAsExtensionMethod);
6829Debug.Assert(node.InvokedAsExtensionMethod || isExtensionBlockMethod);
6836Debug.Assert(node.Method.ContainingType.ExtensionParameter is not null);
6876Debug.Assert(node.ReceiverOpt is null);
6929Debug.Assert(reinferenceResult.Member is not null);
6993Debug.Assert(reinferenceResult.Completion is null);
6995Debug.Assert(newMethod is not null);
7020Debug.Assert(extensionParameter is not null);
7033Debug.Assert(member.IsExtensionBlockMember());
7054Debug.Assert(extensionParameter is not null);
7125Debug.Assert(arguments.Length == 2);
7136Debug.Assert(arguments.Length == 1);
7225Debug.Assert(baseType is object);
7297Debug.Assert(!compareExchangeInfo.IsDefault);
7319Debug.Assert(argsToParamsOpt is { IsDefault: true } or { Length: 3 });
7537Debug.Assert(reinferenceResult.Completion is null);
7551Debug.Assert(reinferenceResult.Completion is null);
7584Debug.Assert(!arguments.IsDefault);
7585Debug.Assert(!expanded || !parametersOpt.IsDefault);
7586Debug.Assert(refKindsOpt.IsDefaultOrEmpty || refKindsOpt.Length == arguments.Length);
7587Debug.Assert(argsToParamsOpt.IsDefault || argsToParamsOpt.Length == arguments.Length);
7595Debug.Assert(!arguments.Any(a => a.IsParamsArrayOrCollection));
7695Debug.Assert(method is ErrorMethodSymbol);
7821Debug.Assert(result.Completion is null);
7833Debug.Assert(arguments.Count(a => a.IsParamsArrayOrCollection) <= 1);
7840Debug.Assert(parametersOpt.IsDefault || arguments.Length == parametersOpt.Length);
7868Debug.Assert(defaultArguments.IsNull || elements.Length == 1);
7869Debug.Assert(elements.Length == 1 || a == arguments.Length - 1);
7874Debug.Assert(argumentsBuilder.Count == arguments.Length + elements.Length - 1);
7978Debug.Assert(receiverSlot >= 0);
8085Debug.Assert(!IsConditionalState);
8149Debug.Assert(!IsConditionalState);
8197Debug.Assert(!IsConditionalState);
8216Debug.Assert(!this.IsConditionalState);
8233Debug.Assert(argumentResultType is not null);
8289Debug.Assert(!this.IsConditionalState);
8475Debug.Assert(!IsConditionalState);
8480Debug.Assert(!IsConditionalState);
8659Debug.Assert(variables.Id == localState.Id);
8678Debug.Assert(!expanded);
8688Debug.Assert(paramsIterationType.HasType);
8705Debug.Assert(member.GetMemberArityIncludingExtension() != 0);
8841Debug.Assert(false); // unexpected value
8880Debug.Assert(lambdaState.HasValue);
8893Debug.Assert(collectionExpressionVisitResults is not null);
8894Debug.Assert(collectionExpressionVisitResults.Length == collection.Elements.Length);
9034Debug.Assert(group != null || !conversion.ExplicitCastInCode); // Explicit conversions should include a group.
9147Debug.Assert((object)symbol != null);
9148Debug.Assert(!symbol.IsExtensionBlockMember(), symbol.ToDisplayString());
9182Debug.Assert(symbol.ContainingType.IsDefinition);
9219Debug.Assert(false);
9249Debug.Assert(targetType.HasType);
9294Debug.Assert(completion is null);
9325Debug.Assert(targetTypeOpt.HasType);
9354Debug.Assert(result.completion is null);
9384Debug.Assert(!IsConditionalState);
9420Debug.Assert(diagnostics.DiagnosticBag is { });
9446Debug.Assert(tupleType.IsTupleType);
9447Debug.Assert(values.Length == types.Length);
9448Debug.Assert(values.Length == (useRestField ? Math.Min(tupleType.TupleElements.Length, NamedTypeSymbol.ValueTupleRestPosition) : tupleType.TupleElements.Length));
9481Debug.Assert(index != -1);
9488Debug.Assert(containingType.OriginalDefinition.SpecialType == SpecialType.System_Nullable_T);
9489Debug.Assert(containingSlot > 0);
9490Debug.Assert(valueSlot > 0);
9512Debug.Assert(conversion.Kind == ConversionKind.ImplicitTuple || conversion.Kind == ConversionKind.ExplicitTuple);
9513Debug.Assert(slot > 0);
9514Debug.Assert(valueSlot > 0);
9603Debug.Assert(targetField.TypeWithAnnotations.Type.StrippedType() is NamedTypeSymbol { IsUnionType: true });
9623Debug.Assert(conversionOperandSlot > 0);
9673Debug.Assert(diagnostics.DiagnosticBag is { });
9729Debug.Assert(diagnostics.DiagnosticBag is { });
9784Debug.Assert(conversionOpt is null
9832Debug.Assert(!trackMembers || !IsConditionalState);
9833Debug.Assert(conversionOperand != null);
9834Debug.Assert(conversionOpt is null || targetInstanceSlotOpt < 0);
9860Debug.Assert(conversionOpt is null);
9909Debug.Assert(targetInstanceSlotOpt < 0);
9948Debug.Assert(targetInstanceSlotOpt < 0);
9953Debug.Assert(targetInstanceSlotOpt < 0);
10015Debug.Assert(containingSlot > 0);
10050Debug.Assert(targetInstanceSlotOpt < 0);
10064Debug.Assert(conversionOperand != null);
10072Debug.Assert(containingSlot > 0);
10109Debug.Assert(targetInstanceSlotOpt < 0);
10112Debug.Assert(conversionOperand != null);
10139Debug.Assert(conversionOperand != null);
10189Debug.Assert(targetType.IsValueType || targetType.IsErrorType());
10292Debug.Assert(dependsOn); // If this case fails, add a corresponding test.
10365Debug.Assert(handlerData.ArgumentPlaceholders.IsEmpty
10387Debug.Assert(extensionBlockFormOffset == 1);
10444Debug.Assert(!IsConditionalState);
10445Debug.Assert(conversionOperand != null);
10446Debug.Assert(targetTypeWithNullability.HasType);
10447Debug.Assert(diagnosticLocation != null);
10448Debug.Assert(conversion.Kind == ConversionKind.ExplicitUserDefined || conversion.Kind == ConversionKind.ImplicitUserDefined);
10480Debug.Assert(method is object);
10481Debug.Assert(method.ParameterCount == 1);
10482Debug.Assert(operandType.Type is object);
10598Debug.Assert(!IsConditionalState);
10599Debug.Assert(conversionOperand != null);
10600Debug.Assert(targetTypeWithNullability.HasType);
10601Debug.Assert(diagnosticLocation != null);
10602Debug.Assert(conversion.IsUnion);
10603Debug.Assert(conversionOpt is null || targetInstanceSlotOpt < 0);
10612Debug.Assert(conversion.BestUnionConversionAnalysis is { });
10615Debug.Assert(analysis.Kind == UserDefinedConversionAnalysisKind.ApplicableInNormalForm);
10616Debug.Assert(analysis.Operator is { ParameterCount: 1 } and ({ MethodKind: MethodKind.Constructor } or { MethodKind: MethodKind.Ordinary, IsStatic: true, ContainingType.IsInterface: true }));
10617Debug.Assert(TypeSymbol.Equals(analysis.FromType, analysis.Operator.GetParameterType(0), TypeCompareKind.AllIgnoreOptions));
10618Debug.Assert(TypeSymbol.Equals(targetTypeWithNullability.Type.StrippedType(), analysis.Operator.MethodKind == MethodKind.Constructor ? analysis.Operator.ContainingType : analysis.Operator.ReturnType, TypeCompareKind.AllIgnoreOptions));
10619Debug.Assert(TypeSymbol.Equals(targetTypeWithNullability.Type.StrippedType(), analysis.ToType, TypeCompareKind.AllIgnoreOptions));
10620Debug.Assert(analysis.TargetConversion is { IsIdentity: true } or { IsNullable: true, IsImplicit: true });
10628Debug.Assert(unionConstructionConversion is not null, "Unexpected conversion group structure for union conversion.");
10629Debug.Assert(sourceToParameterConversion is not null || analysis.SourceConversion.IsIdentity);
10633Debug.Assert(conversionOpt is null);
10653Debug.Assert(i < candidates.Length);
10660Debug.Assert(TypeSymbol.Equals(analysis.FromType, parameterType.Type, TypeCompareKind.AllIgnoreOptions));
10661Debug.Assert(TypeSymbol.Equals(toType, analysis.ToType, TypeCompareKind.AllIgnoreOptions));
10679Debug.Assert(operandType.Type is object);
10699Debug.Assert(factory.MethodKind == MethodKind.Constructor);
10704Debug.Assert(factory is { IsStatic: true, ContainingType.IsInterface: true });
10718Debug.Assert(conversionOperand != null);
10720Debug.Assert(containingSlot > 0);
10760Debug.Assert(conversionOpt.ConversionGroupOpt == conversionGroup);
10773Debug.Assert(conversionOpt.ConversionGroupOpt == conversionGroup);
10838Debug.Assert(operandType.Type is object);
10839Debug.Assert(diagnosticLocation != null);
10872Debug.Assert(node.Type.IsDelegateType());
10919Debug.Assert(analysisCompletion is null);
10931Debug.Assert(TypeSymbol.Equals(resultTypeWithAnnotations.Type, node.Type, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
11008Debug.Assert(arg.Type is not null);
11027Debug.Assert(arg.Type is not null);
11048Debug.Assert(!IsConditionalState);
11114Debug.Assert(_binder is object);
11123Debug.Assert(receiverParameter is not null);
11157Debug.Assert(delegateTypeOpt?.IsDelegateType() != false);
11225Debug.Assert(!IsConditionalState);
11437Debug.Assert(conversion.Kind == ConversionKind.Deconstruction);
11463Debug.Assert(invocation is object);
11464Debug.Assert(rightResult.Type is object);
11490Debug.Assert(invocation.DefaultArguments.IsNull);
11502Debug.Assert(parameters.Length - offset == n);
11509Debug.Assert(receiverParameter is not null);
11554Debug.Assert(rightParts.Length == n);
11721Debug.Assert(!IsConditionalState);
11749Debug.Assert(reinferenceResult.Member is not null);
11817Debug.Assert(!operandConversion.IsUnion);
11914Debug.Assert(!IsConditionalState);
11942Debug.Assert(reinferenceResult.Member is not null);
12041Debug.Assert(MakeSlot(node) == -1);
12129Debug.Assert(property.Parameters.IsEmpty);
12143Debug.Assert(reinferenceResult.Completion is null);
12160Debug.Assert(property.IsExtensionBlockMember());
12182Debug.Assert(node.ReceiverOpt is not null);
12184Debug.Assert(reinferenceResult.Member is not null);
12223Debug.Assert(node.ReceiverOpt is not null);
12229Debug.Assert(reinferrenceResult.Member is not null);
12303Debug.Assert(!IsConditionalState);
12304Debug.Assert(!member.IsExtensionBlockMember());
12344Debug.Assert(!IsConditionalState);
12391Debug.Assert(containingType.IsNullableType());
12392Debug.Assert(TypeSymbol.Equals(NominalSlotType(containingSlot), containingType, TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
12404Debug.Assert(node.HasErrors);
12454Debug.Assert(resultType is object);
12504Debug.Assert(!foundMultiple);
12505Debug.Assert(targetTypeWithAnnotations.HasType);
12511Debug.Assert(node.HasErrors);
12518Debug.Assert(node.HasErrors);
12569Debug.Assert(wellKnownSpan is WellKnownType.System_Span_T or WellKnownType.System_ReadOnlySpan_T);
12790Debug.Assert(!IsConditionalState);
12940Debug.Assert(stack.Count > 0);
12968Debug.Assert(leftOperand is not null);
12993Debug.Assert(isAnd || op == BinaryOperatorKind.Or);
12998Debug.Assert(IsConditionalState);
13024Debug.Assert(!isBool);
13097Debug.Assert(placeholder is object);
13152Debug.Assert(!this.IsConditionalState);
13172Debug.Assert(!this.IsConditionalState);
13191Debug.Assert(node.Type.SpecialType == SpecialType.System_Boolean);
13243Debug.Assert(node.Type.SpecialType == SpecialType.System_RuntimeArgumentHandle);
13251Debug.Assert(node.Type is null);
13258Debug.Assert(!IsConditionalState);
13266Debug.Assert(!IsConditionalState);
13275Debug.Assert(node.WasCompilerGenerated);
13283Debug.Assert(node.WasCompilerGenerated);
13322Debug.Assert(node.Type.IsDynamic());
13341Debug.Assert(node.Type.IsDynamic());
13342Debug.Assert(node.Type.IsReferenceType);
13352Debug.Assert(!IsConditionalState);
13448Debug.Assert(node.Type.IsDynamic());
13461Debug.Assert(!this.IsConditionalState);
13471Debug.Assert(receiverOpt.Type is null || AreCloseEnough(receiverOpt.Type, resultTypeSymbol));
13592Debug.Assert(node.Type is null || node.Type.IsErrorType() || node.Type.IsRefLikeType);
13612Debug.Assert(node.Type is not null);
13783Debug.Assert(node.AwaitableInstancePlaceholder is not null);
13787Debug.Assert(node.RuntimeAsyncAwaitCallPlaceholder is not null);
13793Debug.Assert(node.GetResult is null);
13824Debug.Assert(ResultType is TypeWithState { Type: FunctionPointerTypeSymbol { }, State: NullableFlowState.NotNull });
13896Debug.Assert(!otherIsConditional);
14033Debug.Assert(Id == variables.Container!.Id);
14092Debug.Assert(state.Id > id);
14106Debug.Assert(Id < variables.Id);
14152Debug.Assert(Id > id);
14165Debug.Assert(index < Capacity);
14167Debug.Assert((_state[index], _state[index + 1]) != (false, false));
14184Debug.Assert(Id > id);
14239Debug.Assert(Id == other.Id);
14246Debug.Assert(_state.Capacity == other._state.Capacity);
14268Debug.Assert(Id == other.Id);
14275Debug.Assert(_state.Capacity == other._state.Capacity);
Lowering\LocalRewriter\LocalRewriter_BinaryOperator.cs (74)
118Debug.Assert(node.Type.SpecialType == SpecialType.System_String, "Non-string binary addition should have been handled by VisitConversion or VisitArguments");
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 { });
539Debug.Assert(!operatorKind.IsDynamic());
577Debug.Assert(loweredLeft.Type is { });
614Debug.Assert(operatorKind.Operator() == BinaryOperatorKind.And || operatorKind.Operator() == BinaryOperatorKind.Or);
631Debug.Assert(applyParentUnaryOperator == null || applyParentUnaryOperator.OperatorKind == testOperator);
637Debug.Assert(leftTruthOperator == null);
712Debug.Assert(temp is { });
737Debug.Assert(leftTruthOperator == null);
750Debug.Assert(leftTruthOperator == null);
768Debug.Assert(leftTruthOperator != null);
772Debug.Assert(conversion.IsImplicit);
795Debug.Assert(!operatorKind.IsLogical());
803Debug.Assert(method is { });
804Debug.Assert(TypeSymbol.Equals(method.ReturnType, type, TypeCompareKind.ConsiderEverything2));
822Debug.Assert(left != null);
823Debug.Assert(right != null);
865Debug.Assert(nonNull is { });
909Debug.Assert(expression.Type is { });
932Debug.Assert(expression.Type is { });
946Debug.Assert(expression.Type is { });
1023Debug.Assert(yNonNull is null, "Handled by trivial optimization above; otherwise we should use yNonNull here.");
1036Debug.Assert(xNonNull is null, "Handled by trivial optimization above; otherwise we should use xNonNull here.");
1324Debug.Assert(left != null);
1325Debug.Assert(right != null);
1392Debug.Assert(!(leftAlwaysNull && rightAlwaysNull)); // We've already optimized this case.
1633Debug.Assert(TypeSymbol.Equals(seq.Type, conditional.Type, TypeCompareKind.ConsiderEverything2));
1634Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2));
1635Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2));
1685Debug.Assert(!(leftAlwaysNull && rightAlwaysNull)); // We've already optimized this case.
1708Debug.Assert(alwaysNull.Type is { });
1750Debug.Assert(conditionalExpression.Type is { });
1784Debug.Assert(leftNonNull == null || rightNonNull == null); // We've already optimized the case where they are both non-null.
1785Debug.Assert(!NullableNeverHasValue(left) && !NullableNeverHasValue(right)); // We've already optimized the case where one is null.
1926Debug.Assert(nullableType2 is { });
1958Debug.Assert(loweredLeft != null);
1959Debug.Assert(loweredRight != null);
1960Debug.Assert((object)returnType != null);
1961Debug.Assert(returnType.SpecialType == SpecialType.System_Boolean);
1962Debug.Assert(loweredLeft.IsLiteralNull() != loweredRight.IsLiteralNull());
2022Debug.Assert((object)method != null);
2047Debug.Assert((object)method != null);
2059Debug.Assert(loweredLeft.Type is { SpecialType: SpecialType.System_Decimal });
2060Debug.Assert(loweredRight.Type is { SpecialType: SpecialType.System_Decimal });
2083Debug.Assert((object)method != null);
2090Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) ||
2096Debug.Assert(
2156Debug.Assert(loweredRight.Type is { });
2158Debug.Assert(rightType.SpecialType == SpecialType.System_Int32);
2223Debug.Assert(loweredLeft.Type is { });
2225Debug.Assert(leftType.SpecialType is SpecialType.System_IntPtr or SpecialType.System_UIntPtr);
2228Debug.Assert(loweredRight.Type is { });
2230Debug.Assert(rightType.SpecialType == SpecialType.System_Int32);
2279Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer });
2284Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer });
2290Debug.Assert(kind.Operator() == BinaryOperatorKind.Addition);
2324Debug.Assert(sizeOfExpression.Type is { SpecialType: SpecialType.System_Int32 });
2334Debug.Assert(numericOperand.Type is { });
2471Debug.Assert(loweredLeft.Type is { TypeKind: TypeKind.Pointer });
2472Debug.Assert(loweredRight.Type is { TypeKind: TypeKind.Pointer });
2473Debug.Assert(returnType.SpecialType == SpecialType.System_Int64);
Lowering\LocalRewriter\LocalRewriter_Call.cs (80)
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 { });
57Debug.Assert(!_factory.CurrentType.IsExtension); // When binding a simple name for a call, you cannot get a member inside an extension type
86Debug.Assert(loweredReceiver != null);
163Debug.Assert(nameSyntax != null);
164Debug.Assert(interceptor.IsDefinition);
165Debug.Assert(!interceptor.ContainingType.IsGenericType);
201Debug.Assert(containingMethod is not null);
214Debug.Assert(receiverOpt is not BoundTypeExpression || method.IsStatic);
289Debug.Assert(methodThisParameter is not null);
290Debug.Assert(receiverOpt?.Type is not null);
296Debug.Assert(receiverOpt.Type.Equals(interceptor.Parameters[0].Type, TypeCompareKind.AllIgnoreOptions)
338Debug.Assert(node != null);
389Debug.Assert(invokedAsExtensionMethod && !arguments.IsEmpty);
446Debug.Assert(node.ReceiverOpt is null);
472Debug.Assert(rewrittenArguments.Length == 2);
525Debug.Assert(rewrittenBoundCall.Type is not null);
573Debug.Assert(!IsCapturedPrimaryConstructorParameter(expression));
624Debug.Assert(false, "Not expected to survive lowering.");
632Debug.Assert(false, "Unexpected conversion kind" + conv.ConversionKind);
676Debug.Assert(argumentRefKindsOpt.IsDefault || argumentRefKindsOpt.Length == arguments.Length);
678Debug.Assert(!requiresInstanceReceiver || rewrittenReceiver != null || _inExpressionLambda);
679Debug.Assert(!forceReceiverCapturing || (requiresInstanceReceiver && rewrittenReceiver != null && storesOpt is object));
680Debug.Assert(!forceReceiverCapturing || methodOrIndexer is PropertySymbol);
688Debug.Assert(!_inExpressionLambda);
689Debug.Assert(rewrittenReceiver is object);
690Debug.Assert(rewrittenReceiver.Type is { });
793Debug.Assert(saveTempsOpt is object || tempsOpt?.Count is null or > 0);
800Debug.Assert(assignmentToTemp is object);
801Debug.Assert(tempsOpt is object);
858Debug.Assert(!_inExpressionLambda);
863Debug.Assert(!((BoundConversion)argument).ExplicitCastInCode);
869Debug.Assert(!argumentsAssignedToTemp.IsNull);
875Debug.Assert(argIndex < argumentIndex);
882Debug.Assert(usesReceiver(argument));
883Debug.Assert(requiresInstanceReceiver);
884Debug.Assert(receiverTemp is object);
898Debug.Assert(visitedArgumentsBuilder[argIndex] != null);
935Debug.Assert(!((BoundConversion)argument).ExplicitCastInCode);
953Debug.Assert(rewrittenReceiver.Type is { });
954Debug.Assert(methodOrIndexer.ContainingType.ExtensionParameter is { });
995Debug.Assert(assignmentToTemp.IsRef);
998Debug.Assert(receiverType is object);
1034Debug.Assert(SpillSequenceSpiller.IsComplexConditionalInitializationOfReceiverRef(assignmentToTemp, out _, out _, out _, out _));
1051Debug.Assert(CodeGenerator.ReceiverIsKnownToReferToTempIfReferenceType(receiverTemp));
1077Debug.Assert(rewrittenArguments.All(arg => arg is not BoundDiscardExpression), "Discards should have been substituted by VisitArguments");
1082Debug.Assert(expanded ? rewrittenArguments.Length == parameters.Length : rewrittenArguments.Length >= parameters.Length);
1083Debug.Assert(rewrittenArguments.Count(a => a.IsParamsArrayOrCollection) <= (expanded ? 1 : 0));
1189Debug.Assert(actualArguments.All(static arg => arg is not null));
1240Debug.Assert(argumentRefKindsOpt.IsDefault || argumentRefKindsOpt.Length >= parameters.Length);
1249Debug.Assert(!argumentRefKindsOpt.IsEmpty);
1271Debug.Assert(initialArgRefKind is RefKind.None or RefKind.In or RefKind.Ref);
1286Debug.Assert(comRefKindMismatchPossible);
1310Debug.Assert(rewrittenArguments.Length == methodOrIndexer.GetParameterCount() + 1);
1311Debug.Assert(argsToParamsOpt.IsDefault);
1334Debug.Assert(methodOrIndexer.ContainingType.ExtensionParameter is not null);
1357Debug.Assert(paramsArray.IsParamsArrayOrCollection);
1411Debug.Assert(refKinds.Count == arguments.Length);
1412Debug.Assert(storesToTemps.Count == 0);
1413Debug.Assert(rewrittenArguments.Length == parameters.Length);
1414Debug.Assert(rewrittenArguments.Count(a => a.IsParamsArrayOrCollection) <= (expanded ? 1 : 0));
1423Debug.Assert(arguments[p] == null);
1427Debug.Assert(expanded);
1428Debug.Assert(p == parameters.Length - 1);
1429Debug.Assert(argRefKind == RefKind.None);
1448Debug.Assert(arguments[p].IsParamsArrayOrCollection);
1543Debug.Assert(arguments != null);
1544Debug.Assert(storesToTemps != null);
1545Debug.Assert(temporariesBuilder != null);
1572Debug.Assert(arguments != null);
1573Debug.Assert(tempStores != null);
1613Debug.Assert(firstUnclaimedStore == tempStores.Count, "not all side-effects were claimed");
1639Debug.Assert(value.Type is { });
1691Debug.Assert(actualArguments != null);
1692Debug.Assert(actualArguments.Length == parameters.Length);
1694Debug.Assert(argsRefKindsBuilder != null);
1695Debug.Assert(argsRefKindsBuilder.Count == parameters.Length);
1721Debug.Assert(localRefKind == RefKind.None);
1748Debug.Assert(node.TypeArgumentsOpt.IsDefault);
Lowering\LocalRewriter\LocalRewriter_CollectionExpression.cs (78)
31Debug.Assert(conversion.Kind == ConversionKind.CollectionExpression);
32Debug.Assert(!_inExpressionLambda);
33Debug.Assert(_additionalLocals is { });
34Debug.Assert(node.Type is { });
82Debug.Assert(elementType is { });
128Debug.Assert(spreadElement.IteratorBody is { });
146Debug.Assert(spreadElement.IteratorBody is { });
148Debug.Assert(iteratorBody is { });
161Debug.Assert(result is { });
185Debug.Assert(singleSpread.Expression.Type is not null);
202Debug.Assert(targetEnumerableType.OriginalDefinition == (object)_compilation.GetSpecialType(SpecialType.System_Collections_Generic_IEnumerable_T));
256Debug.Assert(!_inExpressionLambda);
257Debug.Assert(_additionalLocals is { });
258Debug.Assert(node.Placeholder is null);
259Debug.Assert(collectionType is ArrayTypeSymbol or NamedTypeSymbol);
273Debug.Assert(namedType.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_Span_T)) ||
280Debug.Assert(collectionType.OriginalDefinition == (object)_compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T) ||
320Debug.Assert(isReadOnlySpan
337Debug.Assert(!IsAllocatingRefStructCollectionExpression(node, CollectionExpressionTypeKind.ReadOnlySpan, elementType.Type, _compilation));
347Debug.Assert(!IsAllocatingRefStructCollectionExpression(node, isReadOnlySpan ? CollectionExpressionTypeKind.ReadOnlySpan : CollectionExpressionTypeKind.Span, elementType.Type, _compilation));
360Debug.Assert(isReadOnlySpan
384Debug.Assert(conversionKind == ConversionKind.Identity || (isReadOnlySpan && conversionKind == ConversionKind.ImplicitReference));
408Debug.Assert(list.Type is { });
409Debug.Assert(list.Type.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_List_T), TypeCompareKind.AllIgnoreOptions));
421Debug.Assert(!_inExpressionLambda);
426Debug.Assert(rewrittenReceiver is { });
435Debug.Assert(placeholder is { });
483Debug.Assert(!_inExpressionLambda);
484Debug.Assert(_factory.ModuleBuilderOpt is { });
485Debug.Assert(_diagnostics.DiagnosticBag is { });
486Debug.Assert(node.Type is NamedTypeSymbol);
487Debug.Assert(node.Placeholder is null);
488Debug.Assert(node.Type.IsArrayInterface(out _));
498Debug.Assert(node.CollectionCreation is null);
505Debug.Assert(numberIncludingLastSpread == 0);
545Debug.Assert(collectionType.IsMutableArrayInterface(out _));
551Debug.Assert(node.CollectionCreation is null or BoundObjectCreationExpression);
561Debug.Assert(c.IsImplicit);
562Debug.Assert(c.IsReference || c.IsIdentity);
567Debug.Assert(node.Type.OriginalDefinition.SpecialType is
581Debug.Assert(!_inExpressionLambda);
582Debug.Assert(node.Type is { });
583Debug.Assert(node.CollectionCreation is { });
584Debug.Assert(node.Placeholder is null);
585Debug.Assert(node.CollectionBuilderMethod is { });
586Debug.Assert(node.CollectionBuilderElementsPlaceholder is { });
593Debug.Assert(spanType.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_ReadOnlySpan_T), TypeCompareKind.AllIgnoreOptions));
642Debug.Assert(elements.Length > 0);
643Debug.Assert(elements.All(e => e is BoundExpression));
644Debug.Assert(_factory.ModuleBuilderOpt is { });
645Debug.Assert(_diagnostics.DiagnosticBag is { });
646Debug.Assert(_compilation.Assembly.RuntimeSupportsInlineArrayTypes);
647Debug.Assert(_additionalLocals is { });
668Debug.Assert(inlineArrayType.HasInlineArrayAttribute(out int inlineArrayLength) && inlineArrayLength == arrayLength);
709Debug.Assert(span.Type is { });
839Debug.Assert(TryOptimizeSingleSpreadToArray_NoConversionApplied(node, targetsReadOnlyCollection: false, arrayType) is null);
904Debug.Assert(arrayTemp.Type is ArrayTypeSymbol);
947Debug.Assert(indexTemp is not null);
1036Debug.Assert(type is not null);
1132Debug.Assert((object)spreadOperandAsSpan != rewrittenSpreadOperand || spreadOperandAsSpan is BoundLocal { LocalSymbol.SynthesizedKind: SynthesizedLocalKind.LoweringTemp });
1161Debug.Assert(!_inExpressionLambda);
1236Debug.Assert(useKnownLength);
1237Debug.Assert(setCount is { });
1238Debug.Assert(asSpan is { });
1239Debug.Assert(knownLengthTemp is { });
1275Debug.Assert(spanTemp.Type is NamedTypeSymbol);
1318Debug.Assert(indexTemp is not null);
1345Debug.Assert(rewrittenSpreadOperand.Type is not null);
1426Debug.Assert(statements.Length > 0);
1443Debug.Assert(rewrittenExpressions.Count >= numberIncludingLastSpread);
1454Debug.Assert(collectionPlaceholder is { });
1459Debug.Assert(lengthAccess is { });
1478Debug.Assert(sum is { });
1500Debug.Assert(enumeratorInfo is { });
1501Debug.Assert(convertedExpression is { });
1502Debug.Assert(expressionPlaceholder is { });
1503Debug.Assert(elementPlaceholder is { });
1504Debug.Assert(iteratorBody is { });
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (117)
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));
306Debug.Assert(oldNodeOpt == null || oldNodeOpt.Syntax == syntax);
307Debug.Assert(rewrittenType is { });
308Debug.Assert(_factory.ModuleBuilderOpt is { });
309Debug.Assert(_diagnostics.DiagnosticBag is { });
319Debug.Assert(rewrittenOperand.Type is { });
433Debug.Assert(rewrittenOperand.Type is { });
448Debug.Assert(rewrittenOperand.Type is { });
451Debug.Assert(rewrittenOperand.Type.Equals(rewrittenType, TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes));
494Debug.Assert(rewrittenOperand.Type is { });
504Debug.Assert(rewrittenOperand.Type.IsEnumType());
515Debug.Assert(rewrittenType.IsEnumType());
541Debug.Assert(conversion.Method is null);
542Debug.Assert(!conversion.IsExtensionMethod);
543Debug.Assert(constantValueOpt == null);
560Debug.Assert(symbolOpt is { });
570Debug.Assert(oldNodeOpt is { });
573Debug.Assert(method is { });
577Debug.Assert(receiver is { });
584Debug.Assert(_factory.TopLevelMethod is { });
602Debug.Assert(rewrittenOperand.Type is not null);
613Debug.Assert(spanType.OriginalDefinition.Equals(_compilation.GetWellKnownType(WellKnownType.System_Span_T), TypeCompareKind.AllIgnoreOptions));
629Debug.Assert(sourceType is not null);
642Debug.Assert(parameterType.IsSZArray());
643Debug.Assert(rewrittenOperand.Type?.IsSZArray() == true);
645Debug.Assert(c.IsImplicit || conversion.IsExplicit);
646Debug.Assert(c.IsReference || c.IsIdentity);
660Debug.Assert(destinationType.IsReadOnlySpan());
661Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan);
670Debug.Assert(implicitOperator.ParameterTypesWithAnnotations[0].Type.Equals(rewrittenOperand.Type, TypeCompareKind.AllIgnoreOptions));
692Debug.Assert(destinationType.IsReadOnlySpan());
693Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan);
694Debug.Assert(Binder.NeedsSpanCastUp(sourceType, destinationType));
704Debug.Assert(method.ParameterTypesWithAnnotations[0].Type.Equals(rewrittenOperand.Type, TypeCompareKind.AllIgnoreOptions));
711Debug.Assert(destinationType.IsReadOnlySpan());
712Debug.Assert(conversion.Kind is ConversionKind.ImplicitSpan);
719Debug.Assert(method.Parameters[0].Type.IsStringType());
720Debug.Assert(rewrittenOperand.Type?.IsStringType() == true);
757Debug.Assert(_factory.ModuleBuilderOpt is { });
770Debug.Assert((object)target != null);
832Debug.Assert(rewrittenOperand.Type is { });
864Debug.Assert(conversion.IsValid);
889Debug.Assert(conversion.Method is { });
890Debug.Assert(conversion.BestUserDefinedConversionAnalysis is { });
916Debug.Assert(rewrittenOperand.Type is { });
956Debug.Assert(conversion.IsValid);
957Debug.Assert(conversion.BestUnionConversionAnalysis is { });
961Debug.Assert(analysis.Kind == UserDefinedConversionAnalysisKind.ApplicableInNormalForm);
962Debug.Assert(analysis.Operator is { ParameterCount: 1 } and ({ MethodKind: MethodKind.Constructor } or { MethodKind: MethodKind.Ordinary, IsStatic: true, ContainingType.IsInterface: true }));
963Debug.Assert(TypeSymbol.Equals(analysis.FromType, analysis.Operator.GetParameterType(0), TypeCompareKind.AllIgnoreOptions));
964Debug.Assert(TypeSymbol.Equals(rewrittenType.StrippedType(), analysis.Operator.MethodKind == MethodKind.Constructor ? analysis.Operator.ContainingType : analysis.Operator.ReturnType, TypeCompareKind.AllIgnoreOptions));
965Debug.Assert(TypeSymbol.Equals(rewrittenType.StrippedType(), analysis.ToType, TypeCompareKind.AllIgnoreOptions));
966Debug.Assert(analysis.TargetConversion is { IsIdentity: true } or { IsNullable: true, IsImplicit: true });
970Debug.Assert(!analysis.SourceConversion.IsIdentity);
979Debug.Assert(TypeSymbol.Equals(rewrittenOperand.Type, analysis.Operator.GetParameterType(0), TypeCompareKind.AllIgnoreOptions));
986Debug.Assert(TypeSymbol.Equals(rewrittenOperand.Type, analysis.ToType, TypeCompareKind.AllIgnoreOptions));
990Debug.Assert(!analysis.TargetConversion.IsIdentity);
999Debug.Assert(TypeSymbol.Equals(rewrittenOperand.Type, rewrittenType, TypeCompareKind.AllIgnoreOptions));
1023Debug.Assert(rewrittenOperand.Type is { });
1064Debug.Assert(expression.Type is { });
1111Debug.Assert((object)rewrittenType != null);
1119Debug.Assert(rewrittenOperandType is { });
1120Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType());
1167Debug.Assert((object)rewrittenType != null);
1168Debug.Assert(rewrittenOperand.Type is { });
1170Debug.Assert(rewrittenType.IsNullableType() || rewrittenOperandType.IsNullableType());
1293Debug.Assert(conversion.Method is { });
1313Debug.Assert(operand != null);
1314Debug.Assert((object)type != null);
1382Debug.Assert(TypeSymbol.Equals(seq.Type, conditional.Type, TypeCompareKind.ConsiderEverything2));
1383Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Consequence.Type, TypeCompareKind.ConsiderEverything2));
1384Debug.Assert(TypeSymbol.Equals(conditional.Type, conditional.Alternative.Type, TypeCompareKind.ConsiderEverything2));
1415Debug.Assert(conversion.Method is { } && !conversion.Method.ReturnsVoid && conversion.Method.ParameterCount == 1);
1416Debug.Assert(rewrittenOperand.Type is { });
1448Debug.Assert(TypeSymbol.Equals(result.Type, rewrittenType, TypeCompareKind.ConsiderEverything2));
1456Debug.Assert(resultType.IsNullableType() && TypeSymbol.Equals(resultType.GetNullableUnderlyingType(), call.Method.ReturnType, TypeCompareKind.ConsiderEverything2));
1471Debug.Assert(rewrittenOperand.Type is { });
1487Debug.Assert((object)rewrittenType != null);
1488Debug.Assert(rewrittenOperand.Type.IsNullableType());
1519Debug.Assert(conversion.Method is { });
1559Debug.Assert(conversion.IsUnion);
1560Debug.Assert(conversion.Method is { ParameterCount: 1 } and ({ MethodKind: MethodKind.Constructor } or { MethodKind: MethodKind.Ordinary, IsStatic: true, ContainingType.IsInterface: true }));
1561Debug.Assert(rewrittenOperand.Type is { });
1562Debug.Assert(!_inExpressionLambda);
1563Debug.Assert(conversion.Method.Parameters[0].Type.Equals(rewrittenOperand.Type, TypeCompareKind.AllIgnoreOptions));
1602Debug.Assert(rewrittenOperand != null);
1603Debug.Assert((object)rewrittenType != null);
1604Debug.Assert(rewrittenOperand.Type is { });
1605Debug.Assert(!_compilation.Assembly.RuntimeSupportsNumericIntPtr);
1618Debug.Assert(!method.ReturnsVoid);
1619Debug.Assert(method.ParameterCount == 1);
1625Debug.Assert(target.IsNullableType());
1651Debug.Assert((object)source != null);
1652Debug.Assert((object)target != null);
1811Debug.Assert(fromType.SpecialType == SpecialType.System_Decimal || toType.SpecialType == SpecialType.System_Decimal);
1830Debug.Assert(operand.Type is { });
1861Debug.Assert(TypeSymbol.Equals(method.ReturnType, toType, TypeCompareKind.ConsiderEverything2));
1878Debug.Assert(meth is { });
1914Debug.Assert(!_compilation.Assembly.RuntimeSupportsNumericIntPtr);
1945Debug.Assert(underlying is { });
1958Debug.Assert(underlying is { });
1990Debug.Assert(!meth.ContainingType.IsInterface);
Lowering\LocalRewriter\LocalRewriter_ObjectOrCollectionInitializerExpression.cs (42)
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.IsExtensionBlockMember());
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);
272Debug.Assert(temps != 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(Binder.IsWellKnownSystemRange(rangeArgument.Type, _compilation));
472Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions));
505Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions));
540Debug.Assert(TypeSymbol.Equals(rewrittenAccess.Type, assignment.Type, TypeCompareKind.AllIgnoreOptions));
579Debug.Assert(initializers is not null);
697Debug.Assert(memberSymbol is object);
701Debug.Assert(_compilation.Conversions.ClassifyConversionFromType(rewrittenReceiver.Type, memberSymbol.ContainingType, isChecked: false, ref discardedUseSiteInfo).IsImplicit ||
Lowering\LocalRewriter\LocalRewriter_UnaryOperator.cs (42)
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.IsExtensionBlockMember()));
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));
588Debug.Assert(operandType is { });
589Debug.Assert(TypeSymbol.Equals(operandType, node.Type, TypeCompareKind.ConsiderEverything2));
625Debug.Assert(transformedLHS is not BoundPropertyAccess);
641Debug.Assert(!IsCapturedPrimaryConstructorParameter(expression));
661Debug.Assert(boundTemp.Type is not null);
701Debug.Assert(boundTemp.Type is not null);
704Debug.Assert(tempValue.Type is { });
760Debug.Assert(placeholder is not null);
793Debug.Assert(node.MethodOpt is { });
794Debug.Assert(node.MethodOpt.ParameterCount == 1);
805Debug.Assert(TypeSymbol.Equals(node.MethodOpt.GetParameterType(0), node.MethodOpt.ReturnType, TypeCompareKind.ConsiderEverything2));
902Debug.Assert(constantOne != null);
903Debug.Assert(constantOne.SpecialType != SpecialType.None);
904Debug.Assert(binaryOperandType.SpecialType != SpecialType.None);
905Debug.Assert(binaryOperatorKind.OperandTypes() != 0);
932Debug.Assert(binaryOperatorKind.OperandTypes() == BinaryOperatorKind.PointerAndInt);
933Debug.Assert(binaryOperand.Type is { TypeKind: TypeKind.Pointer });
934Debug.Assert(boundOne.Type is { SpecialType: SpecialType.System_Int32 });
980Debug.Assert((object)method != null); // Should have been checked during Warnings pass
987Debug.Assert(operand.Type is { SpecialType: SpecialType.System_Decimal });
994Debug.Assert(operand.Type is { } && operand.Type.IsNullableType() && operand.Type.GetNullableUnderlyingType().SpecialType == SpecialType.System_Decimal);
1180Debug.Assert(underlyingType is { });
1185Debug.Assert(underlyingType.IsEnumType());
1187Debug.Assert(underlyingType is { });
Lowering\LocalRewriter\LocalRewriter.cs (38)
67Debug.Assert(factory.InstrumentationState != null);
73Debug.Assert(TypeSymbol.Equals(factory.CurrentType, (containingType ?? containingMethod.ContainingType), TypeCompareKind.ConsiderEverything2));
102Debug.Assert(statement != null);
103Debug.Assert(compilationState != null);
148Debug.Assert(loweredStatement is { });
214Debug.Assert(!node.HasErrors, "nodes with errors should not be lowered");
232Debug.Assert(!node.HasErrors, "nodes with errors should not be lowered");
244Debug.Assert(!node.HasErrors, "nodes with errors should not be lowered");
253Debug.Assert(!nameofOperator.WasCompilerGenerated);
285Debug.Assert(visited == null || visited.HasErrors || ReferenceEquals(visited.Type, node.Type) ||
322Debug.Assert(CanBePassedByReference(node));
324Debug.Assert(CanBePassedByReference(result));
333Debug.Assert(_factory.ModuleBuilderOpt is { });
513Debug.Assert(_placeholderReplacementMapDoNotUseDirectly is { });
522Debug.Assert(value.Type is { } && (value.Type.Equals(placeholder.Type, TypeCompareKind.AllIgnoreOptions) || value.HasErrors));
531Debug.Assert(_placeholderReplacementMapDoNotUseDirectly.Count == 0);
559Debug.Assert(placeholder is { });
560Debug.Assert(_placeholderReplacementMapDoNotUseDirectly is { });
563Debug.Assert(removed);
587Debug.Assert(node.Type is { });
608Debug.Assert((syntax != null) ^ (location != null));
658Debug.Assert(node.Type.ExtendedSpecialType == InternalSpecialType.System_Type ||
660Debug.Assert(node.GetTypeFromHandle is null);
663Debug.Assert(sourceType is { });
684Debug.Assert(getTypeFromHandle is not null);
685Debug.Assert(TypeSymbol.Equals(type, getTypeFromHandle.ReturnType, TypeCompareKind.AllIgnoreOptions));
691Debug.Assert(node.GetTypeFromHandle is null);
724Debug.Assert(statement is { });
850Debug.Assert(node.Expression.Type is { TypeKind: TypeKind.Array });
880Debug.Assert(parent.Parent is { });
929Debug.Assert(assignment.Left.Kind == BoundKind.FieldAccess);
1071Debug.Assert(eventAccess.ReceiverOpt is { });
1072Debug.Assert(eventAccess.ReceiverOpt.Type is { });
1082Debug.Assert(fieldAccess.ReceiverOpt is { });
1083Debug.Assert(fieldAccess.ReceiverOpt.Type is { });
1155Debug.Assert(!member.IsStatic);
1157Debug.Assert(extensionParameter is not null);
1168Debug.Assert(Conversions.IsValidExtensionMethodThisArgConversion(this._compilation.Conversions.ClassifyConversionFromType(receiver.Type, extensionParameter.Type, isChecked: false, ref discardedUseSiteInfo)));
Lowering\SyntheticBoundNodeFactory.cs (79)
121Debug.Assert(node != null);
122Debug.Assert(compilationState != null);
123Debug.Assert(diagnostics != null);
139Debug.Assert(TopLevelMethod is null || TypeSymbol.Equals(TopLevelMethod.ContainingType, CurrentType, TypeCompareKind.ConsiderEverything2));
145Debug.Assert(CurrentFunction is null ||
155Debug.Assert(ModuleBuilderOpt is { });
177Debug.Assert(CurrentType is { });
185Debug.Assert(CurrentType is { });
193Debug.Assert(CurrentType is { });
201Debug.Assert(CurrentType is { });
209Debug.Assert(CurrentType is { });
218Debug.Assert(ModuleBuilderOpt is { });
229Debug.Assert(CurrentFunction is { IsStatic: false, ThisParameter: { } });
240Debug.Assert(CurrentFunction is { IsStatic: false });
272Debug.Assert(receiverOpt is null || receiverOpt.Type is { } &&
280Debug.Assert((receiverOpt is null) == property.IsStatic);
284Debug.Assert(!(receiverOpt is { Type: ArrayTypeSymbol { IsSZArray: true } } &&
289Debug.Assert(accessor is not null);
295Debug.Assert((receiverOpt is null) == property.IsStatic);
297Debug.Assert(accessor is not null);
366Debug.Assert(result is not null);
407Debug.Assert(result is not null);
444Debug.Assert(left.Type is { } && right.Type is { } &&
563Debug.Assert(CurrentFunction is { });
575Debug.Assert(useSiteInfo.Diagnostics.IsNullOrEmpty());
576Debug.Assert(conversion.Kind != ConversionKind.NoConversion);
580Debug.Assert(CurrentFunction.RefKind == RefKind.None);
590Debug.Assert(CurrentFunction is { });
669Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean);
670Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean);
676Debug.Assert(left.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean);
677Debug.Assert(right.Type?.SpecialType == CodeAnalysis.SpecialType.System_Boolean);
706Debug.Assert(c.IsImplicit);
707Debug.Assert(c.IsBoxing || c.IsReference || c.IsIdentity);
836Debug.Assert(methodSymbol.IsStatic);
844Debug.Assert(methodSymbol.IsStatic);
845Debug.Assert(methodSymbol.IsGenericMethod);
846Debug.Assert(methodSymbol.Arity == typeArgs.Length);
854Debug.Assert(methodSymbol.IsStatic);
883Debug.Assert(method.ParameterCount == args.Length);
925Debug.Assert(method.ParameterCount == args.Length);
940Debug.Assert(valueTypeReceiver.Type is { });
941Debug.Assert(TypeSymbol.Equals(valueTypeReceiver.Type, referenceTypeReceiver.Type, TypeCompareKind.ConsiderEverything2));
947Debug.Assert(left.Type!.Equals(right.Type, TypeCompareKind.IgnoreCustomModifiersAndArraySizesAndLowerBounds | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes) || left.Type.IsErrorType());
948Debug.Assert(left.Type.IsReferenceType);
976Debug.Assert(thenClause != null);
1058Debug.Assert(result.Type is { });
1065Debug.Assert(result.Type is { });
1074Debug.Assert(result.Type is { });
1104Debug.Assert(ex.Type is { SpecialType: CodeAnalysis.SpecialType.System_Int32 });
1131Debug.Assert(statements[0] is null);
1148Debug.Assert(!labels.Contains(v2));
1177Debug.Assert(stringConst.IsString || stringConst.IsNull);
1188Debug.Assert(charConst.IsChar || charConst.IsDefaultValue);
1199Debug.Assert(array.Type is { TypeKind: TypeKind.Array });
1205Debug.Assert(array.Type is { TypeKind: TypeKind.Array });
1218Debug.Assert(array.Type is { TypeKind: TypeKind.Array });
1225Debug.Assert(CurrentFunction is { ThisParameter: { } });
1270Debug.Assert(type.CanBeAssignedNull());
1289Debug.Assert(systemType.ExtendedSpecialType == InternalSpecialType.System_Type ||
1303Debug.Assert(TypeSymbol.Equals(systemType, getTypeFromHandle.ReturnType, TypeCompareKind.AllIgnoreOptions));
1325Debug.Assert(this.CompilationState is { DynamicOperationContextType: { } });
1347Debug.Assert(result.Type.IsErrorType() || result.Type!.IsDerivedFrom(result.GetMethodFromHandle!.ReturnType, TypeCompareKind.AllIgnoreOptions, ref discardedUseSiteInfo));
1454Debug.Assert(result.Type.IsErrorType() || result.Type!.IsDerivedFrom(result.GetMethodFromHandle!.ReturnType, TypeCompareKind.AllIgnoreOptions, ref discardedUseSiteInfo));
1471Debug.Assert(systemReflectionMethodOrConstructorInfo.ExtendedSpecialType == InternalSpecialType.System_Reflection_MethodInfo ||
1534Debug.Assert(arg.Type is { });
1641Debug.Assert(expression is { Type: { SpecialType: CodeAnalysis.SpecialType.System_Boolean } });
1662Debug.Assert(argument.Type is { });
1664Debug.Assert(containingMethod is { });
1665Debug.Assert(kind != SynthesizedLocalKind.UserDefined);
1682Debug.Assert(argument.GetRefKind() != RefKind.In);
1739Debug.Assert(node.Type is { });
1762Debug.Assert((operatorKind == BinaryOperatorKind.Equal) || (operatorKind == BinaryOperatorKind.NotEqual) ||
1768Debug.Assert(
1838Debug.Assert(loweredLeft != null);
1839Debug.Assert(loweredRight != null);
1840Debug.Assert((object)returnType != null);
1841Debug.Assert(returnType.SpecialType == CodeAnalysis.SpecialType.System_Boolean);
1842Debug.Assert(loweredLeft.IsLiteralNull() != loweredRight.IsLiteralNull());
Parser\Lexer.cs (52)
120Debug.Assert(options != null);
329Debug.Assert(info.Kind != SyntaxKind.IdentifierToken || info.StringValue != null);
411Debug.Assert(SyntaxFacts.IsPunctuationOrKeyword(info.Kind));
614Debug.Assert(TextWindow.PeekChar() == '@');
738Debug.Assert(TextWindow.PeekChar() == '@');
764Debug.Assert(TextWindow.PeekChar() == '$');
1037Debug.Assert(info.Text != null);
1135Debug.Assert(hasUSuffix && hasLSuffix);
1600Debug.Assert(string.Equals(info.Text.Substring(0, objectAddressOffset + 1), "@0x", StringComparison.OrdinalIgnoreCase));
1636Debug.Assert(InXmlCrefOrNameAttributeValue);
1695Debug.Assert(consumedSurrogate == SlidingTextWindow.InvalidCharacter, "Since consumedChar == '\\'");
2070Debug.Assert(firstCh is '<' or '|' or '=' or '>');
2210Debug.Assert(delimiter is '/' or '@');
2211Debug.Assert(TextWindow.PeekChar() == delimiter && TextWindow.PeekChar(1) == '*');
2277Debug.Assert(SyntaxFacts.IsWhitespace(TextWindow.PeekChar()));
2312Debug.Assert(this.CurrentLexemeWidth > 0);
2712Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null);
2807Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) || TextWindow.PeekChar() == SlidingTextWindow.InvalidCharacter);
2843Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start));
2844Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior));
2888Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null);
2902Debug.Assert(TextWindow.PeekChar() == '<');
2951Debug.Assert(TextWindow.PeekChar() == '&');
3210Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start));
3211Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior));
3278Debug.Assert(false, "Should have picked up leading indentationTrivia, but didn't.");
3294Debug.Assert(false, "Should have picked up leading indentationTrivia, but didn't.");
3306Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null);
3383Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start));
3384Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior));
3450Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null);
3541Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start));
3542Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior));
3601Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start));
3602Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior));
3686Debug.Assert(TextWindow.Position > beforeConsumed, "First character or entity has been consumed.");
3797Debug.Assert(info.Text == null, "Haven't tried to set it yet.");
3798Debug.Assert(info.StringValue == null, "Haven't tried to set it yet.");
3886Debug.Assert(info.Kind != SyntaxKind.None || info.Text != null);
4007Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start));
4008Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior));
4129Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start));
4130Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior));
4260Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Start));
4261Debug.Assert(!this.LocationIs(XmlDocCommentLocation.Exterior));
4472Debug.Assert(this.StyleIs(XmlDocCommentStyle.Delimited));
4601Debug.Assert(info == null, "Never produce a diagnostic while peeking.");
4609Debug.Assert(ch != SlidingTextWindow.InvalidCharacter, "Precondition established by all callers; required for correctness of AdvanceChar() call.");
4637Debug.Assert(character == '\\');
4687Debug.Assert(character == 'u' || character == 'x');
4741Debug.Assert(TextWindow.PeekChar() == '&');
4855Debug.Assert(codepoint > 0x0000FFFF && codepoint <= 0x0010FFFF);
Symbols\Metadata\PE\PEMethodSymbol.cs (34)
129Debug.Assert((long)value == ((long)value & MethodKindMask));
165Debug.Assert(EnumUtilities.ContainsAllValues<MethodKind>((int)MethodKindMask));
166Debug.Assert(EnumUtilities.ContainsAllValues<NullableContextKind>((int)NullableContextMask));
178Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet));
185Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet));
191Debug.Assert((long)methodKind == ((long)methodKind & MethodKindMask));
193Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet));
203Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet));
258Debug.Assert(BitsAreUnsetOrSame(_bits, bitsToSet));
422Debug.Assert((object)moduleSymbol != null);
423Debug.Assert((object)containingType != null);
424Debug.Assert(!methodDef.IsNil);
436Debug.Assert((uint)implFlags <= ushort.MaxValue);
449Debug.Assert((uint)localflags <= ushort.MaxValue);
475Debug.Assert(flag != 0 && ((ushort)flag & ((ushort)flag - 1)) == 0);
633Debug.Assert(_packedFlags.IsExplicitOverrideIsPopulated);
646Debug.Assert(_packedFlags.IsExplicitOverrideIsPopulated);
711Debug.Fail("Not expecting to get here; if we end up here through ENC, add tests to verify");
742Debug.Assert(!memberNotNull.IsDefault);
750Debug.Assert(!memberNotNullWhenTrue.IsDefault);
756Debug.Assert(!memberNotNullWhenFalse.IsDefault);
817Debug.Assert((methodKind == MethodKind.PropertyGet) || (methodKind == MethodKind.PropertySet));
827Debug.Assert((methodKind == MethodKind.EventAdd) || (methodKind == MethodKind.EventRemove));
835Debug.Assert(TypeSymbol.Equals(propertyOrEventSymbol.ContainingType, _containingType, TypeCompareKind.ConsiderEverything2));
843Debug.Assert(
1032Debug.Assert(!attributeData.IsDefault);
1558Debug.Assert(!ReferenceEquals(data, UnmanagedCallersOnlyAttributeData.Uninitialized));
1559Debug.Assert(!ReferenceEquals(data, UnmanagedCallersOnlyAttributeData.AttributePresentDataNotBound));
1653Debug.Assert(!result.IsDefault);
1681Debug.Assert(MethodKind == MethodKind.Constructor);
1737Debug.Assert(!ReferenceEquals(unmanagedCallersOnlyData, UnmanagedCallersOnlyAttributeData.Uninitialized)
1763Debug.Assert(result != null);
1830Debug.Assert(AssociatedSymbol?.GetCallerUnsafeMode(ConsList<FieldSymbol>.Empty) != CallerUnsafeMode.Implicit);
1870Debug.Assert(_uncommonFields is null or { _lazyOverloadResolutionPriority: 0 });
Symbols\Retargeting\RetargetingSymbolTranslator.cs (39)
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());
578Debug.Assert(newParameters.Count == newArguments.Count);
741Debug.Assert(newModifiers == null || newModifiers.Count == oldModifiers.Length);
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\Source\SourceAssemblySymbol.cs (57)
122Debug.Assert(compilation != null);
123Debug.Assert(assemblySimpleName != null);
124Debug.Assert(!String.IsNullOrWhiteSpace(moduleName));
125Debug.Assert(!netModules.IsDefault);
497Debug.Assert(!DeclaringCompilation.Options.Errors.IsEmpty);
652Debug.Assert((object)compilationRelaxationsAttribute != null, "GetWellKnownType unexpectedly returned null");
661Debug.Assert((object)runtimeCompatibilityAttribute != null, "GetWellKnownType unexpectedly returned null");
694Debug.Assert((object)unverifiableCodeAttribute != null, "GetWellKnownType unexpectedly returned null");
706Debug.Assert((object)securityPermissionAttribute != null, "GetWellKnownType unexpectedly returned null");
713Debug.Assert((object)securityAction != null, "GetWellKnownType unexpectedly returned null");
925Debug.Assert(thisThreadCompleted);
938Debug.Assert(locationOpt != null || filter != null, "If no location or filter was specified, then the module members should be completed");
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);
1832Debug.Assert(!boolType.HasUseSiteError,
1972Debug.Assert(!int32Type.HasUseSiteError,
1992Debug.Assert(!boolType.HasUseSiteError, "Use site errors should have been checked ahead of time (type bool).");
2026Debug.Assert(!stringType.HasUseSiteError, "Use site errors should have been checked ahead of time (type string).");
2036Debug.Assert(!stringType.HasUseSiteError, "Use site errors should have been checked ahead of time (type string).");
2110Debug.Assert(conclusion != IVTConclusion.NoRelationshipClaimed);
2207Debug.Assert(!arguments.Attribute.HasErrors);
2226Debug.Assert(forwardedType.TypeKind != TypeKind.Error);
2278Debug.Assert(!attrData.HasErrors);
2368Debug.Assert(!attribute.HasErrors);
2369Debug.Assert(arguments.SymbolPart == AttributeLocation.None);
2617Debug.Assert(!attribute.HasErrors);
2660Debug.Assert(
2664Debug.Assert(
2672Debug.Assert(_unusedFieldWarnings.IsDefault, "We shouldn't have computed the diagnostics if we're still noting definitions.");
2693Debug.Assert(this.HasComplete(CompletionPart.Module),
2715Debug.Assert(success, "Once CompletionPart.Module is set, no-one should be modifying the map.");
2798Debug.Assert(!_unusedFieldWarnings.IsDefault);
2844Debug.Assert(forcedArity == emittedName.InferredArity);
2860Debug.Assert((object)originalDefinition.ContainingType == null, "How did a nested type get forwarded?");
Symbols\Source\SourceMemberContainerSymbol.cs (105)
113Debug.Assert(EnumUtilities.ContainsAllValues<SpecialType>(SpecialTypeMask));
114Debug.Assert(EnumUtilities.ContainsAllValues<InternalSpecialType>(SpecialTypeMask)); //This assert might false fail in the future, we don't really need to be able to represent NextAvailable
115Debug.Assert(EnumUtilities.ContainsAllValues<NullableContextKind>(NullableContextMask));
146Debug.Assert(BitsAreUnsetOrSame(_flags, bitsToSet));
235Debug.Assert(containingSymbol is NamespaceSymbol { IsGlobalNamespace: true } || !declaration.Declarations.Any(static d => d.IsSimpleProgram));
264Debug.Assert(typeKind is TypeKind.Struct or TypeKind.Class || !HasPrimaryConstructor);
664Debug.Assert(thisThreadCompleted);
719Debug.Assert(thisThreadCompleted);
730Debug.Assert((incompletePart & CompletionPart.NamedTypeSymbolAll) == 0);
870Debug.Assert(!useSiteDiagnostics.IsDefault);
879Debug.Assert(!useSiteDependencies.IsDefault);
1179Debug.Assert(!nonTypeMembers.IsDefault);
1180Debug.Assert(!staticInitializers.IsDefault);
1181Debug.Assert(staticInitializers.All(g => !g.IsDefault));
1182Debug.Assert(!instanceInitializers.IsDefault);
1183Debug.Assert(instanceInitializers.All(g => !g.IsDefault));
1185Debug.Assert(!nonTypeMembers.Any(static s => s is TypeSymbol));
1186Debug.Assert(haveIndexers == nonTypeMembers.Any(static s => s.IsIndexer()));
1253Debug.Assert(ctorInitializerLength >= 0);
1276Debug.Assert(distanceFromCtorBody > 0);
1484Debug.Assert(s_emptyTypeMembers.Count == 0);
1568Debug.Assert(symbol is not null);
1573Debug.Assert(attr is SourceAttributeData);
2060Debug.Assert(IsFileLocal);
2068Debug.Assert(fileIdentifier.FilePathChecksumOpt.IsDefault);
2397Debug.Assert(method1.ParameterCount == method2.ParameterCount);
2477Debug.Assert(checkCollisionWithTypeParameters || typeParameterNames == null);
2529Debug.Assert(!membersByName[indexerName.AsMemory()].Any(SymbolExtensions.IsIndexer));
2621Debug.Assert(cloneMembersByName);
2625Debug.Assert(masterExtension is not null);
2661Debug.Assert(!newMembers.IsEmpty);
2665Debug.Assert(newMembers.All(static (m, membersUnordered) => membersUnordered.Contains(m), membersUnordered));
2782Debug.Assert(value == _lazyKnownCircularStruct);
2793Debug.Assert(TypeKind == TypeKind.Struct);
2812Debug.Assert(field.AssociatedSymbol is not EventSymbol, "Didn't expect to find a field-like event backing field in the member list.");
3027Debug.Assert(!this.IsExtension);
3110Debug.Assert(IsSubmissionClass || IsScriptClass);
3136Debug.Assert(ReferenceEquals(this, this.OriginalDefinition));
3149Debug.Assert(f.AssociatedSymbol is not EventSymbol, "Didn't expect to find a field-like event backing field in the member list.");
3422Debug.Assert(!nonTypeMembersWithPartialImplementations.IsDefault);
3426Debug.Assert(!nonTypeMembersWithPartialImplementations.Any(static s => s is TypeSymbol));
3427Debug.Assert(declarationWithParameters is object || primaryConstructor is null);
3442Debug.Assert(!initializers.IsDefault);
3450Debug.Assert(!group.IsDefaultOrEmpty);
3457Debug.Assert(LexicalSortKey.Compare(new LexicalSortKey(initializers[i - 1].First().Syntax, compilation), new LexicalSortKey(initializers[i].Last().Syntax, compilation)) < 0);
3462Debug.Assert(LexicalSortKey.Compare(new LexicalSortKey(initializers[i].First().Syntax, compilation), new LexicalSortKey(initializers[i + 1].Last().Syntax, compilation)) < 0);
3467Debug.Assert(LexicalSortKey.Compare(new LexicalSortKey(initializers[i].First().Syntax, compilation), new LexicalSortKey(initializers[i].Last().Syntax, compilation)) < 0);
3492Debug.Assert(declaredMembersAndInitializers != DeclaredMembersAndInitializers.UninitializedSentinel);
3517Debug.Assert(InstanceInitializersForPositionalMembers.Count != 0);
3518Debug.Assert(declaredMembers.PrimaryConstructor is object);
3519Debug.Assert(declaredMembers.DeclarationWithParameters is object);
3520Debug.Assert(declaredMembers.DeclarationWithParameters.SyntaxTree == InstanceInitializersForPositionalMembers[0].Syntax.SyntaxTree);
3521Debug.Assert(declaredMembers.DeclarationWithParameters.Span.Contains(InstanceInitializersForPositionalMembers[0].Syntax.Span.Start));
3554Debug.Assert(insertedInitializers[insertedInitializers.Count - 1].Syntax.SyntaxTree == declaredInitializers[0].Syntax.SyntaxTree);
3555Debug.Assert(insertedInitializers[insertedInitializers.Count - 1].Syntax.Span.Start < declaredInitializers[0].Syntax.Span.Start);
3564Debug.Assert(groupsBuilder.Count == groupCount);
3568Debug.Assert(!declaredMembers.InstanceInitializers.Any(g => declaredMembers.DeclarationWithParameters.SyntaxTree == g[0].Syntax.SyntaxTree &&
3574Debug.Assert(groupsBuilder.Count == groupCount + 1);
3773Debug.Assert(partialMembersToMerge.Count != 0);
3814Debug.Assert(!_lazySimpleProgramEntryPoints.IsDefault);
3873Debug.Assert(result is object);
3896Debug.Assert(primaryConstructor is not null);
3897Debug.Assert(!this.IsDelegateType());
3928Debug.Assert(HasPrimaryConstructor);
3933Debug.Assert(declared.PrimaryConstructor is not null);
3939Debug.Assert(membersAndInitializers.PrimaryConstructor is not null);
3946Debug.Assert(HasPrimaryConstructor);
3970Debug.Assert(primaryConstructor is not null);
4175Debug.Assert(symbol.IsPartialMember());
4201Debug.Assert(pair.Key.Equals(WellKnownMemberNames.InstanceConstructorName.AsMemory()));
4212Debug.Assert(symbol.Kind != prev.Kind);
4213Debug.Assert(symbol is SourceOrdinaryMethodSymbol or SourcePropertySymbol or SourcePropertyAccessorSymbol or SourceEventAccessorSymbol);
4214Debug.Assert(prev is SourceOrdinaryMethodSymbol or SourcePropertySymbol or SourcePropertyAccessorSymbol or SourceEventAccessorSymbol);
4222Debug.Assert(symbol.IsPartialMember());
4301Debug.Assert(symbol.IsPartialMember());
4553Debug.Assert(!propertySymbol.IsExplicitInterfaceImplementation); // checked by caller
4604Debug.Assert(!eventSymbol.IsExplicitInterfaceImplementation); // checked by caller
4739Debug.Assert(node.SyntaxTree == initializers.Last().Syntax.SyntaxTree);
4740Debug.Assert(node.SpanStart > initializers.Last().Syntax.Span.Start);
4826Debug.Assert(property.IsIndexer);
4915Debug.Assert(TypeKind == TypeKind.Struct);
4919Debug.Assert(builder.DeclarationWithParameters is TypeDeclarationSyntax { ParameterList: not null } type
4964Debug.Assert(ctor is object);
4974Debug.Assert(declaredMembersAndInitializers.PrimaryConstructor?.GetBackingFields().Any() != true);
4983Debug.Assert(valueProperty.GetMethod is object);
4984Debug.Assert(valueProperty.SetMethod is null);
4987Debug.Assert(backingField is object);
5016Debug.Assert(typeSyntax != null);
5053Debug.Assert(memberOffset == members.Count - typesBuilder.Count);
5102Debug.Assert(declaredMembersAndInitializers.DeclarationWithParameters is object);
5106Debug.Assert(ctor is object);
5159Debug.Assert(isRecordClass || !members.Any(m => m is PropertySymbol { GetMethod.IsEffectivelyReadOnly: false }));
5170Debug.Assert(positionalMembers.All(p => p is PropertySymbol or FieldSymbol));
5218Debug.Assert(isRecordClass);
5266Debug.Assert(isRecordClass);
5473Debug.Assert(property.GetMethod is object);
5474Debug.Assert(property.SetMethod is object);
5478Debug.Assert(backingField is object);
5540Debug.Assert(isRecordClass);
5662Debug.Assert(isRecordClass);
5995Debug.Assert(@event.IsPartial || @event.AddMethod is not null);
5996Debug.Assert(@event.IsPartial || @event.RemoveMethod is not null);
6019Debug.Assert(@event.AssociatedField is null);
6124Debug.Assert(
6329Debug.Assert(this.declaration.ContainsExtensionDeclarations);
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (35)
33Debug.Assert((object)result == calculated);
37Debug.Assert(result.ExternAliases.SequenceEqual(calculated.ExternAliases));
38Debug.Assert(result.UsingAliases.SetEquals(calculated.UsingAliases));
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);
183Debug.Assert(result.SetEquals(GetAliasesAndUsingsForAsserts(declarationSyntax).GetUsingAliasesMap(this, declarationSyntax, basesBeingResolved)));
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);
583Debug.Assert(calculated.Diagnostics?.IsEmptyWithoutResolution ?? true);
598Debug.Assert(calculated.UsingAliases.SequenceEqual(result.UsingAliases));
599Debug.Assert((calculated.UsingAliasesMap ?? ImmutableDictionary<string, AliasAndUsingDirective>.Empty).SetEquals(result.UsingAliasesMap ?? ImmutableDictionary<string, AliasAndUsingDirective>.Empty));
600Debug.Assert(calculated.UsingNamespacesOrTypes.SequenceEqual(result.UsingNamespacesOrTypes));
601Debug.Assert(calculated.Diagnostics?.IsEmptyWithoutResolution ?? true);
763Debug.Assert(directiveDiagnostics.DiagnosticBag is object);
764Debug.Assert(directiveDiagnostics.DependenciesBag is object);
784Debug.Assert(directiveDiagnostics.DependenciesBag.IsEmpty());
959Debug.Assert(_state.HasComplete(CompletionPart.StartValidatingImports));
983Debug.Assert(diagnostics.DiagnosticBag is object);
984Debug.Assert(diagnostics.DependenciesBag is object);
994Debug.Assert(declaringSymbol.IsGlobalNamespace);
1008Debug.Assert(alias.UsingDirective != null);
1027Debug.Assert(declaringSymbol.IsGlobalNamespace);
1063Debug.Assert(target.IsGlobalNamespace);
1202Debug.Assert(_state.HasComplete(CompletionPart.StartValidatingImports));
Utilities\ValueSetFactory.NumericValueSet.cs (10)
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));
214Debug.Assert(builder.Count == 0 || tc.Related(LessThanOrEqual, builder.Last().first, first));
242Debug.Assert(this._tc.GetType() == other._tc.GetType());
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (77)
670Debug.Assert(newActiveStatements.All(a => a != null));
960Debug.Assert(!newActiveStatementSpans.IsDefault);
961Debug.Assert(oldActiveStatements.Length == newActiveStatements.Count);
962Debug.Assert(oldActiveStatements.Length == newExceptionRegions.Count);
1126Debug.Assert(!newActiveStatementSpans.IsDefault);
1127Debug.Assert(newActiveStatementSpans.IsEmpty || oldActiveStatements.Length == newActiveStatementSpans.Length);
1128Debug.Assert(oldActiveStatements.IsEmpty || oldActiveStatements.Length == newActiveStatements.Count);
1129Debug.Assert(newActiveStatements.Count == newExceptionRegions.Count);
1130Debug.Assert(oldMemberBody != null || newMemberBody != null);
1172Debug.Assert(oldDeclaration != null);
1178Debug.Assert(IsDeclarationWithSharedBody(oldDeclaration, oldMember));
1192Debug.Assert(oldMemberBody != null);
1319Debug.Assert(oldMemberBody != null);
1320Debug.Assert(oldDeclaration != null);
1342Debug.Assert(lazyActiveOrMatchedLambdas != null);
1358Debug.Assert(!enclosingBodyMap.Forward.IsEmpty());
1402Debug.Assert(oldEnclosingLambdaBody != null);
1403Debug.Assert(lazyActiveOrMatchedLambdas != null);
1448Debug.Assert(newSpan != default);
1458Debug.Assert(IsDeclarationWithSharedBody(oldDeclaration, oldMember));
1569Debug.Assert(oldAncestors.Count == newAncestors.Count);
1760Debug.Assert(node != null);
1878Debug.Assert(hasAncestor && newAncestor != null);
1892Debug.Assert(hasAncestor && newAncestor != null);
2247Debug.Assert(editMap[newNode] is EditKind.Update or EditKind.Insert);
2309Debug.Assert(currentSegment.path != null);
2310Debug.Assert(lastOldStartLine >= 0);
2487Debug.Assert(previousOldEndLine >= 0);
2716Debug.Assert(inBreakState || newActiveStatementSpans.IsEmpty);
2742Debug.Assert(edit.OldNode is null || edit.NewNode is null || IsNamespaceDeclaration(edit.OldNode) == IsNamespaceDeclaration(edit.NewNode));
2754Debug.Assert(oldSymbol is INamedTypeSymbol);
2755Debug.Assert(newSymbol is INamedTypeSymbol);
2772Debug.Assert(newTypeDeclaration != null);
2971Debug.Assert(oldSymbol is INamedTypeSymbol);
3261Debug.Assert(newDeclaration != null);
3262Debug.Assert(oldProperty.ContainingType.IsRecord);
3263Debug.Assert(newProperty.ContainingType.IsRecord);
3267Debug.Assert(synthesizedProperty.IsSynthesizedAutoProperty());
3268Debug.Assert(synthesizedProperty.SetMethod != null);
3340Debug.Assert(newSymbol != null);
3564Debug.Assert(IsConstructorWithMemberInitializers(oldSymbol, cancellationToken) == IsConstructorWithMemberInitializers(newSymbol, cancellationToken));
3565Debug.Assert(IsDeclarationWithInitializer(oldDeclaration) == IsDeclarationWithInitializer(newDeclaration));
3735Debug.Assert(oldSymbol != null);
3736Debug.Assert(newSymbol != null);
3759Debug.Assert(member is IPropertySymbol or IMethodSymbol);
4272Debug.Assert(oldBody == null || oldDeclaration != null && oldMemberBody != null);
4273Debug.Assert(newBody == null || newDeclaration != null && newMemberBody != null);
4458Debug.Assert(ReturnTypesEquivalent(oldField, newField, exact: false));
4480Debug.Assert(oldImportData.BestFitMapping == newImportData.BestFitMapping ||
4535Debug.Assert(ReturnTypesEquivalent(oldMethod, newMethod, exact: false));
4559Debug.Assert(ReturnTypesEquivalent(oldType.DelegateInvokeMethod, newType.DelegateInvokeMethod, exact: false));
4569Debug.Assert(ReturnTypesEquivalent(oldProperty, newProperty, exact: false));
4583Debug.Assert(ReturnTypesEquivalent(oldEvent, newEvent, exact: false));
4700Debug.Assert(ParameterTypesEquivalent(oldMember.GetParameters(), newMember.GetParameters(), exact: true));
5099Debug.Assert(recordType.IsRecord);
5113Debug.Assert(record.IsRecord);
5200Debug.Assert(oldSymbol != null);
5347Debug.Assert(newSymbol != null);
5532Debug.Assert(oldBody != null);
5533Debug.Assert(newBody != null);
5667Debug.Assert(oldCtor == null || MemberOrDelegateSignaturesEquivalent(oldCtor, newCtor, exact: false));
5674Debug.Assert(newCtor.Parameters.IsEmpty);
5872Debug.Assert(IsNestedFunction(newLambda) == IsNestedFunction(oldLambda));
6446Debug.Assert(!parameter.IsThis);
6490Debug.Assert(parameterKey.Syntax != null);
6611Debug.Assert(oldCapture.Kind == newCapture.Kind);
6685Debug.Assert(IsNestedFunction(newLambda));
6686Debug.Assert(IsNestedFunction(oldLambda));
6746Debug.Assert(local.Kind is not SymbolKind.RangeVariable);
6758Debug.Assert(node != null);
6830Debug.Assert(rootNodes.Count == otherRootNodes.Count);
6846Debug.Assert(otherNode.SyntaxTree == otherRoot.SyntaxTree);
6847Debug.Assert(otherRoot.FullSpan.Contains(otherNode.SpanStart));
6850Debug.Assert(otherNode.FullSpan.Length > 0);
6859Debug.Assert(otherNode.RawKind == rightNode.RawKind);
6863Debug.Assert(!leftChild.IsToken);
6908Debug.Assert(!self.FullSpan.Contains(position), "Position is valid. How could we not find a child?");
Microsoft.CodeQuality.Analyzers\ApiDesignGuidelines\EnumShouldNotHaveDuplicatedValues.cs (1)
83Debug.Assert(added);
src\9382845807600969\AnalysisEntityMapAbstractDomain.cs (16)
98Debug.Assert(!map2.ContainsKey(key1));
99Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0);
163Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0);
164Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0);
184Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0);
185Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0);
193Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0);
205Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0);
212Debug.Assert(!map1.ContainsKey(newKey));
213Debug.Assert(!map2.ContainsKey(newKey));
225Debug.Assert(Compare(map1, resultMap) <= 0);
226Debug.Assert(Compare(map2, resultMap) <= 0);
246Debug.Assert(values.Count > 0);
258Debug.Assert(ValueDomain.Compare(value1, mergedValue) <= 0);
259Debug.Assert(ValueDomain.Compare(value2, mergedValue) <= 0);
266Debug.Assert(isNewKey == (!map1.ContainsKey(key) && !map2.ContainsKey(key)));
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\WellKnownTypeProvider.cs (1)
94Debug.Assert(result
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowOperationVisitor.cs (103)
174Debug.Assert(!_currentAnalysisData.IsDisposed);
179Debug.Assert(!value.IsDisposed);
188Debug.Assert(_currentBasicBlock != null);
231Debug.Assert(ExceptionNamedType != null);
427Debug.Assert(_pendingArgumentsToReset.Count == 0);
428Debug.Assert(_pendingArgumentsToPostProcess.Count == 0);
548Debug.Assert(entryBlock.Kind == BasicBlockKind.Entry);
561Debug.Assert(result);
581Debug.Assert(exitBlock.Kind == BasicBlockKind.Exit);
631Debug.Assert(localFunction.MethodKind == MethodKind.LocalFunction);
632Debug.Assert(DataFlowAnalysisContext.ControlFlowGraph.LocalFunctions.Contains(localFunction));
640Debug.Assert(_visitedLambdas.Contains(lambda));
648Debug.Assert(exitBlock.Kind == BasicBlockKind.Exit);
742Debug.Assert(branch.ControlFlowConditionKind != ControlFlowConditionKind.None);
785Debug.Assert(branch.ControlFlowConditionKind != ControlFlowConditionKind.None);
820Debug.Assert(implicitTaskPointsToValueOpt.Kind == PointsToAbstractValueKind.KnownLocations);
849Debug.Assert(ExecutingExceptionPathsAnalysisPostPass);
850Debug.Assert(!SkipExceptionPathsAnalysisPostPass);
929Debug.Assert(ExecutingExceptionPathsAnalysisPostPass);
930Debug.Assert(!SkipExceptionPathsAnalysisPostPass);
959Debug.Assert(locals.Any() || flowCaptures.Any());
1001/// Checks if the method is an overload of the <see cref="Debug.Assert(bool)"/> method.
1004/// <returns>True if the method is an overlaod of the <see cref="Debug.Assert(bool)"/> method.</returns>
1138Debug.Assert(parameterEntity.Symbol?.Kind == SymbolKind.Parameter);
1151Debug.Assert(CurrentBasicBlock.Kind == BasicBlockKind.Entry);
1299Debug.Fail($"Unexpected 'null' target type for '{operation.Syntax}'");
1355Debug.Assert(PredicateAnalysis);
1361Debug.Assert(PredicateAnalysis);
1385Debug.Assert(PredicateAnalysis);
1386Debug.Assert(operation.Kind is OperationKind.BinaryOperator or
1421Debug.Assert(Equals(savedCurrentAnalysisData, CurrentAnalysisData), "Expected no updates to CurrentAnalysisData");
1433Debug.Assert(result);
1436Debug.Assert(HasPredicatedDataForEntity(flowCaptureReferenceEntity));
1450Debug.Assert(!ReferenceEquals(truePredicatedData, CurrentAnalysisData));
1455Debug.Assert(!ReferenceEquals(falsePredicatedData, CurrentAnalysisData));
1459Debug.Assert(Equals(savedCurrentAnalysisData, CurrentAnalysisData), "Expected no updates to CurrentAnalysisData");
1488Debug.Assert(IsContractCheckArgument((IArgumentOperation)operation));
1526Debug.Assert(targetEntity.CaptureId != null);
1543Debug.Assert(PredicateAnalysis);
1544Debug.Assert(FlowBranchConditionKind != ControlFlowConditionKind.None);
1638Debug.Fail($"Unknown pattern kind '{isPatternOperation.Pattern.Kind}'");
1667Debug.Assert(IsContractCheckArgument(argument));
1681Debug.Assert(result);
1824Debug.Assert(PredicateAnalysis);
1849Debug.Assert(PredicateAnalysis);
1850Debug.Assert(operation.IsComparisonOperator());
1851Debug.Assert(FlowBranchConditionKind != ControlFlowConditionKind.None);
1893Debug.Assert(PredicateAnalysis);
1899Debug.Assert(PredicateAnalysis);
1905Debug.Assert(PredicateAnalysis);
1911Debug.Assert(PredicateAnalysis);
1920Debug.Assert(PredicateAnalysis);
1926Debug.Assert(PredicateAnalysis);
1932Debug.Assert(PredicateAnalysis);
1948Debug.Assert(IsLValueFlowCaptureReference(flowCaptureReference));
2023Debug.Assert(HasPointsToAnalysisResult);
2024Debug.Assert(operation.Type!.HasValueCopySemantics());
2042Debug.Assert(HasPointsToAnalysisResult);
2043Debug.Assert(!operation.Type!.HasValueCopySemantics());
2265Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph);
2266Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph);
2267Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph);
2330Debug.Assert(arguments.All(arg => !_pendingArgumentsToReset.Contains(arg)));
2345Debug.Assert(popped == originalOperation);
2392Debug.Assert(arguments.All(_pendingArgumentsToReset.Contains));
2482Debug.Assert(originalOperation.Kind == OperationKind.ObjectCreation);
2513Debug.Assert(arguments.Length == invokedMethod.Parameters.Length);
2555Debug.Assert(invokedMethod.Parameters.Length == method.GetParameters().Length ||
2621Debug.Assert(success);
2632Debug.Assert(IsStandaloneAnalysisRequiredForLocalFunction(localFunction));
2650Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph);
2651Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph);
2652Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph);
2682Debug.Assert(IsStandaloneAnalysisRequiredForLambda(lambda));
2700Debug.Assert(pointsToAnalysisResult?.ControlFlowGraph == null || cfg == pointsToAnalysisResult?.ControlFlowGraph);
2701Debug.Assert(copyAnalysisResult?.ControlFlowGraph == null || cfg == copyAnalysisResult?.ControlFlowGraph);
2702Debug.Assert(valueContentAnalysisResult?.ControlFlowGraph == null || cfg == valueContentAnalysisResult?.ControlFlowGraph);
2997Debug.Assert(result);
3006Debug.Assert(HasPredicatedDataForEntity(flowCaptureReferenceEntity));
3032Debug.Assert(flowCaptureEntity.CaptureId != null);
3076Debug.Assert(FlowBranchConditionKind == ControlFlowConditionKind.None);
3155Debug.Assert(operation.Initializer == null, "Object or collection initializer must have been lowered in the CFG");
3238Debug.Assert(!arguments.IsEmpty);
3257Debug.Assert(arguments.Length >= 2);
3281Debug.Assert(IsPointsToAnalysis);
3325Debug.Assert(operation != null ^ invocationTarget != null);
3336Debug.Assert(invocation.Instance == null);
3344Debug.Assert(targetMethod.MethodKind is MethodKind.LambdaMethod or
3378Debug.Assert(knownTargetInvocations);
3385Debug.Assert(knownTargetInvocations);
3392Debug.Assert(knownTargetInvocations);
3414Debug.Assert(knownTargetInvocations);
3459Debug.Assert(methodTargetsOptBuilder.Count > 0 || lambdaTargets.Count > 0);
3477Debug.Assert(!ReferenceEquals(oldMergedAnalysisData, CurrentAnalysisData));
3489Debug.Assert(!ReferenceEquals(oldMergedAnalysisData, CurrentAnalysisData));
3493Debug.Assert(mergedCurrentAnalysisData == null || ReferenceEquals(mergedCurrentAnalysisData, CurrentAnalysisData));
3584Debug.Assert(_interproceduralResultsBuilder.ContainsKey(originalOperation));
3602Debug.Assert(_interproceduralResultsBuilder.ContainsKey(originalOperation));
3679Debug.Assert(elementEntities.Length == elementValueBuilder.Count);
3680Debug.Assert(elementEntities.Length == operation.Elements.Length);
3758Debug.Assert(caughtExceptionType != null || CurrentBasicBlock.IsFirstBlockOfFinally(out _));
3791Debug.Assert(CurrentBasicBlock.IsFirstBlockOfFinally(out _));
3825Debug.Assert(operation.Kind == OperationKind.YieldReturn, "IReturnOperation must have been lowered in the CFG");
Language\DocumentationDescriptor.FormattedDescriptor.cs (1)
24Debug.Assert(
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedDictionary`2.cs (21)
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.
301Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
302Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
408Debug.Assert(_entries.Length > 0, "expected entries to be non-empty");
447Debug.Assert(comparer is not null);
518Debug.Assert(_buckets.Length > 0);
521Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
524Debug.Assert(comparer is not null || (SupportsComparerDevirtualization && typeof(TKey).IsValueType));
574Debug.Assert(comparer is not null);
616Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
648Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
649Debug.Assert(newSize >= _entries.Length);
707Debug.Assert(_entries.Length > 0, "entries should be non-empty");
711Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
734Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
784Debug.Assert(_entries.Length > 0, "entries should be non-empty");
788Debug.Assert((SupportsComparerDevirtualization && typeof(TKey).IsValueType) || comparer is not null);
813Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
src\roslyn\src\Dependencies\Collections\Segmented\SegmentedHashSet`1.cs (16)
189Debug.Assert(Count == source.Count);
204Debug.Assert(_buckets.Length > 0, "_buckets should be non-empty");
205Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
227Debug.Assert(entries.Length > 0, "Expected _entries to be initialized");
258Debug.Assert(comparer is not null);
296Debug.Assert(entries.Length > 0, "entries should be non-empty");
302Debug.Assert((SupportsComparerDevirtualization && typeof(T).IsValueType) || comparer is not null);
326Debug.Assert((StartOfFreeList - _freeList) < 0, "shouldn't underflow because max hashtable length is MaxPrimeArrayLength = 0x7FEFFFFD(2146435069) _freelist underflow threshold 2147483646");
901Debug.Assert(_entries.Length > 0, "_entries should be non-empty");
902Debug.Assert(newSize >= _entries.Length);
1023Debug.Assert(_buckets.Length > 0);
1026Debug.Assert(entries.Length > 0, "expected entries to be non-empty");
1063Debug.Assert(comparer is not null);
1091Debug.Assert((StartOfFreeList - entries[_freeList]._next) >= -1, "shouldn't overflow because `next` cannot underflow");
1172Debug.Assert(_buckets.Length > 0, "_buckets shouldn't be empty; callers should check first");
1329Debug.Assert((_buckets.Length > 0) && (_count > 0), "_buckets was empty but count greater than 0");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (1)
56Debug.Assert(
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
266Debug.Assert(