383 references to Contract
Microsoft.CodeAnalysis.CodeStyle (198)
AbstractAggregatedFormattingResult.cs (2)
32Contract.ThrowIfNull(node); 33Contract.ThrowIfNull(formattingResults);
AbstractDocumentationCommentService.cs (1)
52Contract.ThrowIfNull(documentationComment);
AbstractForEachCastDiagnosticAnalyzer.cs (1)
67Contract.ThrowIfFalse(option.Value is ForEachExplicitCastInSourcePreference.Always or ForEachExplicitCastInSourcePreference.WhenStronglyTyped);
AbstractFormatEngine.cs (1)
64Contract.ThrowIfTrue(treeData.Root.IsInvalidTokenRange(startToken, endToken));
AbstractFormatEngine.OperationApplier.cs (6)
61Contract.ThrowIfFalse(triviaInfo.LineBreaks == 0); 94Contract.ThrowIfFalse(triviaInfo.LineBreaks == 0); 132Contract.ThrowIfFalse(triviaInfo.LineBreaks == 0); 271Contract.ThrowIfNull(previousChangesMap); 460Contract.ThrowIfFalse(triviaInfo.SecondTokenIsFirstTokenOnLine); 487Contract.ThrowIfFalse(baseToken.RawKind != 0 && startToken.RawKind != 0 && endToken.RawKind != 0);
AbstractQualifyMemberAccessDiagnosticAnalyzer.cs (1)
36Contract.ThrowIfNull(options);
AbstractSimplifyInterpolationHelpers.cs (3)
79Contract.ThrowIfNull(expression.SemanticModel); 139Contract.ThrowIfNull(operation.SemanticModel); 158Contract.ThrowIfNull(operation.SemanticModel);
AbstractTriviaDataFactory.AbstractComplexTrivia.cs (3)
27Contract.ThrowIfNull(treeInfo); 80Contract.ThrowIfFalse(line > 0); 137Contract.ThrowIfFalse(list.Count > 0);
AbstractTriviaDataFactory.cs (6)
25Contract.ThrowIfNull(treeInfo); 39Contract.ThrowIfFalse(space >= 0); 58Contract.ThrowIfFalse(lineBreaks >= 0); 59Contract.ThrowIfFalse(indentation >= 0); 91Contract.ThrowIfFalse(lineIndex is >= 0 and < LineBreakCacheSize); 92Contract.ThrowIfFalse(indentationLevel >= 0 && indentationLevel < _whitespaces.Length / _whitespaces.Rank);
AbstractTriviaDataFactory.ModifiedWhitespace.cs (1)
27Contract.ThrowIfNull(original);
AbstractTriviaDataFactory.Whitespace.cs (2)
27Contract.ThrowIfFalse(space >= 0); 59Contract.ThrowIfFalse(line > 0);
AbstractTriviaFormatter.cs (6)
72Contract.ThrowIfNull(context); 73Contract.ThrowIfNull(formattingRules); 74Contract.ThrowIfNull(originalString); 76Contract.ThrowIfFalse(lineBreaks >= 0); 77Contract.ThrowIfFalse(spaces >= 0); 79Contract.ThrowIfTrue(token1 == default && token2 == default);
AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
80Contract.ThrowIfNull(semanticModel);
AdjustNewLinesOperation.cs (3)
16Contract.ThrowIfFalse(option != AdjustNewLinesOption.ForceLines || line > 0); 17Contract.ThrowIfFalse(option != AdjustNewLinesOption.PreserveLines || line >= 0); 18Contract.ThrowIfFalse(option != AdjustNewLinesOption.ForceLinesIfOnSingleLine || line > 0);
AdjustSpacesOperation.cs (1)
16Contract.ThrowIfFalse(space >= 0);
AlignTokensOperation.cs (1)
18Contract.ThrowIfNull(tokens);
AnalyzerConfigOptionsExtensions.cs (1)
26Contract.ThrowIfFalse(option.Definition.IsEditorConfigOption);
AnchorIndentationOperation.cs (3)
18Contract.ThrowIfTrue(anchorToken.RawKind == 0); 19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); 21Contract.ThrowIfTrue(endToken.RawKind == 0);
AnnotationTable.cs (1)
108Contract.ThrowIfNull(ra.Data);
AsyncLazy`1.cs (9)
114Contract.ThrowIfNull(asynchronousComputeFunction); 150Contract.ThrowIfTrue(_asynchronousComputationCancellationSource != null && 154Contract.ThrowIfTrue(_requests != null && 159Contract.ThrowIfTrue(_requests != null && 163Contract.ThrowIfTrue(_cachedResult != null && 168Contract.ThrowIfTrue(_asynchronousComputeFunction == null && _synchronousComputeFunction != null); 248Contract.ThrowIfNull(_synchronousComputeFunction); 360Contract.ThrowIfTrue(_computationActive); 361Contract.ThrowIfNull(_asynchronousComputeFunction);
BottomUpBaseIndentationFinder.cs (1)
34Contract.ThrowIfNull(formattingRules);
ChainedFormattingRules.cs (1)
33Contract.ThrowIfNull(formattingRules);
CommonFormattingHelpers.cs (15)
44Contract.ThrowIfNull(root); 45Contract.ThrowIfFalse(spans.Count > 0); 80Contract.ThrowIfNull(root); 81Contract.ThrowIfTrue(textSpan.IsEmpty); 120Contract.ThrowIfFalse(startToken.Equals(endToken) || startToken.Span.End <= endToken.SpanStart); 144Contract.ThrowIfNull(tree); 145Contract.ThrowIfTrue(token.RawKind == 0); 166Contract.ThrowIfTrue(token1.RawKind == 0 && token2.RawKind == 0); 167Contract.ThrowIfTrue(token1.Equals(token2)); 282Contract.ThrowIfFalse(backwardPosition < parentNode.FullSpan.End); 286Contract.ThrowIfTrue(nextToken.RawKind == 0); 307Contract.ThrowIfNull(parentNode); 308Contract.ThrowIfFalse(parentNode.FullSpan.Start < forwardPosition); 312Contract.ThrowIfTrue(previousToken.RawKind == 0); 362Contract.ThrowIfNull(root);
DiagnosticHelper.cs (3)
186Contract.ThrowIfTrue(additionalLocations.IsEmpty()); 187Contract.ThrowIfTrue(tagIndices.IsEmpty()); 197Contract.ThrowIfFalse(indices.All(idx => idx >= 0 && idx < additionalLocationsLength));
EditorConfigValueSerializer`1.cs (1)
62Contract.ThrowIfTrue(RoslynString.IsNullOrEmpty(editorConfigStringForValue));
EmbeddedSeparatedSyntaxNodeList.cs (1)
27Contract.ThrowIfTrue(nodesAndTokens.IsDefault);
FormattingContext.cs (4)
59Contract.ThrowIfNull(engine); 60Contract.ThrowIfNull(tokenStream); 125Contract.ThrowIfNull(operations); 437Contract.ThrowIfFalse(intervals.Length == 0);
FormattingContext.InitialContextFinder.cs (3)
32Contract.ThrowIfNull(tokenStream); 33Contract.ThrowIfNull(formattingRules); 34Contract.ThrowIfNull(rootNode);
FormattingExtensions.cs (1)
201Contract.ThrowIfFalse(lines.Length > 0);
ImmutableHashMapExtensions.cs (2)
28Contract.ThrowIfNull(valueProvider); 31Contract.ThrowIfNull(map);
INamedTypeSymbolExtensions.cs (3)
338Contract.ThrowIfNull(classOrStructType); 339Contract.ThrowIfNull(interfacesOrAbstractClasses); 340Contract.ThrowIfNull(isImplemented);
IndentBlockOperation.cs (10)
17Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask)); 19Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); 20Contract.ThrowIfTrue(startToken.RawKind == 0); 21Contract.ThrowIfTrue(endToken.RawKind == 0); 36Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask)); 38Contract.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.RelativePositionMask)); 39Contract.ThrowIfFalse(baseToken.Span.End <= textSpan.Start); 41Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); 42Contract.ThrowIfTrue(startToken.RawKind == 0); 43Contract.ThrowIfTrue(endToken.RawKind == 0);
ISymbolExtensions.cs (1)
497Contract.ThrowIfFalse(symbol.IsNormalAnonymousType());
ISymbolExtensions_Accessibility.cs (7)
88Contract.ThrowIfNull(symbol); 89Contract.ThrowIfNull(within); 183Contract.ThrowIfNull(type); 221Contract.ThrowIfNull(assembly); 258Contract.ThrowIfNull(containingType); 435Contract.ThrowIfNull(withinType); 436Contract.ThrowIfNull(originalContainingType);
ISyntaxFactsExtensions.cs (1)
29Contract.ThrowIfNull(node);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs\StringExtensions.cs (10)
16Contract.ThrowIfNull(line); 31Contract.ThrowIfNull(line); 46Contract.ThrowIfNull(lineText); 57Contract.ThrowIfNull(lineText); 208Contract.ThrowIfNull(line); 209Contract.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length); 210Contract.ThrowIfFalse(tabSize > 0); 217Contract.ThrowIfNull(line); 218Contract.ThrowIfFalse(column >= 0); 219Contract.ThrowIfFalse(tabSize > 0);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (2)
69Contract.ThrowIfNull(syntaxTree); 131Contract.ThrowIfNull(syntaxTree);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\TestHooks\TaskExtensions.cs\TaskExtensions.cs (2)
53Contract.ThrowIfNull(task, nameof(task)); 90Contract.ThrowIfNull(task, nameof(task));
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs\TaskExtensions.cs (7)
89Contract.ThrowIfNull(continuationAction, nameof(continuationAction)); 108Contract.ThrowIfNull(continuationFunction, nameof(continuationFunction)); 122Contract.ThrowIfNull(continuationAction, nameof(continuationAction)); 154Contract.ThrowIfNull(continuationFunction, nameof(continuationFunction)); 199Contract.ThrowIfNull(continuationFunction, nameof(continuationFunction)); 318Contract.ThrowIfNull(continuationFunction, nameof(continuationFunction)); 381Contract.ThrowIfFalse(task.IsCompleted);
ListExtensions.cs (2)
68Contract.ThrowIfNull(list); 69Contract.ThrowIfNull(predicate);
LocationExtensions.cs (1)
15Contract.ThrowIfNull(location.SourceTree);
Logger.LogBlock.cs (1)
21Contract.ThrowIfNull(s_currentLogger);
NonReentrantLock.cs (1)
172=> Contract.ThrowIfFalse(LockHeldByMe());
ReferenceCountedDisposable.cs (1)
294Contract.ThrowIfNull(weakInstance);
SemanticModelExtensions.cs (3)
109Contract.ThrowIfNull(semanticModel.ParentModel); 110Contract.ThrowIfTrue(semanticModel.ParentModel.IsSpeculativeSemanticModel); 111Contract.ThrowIfTrue(semanticModel.ParentModel.ParentModel != null);
SimplifyTypeNamesDiagnosticAnalyzerBase.cs (1)
82Contract.ThrowIfNull(options);
SourceTextExtensions_SharedWithCodeStyle.cs (1)
19Contract.ThrowIfNull(text);
StackExtensions.cs (2)
34Contract.ThrowIfNull(stack); 35Contract.ThrowIfNull(range);
StructuredAnalyzerConfigOptions.cs (1)
65Contract.ThrowIfFalse(options.KeyComparer == KeyComparer);
SuppressOperation.cs (3)
17Contract.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0); 18Contract.ThrowIfTrue(startToken.RawKind == 0); 19Contract.ThrowIfTrue(endToken.RawKind == 0);
SymbolKey.BodyLevelSymbolKey.cs (5)
22Contract.ThrowIfFalse(IsBodyLevelSymbol(symbol)); 23Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 62Contract.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty); 66Contract.ThrowIfFalse(locations.All(loc => loc.IsInSource)); 258Contract.ThrowIfTrue(semanticModel.SyntaxTree != containerDeclaration.SyntaxTree);
SymbolKey.BuiltinOperatorSymbolKey.cs (1)
48Contract.ThrowIfNull(returnTypeSymbol);
SymbolKey.ErrorTypeSymbolKey.cs (2)
86Contract.ThrowIfFalse(typeArguments.IsDefault); 91Contract.ThrowIfTrue(typeArguments.IsDefault);
SymbolKey.FunctionPointerTypeSymbolKey.cs (2)
71Contract.ThrowIfFalse(parameterTypes.IsDefault); 76Contract.ThrowIfTrue(parameterTypes.IsDefault);
SymbolKey.NamedTypeSymbolKey.cs (2)
54Contract.ThrowIfFalse(typeArguments.IsDefault); 60Contract.ThrowIfTrue(typeArguments.IsDefault);
SymbolKey.SymbolKeyReader.cs (5)
126Contract.ThrowIfNull(result); 417Contract.ThrowIfTrue(_methodSymbolStack.Count == 0); 418Contract.ThrowIfFalse(Equals(method, _methodSymbolStack[^1])); 433Contract.ThrowIfTrue(_contextualSymbolStack.Count == 0); 434Contract.ThrowIfFalse(Equals(contextualSymbol, _contextualSymbolStack.Peek()));
SymbolKey.SymbolKeyWriter.cs (2)
518Contract.ThrowIfTrue(_methodSymbolStack.Count == 0); 519Contract.ThrowIfFalse(method.Equals(_methodSymbolStack[_methodSymbolStack.Count - 1]));
SymbolKey.TypeParameterOrdinalSymbolKey.cs (1)
15Contract.ThrowIfFalse(symbol.TypeParameterKind == TypeParameterKind.Method);
SyntaxNodeExtensions.cs (8)
102Contract.ThrowIfNull(node); 174Contract.ThrowIfTrue(node1.RawKind == 0 || node2.RawKind == 0); 292Contract.ThrowIfNull(root); 293Contract.ThrowIfNull(pairs); 306Contract.ThrowIfNull(root); 307Contract.ThrowIfNull(pairs); 315Contract.ThrowIfNull(nodes); 316Contract.ThrowIfFalse(nodes.Any());
SyntaxTokenExtensions.cs (1)
41Contract.ThrowIfTrue(token1.RawKind == 0 || token2.RawKind == 0);
TokenData.cs (4)
25Contract.ThrowIfNull(tokenStream); 26Contract.ThrowIfFalse((indexInStream == -1) || (0 <= indexInStream && indexInStream < tokenStream.TokenCount)); 78Contract.ThrowIfFalse(this.TokenStream == other.TokenStream); 105Contract.ThrowIfFalse(index1 >= 0 && index2 >= 0);
TokenPairWithOperations.cs (2)
28Contract.ThrowIfNull(tokenStream); 30Contract.ThrowIfFalse(0 <= tokenPairIndex && tokenPairIndex < tokenStream.TokenCount - 1);
TokenStream.cs (10)
138Contract.ThrowIfFalse(0 <= index && index < this.TokenCount); 237Contract.ThrowIfNull(data); 243Contract.ThrowIfNull(data); 249Contract.ThrowIfNull(data); 250Contract.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1); 429Contract.ThrowIfFalse(this.FormatBeginningOfTree); 441Contract.ThrowIfFalse(this.FormatEndOfTree); 453Contract.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1); 465Contract.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1); 478Contract.ThrowIfTrue(token.RawKind == 0);
TreeData.cs (1)
42Contract.ThrowIfNull(root);
TreeData.Debug.cs (1)
25Contract.ThrowIfFalse(text == _debugNodeData.GetTextBetween(token1, token2));
TreeData.Node.cs (2)
18Contract.ThrowIfFalse(root.GetFirstToken(includeZeroWidth: true).RawKind != 0); 23Contract.ThrowIfTrue(token.RawKind == 0);
TreeData.NodeAndText.cs (2)
20Contract.ThrowIfNull(text); 26Contract.ThrowIfTrue(token.RawKind == 0);
TreeData.StructuredTrivia.cs (1)
22Contract.ThrowIfFalse(trivia.HasStructure);
VirtualChar.cs (1)
72Contract.ThrowIfFalse(surrogateChar == 0 || rune == Rune.ReplacementChar,
Microsoft.CodeAnalysis.CodeStyle.Fixes (40)
AbstractAddAccessibilityModifiersCodeFixProvider.cs (1)
54Contract.ThrowIfNull(symbol);
AbstractAddObsoleteAttributeCodeFixProvider.cs (1)
78Contract.ThrowIfNull(obsoleteAttribute);
AbstractFlagsEnumGenerator.cs (5)
80Contract.ThrowIfNull(enumType.EnumUnderlyingType); 121Contract.ThrowIfNull(finalNode); 151Contract.ThrowIfNull(field.ConstantValue); 174Contract.ThrowIfNull(enumType.EnumUnderlyingType); 190Contract.ThrowIfNull(enumType.EnumUnderlyingType);
AbstractForEachCastCodeFixProvider.cs (2)
70Contract.ThrowIfNull(variableDeclarator.Symbol.Type); 71Contract.ThrowIfNull(enumerableType);
AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
81Contract.ThrowIfNull(symbol);
AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
110Contract.ThrowIfNull(node); 117Contract.ThrowIfNull(methodSymbol);
AbstractMakeMethodSynchronousCodeFixProvider.cs (2)
59Contract.ThrowIfNull(methodSymbol); 256Contract.ThrowIfNull(currentInvocationExpression);
AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
82Contract.ThrowIfNull(newRoot);
AbstractRemoveUnusedMembersCodeFixProvider.cs (2)
59Contract.ThrowIfNull(symbol); 72Contract.ThrowIfNull(fieldDeclarator);
AbstractRemoveUnusedValuesCodeFixProvider.cs (6)
485Contract.ThrowIfNull(variableDeclarator); 501Contract.ThrowIfFalse(node.GetRequiredParent().Parent is TExpressionStatementSyntax); 591Contract.ThrowIfNull(type); 592Contract.ThrowIfNull(newLocalNameOpt); 853Contract.ThrowIfNull(declStatement); 894Contract.ThrowIfNull(rootWithRemovedDeclaration);
AbstractUseCollectionInitializerCodeFixProvider.cs (1)
94Contract.ThrowIfNull(statement);
AbstractUseNullPropagationCodeFixProvider.cs (1)
161Contract.ThrowIfNull(newWhenTrueStatement);
AbstractUseObjectInitializerCodeFixProvider.cs (1)
95Contract.ThrowIfNull(statement);
AddAccessibilityModifiersHelpers.cs (1)
17Contract.ThrowIfNull(symbol);
CodeGenerationHelpers.cs (2)
182Contract.ThrowIfNull(attribute); 200Contract.ThrowIfTrue(availableIndices != null && availableIndices.Count != declarationList.Count + 1);
DocumentExtensions.cs (1)
116Contract.ThrowIfFalse(document.SupportsSemanticModel);
IIndentationService.cs (1)
36Contract.ThrowIfNull(firstNonWhitespacePos);
NamingStyleCodeFixProvider.cs (1)
53Contract.ThrowIfNull(serializedNamingStyle);
ParsedDocument.cs (1)
73Contract.ThrowIfFalse(Id == oldDocument.Id);
SimplificationHelpers.cs (1)
66Contract.ThrowIfNull(expression);
SyntaxAnnotationExtensions.cs (1)
18Contract.ThrowIfFalse(symbol is CodeGenerationSymbol);
SyntaxGeneratorExtensions_Negate.cs (1)
526Contract.ThrowIfFalse(syntaxFacts.IsNotPattern(pattern));
TextDocumentExtensions.cs (2)
38Contract.ThrowIfFalse(textDocument is AdditionalDocument); 47Contract.ThrowIfFalse(textDocument is AnalyzerConfigDocument);
UseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (1)
73Contract.ThrowIfNull(expression); // checked in analyzer.
UseExplicitTupleNameCodeFixProvider.cs (1)
50Contract.ThrowIfNull(preferredName);
Microsoft.CodeAnalysis.CSharp.CodeStyle (66)
AnalyzedPattern.cs (1)
31Contract.ThrowIfNull(operation.SemanticModel);
BlockSyntaxExtensions.cs (1)
110Contract.ThrowIfFalse(preference == ExpressionBodyPreference.WhenOnSingleLine);
CastSimplifier.cs (1)
176Contract.ThrowIfTrue(castNode.WalkUpParentheses().ContainsDiagnostics);
ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (3)
45Contract.ThrowIfNull(dataFlow); 64Contract.ThrowIfNull(declaration); 70Contract.ThrowIfNull(beforeSwitch);
CSharpAddBracesDiagnosticAnalyzer.cs (1)
58Contract.ThrowIfNull(embeddedStatement);
CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (1)
133Contract.ThrowIfNull(isPatternExpression);
CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (7)
35Contract.ThrowIfNull(semanticModel); 36Contract.ThrowIfNull(localSymbol); 37Contract.ThrowIfNull(comparison); 38Contract.ThrowIfNull(operand); 283Contract.ThrowIfNull(statement); 309Contract.ThrowIfNull(scope); 377Contract.ThrowIfNull(dataFlow);
CSharpInferredMemberNameSimplifier.cs (2)
64Contract.ThrowIfNull(toRemove.NameColon); 86Contract.ThrowIfNull(toRemove.NameEquals);
CSharpInlineDeclarationDiagnosticAnalyzer.cs (2)
260Contract.ThrowIfNull(nextStatement); 265Contract.ThrowIfNull(dataFlow);
CSharpMakeStructMemberReadOnlyAnalyzer.cs (1)
128Contract.ThrowIfNull(semanticModel);
CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
53Contract.ThrowIfFalse(nodes.Any());
CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
125Contract.ThrowIfNull(currentOptionsDirective); 157Contract.ThrowIfNull(currentOptionsDirective);
CSharpSmartTokenFormatter.cs (4)
36Contract.ThrowIfNull(root); 48Contract.ThrowIfTrue(startToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 49Contract.ThrowIfTrue(endToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); 80Contract.ThrowIfTrue(token.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken);
CSharpTriviaFormatter.cs (1)
225Contract.ThrowIfFalse(multilineCommentTrivia.Count == 1);
CSharpTypeStyleDiagnosticAnalyzerBase.cs (1)
38Contract.ThrowIfNull(options);
CSharpUseIndexOperatorDiagnosticAnalyzer.cs (1)
199Contract.ThrowIfNull(semanticModel);
CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (1)
91Contract.ThrowIfNull(semanticModel);
CSharpUseRangeOperatorDiagnosticAnalyzer.cs (4)
85Contract.ThrowIfNull(semanticModel); 148Contract.ThrowIfNull(invocation.Instance); 165Contract.ThrowIfNull(invocation.Instance); 214Contract.ThrowIfNull(invocation.Instance);
CSharpVirtualCharService.cs (3)
140Contract.ThrowIfFalse(tokenText is [.., 'u' or 'U', '8']); 146Contract.ThrowIfFalse(tokenText[0] == '"'); 151Contract.ThrowIfFalse(tokenText[endIndexExclusive - 1] == '"');
FormattingHelpers.cs (1)
486Contract.ThrowIfNull(node);
FormattingRangeHelper.cs (1)
22Contract.ThrowIfTrue(endToken.Kind() == SyntaxKind.None);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs\SyntaxTreeExtensions.cs (1)
489Contract.ThrowIfNull(syntaxTree);
SemanticModelExtensions.cs (1)
170Contract.ThrowIfNull(@using.NamespaceOrType);
SyntaxNodeExtensions.cs (1)
79Contract.ThrowIfTrue(sourceText == null && includePreviousTokenTrailingTriviaOnlyIfOnSameLine, "If we are including previous token trailing trivia, we need the text too.");
SyntaxTriviaExtensions.cs (2)
121Contract.ThrowIfNull(trivia); 137Contract.ThrowIfNull(trivia);
TriviaDataFactory.Analyzer.cs (1)
128Contract.ThrowIfFalse(SyntaxFacts.IsPreprocessorDirective(trivia.Kind()));
TriviaDataFactory.CodeShapeAnalyzer.cs (3)
38Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.EndOfLineTrivia); 39Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.SkippedTokensTrivia); 40Contract.ThrowIfTrue(trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia);
TriviaDataFactory.ComplexTrivia.cs (1)
63Contract.ThrowIfFalse(triviaList.Count > 0);
TriviaDataFactory.cs (1)
108Contract.ThrowIfFalse(space >= -1);
TriviaDataFactory.FormattedComplexTrivia.cs (3)
32Contract.ThrowIfNull(context); 33Contract.ThrowIfNull(formattingRules); 34Contract.ThrowIfNull(originalString);
TriviaDataFactory.ModifiedComplexTrivia.cs (3)
24Contract.ThrowIfNull(original); 74Contract.ThrowIfFalse(this.SecondTokenIsFirstTokenOnLine); 80Contract.ThrowIfFalse(triviaList.Count > 0);
TriviaRewriter.cs (2)
34Contract.ThrowIfNull(node); 35Contract.ThrowIfNull(map);
TypeStyleHelper.cs (1)
133Contract.ThrowIfNull(containingType);
UseExpressionBodyHelper`1.cs (1)
84Contract.ThrowIfNull(body);
UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
87Contract.ThrowIfNull(semanticModel);
UsingsAndExternAliasesDirectiveComparer.cs (2)
128Contract.ThrowIfNull(using1!.Name); 129Contract.ThrowIfNull(using2!.Name);
UsingsAndExternAliasesOrganizer.cs (2)
84Contract.ThrowIfNull(using1.Name); 85Contract.ThrowIfNull(using2.Name);
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (46)
AbstractAssignOutParametersCodeFixProvider.cs (1)
111Contract.ThrowIfNull(parameterList);
ArrowExpressionClausePlacementCodeFixProvider.cs (1)
59Contract.ThrowIfTrue(arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken);
ConditionalExpressionPlacementCodeFixProvider.cs (1)
59Contract.ThrowIfTrue(questionToken.Kind() != SyntaxKind.QuestionToken);
ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
113Contract.ThrowIfNull(nextStatement);
ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (7)
94Contract.ThrowIfNull(_assignmentTarget); 105Contract.ThrowIfFalse(_assignmentTarget is IdentifierNameSyntax); 210Contract.ThrowIfNull(result); 237Contract.ThrowIfNull(armExpression); 279Contract.ThrowIfNull(node.Expression); 285Contract.ThrowIfNull(node.Expression); 294Contract.ThrowIfNull(result);
CSharpAddImportsService.cs (1)
140Contract.ThrowIfNull(rewritten);
CSharpAsAndMemberAccessCodeFixProvider.cs (2)
66Contract.ThrowIfNull(parent); 126Contract.ThrowIfNull(binaryExpression);
CSharpCodeGenerationHelpers.cs (2)
114Contract.ThrowIfNull(syntax); 268Contract.ThrowIfNull(symbol);
CSharpConvertTypeOfToNameOfCodeFixProvider.cs (1)
35Contract.ThrowIfNull(typeSymbol);
CSharpForEachCastCodeFixProvider.cs (1)
33Contract.ThrowIfNull(result);
CSharpIndentationService.cs (2)
54Contract.ThrowIfNull(formattingRules); 55Contract.ThrowIfNull(root);
CSharpIndentationService.Indenter.cs (5)
76Contract.ThrowIfNull(indenter.Tree); 77Contract.ThrowIfTrue(token.Kind() == SyntaxKind.None); 127Contract.ThrowIfNull(interpolatedExpression); 272Contract.ThrowIfNull(nonTerminalNode, @"Malformed code or bug in parser???"); 285Contract.ThrowIfNull(nonTerminalNode, @"Malformed code or bug in parser???");
CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
79Contract.ThrowIfNull(currentAccessorList);
CSharpRemoveUnnecessaryImportsService.cs (1)
57Contract.ThrowIfNull(formattingOptions);
CSharpTypeInferenceService.TypeInferrer.cs (4)
952Contract.ThrowIfTrue(previousToken.HasValue && previousToken.Value != operatorToken); 1128Contract.ThrowIfTrue(previousToken.HasValue && previousToken.Value != coalesceExpression.OperatorToken); 1945Contract.ThrowIfTrue(previousToken.HasValue && previousToken.Value != prefixUnaryExpression.OperatorToken); 2001Contract.ThrowIfTrue(previousToken.HasValue && previousToken.Value != awaitExpression.AwaitKeyword);
CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
46Contract.ThrowIfNull(compilationOptions);
CSharpUpgradeProjectCodeFixProvider.cs (2)
95Contract.ThrowIfFalse(LanguageVersionFacts.TryParse(newVersion, out var parsedNewVersion)); 109Contract.ThrowIfFalse(LanguageVersionFacts.TryParse(newVersion, out var parsedNewVersion));
CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
59Contract.ThrowIfFalse(CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.GetWhenTrueAssignment(
CSharpUseNameofInAttributeCodeFixProvider.cs (1)
52Contract.ThrowIfNull(name);
CSharpUseRangeOperatorCodeFixProvider.cs (2)
147Contract.ThrowIfNull(instance); 199Contract.ThrowIfNull(result.Op2);
J\s\src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\SyntaxTokenExtensions.cs\SyntaxTokenExtensions.cs (2)
41Contract.ThrowIfFalse(genericIdentifier.Kind() == SyntaxKind.IdentifierToken); 45Contract.ThrowIfFalse(token.Kind() == SyntaxKind.LessThanToken);
MakeLocalFunctionStaticCodeFixHelper.cs (1)
219Contract.ThrowIfNull(symbolType);
NamedTypeGenerator.cs (1)
228Contract.ThrowIfNull(invokeMethod);
TypeDeclarationSyntaxExtensions.cs (1)
71Contract.ThrowIfNull(typeNode);
UseUtf8StringLiteralCodeFixProvider.cs (3)
53Contract.ThrowIfNull(readOnlySpanType); 61Contract.ThrowIfNull(arrayOp.Initializer); 150Contract.ThrowIfFalse(UseUtf8StringLiteralDiagnosticAnalyzer.TryConvertToUtf8String(builder, initializer.ElementValues));
Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests (2)
CSharpRemoveRedundantNullableDirectiveTests.cs (1)
255Contract.ThrowIfNull(compilationOptions);
CSharpRemoveUnnecessaryNullableDirectiveTests.cs (1)
242Contract.ThrowIfNull(compilationOptions);
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (26)
SyntaxNodeExtensions.vb (2)
114Contract.ThrowIfNull(node) 115Contract.ThrowIfFalse(node.IsStatementContainerNode())
SyntaxTreeExtensions.vb (1)
239Contract.ThrowIfNull(syntaxTree)
TriviaDataFactory.Analyzer.vb (1)
55Contract.ThrowIfFalse(SyntaxFacts.IsPreprocessorDirective(trivia.Kind))
TriviaDataFactory.CodeShapeAnalyzer.vb (2)
38Contract.ThrowIfTrue(trivia.Kind = SyntaxKind.EndOfLineTrivia) 39Contract.ThrowIfTrue(trivia.Kind = SyntaxKind.SkippedTokensTrivia)
TriviaDataFactory.ComplexTrivia.vb (2)
22Contract.ThrowIfNull(treeInfo) 64Contract.ThrowIfFalse(list.Count > 0)
TriviaDataFactory.FormattedComplexTrivia.vb (3)
27Contract.ThrowIfNull(context) 28Contract.ThrowIfNull(formattingRules) 29Contract.ThrowIfNull(originalString)
TriviaDataFactory.LineContinuationTrivia.vb (1)
26Contract.ThrowIfFalse(Me.SecondTokenIsFirstTokenOnLine)
TriviaDataFactory.ModifiedComplexTrivia.vb (3)
19Contract.ThrowIfNull(original) 71Contract.ThrowIfFalse(Me.SecondTokenIsFirstTokenOnLine) 77Contract.ThrowIfFalse(list.Count > 0)
TriviaDataFactory.TriviaRewriter.vb (2)
24Contract.ThrowIfNull(node) 25Contract.ThrowIfNull(map)
TriviaDataFactory.vb (3)
103Contract.ThrowIfFalse(lineBreaks = 1) 117Contract.ThrowIfFalse(indentation >= 0 AndAlso indentation < s_lineContinuationCacheSize) 153Contract.ThrowIfFalse(space >= -1)
VisualBasicFormatEngine.vb (1)
34Contract.ThrowIfNull(tokenStream)
VisualBasicSemanticFacts.vb (2)
134Contract.ThrowIfNull(model) 135Contract.ThrowIfTrue(model.IsSpeculativeSemanticModel)
VisualBasicSmartTokenFormatter.vb (2)
26Contract.ThrowIfNull(root) 35Contract.ThrowIfTrue(token.Kind = SyntaxKind.None OrElse token.Kind = SyntaxKind.EndOfFileToken)
VisualBasicTriviaFormatter.vb (1)
296Contract.ThrowIfFalse(singlelineDocCommentTrivia.Count = 1)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (5)
StringExtensions.vb (2)
62Contract.ThrowIfNull(text) 91Contract.ThrowIfNull(text)
VisualBasicRemoveUnnecessaryImportsService.vb (1)
32Contract.ThrowIfNull(formattingOptions)
VisualBasicTypeInferenceService.TypeInferrer.vb (1)
524Contract.ThrowIfTrue(previousToken <> Nothing AndAlso binop.OperatorToken <> previousToken)
VisualBasicUseIsNotExpressionCodeFixProvider.vb (1)
65Contract.ThrowIfFalse(operand.IsKind(SyntaxKind.TypeOfIsExpression))