1834 references to Contract
Microsoft.CodeAnalysis.CSharp.EditorFeatures (11)
BlockCommentEditing\BlockCommentEditingCommandHandler.cs (2)
45
Contract
.ThrowIfNull(undoHistoryRegistry);
46
Contract
.ThrowIfNull(editorOperationsFactoryService);
EventHookup\EventHookupCommandHandler_TabKeyCommand.cs (1)
296
Contract
.ThrowIfNull(eventHookupExpression);
StringCopyPaste\AbstractPasteProcessor.cs (3)
117
Contract
.ThrowIfTrue(StringExpressionBeforePasteInfo.ContentSpans.IsEmpty);
139
Contract
.ThrowIfFalse(IsAnyRawStringExpression(StringExpressionBeforePaste));
154
Contract
.ThrowIfFalse(IsAnyRawStringExpression(StringExpressionBeforePaste));
StringCopyPaste\StringCopyPasteCommandHandler.cs (1)
77
Contract
.ThrowIfFalse(_threadingContext.HasMainThread);
StringCopyPaste\StringCopyPasteCommandHandler_CutCopy.cs (1)
39
Contract
.ThrowIfFalse(_threadingContext.HasMainThread);
StringCopyPaste\StringCopyPasteHelpers.cs (1)
565
Contract
.ThrowIfTrue(spans.Length == 0);
StringCopyPaste\StringInfo.cs (2)
123
Contract
.ThrowIfFalse(SyntaxFacts.IsNewLine(text[rawStart]));
138
Contract
.ThrowIfFalse(SyntaxFacts.IsNewLine(text[rawEnd - 1]));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (12)
Completion\CompletionProviders\CrefCompletionProviderTests.cs (1)
404
Contract
.ThrowIfNull(n);
Completion\CompletionProviders\OverrideCompletionProviderTests.cs (6)
2586
Contract
.ThrowIfNull(testDocument.CursorPosition);
3012
Contract
.ThrowIfNull(testDocument.CursorPosition);
3070
Contract
.ThrowIfNull(testDocument.CursorPosition);
3350
Contract
.ThrowIfNull(testDocument.CursorPosition);
3484
Contract
.ThrowIfNull(testDocument.CursorPosition);
3531
Contract
.ThrowIfNull(testDocument.CursorPosition);
QuickInfo\SemanticQuickInfoSourceTests.cs (3)
54
Contract
.ThrowIfNull(service);
135
Contract
.ThrowIfNull(service);
304
Contract
.ThrowIfNull(service);
StringCopyPaste\StringCopyPasteCommandHandlerTests.cs (2)
126
Contract
.ThrowIfNull(pasteText);
128
Contract
.ThrowIfNull(json);
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (1)
EmbeddedLanguages\Json\CSharpJsonParserTests_NstTests.cs (1)
19
Contract
.ThrowIfNull(tree);
Microsoft.CodeAnalysis.CSharp.Features (185)
CodeRefactorings\ConvertLocalFunctionToMethod\CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs (2)
77
Contract
.ThrowIfTrue(localFunction.Body is null && localFunction.ExpressionBody is null);
180
Contract
.ThrowIfNull(additionalTypeArguments);
CodeRefactorings\SyncNamespace\CSharpChangeNamespaceService.cs (1)
347
Contract
.ThrowIfNull(syntaxRoot);
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (1)
242
Contract
.ThrowIfNull(attributeType);
Completion\CompletionProviders\CrefCompletionProvider.cs (1)
72
Contract
.ThrowIfNull(semanticModel);
Completion\CompletionProviders\EnumAndCompletionListTagCompletionProvider.cs (1)
87
Contract
.ThrowIfNull(typeInferenceService, nameof(typeInferenceService));
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (1)
109
Contract
.ThrowIfNull(namedType);
Completion\CompletionProviders\SnippetCompletionProvider.cs (1)
128
Contract
.ThrowIfNull(directive);
Completion\CompletionProviders\TupleNameCompletionProvider.cs (1)
48
Contract
.ThrowIfNull(context);
ConvertProgram\ConvertProgramTransform_ProgramMain.cs (2)
47
Contract
.ThrowIfNull(newRoot);
51
Contract
.ThrowIfNull(newRoot);
ConvertProgram\ConvertProgramTransform_TopLevelStatements.cs (3)
34
Contract
.ThrowIfNull(typeDeclaration); // checked by analyzer
226
Contract
.ThrowIfNull(methodDeclaration.Body); // checked by analyzer
299
Contract
.ThrowIfNull(field);
ConvertToExtension\ConvertToExtensionCodeRefactoringProvider.cs (3)
199
Contract
.ThrowIfTrue(allExtensionMethods.IsEmpty);
223
Contract
.ThrowIfTrue(allExtensionMethods.IsEmpty);
257
Contract
.ThrowIfTrue(group.IsEmpty);
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (1)
49
Contract
.ThrowIfTrue(result.IsDefault);
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (1)
145
Contract
.ThrowIfTrue(characters.IsDefaultOrEmpty);
ConvertToRawString\IConvertStringProvider.cs (1)
45
Contract
.ThrowIfFalse(CheckSyntax(stringExpression));
Copilot\CSharpImplementNotImplementedExceptionFixProvider.cs (3)
91
Contract
.ThrowIfFalse(methodOrProperty is BasePropertyDeclarationSyntax or BaseMethodDeclarationSyntax);
111
Contract
.ThrowIfFalse(memberImplementationDetails.TryGetValue(methodOrProperty, out var implementationDetails));
122
Contract
.ThrowIfTrue(string.IsNullOrWhiteSpace(implementationDetails.Message));
EditAndContinue\BreakpointSpans.cs (2)
353
Contract
.ThrowIfNull(property.AccessorList);
368
Contract
.ThrowIfNull(indexer.AccessorList);
EditAndContinue\CSharpEditAndContinueAnalyzer.cs (8)
1015
Contract
.ThrowIfNull(declaration.Parent);
1017
Contract
.ThrowIfNull(recordType);
1154
Contract
.ThrowIfNull(oldNode);
1171
Contract
.ThrowIfNull(oldNode);
1172
Contract
.ThrowIfNull(newNode);
1353
Contract
.ThrowIfNull(oldNode);
1354
Contract
.ThrowIfNull(newNode);
1407
Contract
.ThrowIfNull(node.Parent);
EditAndContinue\DeclarationBody\PropertyOrIndexerAccessorDeclarationBody.cs (5)
120
Contract
.ThrowIfNull(newPropertyBody.ExplicitBody);
132
Contract
.ThrowIfNull(ExplicitBody);
133
Contract
.ThrowIfNull(newPropertyBody.ExplicitBody);
134
Contract
.ThrowIfNull(MatchRoot);
135
Contract
.ThrowIfNull(newPropertyBody.MatchRoot);
EditAndContinue\SyntaxComparer.cs (1)
923
Contract
.ThrowIfFalse(rightName.HasValue == leftName.HasValue);
EditAndContinue\SyntaxUtilities.cs (1)
217
Contract
.ThrowIfNull(declaration.Parent);
ExtractMethod\CSharpMethodExtractor.cs (3)
38
Contract
.ThrowIfFalse(originalSpanStart >= 0);
126
Contract
.ThrowIfNull(memberNode);
127
Contract
.ThrowIfTrue(memberNode.Kind() == SyntaxKind.NamespaceDeclaration);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.CallSiteContainerRewriter.cs (14)
37
Contract
.ThrowIfNull(outmostCallSiteContainer);
38
Contract
.ThrowIfNull(variableToRemoveMap);
39
Contract
.ThrowIfNull(firstStatementOrFieldToReplace);
40
Contract
.ThrowIfNull(lastStatementOrFieldToReplace);
41
Contract
.ThrowIfTrue(statementsOrFieldToInsert.IsDefaultOrEmpty);
67
Contract
.ThrowIfFalse(variable.Initializer == null);
275
Contract
.ThrowIfNull(statement);
297
Contract
.ThrowIfFalse(firstIndex >= 0);
300
Contract
.ThrowIfFalse(lastIndex >= 0);
302
Contract
.ThrowIfFalse(firstIndex <= lastIndex);
325
Contract
.ThrowIfFalse(firstMemberIndex >= 0);
328
Contract
.ThrowIfFalse(lastMemberIndex >= 0);
330
Contract
.ThrowIfFalse(firstMemberIndex <= lastMemberIndex);
369
Contract
.ThrowIfFalse(_firstStatementOrFieldToReplace == _lastStatementOrFieldToReplace);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.cs (7)
68
Contract
.ThrowIfFalse(SemanticDocument == selectionResult.SemanticDocument);
255
Contract
.ThrowIfFalse(controlFlowValueType.SpecialType == SpecialType.System_Int32);
317
Contract
.ThrowIfTrue(AnalyzerResult.MethodTypeParametersInDeclaration.IsEmpty);
331
Contract
.ThrowIfNull(declStatement);
332
Contract
.ThrowIfFalse(declStatement.Parent.IsStatementContainerNode());
874
Contract
.ThrowIfTrue(variableInfos.IsEmpty);
891
Contract
.ThrowIfTrue(variableInfos.IsEmpty && !needsControlFlowValue);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.ExpressionCodeGenerator.cs (2)
89
Contract
.ThrowIfFalse(this.SelectionResult.IsExtractMethodOnExpression);
141
Contract
.ThrowIfTrue(
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.MultipleStatementsCodeGenerator.cs (2)
68
Contract
.ThrowIfNull(node);
69
Contract
.ThrowIfFalse(node.IsStatementContainerNode());
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.SingleStatementCodeGenerator.cs (1)
32
Contract
.ThrowIfFalse(this.SelectionResult.IsExtractMethodOnSingleStatement);
ExtractMethod\CSharpMethodExtractor.PostProcessor.cs (5)
30
Contract
.ThrowIfNull(semanticModel);
120
Contract
.ThrowIfNull(statement);
123
Contract
.ThrowIfNull(type);
133
Contract
.ThrowIfFalse(keyValuePair.Value.Count > 0);
157
Contract
.ThrowIfNull(statement);
ExtractMethod\CSharpSelectionResult.cs (7)
35
Contract
.ThrowIfNull(document);
71
Contract
.ThrowIfTrue(IsExtractMethodOnExpression);
75
Contract
.ThrowIfNull(statement);
82
Contract
.ThrowIfTrue(IsExtractMethodOnExpression);
92
Contract
.ThrowIfFalse(IsExtractMethodOnExpression);
128
Contract
.ThrowIfFalse(last.IsParentKind(SyntaxKind.GlobalStatement));
129
Contract
.ThrowIfFalse(last.Parent.IsParentKind(SyntaxKind.CompilationUnit));
ExtractMethod\CSharpSelectionResult.ExpressionResult.cs (5)
35
Contract
.ThrowIfNull(SemanticDocument);
36
Contract
.ThrowIfFalse(IsExtractMethodOnExpression);
42
Contract
.ThrowIfNull(scope);
150
Contract
.ThrowIfNull(container);
151
Contract
.ThrowIfFalse(
ExtractMethod\CSharpSelectionResult.StatementResult.cs (1)
39
Contract
.ThrowIfTrue(IsExtractMethodOnExpression);
ExtractMethod\CSharpSelectionValidator.cs (5)
90
Contract
.ThrowIfFalse(ContainsValidSelection);
91
Contract
.ThrowIfFalse(selectionInfo.Status.Succeeded);
366
Contract
.ThrowIfNull(firstStatement);
367
Contract
.ThrowIfNull(lastStatement);
419
Contract
.ThrowIfFalse(line.LineNumber > 0);
ExtractMethod\Extensions.cs (3)
21
Contract
.ThrowIfNull(node);
56
Contract
.ThrowIfNull(node);
97
Contract
.ThrowIfNull(node);
ImplementInterface\AbstractChangeImplementationCodeRefactoringProvider.cs (1)
60
Contract
.ThrowIfNull(member);
InlineHints\CSharpInlineTypeHintsService.cs (1)
151
Contract
.ThrowIfFalse(displayAllOverride);
LineSeparators\CSharpLineSeparatorService.cs (2)
245
Contract
.ThrowIfNull(spans);
260
Contract
.ThrowIfNull(spans);
ReplacePropertyWithMethods\CSharpReplacePropertyWithMethodsService.cs (1)
246
Contract
.ThrowIfNull(rewritten);
SignatureHelp\ElementAccessExpressionSignatureHelpProvider.cs (2)
294
Contract
.ThrowIfFalse(openBracket.Parent is BracketedArgumentListSyntax &&
336
Contract
.ThrowIfFalse(openBracket.Parent is ArrayRankSpecifierSyntax && openBracket.Parent.Parent is ArrayTypeSyntax);
SignatureHelp\GenericNamePartiallyWrittenSignatureHelpProvider.cs (1)
32
Contract
.ThrowIfTrue(nextToken.Kind() == 0);
SignatureHelp\GenericNameSignatureHelpProvider.cs (1)
163
Contract
.ThrowIfFalse(lessThanToken.Parent is TypeArgumentListSyntax && lessThanToken.Parent.Parent is GenericNameSyntax);
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (1)
68
Contract
.ThrowIfFalse(includeInstance || includeStatic);
SignatureHelp\LightweightOverloadResolution.cs (1)
175
Contract
.ThrowIfTrue(argumentToParameterMap.Count != arguments.Count);
Snippets\AbstractCSharpForLoopSnippetProvider.cs (1)
84
Contract
.ThrowIfNull(property);
Snippets\CSharpConstructorSnippetProvider.cs (2)
65
Contract
.ThrowIfNull(containingType);
68
Contract
.ThrowIfNull(containingTypeSymbol);
src\Analyzers\CSharp\Analyzers\AddAccessibilityModifiers\CSharpAddAccessibilityModifiers.cs (1)
76
Contract
.ThrowIfFalse(option == AccessibilityModifiersRequired.OmitIfDefault);
src\Analyzers\CSharp\Analyzers\AddBraces\CSharpAddBracesDiagnosticAnalyzer.cs (1)
58
Contract
.ThrowIfNull(embeddedStatement);
src\Analyzers\CSharp\Analyzers\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionDiagnosticAnalyzer.Analyzer.cs (3)
45
Contract
.ThrowIfNull(dataFlow);
64
Contract
.ThrowIfNull(declaration);
70
Contract
.ThrowIfNull(beforeSwitch);
src\Analyzers\CSharp\Analyzers\InlineDeclaration\CSharpInlineDeclarationDiagnosticAnalyzer.cs (2)
266
Contract
.ThrowIfNull(nextStatement);
271
Contract
.ThrowIfNull(dataFlow);
src\Analyzers\CSharp\Analyzers\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyAnalyzer.cs (2)
77
Contract
.ThrowIfNull(context.FilterTree);
220
Contract
.ThrowIfNull(semanticModel);
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryImports\CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer.cs (1)
53
Contract
.ThrowIfFalse(nodes.Any());
src\Analyzers\CSharp\Analyzers\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveDiagnosticAnalyzer.cs (2)
117
Contract
.ThrowIfNull(currentOptionsDirective);
149
Contract
.ThrowIfNull(currentOptionsDirective);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs (1)
358
Contract
.ThrowIfTrue(useSpread && arguments.Count != 1);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (3)
659
Contract
.ThrowIfFalse(originalInitializer.Parent
747
Contract
.ThrowIfFalse(expression is ArrayCreationExpressionSyntax or StackAllocArrayCreationExpressionSyntax);
1193
Contract
.ThrowIfTrue(arguments.Count != 1);
src\Analyzers\CSharp\Analyzers\UseExpressionBody\Helpers\UseExpressionBodyHelper`1.cs (1)
87
Contract
.ThrowIfNull(body);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseIndexOperatorDiagnosticAnalyzer.cs (1)
198
Contract
.ThrowIfNull(semanticModel);
src\Analyzers\CSharp\Analyzers\UseIndexOrRangeOperator\CSharpUseRangeOperatorDiagnosticAnalyzer.cs (5)
79
Contract
.ThrowIfNull(semanticModel);
141
Contract
.ThrowIfNull(invocation.Instance);
165
Contract
.ThrowIfNull(invocation.Instance);
227
Contract
.ThrowIfNull(invocation.Instance);
276
Contract
.ThrowIfNull(invocation.Instance);
src\Analyzers\CSharp\Analyzers\UseIsNullCheck\CSharpUseNullCheckOverTypeCheckDiagnosticAnalyzer.cs (1)
90
Contract
.ThrowIfNull(semanticModel);
src\Analyzers\CSharp\Analyzers\UsePatternCombinators\AnalyzedPattern.cs (1)
33
Contract
.ThrowIfNull(operation.SemanticModel);
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndMemberAccessDiagnosticAnalyzer.cs (1)
132
Contract
.ThrowIfNull(isPatternExpression);
src\Analyzers\CSharp\Analyzers\UsePatternMatching\CSharpAsAndNullCheckDiagnosticAnalyzer.Analyzer.cs (7)
38
Contract
.ThrowIfNull(semanticModel);
39
Contract
.ThrowIfNull(localSymbol);
40
Contract
.ThrowIfNull(comparison);
41
Contract
.ThrowIfNull(operand);
323
Contract
.ThrowIfNull(statement);
349
Contract
.ThrowIfNull(scope);
417
Contract
.ThrowIfNull(dataFlow);
src\Analyzers\CSharp\Analyzers\UsePrimaryConstructor\CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs (1)
547
Contract
.ThrowIfNull(semanticModel);
src\Analyzers\CSharp\Analyzers\UseUtf8StringLiteral\UseUtf8StringLiteralDiagnosticAnalyzer.cs (1)
86
Contract
.ThrowIfNull(semanticModel);
src\Analyzers\CSharp\CodeFixes\AssignOutParameters\AbstractAssignOutParametersCodeFixProvider.cs (1)
110
Contract
.ThrowIfNull(parameterList);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.cs (1)
107
Contract
.ThrowIfNull(nextStatement);
src\Analyzers\CSharp\CodeFixes\ConvertSwitchStatementToExpression\ConvertSwitchStatementToExpressionCodeFixProvider.Rewriter.cs (7)
95
Contract
.ThrowIfNull(_assignmentTarget);
106
Contract
.ThrowIfFalse(_assignmentTarget is IdentifierNameSyntax);
210
Contract
.ThrowIfNull(result);
237
Contract
.ThrowIfNull(armExpression);
279
Contract
.ThrowIfNull(node.Expression);
285
Contract
.ThrowIfNull(node.Expression);
294
Contract
.ThrowIfNull(result);
src\Analyzers\CSharp\CodeFixes\ConvertTypeOfToNameOf\CSharpConvertTypeOfToNameOfCodeFixProvider.cs (1)
37
Contract
.ThrowIfNull(typeSymbol);
src\Analyzers\CSharp\CodeFixes\ForEachCast\CSharpForEachCastCodeFixProvider.cs (1)
26
Contract
.ThrowIfNull(result);
src\Analyzers\CSharp\CodeFixes\MakeLocalFunctionStatic\MakeLocalFunctionStaticCodeFixHelper.cs (1)
210
Contract
.ThrowIfNull(symbolType);
src\Analyzers\CSharp\CodeFixes\MakeStructMemberReadOnly\CSharpMakeStructMemberReadOnlyCodeFixProvider.cs (1)
73
Contract
.ThrowIfNull(currentAccessorList);
src\Analyzers\CSharp\CodeFixes\NewLines\ArrowExpressionClausePlacement\ArrowExpressionClausePlacementCodeFixProvider.cs (1)
53
Contract
.ThrowIfTrue(arrowToken.Kind() != SyntaxKind.EqualsGreaterThanToken);
src\Analyzers\CSharp\CodeFixes\NewLines\ConditionalExpressionPlacement\ConditionalExpressionPlacementCodeFixProvider.cs (1)
53
Contract
.ThrowIfTrue(questionToken.Kind() != SyntaxKind.QuestionToken);
src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
41
Contract
.ThrowIfNull(compilationOptions);
src\Analyzers\CSharp\CodeFixes\UpgradeProject\CSharpUpgradeProjectCodeFixProvider.cs (2)
91
Contract
.ThrowIfFalse(LanguageVersionFacts.TryParse(newVersion, out var parsedNewVersion));
105
Contract
.ThrowIfFalse(LanguageVersionFacts.TryParse(newVersion, out var parsedNewVersion));
src\Analyzers\CSharp\CodeFixes\UseCollectionExpression\CSharpCollectionExpressionRewriter.cs (3)
469
Contract
.ThrowIfTrue(expressions.Length >= 2 && match.UseSpread);
543
Contract
.ThrowIfNull(expression.Parent);
810
Contract
.ThrowIfNull(expression.Parent);
src\Analyzers\CSharp\CodeFixes\UseCollectionInitializer\CSharpUseCollectionInitializerCodeFixProvider_CollectionInitializer.cs (1)
98
Contract
.ThrowIfNull(expression.Parent);
src\Analyzers\CSharp\CodeFixes\UseCompoundAssignment\CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs (1)
55
Contract
.ThrowIfFalse(CSharpUseCompoundCoalesceAssignmentDiagnosticAnalyzer.GetWhenTrueAssignment(
src\Analyzers\CSharp\CodeFixes\UseExplicitArrayInExpressionTree\CSharpUseExplicitArrayInExpressionTreeCodeFixProvider.cs (1)
120
Contract
.ThrowIfNull(arrayType); // Validated in RegisterCodeFixesAsync
src\Analyzers\CSharp\CodeFixes\UseIndexOrRangeOperator\CSharpUseRangeOperatorCodeFixProvider.cs (2)
137
Contract
.ThrowIfNull(instance);
250
Contract
.ThrowIfNull(result.Op2);
src\Analyzers\CSharp\CodeFixes\UseNameofInAttribute\CSharpUseNameofInAttributeCodeFixProvider.cs (1)
45
Contract
.ThrowIfNull(name);
src\Analyzers\CSharp\CodeFixes\UsePatternMatching\CSharpAsAndMemberAccessCodeFixProvider.cs (2)
62
Contract
.ThrowIfNull(parent);
135
Contract
.ThrowIfNull(binaryExpression);
src\Analyzers\CSharp\CodeFixes\UsePrimaryConstructor\CSharpUsePrimaryConstructorCodeFixProvider.cs (3)
453
Contract
.ThrowIfNull(constructorDeclaration.Body);
470
Contract
.ThrowIfFalse(member is IFieldSymbol or IPropertySymbol);
522
Contract
.ThrowIfNull(parameterName);
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (3)
50
Contract
.ThrowIfNull(readOnlySpanType);
58
Contract
.ThrowIfNull(arrayOp.Initializer);
147
Contract
.ThrowIfFalse(UseUtf8StringLiteralDiagnosticAnalyzer.TryConvertToUtf8String(builder, initializer.ElementValues));
StringIndentation\CSharpStringIndentationService.cs (2)
167
Contract
.ThrowIfNull(offsetOpt);
178
Contract
.ThrowIfTrue(lastLine.LineNumber - firstLine.LineNumber < 2);
Structure\CSharpStructureHelpers.cs (3)
110
Contract
.ThrowIfNull(text);
111
Contract
.ThrowIfNull(prefix);
119
Contract
.ThrowIfFalse(comment.IsSingleLineComment() || comment.IsMultiLineComment());
Structure\Providers\DisabledTextTriviaStructureProvider.cs (1)
20
Contract
.ThrowIfNull(trivia.SyntaxTree);
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (6)
EditAndContinue\Helpers\EditingTestBase.cs (4)
184
Contract
.ThrowIfNull(match);
224
Contract
.ThrowIfNull(body);
256
Contract
.ThrowIfNull(oldBody);
260
Contract
.ThrowIfNull(newBody);
src\Analyzers\CSharp\Tests\RemoveUnnecessaryNullableDirective\CSharpRemoveRedundantNullableDirectiveTests.cs (1)
454
Contract
.ThrowIfNull(compilationOptions);
src\Analyzers\CSharp\Tests\RemoveUnnecessaryNullableDirective\CSharpRemoveUnnecessaryNullableDirectiveTests.cs (1)
252
Contract
.ThrowIfNull(compilationOptions);
Microsoft.CodeAnalysis.CSharp.Workspaces (79)
CodeGeneration\CSharpSyntaxGenerator.cs (5)
874
Contract
.ThrowIfNull(type);
1247
Contract
.ThrowIfNull(result);
2249
Contract
.ThrowIfNull(vd.Parent);
3125
Contract
.ThrowIfTrue(ReferenceEquals(root, node));
3146
Contract
.ThrowIfTrue(ReferenceEquals(root, declaration));
FindSymbols\CSharpDeclaredSymbolInfoFactoryService.cs (1)
274
Contract
.ThrowIfTrue(node is TypeDeclarationSyntax);
OrganizeImports\CSharpOrganizeImportsService.cs (1)
26
Contract
.ThrowIfNull(newRoot);
OrganizeImports\CSharpOrganizeImportsService.Rewriter.cs (1)
40
Contract
.ThrowIfNull(node);
ReassignedVariable\CSharpReassignedVariableService.cs (1)
50
Contract
.ThrowIfNull(current, "Couldn't find a suitable parent of this local declaration");
Rename\CSharpRenameRewriterLanguageService.cs (1)
866
Contract
.ThrowIfNull(tree);
Simplification\CSharpSimplificationService.cs (3)
79
Contract
.ThrowIfNull(token.Parent);
172
Contract
.ThrowIfNull(syntaxNodeToSpeculate);
173
Contract
.ThrowIfFalse(SpeculationAnalyzer.CanSpeculateOnNode(nodeToSpeculate));
Simplification\Reducers\AbstractCSharpReducer.AbstractReductionRewriter.cs (6)
41
Contract
.ThrowIfNull(options);
64
Contract
.ThrowIfNull(ParseOptions);
65
Contract
.ThrowIfNull(Options);
66
Contract
.ThrowIfNull(SemanticModel);
107
Contract
.ThrowIfNull(lastPattern.Parent);
118
Contract
.ThrowIfNull(topMostCref.Parent);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\EmbeddedLanguages\VirtualChars\CSharpVirtualCharService.cs (3)
141
Contract
.ThrowIfFalse(tokenText is [.., 'u' or 'U', '8']);
147
Contract
.ThrowIfFalse(tokenText[0] == '"');
152
Contract
.ThrowIfFalse(tokenText[endIndexExclusive - 1] == '"');
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\BlockSyntaxExtensions.cs (1)
177
Contract
.ThrowIfFalse(preference == ExpressionBodyPreference.WhenOnSingleLine);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SemanticModelExtensions.cs (1)
170
Contract
.ThrowIfNull(@using.NamespaceOrType);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxNodeExtensions.cs (1)
80
Contract
.ThrowIfTrue(sourceText == null && includePreviousTokenTrailingTriviaOnlyIfOnSameLine, "If we are including previous token trailing trivia, we need the text too.");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTokenExtensions.cs (2)
257
Contract
.ThrowIfFalse(genericIdentifier.Kind() == SyntaxKind.IdentifierToken);
261
Contract
.ThrowIfFalse(token.Kind() == SyntaxKind.LessThanToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTreeExtensions.cs (1)
472
Contract
.ThrowIfNull(syntaxTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Extensions\SyntaxTriviaExtensions.cs (2)
121
Contract
.ThrowIfNull(trivia);
137
Contract
.ThrowIfNull(trivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\CSharpTriviaFormatter.cs (1)
224
Contract
.ThrowIfFalse(multilineCommentTrivia.Count == 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.Analyzer.cs (1)
128
Contract
.ThrowIfFalse(SyntaxFacts.IsPreprocessorDirective(trivia.Kind()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.CodeShapeAnalyzer.cs (3)
36
Contract
.ThrowIfTrue(trivia.Kind() == SyntaxKind.EndOfLineTrivia);
37
Contract
.ThrowIfTrue(trivia.Kind() == SyntaxKind.SkippedTokensTrivia);
38
Contract
.ThrowIfTrue(trivia.Kind() == SyntaxKind.PreprocessingMessageTrivia);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ComplexTrivia.cs (1)
61
Contract
.ThrowIfFalse(triviaList.Count > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.cs (1)
108
Contract
.ThrowIfFalse(space >= -1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (3)
31
Contract
.ThrowIfNull(context);
32
Contract
.ThrowIfNull(formattingRules);
33
Contract
.ThrowIfNull(originalString);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.ModifiedComplexTrivia.cs (3)
22
Contract
.ThrowIfNull(original);
72
Contract
.ThrowIfFalse(this.SecondTokenIsFirstTokenOnLine);
78
Contract
.ThrowIfFalse(triviaList.Count > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaRewriter.cs (2)
33
Contract
.ThrowIfNull(node);
34
Contract
.ThrowIfNull(map);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\FormattingHelpers.cs (1)
488
Contract
.ThrowIfNull(node);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Indentation\CSharpSmartTokenFormatter.cs (4)
35
Contract
.ThrowIfNull(root);
47
Contract
.ThrowIfTrue(startToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken);
48
Contract
.ThrowIfTrue(endToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken);
78
Contract
.ThrowIfTrue(token.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\CSharpInferredMemberNameSimplifier.cs (2)
62
Contract
.ThrowIfNull(toRemove.NameColon);
84
Contract
.ThrowIfNull(toRemove.NameEquals);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (1)
183
Contract
.ThrowIfTrue(castNode.WalkUpParentheses().ContainsDiagnostics);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\FormattingRangeHelper.cs (1)
22
Contract
.ThrowIfTrue(endToken.Kind() == SyntaxKind.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesDirectiveComparer.cs (2)
134
Contract
.ThrowIfNull(using1!.Name);
135
Contract
.ThrowIfNull(using2!.Name);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Utilities\UsingsAndExternAliasesOrganizer.cs (2)
93
Contract
.ThrowIfNull(using1.Name);
94
Contract
.ThrowIfNull(using2.Name);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\CSharpCodeGenerationHelpers.cs (2)
117
Contract
.ThrowIfNull(syntax);
272
Contract
.ThrowIfNull(symbol);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CodeGeneration\NamedTypeGenerator.cs (1)
234
Contract
.ThrowIfNull(invokeMethod);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\TypeDeclarationSyntaxExtensions.cs (1)
72
Contract
.ThrowIfNull(typeNode);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.cs (2)
53
Contract
.ThrowIfNull(formattingRules);
54
Contract
.ThrowIfNull(root);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Indentation\CSharpIndentationService.Indenter.cs (5)
73
Contract
.ThrowIfNull(indenter.Tree);
74
Contract
.ThrowIfTrue(token.Kind() == SyntaxKind.None);
124
Contract
.ThrowIfNull(interpolatedExpression);
267
Contract
.ThrowIfNull(nonTerminalNode, @"Malformed code or bug in parser???");
280
Contract
.ThrowIfNull(nonTerminalNode, @"Malformed code or bug in parser???");
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpAddImportsService.cs (1)
134
Contract
.ThrowIfNull(rewritten);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpSyntaxGeneratorInternal.cs (1)
299
Contract
.ThrowIfNull(expression);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (4)
948
Contract
.ThrowIfTrue(previousToken.HasValue && previousToken.Value != operatorToken);
1116
Contract
.ThrowIfTrue(previousToken.HasValue && previousToken.Value != coalesceExpression.OperatorToken);
1906
Contract
.ThrowIfTrue(previousToken.HasValue && previousToken.Value != prefixUnaryExpression.OperatorToken);
1962
Contract
.ThrowIfTrue(previousToken.HasValue && previousToken.Value != awaitExpression.AwaitKeyword);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Lightup\NullableSyntaxAnnotationEx.cs (2)
29
Contract
.ThrowIfFalse(ReferenceEquals(Oblivious, NullableSyntaxAnnotation.Oblivious));
30
Contract
.ThrowIfFalse(ReferenceEquals(AnnotatedOrNotAnnotated, NullableSyntaxAnnotation.AnnotatedOrNotAnnotated));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\SemanticModelReuse\CSharpSemanticModelReuseLanguageService.cs (2)
31
Contract
.ThrowIfFalse(accessor.Parent is AccessorListSyntax);
32
Contract
.ThrowIfFalse(accessor.Parent.Parent is BasePropertyDeclarationSyntax);
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (1)
EmbeddedLanguages\VirtualChars\CSharpVirtualCharServiceTests.cs (1)
49
Contract
.ThrowIfNull(tokens);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (32)
CompleteStatement\AbstractCompleteStatementTests.cs (3)
41
Contract
.ThrowIfTrue(positions.IsEmpty && spans.IsEmpty, "Expected at least one test position");
42
Contract
.ThrowIfTrue(!positions.IsEmpty && !spans.IsEmpty, "Cannot test positions and spans at the same time");
54
Contract
.ThrowIfFalse(spans.Keys.ToArray() is [""]);
Completion\AbstractArgumentProviderTests`1.cs (3)
67
Contract
.ThrowIfNull(parameter);
102
Contract
.ThrowIfTrue(arguments.Any(argument => syntaxFacts.IsNamedArgument(argument)), "Named arguments are not currently supported by this test.");
103
Contract
.ThrowIfTrue(parameters.Any(parameter => parameter.IsParams), "'params' parameters are not currently supported by this test.");
Diagnostics\GenerateType\GenerateTypeTestState.cs (2)
35
Contract
.ThrowIfNull(_testDocument, "markup does not contain a cursor position");
47
Contract
.ThrowIfNull(ProjectToBeModified, "Project with the given name does not exist");
NavigateTo\NavigateToTestAggregator.Callback.cs (1)
26
Contract
.ThrowIfNull(options);
NavigateTo\NavigateToTestAggregator.cs (1)
26
Contract
.ThrowIfNull(itemProvider);
Options\OptionSerializerTests.cs (3)
79
Contract
.ThrowIfNull(defaultValue, $"Option: {option.Name}");
101
Contract
.ThrowIfNull(enumType, $"Option: {option.Name}");
132
Contract
.ThrowIfNull(defaultValue, $"Option: {option.Name}");
Squiggles\TestDiagnosticTagProducer.cs (1)
28
Contract
.ThrowIfNull(document.FilePath);
Structure\AbstractSyntaxStructureProviderTests.cs (2)
45
Contract
.ThrowIfNull(hostDocument.CursorPosition);
66
Contract
.ThrowIfNull(hostDocument.CursorPosition);
Workspaces\EditorTestHostDocument.cs (4)
108
Contract
.ThrowIfNull(field);
119
Contract
.ThrowIfNull(ExportProvider, $"Can only create text view for {nameof(TestHostDocument)} created with {nameof(ExportProvider)}");
150
Contract
.ThrowIfNull(LanguageServiceProvider, $"To get a text buffer for a {nameof(TestHostDocument)}, it must have been parented in a project.");
171
Contract
.ThrowIfNull(document);
Workspaces\EditorTestWorkspace.cs (12)
142
Contract
.ThrowIfNull(testDocument);
149
Contract
.ThrowIfNull(testDocument);
156
Contract
.ThrowIfNull(testDocument);
164
Contract
.ThrowIfNull(testDocument);
165
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
174
Contract
.ThrowIfNull(testDocument);
175
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
184
Contract
.ThrowIfNull(testDocument);
185
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
194
Contract
.ThrowIfNull(testDocument);
195
Contract
.ThrowIfFalse(testDocument.IsSourceGenerated);
217
Contract
.ThrowIfFalse(threadingContext.HasMainThread && threadingContext.JoinableTaskContext.IsOnMainThread);
Microsoft.CodeAnalysis.EditorFeatures.Text (15)
Extensions.SnapshotSourceText.cs (6)
40
Contract
.ThrowIfNull(editorSnapshot);
51
Contract
.ThrowIfNull(textImage);
101
Contract
.ThrowIfFalse(editorSnapshot.TextBuffer == container.GetTextBuffer());
228
Contract
.ThrowIfNull(editorSnapshot);
231
Contract
.ThrowIfNull(textImage);
245
Contract
.ThrowIfFalse(snapshot == editorSnapshot);
Extensions.TextBufferContainer.cs (1)
30
Contract
.ThrowIfNull(editorBuffer);
Shared\Extensions\ITextSnapshotExtensions.cs (3)
107
Contract
.ThrowIfNull(snapshot);
114
Contract
.ThrowIfNull(snapshot);
132
Contract
.ThrowIfNull(snapshot);
Shared\Extensions\ITextSnapshotLineExtensions.cs (5)
35
Contract
.ThrowIfNull(line);
61
Contract
.ThrowIfNull(line, "line");
62
Contract
.ThrowIfFalse(startIndex >= 0);
83
Contract
.ThrowIfNull(line, @"line");
84
Contract
.ThrowIfNull(predicate, @"tree");
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (9)
MetadataAsSource\AbstractMetadataAsSourceTests.TestContext.cs (4)
88
Contract
.ThrowIfNull(symbol);
107
Contract
.ThrowIfNull(symbol);
179
Contract
.ThrowIfNull(assemblySymbol);
320
Contract
.ThrowIfNull(symbol);
Tagging\AsynchronousTaggerTests.cs (5)
82
Contract
.ThrowIfNull(tagger);
110
Contract
.ThrowIfNull(tagger);
136
Contract
.ThrowIfNull(tagger);
188
Contract
.ThrowIfNull(tagger);
235
Contract
.ThrowIfNull(tagger);
Microsoft.CodeAnalysis.ExternalAccess.Copilot (2)
Internal\Analyzer\CSharp\CSharpCopilotCodeAnalysisService.cs (1)
164
Contract
.ThrowIfNull(GenerateImplementationService);
Internal\SemanticSearch\CopilotSemanticSearchQueryExecutor.cs (1)
69
Contract
.ThrowIfFalse(resultCountLimit > 0);
Microsoft.CodeAnalysis.ExternalAccess.Debugger (2)
GlassTestsHotReloadService.cs (2)
42
Contract
.ThrowIfFalse(_sessionId == default, "Session already started");
49
Contract
.ThrowIfFalse(sessionId != default, "Session has not started");
Microsoft.CodeAnalysis.ExternalAccess.FSharp (9)
Internal\Editor\FSharpSmartIndentProvider.cs (2)
42
Contract
.ThrowIfTrue(service == null && legacyService == null);
97
Contract
.ThrowIfNull(_provider._legacyService);
Internal\NavigateTo\FSharpNavigateToSearchService.cs (2)
58
Contract
.ThrowIfTrue(projects.IsEmpty);
59
Contract
.ThrowIfTrue(projects.Select(p => p.Language).Distinct().Count() != 1);
Internal\SignatureHelp\FSharpSignatureHelpProvider.cs (1)
57
Contract
.ThrowIfNull(_legacyProvider, "Either the new or legacy provider must be available");
SignatureHelp\FSharpSignatureHelpItems.cs (3)
67
Contract
.ThrowIfNull(items);
68
Contract
.ThrowIfTrue(items.IsEmpty());
69
Contract
.ThrowIfTrue(selectedItem.HasValue && selectedItem.Value >= items.Count);
SignatureHelp\FSharpSignatureHelpTriggerInfo.cs (1)
16
Contract
.ThrowIfTrue(triggerReason == FSharpSignatureHelpTriggerReason.TypeCharCommand && triggerCharacter == null);
Microsoft.CodeAnalysis.ExternalAccess.Razor.Features (9)
Cohost\Handlers\CodeActions.cs (2)
34
Contract
.ThrowIfNull(codeAction.Data);
58
Contract
.ThrowIfNull(data.CodeActionPath);
Cohost\Handlers\InlayHints.cs (1)
35
Contract
.ThrowIfNull(s_resolveCache, "Cache should never be null for resolve, since it should have been created by the original request");
RazorCSharpFormattingInteractionService.cs (3)
41
Contract
.ThrowIfFalse(document.Project.Language is LanguageNames.CSharp);
68
Contract
.ThrowIfFalse(root.Language is LanguageNames.CSharp);
79
Contract
.ThrowIfFalse(root.Language is LanguageNames.CSharp);
RazorUri.cs (1)
29
Contract
.ThrowIfFalse(IsGeneratedDocumentUri(generatedDocumentUri));
Remote\RazorPinnedSolutionInfoWrapper.cs (2)
29
Contract
.ThrowIfTrue(checksum == Checksum.Null && solution is null, "Either a Checksum or a Solution must be provided.");
30
Contract
.ThrowIfTrue(checksum != Checksum.Null && solution is not null, "Only one of Checksum or Solution can be provided.");
Microsoft.CodeAnalysis.ExternalAccess.Xaml (1)
External\ResolveDataConversions.cs (1)
23
Contract
.ThrowIfNull(requestData);
Microsoft.CodeAnalysis.Features (417)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParametersCodeAction.cs (1)
66
Contract
.ThrowIfNull(constructorDocument);
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.cs (1)
186
Contract
.ThrowIfNull(changedSolution);
AddImport\CodeActions\AssemblyReferenceCodeAction.cs (1)
30
Contract
.ThrowIfFalse(fixData.Kind == AddImportFixKind.ReferenceAssemblySymbol);
AddImport\CodeActions\InstallPackageAndAddImportCodeAction.cs (1)
38
Contract
.ThrowIfFalse(fixData.Kind == AddImportFixKind.PackageSymbol);
AddImport\CodeActions\MetadataSymbolReferenceCodeAction.cs (1)
24
Contract
.ThrowIfFalse(fixData.Kind == AddImportFixKind.MetadataSymbol);
AddImport\CodeActions\ProjectSymbolReferenceCodeAction.cs (1)
34
Contract
.ThrowIfFalse(fixData.Kind == AddImportFixKind.ProjectSymbol);
AddImport\SearchScopes\ProjectSearchScope.cs (1)
19
Contract
.ThrowIfFalse(project.SupportsCompilation);
AddImport\SymbolReferenceFinder_PackageAssemblySearch.cs (1)
25
Contract
.ThrowIfFalse(options.SearchNuGetPackages || options.SearchReferenceAssemblies);
CodeFixes\Configuration\ConfigurationUpdater.cs (2)
163
Contract
.ThrowIfFalse(!string.IsNullOrEmpty(category));
186
Contract
.ThrowIfNull(category);
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (1)
111
Contract
.ThrowIfNull(defaultValue);
CodeFixes\Service\CodeFixService.cs (3)
362
Contract
.ThrowIfNull(solution);
1020
Contract
.ThrowIfNull(x);
1021
Contract
.ThrowIfNull(y);
CodeFixes\Service\CodeFixService.FixAllDiagnosticProvider.cs (3)
49
Contract
.ThrowIfFalse(diagnostics.All(d => d.DocumentId != null));
62
Contract
.ThrowIfFalse(diagnostics.All(d => d.DocumentId != null));
81
Contract
.ThrowIfFalse(diagnostics.All(d => d.DocumentId == null));
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (1)
211
Contract
.ThrowIfFalse(batchOfFixes.Any());
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (4)
140
Contract
.ThrowIfFalse(!diagnostic.IsSuppressed);
159
Contract
.ThrowIfFalse(diagnostic.Location.IsInSource);
164
Contract
.ThrowIfNull(targetSymbol);
181
Contract
.ThrowIfFalse(!diagnostic.Location.IsInSource);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (2)
182
Contract
.ThrowIfFalse(indexOfTriviaToRemoveOrToggle >= 0);
189
Contract
.ThrowIfFalse(triviaToToggle != default);
CodeRefactorings\ExtractMethod\AbstractExtractMethodCodeRefactoringProvider.cs (2)
79
Contract
.ThrowIfNull(result);
110
Contract
.ThrowIfNull(localFunctionResult);
CodeRefactorings\MoveType\AbstractMoveTypeService.MoveTypeEditor.cs (1)
312
Contract
.ThrowIfNull(symbol);
CodeRefactorings\MoveType\AbstractMoveTypeService.RenameFileEditor.cs (1)
27
Contract
.ThrowIfNull(newSolution);
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (2)
908
Contract
.ThrowIfNull(x);
909
Contract
.ThrowIfNull(y);
Completion\Providers\AbstractAwaitCompletionProvider.cs (3)
120
Contract
.ThrowIfTrue(dotAwaitContext == DotAwaitContext.None);
216
Contract
.ThrowIfFalse(dotToken.HasValue);
217
Contract
.ThrowIfNull(expr);
Completion\Providers\AbstractCrefCompletionProvider.cs (1)
37
Contract
.ThrowIfNull(semanticModel);
Completion\Providers\AbstractMemberInsertingCompletionProvider.cs (4)
89
Contract
.ThrowIfNull(lineStart);
130
Contract
.ThrowIfNull(containingType);
162
Contract
.ThrowIfNull(startToken);
164
Contract
.ThrowIfNull(endToken);
Completion\Providers\AbstractObjectInitializerCompletionProvider.cs (1)
43
Contract
.ThrowIfNull(enclosing);
Completion\Providers\AbstractRecommendationServiceBasedCompletionProvider.cs (1)
231
Contract
.ThrowIfNull(context);
Completion\Providers\AbstractSymbolCompletionProvider.cs (2)
326
Contract
.ThrowIfNull(syntaxContext);
423
Contract
.ThrowIfNull(syntaxContext);
Completion\Providers\CompletionUtilities.cs (1)
47
Contract
.ThrowIfNull(solution);
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (1)
96
Contract
.ThrowIfTrue(quotedPath[0] != '"');
Completion\Providers\Snippets\SnippetCompletionItem.cs (3)
44
Contract
.ThrowIfFalse(item.TryGetProperty(SnippetIdentifierKey, out var text));
50
Contract
.ThrowIfFalse(item.TryGetProperty("Position", out var text));
51
Contract
.ThrowIfFalse(int.TryParse(text, out var num));
Completion\Utilities.cs (1)
54
Contract
.ThrowIfFalse(document.SupportsSemanticModel, "Should only be called from C#/VB providers.");
ConvertAutoPropertyToFullProperty\AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider.cs (1)
91
Contract
.ThrowIfNull(document.DocumentState.ParseOptions);
ConvertToInterpolatedString\AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider.cs (3)
71
Contract
.ThrowIfTrue(placeholderIndex < 0);
324
Contract
.ThrowIfNull(literalExpression);
345
Contract
.ThrowIfTrue(placeholderIndex < 0);
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (1)
546
Contract
.ThrowIfNull(containingMember,
Copilot\ICopilotChangeAnalysisService.cs (3)
57
Contract
.ThrowIfFalse(document.SupportsSemanticModel);
59
Contract
.ThrowIfTrue(!changes.IsSorted(static (c1, c2) => c1.Span.Start - c2.Span.Start), "'changes' was not sorted.");
60
Contract
.ThrowIfTrue(new NormalizedTextSpanCollection(changes.Select(c => c.Span)).Count != changes.Length, "'changes' was not normalized.");
Diagnostics\CodeAnalysisDiagnosticAnalyzerService.cs (1)
91
Contract
.ThrowIfFalse(project.Solution.Workspace == _workspace);
Diagnostics\Service\DocumentAnalysisExecutor.cs (1)
73
Contract
.ThrowIfFalse(AnalysisScope.ProjectAnalyzers.Contains(analyzer) || AnalysisScope.HostAnalyzers.Contains(analyzer));
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.cs (1)
35
Contract
.ThrowIfNull(analyzerService);
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.StateManager.ProjectStates.cs (1)
79
Contract
.ThrowIfTrue(newHostAnalyzers.Count > 0);
Diagnostics\Service\EngineV2\InProcOrRemoteHostAnalyzerRunner.cs (1)
66
Contract
.ThrowIfFalse(compilationWithAnalyzers.HasAnalyzers);
DocumentHighlighting\AbstractDocumentHighlightsService.cs (1)
117
Contract
.ThrowIfNull(symbol);
EditAndContinue\AbstractEditAndContinueAnalyzer.cs (69)
225
Contract
.ThrowIfFalse(oldSymbol != null || newSymbol != null);
514
Contract
.ThrowIfFalse(oldProject.SupportsEditAndContinue());
515
Contract
.ThrowIfFalse(newProject.SupportsEditAndContinue());
516
Contract
.ThrowIfTrue(newActiveStatementSpans.IsDefault);
526
Contract
.ThrowIfNull(filePath);
532
Contract
.ThrowIfFalse(newDocument == null || newDocument.State.SupportsEditAndContinue());
533
Contract
.ThrowIfFalse(oldDocument == null || oldDocument.State.SupportsEditAndContinue());
534
Contract
.ThrowIfFalse(oldDocument != null || newDocument != null);
918
Contract
.ThrowIfNull(oldProject.ParseOptions);
919
Contract
.ThrowIfNull(newProject.ParseOptions);
920
Contract
.ThrowIfNull(oldProject.CompilationOptions);
921
Contract
.ThrowIfNull(newProject.CompilationOptions);
966
Contract
.ThrowIfFalse(newExceptionRegions[i].IsDefault);
978
Contract
.ThrowIfFalse(hasPartner);
991
Contract
.ThrowIfNull(oldStatementSyntax);
1023
Contract
.ThrowIfFalse(statementPart == -1);
1028
Contract
.ThrowIfNull(newStatement);
1192
Contract
.ThrowIfNull(oldStatementSyntax);
1369
Contract
.ThrowIfNull(newStatementSyntax);
1370
Contract
.ThrowIfNull(newBody);
1550
Contract
.ThrowIfNull(newStatementSyntax);
2126
Contract
.ThrowIfNull(oldNode);
2141
Contract
.ThrowIfFalse(oldTypedNodes.Count == newTypedNodes.Count);
2148
Contract
.ThrowIfNull(oldType);
2149
Contract
.ThrowIfNull(newType);
2280
Contract
.ThrowIfNull(oldToken.Parent);
2281
Contract
.ThrowIfNull(newToken.Parent);
2771
Contract
.ThrowIfNull(symbol);
2869
Contract
.ThrowIfNull(oldSymbol);
2870
Contract
.ThrowIfNull(oldDeclaration);
3017
Contract
.ThrowIfNull(newSymbol);
3018
Contract
.ThrowIfNull(newDeclaration);
3125
Contract
.ThrowIfFalse(newSymbol is INamedTypeSymbol || IsGlobalMain(newSymbol));
3144
Contract
.ThrowIfFalse(editKind == SemanticEditKind.Insert);
3149
Contract
.ThrowIfNull(newContainingType);
3150
Contract
.ThrowIfNull(oldContainingType);
3166
Contract
.ThrowIfNull(oldSymbol);
3167
Contract
.ThrowIfNull(newSymbol);
3173
Contract
.ThrowIfNull(oldSymbol);
3174
Contract
.ThrowIfNull(newSymbol);
3252
Contract
.ThrowIfNull(oldDeclaration);
3253
Contract
.ThrowIfNull(oldSymbol);
3291
Contract
.ThrowIfFalse(editKind is SemanticEditKind.Update or SemanticEditKind.Insert);
3296
Contract
.ThrowIfNull(oldSymbol);
3458
Contract
.ThrowIfNull(oldSymbol);
3459
Contract
.ThrowIfNull(newSymbol);
3462
Contract
.ThrowIfNull(oldDeclaration);
3463
Contract
.ThrowIfNull(newDeclaration);
3499
Contract
.ThrowIfNull(newBody);
3507
Contract
.ThrowIfNull(newBody);
3527
Contract
.ThrowIfNull(oldContainingType);
3528
Contract
.ThrowIfNull(newContainingType);
3581
Contract
.ThrowIfFalse(oldSymbol != null || newSymbol != null);
3596
Contract
.ThrowIfNull(symbol);
4086
Contract
.ThrowIfFalse(oldMember is IFieldSymbol or IPropertySymbol or IEventSymbol);
4451
Contract
.ThrowIfNull(newType.DelegateInvokeMethod);
4693
Contract
.ThrowIfNull(oldSynthesizedDeconstructor);
4694
Contract
.ThrowIfNull(newSynthesizedDeconstructor);
5051
Contract
.ThrowIfNull(oldSymbol);
5060
Contract
.ThrowIfNull(newSymbol);
5525
Contract
.ThrowIfFalse(oldCtor is { MethodKind: MethodKind.Constructor or MethodKind.StaticConstructor });
5744
Contract
.ThrowIfNull(oldDeclaration);
6232
Contract
.ThrowIfNull(oldBackingField);
6307
Contract
.ThrowIfNull(symbol);
6420
Contract
.ThrowIfNull(primaryParameterMap);
6483
Contract
.ThrowIfTrue(oldCapture.IsThis);
6624
Contract
.ThrowIfFalse(IsClosureScope(scope));
6918
Contract
.ThrowIfNull(current);
7026
Contract
.ThrowIfNull(oldProperty);
EditAndContinue\ActiveStatementExceptionRegions.cs (1)
23
Contract
.ThrowIfTrue(spans.IsDefault);
EditAndContinue\CommittedSolution.cs (4)
246
Contract
.ThrowIfNull(document.FilePath);
342
Contract
.ThrowIfNull(document.FilePath);
414
Contract
.ThrowIfNull(sourceFilePath);
515
Contract
.ThrowIfNull(document.FilePath);
EditAndContinue\DebuggingSession.cs (7)
547
Contract
.ThrowIfTrue(solutionUpdate.ModuleUpdates.Updates.IsEmpty && solutionUpdate.ProjectsToRebuild.IsEmpty);
579
Contract
.ThrowIfFalse(solutionUpdate.ModuleUpdates.Updates.IsEmpty);
580
Contract
.ThrowIfFalse(solutionUpdate.NonRemappableRegions.IsEmpty);
583
Contract
.ThrowIfFalse(solutionUpdate.ProjectsToRestart.IsEmpty);
584
Contract
.ThrowIfFalse(solutionUpdate.ProjectsToRebuild.IsEmpty);
766
Contract
.ThrowIfNull(document.FilePath);
896
Contract
.ThrowIfNull(mappedDocument.FilePath);
EditAndContinue\DeclarationBodyMap.cs (1)
29
Contract
.ThrowIfFalse(forwardMatch.Count == reverseMatch.Count);
EditAndContinue\DocumentActiveStatementChanges.cs (2)
21
Contract
.ThrowIfFalse(oldSpans.Length == newStatements.Length);
22
Contract
.ThrowIfFalse(oldSpans.Length == newExceptionRegions.Length);
EditAndContinue\DocumentSemanticModel.cs (1)
42
Contract
.ThrowIfNull(Model);
EditAndContinue\EditAndContinueDocumentAnalysesCache.cs (1)
71
Contract
.ThrowIfFalse(oldDocument != null || newDocument != null);
EditAndContinue\EditAndContinueService.cs (6)
145
Contract
.ThrowIfTrue(captureAllMatchingDocuments && !captureMatchingDocuments.IsEmpty);
198
Contract
.ThrowIfNull(debuggingSession, "Debugging session has not started.");
208
Contract
.ThrowIfNull(debuggingSession);
239
Contract
.ThrowIfNull(debuggingSession);
247
Contract
.ThrowIfNull(debuggingSession);
255
Contract
.ThrowIfNull(debuggingSession);
EditAndContinue\EditSession.cs (11)
644
Contract
.ThrowIfFalse(oldProject.Language == newProject.Language);
726
Contract
.ThrowIfTrue(analysis.ActiveStatements.IsDefault);
776
Contract
.ThrowIfNull(oldResolution.Symbol);
787
Contract
.ThrowIfNull(newResolution.Symbol);
793
Contract
.ThrowIfNull(newResolution.Symbol);
813
Contract
.ThrowIfNull(newSymbol);
917
Contract
.ThrowIfNull(path);
1115
Contract
.ThrowIfNull(oldCompilation);
1126
Contract
.ThrowIfNull(newCompilation);
1213
Contract
.ThrowIfNull(emitResult.Baseline);
1325
Contract
.ThrowIfTrue(syntaxError != null);
EditAndContinue\RudeEditReportingCondition.cs (1)
18
Contract
.ThrowIfFalse(member.Kind is SymbolKind.Method or SymbolKind.Property or SymbolKind.Field);
EditAndContinue\SolutionSnapshotRegistry.cs (2)
54
Contract
.ThrowIfFalse(_pendingSolutionSnapshots.TryGetValue(id, out var solution));
55
Contract
.ThrowIfFalse(_pendingSolutionSnapshots.Remove(id));
EditAndContinue\TraceLog.cs (1)
55
Contract
.ThrowIfNull(_logDirectory);
EditAndContinue\Utilities\BidirectionalMap.cs (1)
21
Contract
.ThrowIfFalse(forward.Count == reverse.Count);
EditAndContinue\Utilities\Extensions.cs (2)
80
Contract
.ThrowIfFalse(project.SupportsEditAndContinue());
81
Contract
.ThrowIfNull(project.CompilationOptions);
EmbeddedLanguages\AbstractEmbeddedLanguageFeatureService.cs (1)
118
Contract
.ThrowIfTrue(services.IsDefaultOrEmpty);
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (3)
222
Contract
.ThrowIfNull(startString);
223
Contract
.ThrowIfNull(lengthString);
224
Contract
.ThrowIfNull(newText);
EmbeddedLanguages\ExportEmbeddedLanguageFeatureServiceAttribute.cs (2)
55
Contract
.ThrowIfFalse(contractType.IsInterface && typeof(IEmbeddedLanguageFeatureService).IsAssignableFrom(contractType),
60
Contract
.ThrowIfFalse(name is PredefinedEmbeddedLanguageNames.Regex or PredefinedEmbeddedLanguageNames.Json,
EmbeddedLanguages\RegularExpressions\RegexParser.cs (3)
884
Contract
.ThrowIfFalse(comment.HasValue);
1388
Contract
.ThrowIfNull(last);
1705
Contract
.ThrowIfNull(number);
EmbeddedLanguages\StackFrame\StackFrameParser.cs (2)
89
Contract
.ThrowIfFalse(_lexer.Position == _lexer.Text.Length);
90
Contract
.ThrowIfFalse(eolToken.Kind == StackFrameKind.EndOfFrame);
EncapsulateField\AbstractEncapsulateFieldService.cs (2)
143
Contract
.ThrowIfTrue(fields.Length == 0);
292
Contract
.ThrowIfFalse(resolution.IsSuccessful);
Extensions\ExtensionFolder.cs (2)
117
Contract
.ThrowIfTrue(!Monitor.IsEntered(_extensionMessageHandlerService._gate));
140
Contract
.ThrowIfTrue(!Monitor.IsEntered(_extensionMessageHandlerService._gate));
Extensions\ExtensionMessageHandlerService.cs (1)
68
Contract
.ThrowIfTrue(!Monitor.IsEntered(_gate));
ExternalAccess\UnitTesting\API\NewUnitTestingIncrementalAnalyzerProvider.cs (1)
44
Contract
.ThrowIfNull(workspaceKind);
ExternalAccess\UnitTesting\API\UnitTestingHotReloadService.cs (3)
77
Contract
.ThrowIfFalse(_sessionId == default, "Session already started");
95
Contract
.ThrowIfFalse(sessionId != default, "Session has not started");
136
Contract
.ThrowIfFalse(_sessionId != default, "Session has not started");
ExternalAccess\UnitTesting\Notification\AbstractGlobalOperationNotificationService.cs (4)
43
Contract
.ThrowIfFalse(_registrations.Count == 0);
44
Contract
.ThrowIfFalse(_operations.Count == 0, $"Non-disposed operations: {string.Join(", ", _operations)}");
73
Contract
.ThrowIfFalse(_operations.Count == 1);
86
Contract
.ThrowIfFalse(result);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingIdleProcessor.cs (2)
50
Contract
.ThrowIfFalse(_processorTask == null);
82
Contract
.ThrowIfTrue(_isPaused_doNotAccessDirectly);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingSolutionCrawlerRegistrationService.cs (3)
60
Contract
.ThrowIfNull(workspaceKind);
111
Contract
.ThrowIfNull(workspaceKind);
130
Contract
.ThrowIfNull(workspaceKind);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.cs (10)
169
Contract
.ThrowIfNull(args.ProjectId);
175
Contract
.ThrowIfNull(args.ProjectId);
180
Contract
.ThrowIfNull(args.ProjectId);
185
Contract
.ThrowIfNull(args.DocumentId);
191
Contract
.ThrowIfNull(args.DocumentId);
196
Contract
.ThrowIfNull(args.DocumentId);
209
Contract
.ThrowIfNull(args.ProjectId);
561
Contract
.ThrowIfNull(_projectOrDocumentIds);
609
Contract
.ThrowIfNull(_projectOrDocumentIds);
652
Contract
.ThrowIfNull(_projectOrDocumentIds);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingAsyncDocumentWorkItemQueue.cs (2)
87
Contract
.ThrowIfNull(lowPriorityDocumentId);
93
Contract
.ThrowIfNull(item.DocumentId);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs (1)
76
Contract
.ThrowIfNull(item.DocumentId);
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs (3)
63
Contract
.ThrowIfFalse(item.DocumentId != null, "can only enqueue a document work item");
79
Contract
.ThrowIfFalse(item.DocumentId != null);
172
Contract
.ThrowIfNull(workItem.DocumentId);
ExternalAccess\VSTypeScript\Api\VSTypeScriptDiagnosticData.cs (1)
41
Contract
.ThrowIfTrue(useMapped);
ExternalAccess\VSTypeScript\VSTypeScriptNavigateToSearchService.cs (2)
60
Contract
.ThrowIfTrue(projects.IsEmpty);
61
Contract
.ThrowIfTrue(projects.Select(p => p.Language).Distinct().Count() != 1);
ExtractClass\AbstractExtractClassRefactoringProvider.cs (1)
76
Contract
.ThrowIfNull(containingType);
ExtractClass\ExtractClassWithDialogCodeAction.cs (1)
205
Contract
.ThrowIfFalse(remainingResults.Count == 0);
ExtractMethod\AbstractSyntaxTriviaService.cs (6)
28
Contract
.ThrowIfNull(root);
29
Contract
.ThrowIfTrue(textSpan.IsEmpty);
35
Contract
.ThrowIfFalse(textSpan.Contains(tokens[TriviaLocation.AfterBeginningOfSpan].Span) && textSpan.Contains(tokens[TriviaLocation.BeforeEndOfSpan].Span));
54
Contract
.ThrowIfNull(root);
55
Contract
.ThrowIfNull(oldTokens);
56
Contract
.ThrowIfNull(computeReplacementToken);
ExtractMethod\AbstractSyntaxTriviaService.Result.cs (4)
31
Contract
.ThrowIfNull(root);
32
Contract
.ThrowIfNull(annotations);
33
Contract
.ThrowIfNull(triviaList);
112
Contract
.ThrowIfFalse(
ExtractMethod\Extensions.cs (1)
42
Contract
.ThrowIfNull(typeSymbol);
ExtractMethod\ExtractMethodFlowControlInformation.cs (1)
103
Contract
.ThrowIfFalse(valuesIndex == values.Length);
ExtractMethod\MethodExtractor.Analyzer.cs (9)
41
Contract
.ThrowIfNull(selectionResult);
90
Contract
.ThrowIfFalse(unused.Count == 0);
363
Contract
.ThrowIfTrue(variable.UseAsReturnValue);
409
Contract
.ThrowIfNull(dataFlowAnalysisData);
500
Contract
.ThrowIfTrue(bestEffort, "Should never fail if bestEffort is true");
511
Contract
.ThrowIfFalse(variableStyle.ParameterStyle.DeclarationBehavior == DeclarationBehavior.MoveIn || variableStyle.ParameterStyle.DeclarationBehavior == DeclarationBehavior.SplitIn);
605
Contract
.ThrowIfNull(type);
612
Contract
.ThrowIfTrue(bestEffort, "Should never fail if bestEffort is true");
835
Contract
.ThrowIfFalse(parameters.Length == arguments.Length);
ExtractMethod\MethodExtractor.CodeGenerator.cs (2)
297
Contract
.ThrowIfTrue(AnalyzerResult.GetVariablesToSplitOrMoveOutToCallSite().Any(v => v.UseAsReturnValue));
392
Contract
.ThrowIfFalse(variable.GetDeclarationBehavior() is
ExtractMethod\MethodExtractor.cs (1)
225
Contract
.ThrowIfNull(type);
ExtractMethod\MethodExtractor.VariableInfo.cs (4)
35
Contract
.ThrowIfFalse(!_useAsReturnValue || _variableStyle.ReturnStyle.ReturnBehavior != ReturnBehavior.None);
85
Contract
.ThrowIfNull(variable);
86
Contract
.ThrowIfFalse(variable.CanBeUsedAsReturnValue);
87
Contract
.ThrowIfFalse(variable.ParameterModifier is ParameterBehavior.Out or ParameterBehavior.Ref);
ExtractMethod\MethodExtractor.VariableSymbol.cs (5)
67
Contract
.ThrowIfNull(other);
109
Contract
.ThrowIfFalse(locationLeft.IsInSource);
110
Contract
.ThrowIfFalse(locationRight.IsInSource);
111
Contract
.ThrowIfFalse(locationLeft.SourceTree == locationRight.SourceTree);
150
Contract
.ThrowIfFalse(Symbol.Ordinal != other.Symbol.Ordinal);
ExtractMethod\OperationStatus.cs (1)
20
Contract
.ThrowIfTrue(reasons.IsDefault);
ExtractMethod\SelectionResult.cs (5)
108
Contract
.ThrowIfTrue(IsExtractMethodOnExpression);
116
Contract
.ThrowIfTrue(IsExtractMethodOnExpression);
209
Contract
.ThrowIfTrue(IsExtractMethodOnExpression);
243
Contract
.ThrowIfNull(root);
256
Contract
.ThrowIfNull(root);
ExtractMethod\UniqueNameGenerator.cs (3)
15
Contract
.ThrowIfNull(semanticModel);
21
Contract
.ThrowIfNull(contextNode);
22
Contract
.ThrowIfNull(baseName);
FindUsages\DefinitionItem.cs (5)
136
Contract
.ThrowIfFalse(classifiedSpans.IsEmpty || sourceSpans.Length == classifiedSpans.Length);
140
Contract
.ThrowIfFalse(Properties.ContainsKey(MetadataSymbolOriginatingProjectIdGuid));
141
Contract
.ThrowIfFalse(Properties.ContainsKey(MetadataSymbolOriginatingProjectIdDebugName));
232
Contract
.ThrowIfTrue(sourceSpans.IsDefault);
233
Contract
.ThrowIfTrue(metadataLocations.IsDefault);
FindUsages\DefinitionItem.DefaultDefinitionItem.cs (1)
47
Contract
.ThrowIfNull(project);
FindUsages\DefinitionItemFactory.cs (7)
126
Contract
.ThrowIfNull(originatingProjectId);
157
Contract
.ThrowIfNull(info);
158
Contract
.ThrowIfNull(info.ReferencedThrough);
192
Contract
.ThrowIfTrue(namespaceSymbol.ConstituentNamespaces.IsEmpty);
207
Contract
.ThrowIfNull(containingAssembly);
210
Contract
.ThrowIfNull(info);
211
Contract
.ThrowIfNull(info.ReferencedThrough);
FindUsages\IRemoteFindUsagesService.cs (2)
155
Contract
.ThrowIfFalse(_idToDefinition.ContainsKey(definitionId));
177
Contract
.ThrowIfNull(document);
FullyQualify\AbstractFullyQualifyService.cs (2)
168
Contract
.ThrowIfNull(rightSide);
197
Contract
.ThrowIfNull(symbolResult.OriginalSymbol);
GenerateConstructors\AbstractGenerateConstructorsCodeRefactoringProvider.ConstructorDelegatingCodeAction.cs (1)
47
Contract
.ThrowIfNull(_state.DelegatedConstructor);
GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.cs (1)
248
Contract
.ThrowIfNull(globalOptions);
GenerateType\AbstractGenerateTypeService.Editor.cs (1)
69
Contract
.ThrowIfFalse(document.Project.Solution == generateTypeOptionsResult.Project.Solution);
GenerateType\AbstractGenerateTypeService.State.cs (1)
116
Contract
.ThrowIfNull(generateTypeServiceStateOptions.NameOrMemberAccessExpression);
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (1)
729
Contract
.ThrowIfNull(symbol.ContainingAssembly);
InitializeParameter\AbstractAddParameterCheckCodeRefactoringProvider.cs (1)
198
Contract
.ThrowIfNull(parameterSyntax);
InlineMethod\AbstractInlineMethodRefactoringProvider.MethodParametersInfo.cs (1)
440
Contract
.ThrowIfNull(parameterSymbol, "We filtered out varags methods earlier.");
IntroduceParameter\IntroduceParameterDocumentRewriter.cs (2)
138
Contract
.ThrowIfNull(parameterList);
451
Contract
.ThrowIfNull(newMethodDeclaration);
IntroduceVariable\AbstractIntroduceLocalForExpressionCodeRefactoringProvider.cs (1)
111
Contract
.ThrowIfNull(type);
LanguageServices\SymbolDisplayService\AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs (3)
285
Contract
.ThrowIfFalse(symbolGroup.Length > 0);
294
Contract
.ThrowIfFalse(symbolGroup.Length > 0);
694
Contract
.ThrowIfTrue(symbol.TypeParameterKind == TypeParameterKind.Cref);
MetadataAsSource\AbstractMetadataAsSourceService.cs (1)
30
Contract
.ThrowIfNull(rootNamespace);
MetadataAsSource\DecompilationMetadataAsSourceFileProvider.cs (6)
289
Contract
.ThrowIfTrue(_openedDocumentIds.ContainsKey(fileInfo));
324
Contract
.ThrowIfNull(documentId);
362
Contract
.ThrowIfFalse(_openedDocumentIds.IsEmpty);
369
Contract
.ThrowIfNull(compilation, "We are trying to produce a key for a language that doesn't support compilations.");
405
Contract
.ThrowIfNull(filePath);
416
Contract
.ThrowIfNull(assemblyIdentity);
MetadataAsSource\MetadataAsSourceFileService.cs (4)
101
Contract
.ThrowIfNull(_workspace);
165
Contract
.ThrowIfFalse(threadingService.IsOnMainThread);
250
Contract
.ThrowIfNull(document.FilePath);
260
Contract
.ThrowIfNull(_workspace);
MoveStaticMembers\AbstractMoveStaticMembersRefactoringProvider.cs (1)
51
Contract
.ThrowIfNull(containingType);
NavigateTo\AbstractNavigateToSearchService.CachedDocumentSearch.cs (2)
72
Contract
.ThrowIfTrue(projects.IsEmpty);
73
Contract
.ThrowIfTrue(projects.Select(p => p.Language).Distinct().Count() != 1);
NavigateTo\AbstractNavigateToSearchService.GeneratedDocumentSearch.cs (2)
33
Contract
.ThrowIfTrue(projects.IsEmpty);
34
Contract
.ThrowIfTrue(projects.Select(p => p.Language).Distinct().Count() != 1);
NavigateTo\AbstractNavigateToSearchService.NormalSearch.cs (2)
158
Contract
.ThrowIfTrue(projects.IsEmpty);
159
Contract
.ThrowIfTrue(projects.Select(p => p.Language).Distinct().Count() != 1);
NavigateTo\NavigateToSearcher.cs (1)
494
Contract
.ThrowIfFalse(orderedProjects.SelectMany(s => s).Count() == filteredProjects.SelectMany(s => s).Count());
NavigationBar\NavigationBarItems\RoslynNavigationBarItem.SymbolItem.cs (3)
83
Contract
.ThrowIfTrue(inDocumentInfo == null && otherDocumentInfo == null, "Both locations were null");
84
Contract
.ThrowIfTrue(inDocumentInfo != null && otherDocumentInfo != null, "Both locations were not null");
88
Contract
.ThrowIfTrue(inDocumentInfo.Value.spans.IsEmpty, "If location is in document, it must have non-empty spans");
PdbSourceDocument\PdbFileLocatorService.cs (1)
44
Contract
.ThrowIfNull(pdbReaderProvider);
PdbSourceDocument\PdbSourceDocumentMetadataAsSourceFileProvider.cs (3)
98
Contract
.ThrowIfNull(telemetryMessage);
294
Contract
.ThrowIfNull(navigateDocument);
392
Contract
.ThrowIfTrue(_openedDocumentIds.Contains(info.DocumentId));
PullMemberUp\AbstractPullMemberUpRefactoringProvider.cs (1)
49
Contract
.ThrowIfNull(containingType);
QuickInfo\Presentation\TaggedTextExtensions.cs (5)
92
Contract
.ThrowIfNull(part.NavigationTarget);
127
Contract
.ThrowIfFalse(_paragraphs.Count == 0);
128
Contract
.ThrowIfFalse(_lines.Count == 0);
129
Contract
.ThrowIfFalse(_runs.Count == 0);
211
Contract
.ThrowIfTrue(_lines.Count == 0);
Rename\SymbolicRenameInfo.cs (3)
63
Contract
.ThrowIfTrue(this.IsError);
90
Contract
.ThrowIfTrue(this.IsError);
97
Contract
.ThrowIfTrue(this.IsError);
ReplaceConditionalWithStatements\AbstractReplaceConditionalWithStatementsCodeRefactoringProvider.cs (2)
233
Contract
.ThrowIfNull(initializer);
300
Contract
.ThrowIfNull(containerWithConditionalReplaced);
ReplacePropertyWithMethods\AbstractReplacePropertyWithMethodsService.cs (2)
124
Contract
.ThrowIfNull(_expression.Parent, $"Parent of {_expression} is null.");
291
Contract
.ThrowIfNull(_expression.Parent, $"Parent of {_expression} is null.");
ReplacePropertyWithMethods\ReplacePropertyWithMethodsCodeRefactoringProvider.cs (3)
52
Contract
.ThrowIfNull(propertySymbol);
258
Contract
.ThrowIfNull(parent);
434
Contract
.ThrowIfFalse(x.location.Document == y.location.Document);
SemanticSearch\IRemoteSemanticSearchService.cs (2)
135
Contract
.ThrowIfNull(client);
145
Contract
.ThrowIfNull(client);
SignatureHelp\SignatureHelpItems.cs (3)
69
Contract
.ThrowIfNull(items);
70
Contract
.ThrowIfTrue(items.IsEmpty());
71
Contract
.ThrowIfTrue(selectedItem.HasValue && selectedItem.Value >= items.Count);
SignatureHelp\SignatureHelpTriggerInfo.cs (1)
15
Contract
.ThrowIfTrue(triggerReason == SignatureHelpTriggerReason.TypeCharCommand && triggerCharacter == null);
Snippets\AbstractSnippetService.cs (1)
30
Contract
.ThrowIfFalse(_identifierToProviderMap.ContainsKey(snippetIdentifier));
Snippets\RoslynLSPSnippetConverter.cs (2)
36
Contract
.ThrowIfNull(textChangeText);
126
Contract
.ThrowIfNull(textChangeText);
Snippets\SnippetProviders\AbstractConsoleSnippetProvider.cs (1)
78
Contract
.ThrowIfNull(snippetExpressionNode);
Snippets\SnippetProviders\AbstractSnippetProvider.cs (1)
213
Contract
.ThrowIfNull(snippetExpressionNode);
SolutionCrawler\AbstractDocumentDifferenceService.cs (2)
69
Contract
.ThrowIfNull(oldRoot);
70
Contract
.ThrowIfNull(newRoot);
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
58
Contract
.ThrowIfFalse(option.Value is ForEachExplicitCastInSourcePreference.Always or ForEachExplicitCastInSourcePreference.WhenStronglyTyped);
src\Analyzers\Core\Analyzers\Formatting\AbstractFormattingAnalyzer.cs (2)
62
Contract
.ThrowIfNull(change.NewText);
89
Contract
.ThrowIfNull(change.NewText);
src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (3)
212
Contract
.ThrowIfTrue(additionalLocations.IsEmpty());
213
Contract
.ThrowIfTrue(tagIndices.IsEmpty());
223
Contract
.ThrowIfFalse(indices.All(idx => idx >= 0 && idx < additionalLocationsLength));
src\Analyzers\Core\Analyzers\RemoveUnusedParametersAndValues\AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.BlockAnalyzer.cs (2)
124
Contract
.ThrowIfFalse(context.FilterSpan != symbolStartAnalyzer._symbolStartAnalysisContext.FilterSpan);
125
Contract
.ThrowIfNull(symbolStartAnalyzer._symbolStartAnalysisContext.FilterTree);
src\Analyzers\Core\Analyzers\SimplifyInterpolation\AbstractSimplifyInterpolationHelpers.cs (3)
91
Contract
.ThrowIfNull(expression.SemanticModel);
151
Contract
.ThrowIfNull(operation.SemanticModel);
170
Contract
.ThrowIfNull(operation.SemanticModel);
src\Analyzers\Core\Analyzers\UseAutoProperty\AbstractUseAutoPropertyAnalyzer.cs (2)
200
Contract
.ThrowIfNull(context.FilterTree);
485
Contract
.ThrowIfFalse(TryGetSyntax(getterField, out var fieldDeclaration, out var variableDeclarator, cancellationToken));
src\Analyzers\Core\Analyzers\UseCollectionInitializer\AbstractUseCollectionInitializerAnalyzer.cs (1)
160
Contract
.ThrowIfTrue(seenInvocation && seenIndexAssignment);
src\Analyzers\Core\Analyzers\UseCollectionInitializer\UpdateExpressionState.cs (2)
229
Contract
.ThrowIfTrue(arguments.Count == 0);
230
Contract
.ThrowIfFalse(this.SyntaxFacts.IsSimpleMemberAccessExpression(memberAccess));
src\Analyzers\Core\Analyzers\UseConditionalExpression\UseConditionalExpressionHelpers.cs (1)
56
Contract
.ThrowIfNull(semanticModel);
src\Analyzers\Core\Analyzers\UseThrowExpression\AbstractUseThrowExpressionDiagnosticAnalyzer.cs (1)
80
Contract
.ThrowIfNull(semanticModel);
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AbstractAddAccessibilityModifiersCodeFixProvider.cs (1)
52
Contract
.ThrowIfNull(symbol);
src\Analyzers\Core\CodeFixes\AddAccessibilityModifiers\AddAccessibilityModifiersHelpers.cs (1)
15
Contract
.ThrowIfNull(symbol);
src\Analyzers\Core\CodeFixes\AddObsoleteAttribute\AbstractAddObsoleteAttributeCodeFixProvider.cs (1)
77
Contract
.ThrowIfNull(obsoleteAttribute);
src\Analyzers\Core\CodeFixes\DocumentationComments\AbstractRemoveDocCommentNodeCodeFixProvider.cs (1)
81
Contract
.ThrowIfNull(newRoot);
src\Analyzers\Core\CodeFixes\ForEachCast\AbstractForEachCastCodeFixProvider.cs (2)
67
Contract
.ThrowIfNull(variableDeclarator.Symbol.Type);
68
Contract
.ThrowIfNull(enumerableType);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.cs (1)
89
Contract
.ThrowIfNull(state.TypeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateConstructor\AbstractGenerateConstructorService.State.cs (10)
105
Contract
.ThrowIfNull(TypeToGenerateIn);
125
Contract
.ThrowIfNull(TypeToGenerateIn);
142
Contract
.ThrowIfNull(TypeToGenerateIn);
185
Contract
.ThrowIfNull(TypeToGenerateIn);
186
Contract
.ThrowIfNull(TypeToGenerateIn.BaseType);
207
Contract
.ThrowIfNull(TypeToGenerateIn);
241
Contract
.ThrowIfNull(TypeToGenerateIn);
425
Contract
.ThrowIfNull(TypeToGenerateIn);
458
Contract
.ThrowIfNull(TypeToGenerateIn);
480
Contract
.ThrowIfNull(TypeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateConstructor\GenerateConstructorHelpers.cs (1)
303
Contract
.ThrowIfNull(typeToGenerateIn);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\AbstractGenerateDefaultConstructorsService.cs (1)
49
Contract
.ThrowIfNull(state.ClassType);
src\Analyzers\Core\CodeFixes\GenerateDefaultConstructors\GenerateDefaultConstructorsCodeAction.cs (2)
32
Contract
.ThrowIfNull(_state.ClassType);
53
Contract
.ThrowIfNull(classType);
src\Analyzers\Core\CodeFixes\GenerateMember\AbstractGenerateMemberService.cs (1)
131
Contract
.ThrowIfNull(attributeNode);
src\Analyzers\Core\CodeFixes\MakeFieldReadonly\AbstractMakeFieldReadonlyCodeFixProvider.cs (1)
80
Contract
.ThrowIfNull(symbol);
src\Analyzers\Core\CodeFixes\MakeMethodAsynchronous\AbstractMakeMethodAsynchronousCodeFixProvider.cs (2)
109
Contract
.ThrowIfNull(node);
116
Contract
.ThrowIfNull(methodSymbol);
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (2)
59
Contract
.ThrowIfNull(methodSymbol);
252
Contract
.ThrowIfNull(currentInvocationExpression);
src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
50
Contract
.ThrowIfNull(serializedNamingStyle);
src\Analyzers\Core\CodeFixes\RemoveUnusedMembers\AbstractRemoveUnusedMembersCodeFixProvider.cs (2)
57
Contract
.ThrowIfNull(symbol);
70
Contract
.ThrowIfNull(fieldDeclarator);
src\Analyzers\Core\CodeFixes\RemoveUnusedParametersAndValues\AbstractRemoveUnusedValuesCodeFixProvider.cs (6)
496
Contract
.ThrowIfNull(variableDeclarator);
512
Contract
.ThrowIfFalse(node.GetRequiredParent().Parent is TExpressionStatementSyntax);
602
Contract
.ThrowIfNull(type);
603
Contract
.ThrowIfNull(newLocalNameOpt);
858
Contract
.ThrowIfNull(declStatement);
904
Contract
.ThrowIfNull(rootWithRemovedDeclaration);
src\Analyzers\Core\CodeFixes\UseCoalesceExpression\AbstractUseCoalesceExpressionForIfNullStatementCheckCodeFixProvider.cs (1)
89
Contract
.ThrowIfNull(expression); // checked in analyzer.
src\Analyzers\Core\CodeFixes\UseExplicitTupleName\UseExplicitTupleNameCodeFixProvider.cs (1)
44
Contract
.ThrowIfNull(preferredName);
src\Analyzers\Core\CodeFixes\UseNullPropagation\AbstractUseNullPropagationCodeFixProvider.cs (1)
181
Contract
.ThrowIfNull(newWhenTrueStatement);
src\Analyzers\Core\CodeFixes\UseObjectInitializer\AbstractUseObjectInitializerCodeFixProvider.cs (1)
81
Contract
.ThrowIfNull(statement);
SymbolMapping\SymbolMappingResult.cs (2)
14
Contract
.ThrowIfNull(project);
15
Contract
.ThrowIfNull(symbol);
UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (3)
193
Contract
.ThrowIfTrue(field == null || property == null);
262
Contract
.ThrowIfNull(newFieldTreeRoot);
380
Contract
.ThrowIfFalse(fieldDocument.Project == propertyDocument.Project);
ValueTracking\SerializableValueTrackedItem.cs (1)
48
Contract
.ThrowIfNull(symbolResolution.Symbol);
ValueTracking\ValueTrackedItem.cs (1)
46
Contract
.ThrowIfNull(location.SourceTree);
Wrapping\AbstractCodeActionComputer.cs (2)
233
Contract
.ThrowIfNull(nodeToFormat);
265
Contract
.ThrowIfNull(rewrittenRoot);
Wrapping\SeparatedSyntaxList\SeparatedSyntaxListCodeActionComputer.cs (1)
339
Contract
.ThrowIfFalse(comma.IsToken);
Microsoft.CodeAnalysis.Features.Test.Utilities (6)
EditAndContinue\EditAndContinueTestVerifier.cs (3)
187
Contract
.ThrowIfNull(oldModel);
188
Contract
.ThrowIfNull(newModel);
435
Contract
.ThrowIfFalse(actualSyntaxMaps.HasMap);
EditAndContinue\SourceMarkers.cs (3)
63
Contract
.ThrowIfFalse(isStartingTag || isEndingTag);
84
Contract
.ThrowIfFalse(end >= 0, $"Missing ending tag for {id}");
111
Contract
.ThrowIfTrue(result.Any(span => span == default));
Microsoft.CodeAnalysis.Features.UnitTests (41)
EditAndContinue\RemoteEditAndContinueServiceTests.cs (1)
153
Contract
.ThrowIfNull(sessionProxy);
FindUsages\DefinitionItemFactoryTests.cs (40)
135
Contract
.ThrowIfNull(compilation);
171
Contract
.ThrowIfNull(compilation);
213
Contract
.ThrowIfNull(compilation);
249
Contract
.ThrowIfNull(compilation);
291
Contract
.ThrowIfNull(compilation);
333
Contract
.ThrowIfNull(compilation);
386
Contract
.ThrowIfNull(compilation);
440
Contract
.ThrowIfNull(compilation);
480
Contract
.ThrowIfNull(compilation);
520
Contract
.ThrowIfNull(compilation);
562
Contract
.ThrowIfNull(compilation);
620
Contract
.ThrowIfNull(compilation);
666
Contract
.ThrowIfNull(compilation);
703
Contract
.ThrowIfNull(compilation);
765
Contract
.ThrowIfNull(compilation);
821
Contract
.ThrowIfNull(compilation);
875
Contract
.ThrowIfNull(compilation);
932
Contract
.ThrowIfNull(tree);
935
Contract
.ThrowIfNull(compilation);
980
Contract
.ThrowIfNull(compilation);
1035
Contract
.ThrowIfNull(compilation);
1087
Contract
.ThrowIfNull(compilation);
1149
Contract
.ThrowIfNull(compilation);
1152
Contract
.ThrowIfNull(g);
1206
Contract
.ThrowIfNull(compilation);
1209
Contract
.ThrowIfNull(g);
1263
Contract
.ThrowIfNull(compilation);
1337
Contract
.ThrowIfNull(tree);
1340
Contract
.ThrowIfNull(compilation);
1397
Contract
.ThrowIfNull(tree);
1400
Contract
.ThrowIfNull(compilation);
1448
Contract
.ThrowIfNull(tree);
1451
Contract
.ThrowIfNull(compilation);
1455
Contract
.ThrowIfNull(f);
1512
Contract
.ThrowIfNull(tree);
1515
Contract
.ThrowIfNull(compilation);
1521
Contract
.ThrowIfNull(x);
1583
Contract
.ThrowIfNull(tree);
1586
Contract
.ThrowIfNull(compilation);
1592
Contract
.ThrowIfNull(r);
Microsoft.CodeAnalysis.LanguageServer (45)
BrokeredServices\MefServiceBrokerOfExportedServices.cs (1)
30
Contract
.ThrowIfNull(_containerTask, $"{nameof(SetContainer)} should have already been called.");
BrokeredServices\ServiceBrokerFactory.cs (2)
56
Contract
.ThrowIfNull(_container);
65
Contract
.ThrowIfFalse(_container == null, "We should only create one container.");
BrokeredServices\WrappedServiceBroker.cs (1)
29
Contract
.ThrowIfTrue(_serviceBrokerTask.Task.IsCompleted);
DotnetCliHelper.cs (2)
109
Contract
.ThrowIfNull(process, $"Unable to start dotnet CLI at {_dotnetExecutablePath.Value} with arguments {arguments} in directory {workingDirectory}");
120
Contract
.ThrowIfFalse(File.Exists(vstestConsole), $"VSTestConsole was not found at {vstestConsole}");
FileBasedPrograms\FileBasedProgramsProjectSystem.cs (3)
81
Contract
.ThrowIfNull(metadataWorkspace);
86
Contract
.ThrowIfNull(primordialDoc.FilePath);
100
Contract
.Fail($"Could not find language information for {uri} with absolute path {documentFilePath}");
FileBasedPrograms\VirtualProjectXmlProvider.cs (1)
149
Contract
.ThrowIfFalse(PathUtilities.IsAbsolute(documentFilePath));
HostWorkspace\FileWatching\LspFileChangeWatcher.cs (1)
34
Contract
.ThrowIfFalse(SupportsLanguageServerHost(languageServerHost));
HostWorkspace\LanguageServerProjectLoader.cs (2)
189
Contract
.ThrowIfFalse(PathUtilities.IsAbsolute(projectPath));
389
Contract
.Fail($"Cannot begin loading project '{projectPath}' because it has already begun loading.");
HostWorkspace\LoadedProject.cs (5)
48
Contract
.ThrowIfNull(projectSystemProject.FilePath);
102
Contract
.ThrowIfNull(_mostRecentFileInfo, "We haven't been given a loaded project yet, so we can't provide the existing TFM.");
122
Contract
.ThrowIfFalse(newProjectInfo.FilePath == _mostRecentFileInfo.FilePath);
123
Contract
.ThrowIfFalse(newProjectInfo.TargetFramework == _mostRecentFileInfo.TargetFramework);
241
Contract
.ThrowIfNull(_projectSystemProject.CompilationOptions, "Compilation options cannot be null for C#/VB project");
HostWorkspace\ProjectDependencyHelper.cs (1)
129
Contract
.ThrowIfNull(LanguageServerHost.Instance, "We don't have an LSP channel yet to send this request through.");
HostWorkspace\ProjectInitializationHandler.cs (2)
47
Contract
.ThrowIfNull(LanguageServerHost.Instance, "We don't have an LSP channel yet to send this request through.");
61
Contract
.ThrowIfFalse(didSubscribe, $"Unable to subscribe to {Descriptors.RemoteProjectInitializationStatusService.Moniker}");
HostWorkspace\ProjectTelemetry\ProjectLoadTelemetryReporter.cs (1)
94
Contract
.ThrowIfNull(instance, nameof(instance));
HostWorkspace\WorkspaceProject.cs (2)
178
Contract
.ThrowIfNull(_project.FilePath, "We don't have a project path at this point.");
184
Contract
.ThrowIfNull(fileDirectory);
LanguageServer\Handler\DebugConfiguration\WorkspaceDebugConfigurationHandler.cs (1)
33
Contract
.ThrowIfNull(context.Solution, nameof(context.Solution));
LanguageServer\Handler\Restore\RestorableProjectsHandler.cs (1)
30
Contract
.ThrowIfNull(context.Solution);
LanguageServer\Handler\Restore\RestoreHandler.cs (1)
33
Contract
.ThrowIfNull(context.Solution);
Logging\RoslynLogger.cs (1)
32
Contract
.ThrowIfTrue(_instance is not null);
Logging\ServerLoggerFactory.cs (3)
26
Contract
.ThrowIfTrue(_loggerFactory is not null);
32
Contract
.ThrowIfNull(_loggerFactory);
38
Contract
.ThrowIfNull(_loggerFactory);
Logging\ShowToastNotification.cs (1)
29
Contract
.ThrowIfNull(LanguageServerHost.Instance, "We don't have an LSP channel yet to send this request through.");
ServerConfigurationFactory.cs (1)
31
Contract
.ThrowIfFalse(_serverConfiguration == null);
Services\ExtensionAssemblyManager.cs (2)
70
Contract
.ThrowIfFalse(TryGetOrCreateLoadContext(starredCompletionsComponentDll));
142
Contract
.ThrowIfNull(devKitDependencyDirectory);
Services\StarredCompletions\StarredCompletionProvider.cs (2)
32
Contract
.ThrowIfNull(provider, "ProvideCompletionsAsync must have completed successfully for GetChangeAsync to be called");
39
Contract
.ThrowIfNull(provider, "ProvideCompletionsAsync must have completed successfully for GetDescriptionAsync to be called");
Testing\RunTestsHandler.cs (5)
38
Contract
.ThrowIfNull(context.Document);
45
Contract
.ThrowIfFalse(File.Exists(projectOutputPath), $"Output path {projectOutputPath} is missing");
47
Contract
.ThrowIfNull(projectOutputDirectory, $"Could not get project output directory from {projectOutputPath}");
125
Contract
.ThrowIfNull(workingDirectory, $"Unable to get working directory for project {document.Project.Name}");
128
Contract
.ThrowIfNull(projectFileName, $"Unable to get project file name for project {document.Project.Name}");
Testing\TestDiscoverer.DiscoveryHandler.cs (2)
53
Contract
.ThrowIfFalse(_isComplete, "Tried to get test cases before discovery completed");
59
Contract
.ThrowIfFalse(_isComplete, "Tried to get discovery status before completion");
Testing\TestRunner.TestRunHandler.cs (1)
82
Contract
.ThrowIfTrue(_isComplete);
Microsoft.CodeAnalysis.LanguageServer.Protocol (120)
Extensions\Extensions.cs (10)
28
Contract
.ThrowIfNull(document.FilePath);
40
Contract
.ThrowIfNull(document.FilePath);
41
Contract
.ThrowIfNull(document.Name);
42
Contract
.ThrowIfTrue(document is SourceGeneratedDocument);
45
Contract
.ThrowIfNull(directoryName);
52
Contract
.ThrowIfNull(document.Name);
53
Contract
.ThrowIfNull(document.Project.FilePath);
56
Contract
.ThrowIfNull(projectDirectoryName);
63
Contract
.ThrowIfNull(documentUri.ParsedUri, $"URI {documentUri} could not be parsed");
109
Contract
.ThrowIfTrue(textDocument is not null && textDocument is not Document, $"{textDocument!.Id} is not a Document");
Extensions\ProtocolConversions.cs (8)
152
Contract
.ThrowIfNull(context.TriggerCharacter);
153
Contract
.ThrowIfFalse(char.TryParse(context.TriggerCharacter, out var triggerChar));
164
Contract
.ThrowIfNull(context.TriggerCharacter);
165
Contract
.ThrowIfFalse(char.TryParse(context.TriggerCharacter, out var triggerChar));
181
Contract
.ThrowIfTrue(position < 1);
345
Contract
.ThrowIfNull(textChange.NewText);
410
Contract
.ThrowIfNull(textDiffService);
1025
Contract
.ThrowIfFalse(textSpans.Length == mappedSpanResult.Length,
Extensions\ProtocolConversions.Diagnostics.cs (3)
55
Contract
.ThrowIfNull(diagnostic.Tags, $"diagnostic {diagnostic.Identifier} was missing tags");
101
Contract
.ThrowIfNull(diagnosticData.Message, $"Got a document diagnostic that did not have a {nameof(diagnosticData.Message)}");
268
Contract
.ThrowIfNull(diagnosticData.Language, $"diagnostic {diagnosticData.Id} is missing a language");
Extensions\SourceGeneratedDocumentUri.cs (1)
87
Contract
.ThrowIfNull(value, $"Could not get {keyName} from {query}");
ExternalAccess\Razor\SemanticTokensRangesHandler.cs (2)
31
Contract
.ThrowIfNull(request.TextDocument);
40
Contract
.ThrowIfNull(request.TextDocument, "TextDocument is null.");
Features\CodeCleanup\AbstractCodeCleanupService.cs (1)
185
Contract
.ThrowIfNull(solution);
Features\DecompiledSource\AssemblyResolver.cs (1)
175
Contract
.ThrowIfNull(fileName);
Handler\AbstractRefreshQueue.cs (1)
102
Contract
.ThrowIfNull(_refreshQueue);
Handler\Breakpoints\ValidateBreakableRangeHandler.cs (1)
62
Contract
.ThrowIfNull(tree);
Handler\CodeActions\CodeActionFixAllResolveHandler.cs (4)
41
Contract
.ThrowIfNull(request.Data);
53
Contract
.ThrowIfNull(data.CodeActionPath);
57
Contract
.ThrowIfNull(fixAllCodeAction);
69
Contract
.ThrowIfNull(resolveData, "Missing data for fix all code action resolve request");
Handler\CodeActions\CodeActionHelpers.cs (2)
467
Contract
.ThrowIfNull(matchingAction);
476
Contract
.ThrowIfNull(matchingAction);
Handler\CodeActions\CodeActionResolveHandler.cs (3)
57
Contract
.ThrowIfNull(codeAction.Data);
85
Contract
.ThrowIfNull(data.CodeActionPath);
101
Contract
.ThrowIfNull(resolveData, "Missing data for code action resolve request");
Handler\CodeActions\CodeActionResolveHelper.cs (7)
27
Contract
.ThrowIfNull(solution);
222
Contract
.ThrowIfNull(oldTextDoc);
238
Contract
.ThrowIfNull(newTextDoc);
253
Contract
.Fail($"Can't find uri for document: {newTextDoc.Name}.");
278
Contract
.ThrowIfNull(oldTextDoc);
279
Contract
.ThrowIfNull(newTextDoc);
292
Contract
.ThrowIfNull(textDiffService);
Handler\CodeLens\CodeLensResolveHandler.cs (2)
88
Contract
.ThrowIfNull(codeLens.Data);
90
Contract
.ThrowIfNull(resolveData, "Missing data for code lens resolve request");
Handler\Completion\CompletionHandler.cs (2)
48
Contract
.ThrowIfNull(context.Document);
49
Contract
.ThrowIfNull(context.Solution);
Handler\Completion\CompletionResolveHandler.cs (2)
127
Contract
.ThrowIfNull(request.Data);
131
Contract
.Fail("Document should always be provided when resolving a completion item request.");
Handler\Completion\CompletionResultFactory.cs (6)
278
Contract
.ThrowIfNull(commitCharacters);
515
Contract
.ThrowIfTrue(item.IsComplexTextEdit);
516
Contract
.ThrowIfNull(lspItem.Label);
659
Contract
.ThrowIfTrue(lspItem.InsertText != null);
660
Contract
.ThrowIfTrue(lspItem.TextEdit != null);
685
Contract
.ThrowIfNull(newText);
Handler\Completion\Extensions.cs (2)
53
Contract
.ThrowIfNull(request.Data);
57
Contract
.Fail("Result id should always be provided when resolving a completion item we returned.");
Handler\Configuration\DidChangeConfigurationNotificationHandler.cs (1)
128
Contract
.ThrowIfNull(options);
Handler\Diagnostics\AbstractPullDiagnosticHandler.cs (2)
114
Contract
.ThrowIfNull(context.Solution);
285
Contract
.ThrowIfFalse(diagnostics.IsEmpty);
Handler\Diagnostics\BuildOnlyDiagnosticIdsHandler.cs (1)
42
Contract
.ThrowIfNull(context.Solution);
Handler\Diagnostics\DiagnosticSourceProviders\DiagnosticSourceManager.cs (1)
73
Contract
.ThrowIfFalse(provider.IsEnabled(context.GetRequiredClientCapabilities()));
Handler\Diagnostics\DiagnosticSourceProviders\WorkspaceDocumentsAndProjectDiagnosticSourceProvider.cs (1)
52
Contract
.ThrowIfNull(context.Solution);
Handler\EditAndContinue\RegisterSolutionSnapshotHandler.cs (1)
35
Contract
.ThrowIfNull(context.Solution);
Handler\EditAndContinue\WorkspaceEditAndContinueDiagnosticSourceProvider.cs (1)
28
Contract
.ThrowIfNull(context.Solution);
Handler\Extensions\ActivateExtensionHandler.cs (1)
25
Contract
.ThrowIfNull(context.Solution);
Handler\Extensions\DeactivateExtensionHandler.cs (1)
25
Contract
.ThrowIfNull(context.Solution);
Handler\Extensions\DispatchDocumentExtensionMessageHandler.cs (1)
29
Contract
.ThrowIfNull(context.Document);
Handler\Extensions\DispatchWorkspaceExtensionMessageHandler.cs (1)
25
Contract
.ThrowIfNull(context.Solution);
Handler\InitializeManager.cs (1)
30
Contract
.ThrowIfFalse(_initializeParams == null);
Handler\InlayHint\InlayHintResolveHandler.cs (2)
83
Contract
.ThrowIfNull(inlayHint.Data);
85
Contract
.ThrowIfNull(resolveData, "Missing data for inlay hint resolve request");
Handler\InlineCompletions\XmlSnippetParser.CodeSnippet.cs (2)
67
Contract
.ThrowIfNull(snippets, $"Did not find any code snippets in {filePath}");
276
Contract
.ThrowIfFalse(snippetParts.Any());
Handler\InlineCompletions\XmlSnippetParser.cs (1)
70
Contract
.ThrowIfFalse(matchingSnippet.IsExpansionSnippet(), "Only expansion snippets are supported");
Handler\MapCode\MapCodeHandler.cs (1)
37
Contract
.ThrowIfNull(context.Solution);
Handler\ProjectContext\GetTextDocumentWithContextHandler.cs (2)
31
Contract
.ThrowIfNull(context.Workspace);
32
Contract
.ThrowIfNull(context.Solution);
Handler\References\FindAllReferencesHandler.cs (2)
55
Contract
.ThrowIfNull(document);
56
Contract
.ThrowIfNull(workspace);
Handler\RelatedDocuments\RelatedDocumentsHandler.cs (2)
46
Contract
.ThrowIfNull(solution);
47
Contract
.ThrowIfNull(document);
Handler\Rename\RenameHandler.cs (1)
73
Contract
.ThrowIfTrue(!includeSourceGenerated && !renamedSolution.CompilationState.FrozenSourceGeneratedDocumentStates.IsEmpty, "Renaming in generated documents is not allowed, but there are changes in source generated documents.");
Handler\RequestContext.cs (1)
314
Contract
.ThrowIfFalse(_trackedDocuments.ContainsKey(documentUri), $"Attempted to get text for {documentUri} which is not open.");
Handler\SemanticTokens\SemanticTokensFullHandler.cs (2)
27
Contract
.ThrowIfNull(request.TextDocument);
36
Contract
.ThrowIfNull(request.TextDocument);
Handler\SemanticTokens\SemanticTokensHelpers.cs (4)
194
Contract
.ThrowIfTrue(numLinesInSpan < 1);
297
Contract
.ThrowIfTrue(deltaLine < 0, $"deltaLine is less than 0: {deltaLine}");
312
Contract
.ThrowIfFalse(tokenLength > 0);
358
Contract
.ThrowIfFalse(tokenTypesToIndex.TryGetValue(tokenTypeStr, out var tokenTypeIndex), "No matching token type index found.");
Handler\SemanticTokens\SemanticTokensRangeHandler.cs (2)
26
Contract
.ThrowIfNull(request.TextDocument);
35
Contract
.ThrowIfNull(request.TextDocument, "TextDocument is null.");
Handler\SourceGenerators\SourceGeneratedDocumentGetTextHandler.cs (2)
49
Contract
.ThrowIfFalse(document is SourceGeneratedDocument);
64
Contract
.ThrowIfNull(request.ResultId, "Attempted to reuse cache entry but given no resultId");
Handler\SpellCheck\AbstractSpellCheckingHandler.cs (3)
138
Contract
.ThrowIfNull(context.Solution);
197
Contract
.ThrowIfTrue(triplesIndex != triples.Length);
205
Contract
.ThrowIfNull(context.Solution);
Handler\SpellCheck\WorkspaceSpellCheckHandler.cs (1)
33
Contract
.ThrowIfNull(context.Solution);
Handler\Symbols\WorkspaceSymbolsHandler.cs (2)
52
Contract
.ThrowIfNull(context.Solution);
79
Contract
.ThrowIfNull(context.Solution);
Handler\Tasks\WorkspaceTaskDiagnosticSourceProvider.cs (1)
30
Contract
.ThrowIfNull(context.Solution);
LspServices\AbstractExportLspServiceAttribute.cs (3)
60
Contract
.ThrowIfFalse(serviceType.GetInterfaces().Contains(typeof(ILspService)), $"{serviceType.Name} does not inherit from {nameof(ILspService)}");
62
Contract
.ThrowIfNull(serviceType.FullName);
65
Contract
.ThrowIfNull(serviceType.Assembly.FullName);
LspServices\LspServiceMetadataView.cs (2)
54
Contract
.ThrowIfNull(requestContextTypeRef);
81
Contract
.ThrowIfNull(assemblyName);
LspServices\LspServices.cs (6)
66
Contract
.ThrowIfFalse(metadata.ServerKind == serverKind);
73
Contract
.ThrowIfFalse(metadata.ServerKind == WellKnownLspServerKinds.Any);
82
Contract
.ThrowIfTrue(existing.Metadata.ServerKind == WellKnownLspServerKinds.Any);
90
Contract
.ThrowIfNull(service, $"Missing required LSP service {typeof(T).FullName}");
123
Contract
.ThrowIfNull(typeName);
199
Contract
.ThrowIfNull(typeName);
RoslynLanguageServer.cs (3)
127
Contract
.ThrowIfNull(typeName);
197
Contract
.ThrowIfNull(textDocumentIdentifier, "Failed to deserialize text document identifier property");
208
Contract
.ThrowIfNull(data, "Failed to document resolve data object");
Workspaces\LspMiscellaneousFilesWorkspaceProvider.cs (1)
61
Contract
.ThrowIfNull(metadataWorkspace);
Workspaces\LspWorkspaceManager.cs (3)
110
Contract
.ThrowIfTrue(_trackedDocuments.ContainsKey(uri), $"didOpen received for {uri} which is already open.");
150
Contract
.ThrowIfFalse(_trackedDocuments.ContainsKey(uri), $"didClose received for {uri} which is not open.");
204
Contract
.ThrowIfFalse(_trackedDocuments.ContainsKey(uri), $"didChange received for {uri} which is not open.");
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (14)
CodeActions\RunCodeActionsTests.cs (1)
76
Contract
.ThrowIfNull(result);
DocumentChanges\DocumentChangesTests.LinkedDocuments.cs (1)
107
Contract
.ThrowIfNull(lspDocument);
FormatNewFile\FormatNewFileTests.cs (1)
67
Contract
.ThrowIfNull(project.FilePath);
InlineCompletions\InlineCompletionsTests.cs (1)
275
Contract
.ThrowIfNull(response);
InlineCompletions\TestSnippetInfoService.cs (1)
36
Contract
.ThrowIfNull(snippets);
Miscellaneous\LspMiscellaneousFilesWorkspaceTests.cs (3)
160
Contract
.ThrowIfNull(miscWorkspace);
161
Contract
.ThrowIfNull(miscDocument);
344
Contract
.ThrowIfNull(result);
Ordering\RequestOrderingTests.cs (2)
271
Contract
.ThrowIfNull(response);
275
Contract
.ThrowIfNull(solution);
SemanticTokens\AbstractSemanticTokensTests.cs (3)
33
Contract
.ThrowIfNull(result);
41
Contract
.ThrowIfNull(result);
49
Contract
.ThrowIfNull(result);
TestConfigurableDocumentHandler.cs (1)
56
Contract
.ThrowIfNull(_response, $"{nameof(ConfigureHandler)} has not been called");
Microsoft.CodeAnalysis.Remote.ServiceHub (68)
Host\AssetProvider.cs (5)
40
Contract
.ThrowIfTrue(checksum == Checksum.Null);
53
Contract
.ThrowIfTrue(builder.Count != 1);
247
Contract
.ThrowIfTrue(checksums.Contains(Checksum.Null));
299
Contract
.ThrowIfTrue(missingChecksumsMemory.Length == 0);
304
Contract
.ThrowIfTrue(missingChecksumsMemory.Span.IndexOf(Checksum.Null) >= 0);
Host\RemoteServiceBrokerProvider.cs (1)
34
Contract
.ThrowIfNull(s_instance, "Global service broker not registered");
Host\RemoteSolutionCache.cs (4)
91
Contract
.ThrowIfTrue(_cacheNodes.Count > _totalHistory);
95
Contract
.ThrowIfTrue(_cacheNodes.Count > _totalHistory + 1);
96
Contract
.ThrowIfNull(_cacheNodes.First);
97
Contract
.ThrowIfFalse(_cacheNodes.First.Value.Checksum.Equals(checksum));
Host\RemoteWorkspace.cs (3)
94
Contract
.ThrowIfTrue(solutionChecksum == Checksum.Null);
128
Contract
.ThrowIfTrue(inFlightSolution.InFlightCount < 1);
144
Contract
.ThrowIfTrue(inFlightSolution.InFlightCount < 1);
Host\RemoteWorkspace.InFlightSolution.cs (13)
58
Contract
.ThrowIfFalse(workspace._gate.CurrentCount == 0);
80
Contract
.ThrowIfFalse(_workspace._gate.CurrentCount == 0);
89
Contract
.ThrowIfFalse(_workspace._gate.CurrentCount == 0);
108
Contract
.ThrowIfFalse(_workspace._gate.CurrentCount == 0);
109
Contract
.ThrowIfNull(updatePrimaryBranchAsync);
110
Contract
.ThrowIfTrue(this._cancellationTokenSource_doNotAccessDirectly.IsCancellationRequested);
145
Contract
.ThrowIfFalse(_workspace._gate.CurrentCount == 0);
146
Contract
.ThrowIfTrue(InFlightCount < 1);
159
Contract
.ThrowIfFalse(_workspace._gate.CurrentCount == 0);
160
Contract
.ThrowIfTrue(InFlightCount < 1);
169
Contract
.ThrowIfFalse(_workspace._solutionChecksumToSolution.TryGetValue(SolutionChecksum, out var existingSolution));
170
Contract
.ThrowIfFalse(existingSolution == this);
173
Contract
.ThrowIfFalse(_workspace._solutionChecksumToSolution.Remove(SolutionChecksum));
Host\RemoteWorkspace.SolutionCreator.cs (14)
59
Contract
.ThrowIfFalse(solution.Id == newSolutionInfo.Id && solution.FilePath == newSolutionInfo.FilePath);
192
Contract
.ThrowIfFalse(oldProjectIdToChecksum.Keys.All(newProjectIdToChecksum.Keys.Contains));
205
Contract
.ThrowIfTrue(oldProjectStateChecksums.ProjectId != projectId);
206
Contract
.ThrowIfTrue(oldChecksum != oldProjectStateChecksums.Checksum);
218
Contract
.ThrowIfTrue(checksum != newProjectStateChecksum.Checksum);
308
Contract
.ThrowIfTrue(isConeSync);
323
Contract
.ThrowIfTrue(oldProjectChecksums.Checksum == newProjectChecksums.Checksum);
523
Contract
.ThrowIfTrue(
528
Contract
.ThrowIfNull(document);
574
Contract
.ThrowIfFalse(document.State.Attributes.Id == newDocumentInfo.Id);
575
Contract
.ThrowIfFalse(document.State.Attributes.IsGenerated == newDocumentInfo.IsGenerated);
576
Contract
.ThrowIfFalse(document.State.Attributes.DesignTimeOnly == newDocumentInfo.DesignTimeOnly);
587
Contract
.ThrowIfFalse(document is Document);
594
Contract
.ThrowIfFalse(document is Document);
Host\RemoteWorkspace_SolutionCaching.cs (9)
45
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
52
Contract
.ThrowIfTrue(solution.InFlightCount < 1);
68
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
73
Contract
.ThrowIfTrue(solution.InFlightCount < 1);
77
Contract
.ThrowIfTrue(solution.InFlightCount < 2);
94
Contract
.ThrowIfFalse(solution.InFlightCount == 1);
104
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
112
Contract
.ThrowIfTrue(solution.InFlightCount < 1);
113
Contract
.ThrowIfTrue(solutionChecksum != solution.SolutionChecksum);
Host\SolutionAssetCache.cs (4)
69
Contract
.ThrowIfNull(value);
179
Contract
.ThrowIfFalse(solutionState.TryGetStateChecksums(out var stateChecksums));
184
Contract
.ThrowIfFalse(projectState.TryGetStateChecksums(out var projectStateChecksums));
197
Contract
.ThrowIfFalse(documentState.TryGetStateChecksums(out var documentChecksums));
Host\TestUtils.cs (2)
202
Contract
.ThrowIfTrue(solutionChecksums.ProjectCone != null);
214
Contract
.ThrowIfFalse(projectCone.Equals(solutionChecksums.ProjectCone));
Services\BrokeredServiceBase.cs (1)
60
Contract
.ThrowIfNull(traceSource);
Services\BrokeredServiceBase.FactoryBase.cs (1)
131
Contract
.ThrowIfNull(descriptor.ClientInterface);
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (4)
146
Contract
.ThrowIfFalse(projectAnalyzers.Length > 0 || compilationWithAnalyzers.HostCompilationWithAnalyzers is not null);
156
Contract
.ThrowIfFalse(hostAnalyzers.Length > 0 || compilationWithAnalyzers.ProjectCompilationWithAnalyzers is not null);
283
Contract
.ThrowIfNull(analyzerId);
431
Contract
.ThrowIfFalse(!projectAnalyzers.IsEmpty || !hostAnalyzers.IsEmpty);
Services\NavigationBar\RemoteNavigationBarItemService.cs (1)
28
Contract
.ThrowIfNull(document);
Services\ProcessTelemetry\RemoteWorkspaceConfigurationService.cs (1)
31
Contract
.ThrowIfFalse(_options == null);
Services\SemanticClassification\RemoteSemanticClassificationService.cs (1)
34
Contract
.ThrowIfNull(document);
Services\SourceGeneration\RemoteSourceGenerationService.cs (2)
44
Contract
.ThrowIfFalse(id.IsSourceGenerated);
64
Contract
.ThrowIfFalse(id.IsSourceGenerated);
src\VisualStudio\Core\Def\Telemetry\AbstractWorkspaceTelemetryService.cs (1)
24
Contract
.ThrowIfFalse(CurrentSession is null);
src\VisualStudio\Core\Def\Telemetry\Shared\TelemetryLogger.cs (1)
150
Contract
.ThrowIfFalse(_pendingScopes.TryRemove(blockId, out var scope));
Microsoft.CodeAnalysis.Remote.Workspaces (51)
AbstractAssetProvider.cs (1)
83
Contract
.ThrowIfFalse(RemoteSupportedLanguages.IsSupported(attributes.Language));
AbstractAssetProviderExtensions.cs (1)
71
Contract
.ThrowIfTrue(checksumToAsset.Count != checksumSet.Count);
BrokeredServiceConnection.cs (8)
62
Contract
.ThrowIfFalse((callbackDispatcher == null) == (serviceDescriptor.ClientInterface == null));
92
Contract
.ThrowIfNull(service);
131
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
148
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
232
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
251
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
270
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
289
Contract
.ThrowIfFalse(_callbackDispatcher is not null);
EditAndContinue\ManagedHotReloadLanguageService.cs (9)
114
Contract
.ThrowIfNull(_debuggingSession);
143
Contract
.ThrowIfNull(_debuggingSession);
145
Contract
.ThrowIfNull(committedDesignTimeSolution);
168
Contract
.ThrowIfNull(_debuggingSession);
197
Contract
.ThrowIfNull(_debuggingSession);
198
Contract
.ThrowIfNull(Interlocked.Exchange(ref _pendingUpdatedDesignTimeSolution, null));
219
Contract
.ThrowIfNull(_debuggingSession);
257
Contract
.ThrowIfNull(_committedDesignTimeSolution);
284
Contract
.ThrowIfNull(_debuggingSession);
RemoteCallback.cs (1)
52
Contract
.ThrowIfNull(rental.Proxy);
RemoteHostAssetReader.cs (6)
60
Contract
.ThrowIfFalse(_solutionChecksum == responseSolutionChecksum);
91
Contract
.ThrowIfNull(asset);
103
Contract
.ThrowIfTrue(sentinelByte != RemoteHostAssetWriter.MessageSentinelByte);
123
Contract
.ThrowIfFalse(sequenceReader.TryRead(out var sentinel));
124
Contract
.ThrowIfFalse(sequenceReader.TryReadLittleEndian(out int length));
132
Contract
.ThrowIfFalse(sequenceReader.TryCopyTo(checksumBytes));
RemoteHostAssetWriter.cs (3)
114
Contract
.ThrowIfTrue(foundChecksumCount != _checksums.Length);
120
Contract
.ThrowIfNull(asset);
183
Contract
.ThrowIfTrue(length > int.MaxValue);
Serialization\MessagePackFormatters.cs (1)
69
Contract
.ThrowIfFalse(arrayCount is 1 or 2);
ServiceBrokerExtensions.cs (4)
19
Contract
.ThrowIfNull(service);
29
Contract
.ThrowIfNull(service);
39
Contract
.ThrowIfNull(service);
49
Contract
.ThrowIfNull(service);
ServiceDescriptors.cs (4)
114
Contract
.ThrowIfFalse(serviceInterface.IsInterface);
116
Contract
.ThrowIfFalse(interfaceName.StartsWith(InterfaceNamePrefix, StringComparison.Ordinal));
117
Contract
.ThrowIfFalse(interfaceName.EndsWith(InterfaceNameSuffix, StringComparison.Ordinal));
124
Contract
.ThrowIfFalse(callbackInterface == null || callbackInterface.IsInterface);
SolutionAssetStorage.cs (3)
83
Contract
.ThrowIfTrue(scope.RefCount <= 0);
100
Contract
.ThrowIfTrue(existingScope != scope);
102
Contract
.ThrowIfTrue(scope.RefCount <= 0);
SolutionAssetStorage.Scope.cs (9)
53
Contract
.ThrowIfTrue(checksumsToFind.Contains(Checksum.Null));
57
Contract
.ThrowIfTrue(checksumsToFind.Count > 0);
77
Contract
.ThrowIfFalse(solutionState.TryGetStateChecksums(out var stateChecksums));
83
Contract
.ThrowIfFalse(solutionState.TryGetStateChecksums(this.ProjectCone.RootProjectId, out var stateChecksums));
99
Contract
.ThrowIfTrue(checksum == Checksum.Null);
106
Contract
.ThrowIfNull(foundAsset);
107
Contract
.ThrowIfTrue(asset != null); // We should only find one asset
108
Contract
.ThrowIfTrue(checksum != foundChecksum);
112
Contract
.ThrowIfNull(asset);
VisualStudioMefHostServices.cs (1)
28
Contract
.ThrowIfNull(exportProvider);
Microsoft.CodeAnalysis.Workspaces (574)
Classification\SyntaxClassification\SyntacticChangeRangeComputer.cs (7)
101
Contract
.ThrowIfTrue(commonLeftWidth > oldRootWidth);
102
Contract
.ThrowIfTrue(commonLeftWidth > newRootWidth);
103
Contract
.ThrowIfTrue(commonRightWidth > oldRootWidth);
104
Contract
.ThrowIfTrue(commonRightWidth > newRootWidth);
135
Contract
.ThrowIfFalse(currentOld.FullSpan.Start == currentNew.FullSpan.Start);
178
Contract
.ThrowIfTrue(oldRoot.IsIncrementallyIdenticalTo(newRoot));
190
Contract
.ThrowIfFalse((oldRoot.FullSpan.End - currentOld.FullSpan.End) ==
CodeActions\CodeAction.cs (1)
199
Contract
.ThrowIfFalse(provider is CodeFixProvider or CodeRefactoringProvider);
CodeActions\CodeAction_Cleanup.cs (2)
74
Contract
.ThrowIfFalse(document.SupportsSyntaxTree);
210
Contract
.ThrowIfFalse(document.SupportsSyntaxTree, "GetDocumentIdsAndOptionsAsync should only be returning documents that support syntax");
CodeCleanup\AbstractCodeCleanerService.cs (7)
213
Contract
.ThrowIfFalse(hasMultiplePreviousToken || hasMultipleNextToken);
239
Contract
.ThrowIfTrue(spanMarkerType == SpanMarkerType.EndOfFile);
240
Contract
.ThrowIfTrue(previousToken.RawKind == 0);
255
Contract
.ThrowIfTrue(spanMarkerType == SpanMarkerType.BeginningOfFile);
256
Contract
.ThrowIfTrue(nextToken.RawKind == 0);
371
Contract
.ThrowIfTrue(startToken.RawKind == 0 || endToken.RawKind == 0);
668
Contract
.ThrowIfNull(annotation.Data);
CodeFixes\FixAllOccurrences\BatchFixAllProvider.cs (1)
56
Contract
.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or
CodeFixes\FixAllOccurrences\FixAllContext.cs (1)
311
Contract
.ThrowIfNull(project);
CodeFixesAndRefactorings\DocumentBasedFixAllProviderHelpers.cs (1)
76
Contract
.ThrowIfFalse(
CodeFixesAndRefactorings\FixAllLogger.cs (1)
94
Contract
.ThrowIfTrue(completed && timedOut);
CodeRefactorings\FixAllOccurences\DocumentBasedFixAllProvider.cs (1)
84
Contract
.ThrowIfFalse(fixAllContext.Scope is FixAllScope.Document or FixAllScope.Project
CodeRefactorings\FixAllOccurences\FixAllState.cs (2)
96
Contract
.ThrowIfNull(Document);
107
Contract
.ThrowIfNull(Document);
Diagnostics\AnalysisResultPair.cs (6)
21
Contract
.ThrowIfTrue(projectAnalysisResult is null && hostAnalysisResult is null);
43
Contract
.ThrowIfNull(arg.hostDiagnostics);
68
Contract
.ThrowIfNull(arg.hostDiagnostics);
93
Contract
.ThrowIfNull(arg.hostDiagnostics);
118
Contract
.ThrowIfNull(arg.hostDiagnostics);
143
Contract
.ThrowIfNull(arg.hostTelemetryInfo);
Diagnostics\CompilationWithAnalyzersPair.cs (3)
22
Contract
.ThrowIfFalse(projectCompilationWithAnalyzers.AnalysisOptions.ReportSuppressedDiagnostics == hostCompilationWithAnalyzers.AnalysisOptions.ReportSuppressedDiagnostics);
23
Contract
.ThrowIfFalse(projectCompilationWithAnalyzers.AnalysisOptions.ConcurrentAnalysis == hostCompilationWithAnalyzers.AnalysisOptions.ConcurrentAnalysis);
27
Contract
.ThrowIfTrue(projectCompilationWithAnalyzers is null && hostCompilationWithAnalyzers is null);
Diagnostics\DiagnosticAnalysisResult.cs (1)
135
Contract
.ThrowIfNull(map);
Diagnostics\DiagnosticAnalysisResultBuilder.cs (1)
45
Contract
.ThrowIfTrue(Project.SupportsCompilation);
Diagnostics\DiagnosticDataLocation.cs (1)
62
Contract
.ThrowIfNull(unmappedFileSpan.Path);
Diagnostics\DocumentAnalysisScope.cs (1)
56
Contract
.ThrowIfFalse(TextDocument is AdditionalDocument);
Diagnostics\HostDiagnosticAnalyzers.cs (1)
182
Contract
.ThrowIfNull(language);
Editing\SyntaxEditor.cs (2)
253
Contract
.Fail($"GetCurrentNode returned null with the following node: {OriginalNode}");
285
Contract
.ThrowIfNull(node);
Editing\SyntaxGenerator.cs (4)
1022
Contract
.ThrowIfNull(attribute.AttributeClass);
1387
Contract
.ThrowIfTrue(ReferenceEquals(root, node));
1538
Contract
.ThrowIfNull(currentFirst);
1920
Contract
.ThrowIfNull(name);
ErrorReporting\InfoBarUI.cs (1)
19
Contract
.ThrowIfNull(title);
FindSymbols\Declarations\DeclarationFinder.cs (3)
28
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
78
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
85
Contract
.ThrowIfNull(info);
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (2)
28
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
33
Contract
.ThrowIfNull(query.Name);
FindSymbols\FindLiterals\FindLiteralsSearchEngine.cs (2)
122
Contract
.ThrowIfNull(index);
125
Contract
.ThrowIfNull(_stringValue);
FindSymbols\FindReferences\DependentProjectsFinder.cs (4)
311
Contract
.ThrowIfNull(symbolOrigination.assembly);
312
Contract
.ThrowIfNull(project);
313
Contract
.ThrowIfFalse(project.SupportsCompilation);
326
Contract
.ThrowIfFalse(project.SupportsCompilation);
FindSymbols\FindReferences\DependentTypeFinder.cs (1)
348
Contract
.ThrowIfNull(symbolTreeInfo);
FindSymbols\FindReferences\Finders\AbstractReferenceFinder.cs (1)
592
Contract
.ThrowIfFalse(notNullOriginalUnreducedSymbol2.GetOriginalUnreducedDefinition().Equals(notNullOriginalUnreducedSymbol2));
FindSymbols\FindReferences\Finders\AbstractTypeParameterSymbolReferenceFinder.cs (1)
61
Contract
.ThrowIfNull(token.Parent);
FindSymbols\FindReferences\Finders\ExplicitConversionSymbolReferenceFinder.cs (1)
47
Contract
.ThrowIfNull(underlyingNamedType);
FindSymbols\FindReferences\Finders\MethodTypeParameterSymbolReferenceFinder.cs (1)
61
Contract
.ThrowIfNull(symbol.DeclaringMethod);
FindSymbols\FindReferences\FindReferencesSearchEngine.cs (3)
187
Contract
.ThrowIfFalse(linkedSymbols.Contains(symbol), "Linked symbols did not contain the very symbol we started with.");
190
Contract
.ThrowIfFalse(group.Symbols.Contains(symbol), "Symbol group did not contain the very symbol we started with.");
197
Contract
.ThrowIfFalse(symbolToGroup.ContainsKey(symbol));
FindSymbols\FindReferences\FindReferencesSearchEngine.SymbolSet.cs (2)
129
Contract
.ThrowIfNull(searchSymbol);
241
Contract
.ThrowIfFalse(projects.Count == 1, "Only a single project should be passed in");
FindSymbols\IStreamingFindReferencesProgress.cs (1)
35
Contract
.ThrowIfTrue(symbols.IsDefaultOrEmpty, "Symbols should be non empty");
FindSymbols\Shared\AbstractSyntaxIndex.cs (3)
33
Contract
.ThrowIfNull(index);
58
Contract
.ThrowIfFalse(index != null || loadOnly == true, "Result can only be null if 'loadOnly: true' was passed.");
122
Contract
.ThrowIfFalse(document.SupportsSyntaxTree);
FindSymbols\SymbolFinder.FindReferencesServerCallback.cs (1)
42
Contract
.ThrowIfTrue(dehydrated.Symbols.Count == 0);
FindSymbols\SymbolFinder_Helpers.cs (5)
124
Contract
.ThrowIfNull(equivalentTypesWithDifferingAssemblies);
125
Contract
.ThrowIfTrue(equivalentTypesWithDifferingAssemblies.Count == 0);
128
Contract
.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => !SymbolEquivalenceComparer.Instance.Equals(kvp.Key.ContainingAssembly, kvp.Value.ContainingAssembly)));
131
Contract
.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => kvp.Key.ContainingType == null));
132
Contract
.ThrowIfFalse(equivalentTypesWithDifferingAssemblies.All(kvp => kvp.Value.ContainingType == null));
FindSymbols\SymbolTree\MetadataInfo.cs (1)
30
Contract
.ThrowIfNull(info);
FindSymbols\SymbolTree\SymbolTreeInfo.cs (4)
124
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
136
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
148
Contract
.ThrowIfTrue(query.Kind == SearchKind.Custom, "Custom queries are not supported in this API");
154
Contract
.ThrowIfNull(queryName);
FindSymbols\SymbolTree\SymbolTreeInfo_Metadata.cs (1)
136
Contract
.ThrowIfTrue(info.Checksum != checksum, "How could the info stored for a particular PEReference now have a different checksum?");
FindSymbols\SymbolTree\SymbolTreeInfo_Serialization.cs (1)
57
Contract
.ThrowIfNull(result);
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (4)
180
Contract
.ThrowIfNull(info);
181
Contract
.ThrowIfTrue(info.Checksum != checksum, "If we computed a SymbolTreeInfo, then its checksum must match our checksum.");
202
Contract
.ThrowIfNull(info);
203
Contract
.ThrowIfTrue(info.Checksum != checksum, "If we computed a SymbolTreeInfo, then its checksum must match our checksum.");
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (1)
90
Contract
.ThrowIfNull(node);
FindSymbols\TopLevelSyntaxTree\DeclaredSymbolInfo.cs (2)
129
Contract
.ThrowIfTrue((uint)accessibility > Max4BitValue);
130
Contract
.ThrowIfTrue((uint)kind > Max5BitValue);
Formatting\AbstractFormattingService.cs (1)
19
Contract
.ThrowIfNull(syntaxFormattingOptions);
Formatting\Formatter.cs (1)
137
Contract
.ThrowIfNull(formattingOptions);
LanguageServices\FixAllSpanMappingService\AbstractFixAllSpanMappingService.cs (2)
26
Contract
.ThrowIfFalse(fixAllScope is FixAllScope.ContainingMember or FixAllScope.ContainingType);
54
Contract
.ThrowIfNull(documentForLocation);
LinkedFileDiffMerging\LinkedFileDiffMergingSession.cs (4)
36
Contract
.ThrowIfNull(filePath);
56
Contract
.ThrowIfTrue(newDocumentsAndHashes.Count == 0);
62
Contract
.ThrowIfTrue(relatedDocuments.Length == 1, "We should have skipped non-linked files in the prior loop.");
95
Contract
.ThrowIfTrue(newDocumentsAndHashes.Count < 2);
Options\DocumentOptionSet.cs (1)
78
Contract
.ThrowIfTrue(internallyDefinedOption.Type == typeof(NamingStylePreferences));
PatternMatching\PatternMatcher.cs (1)
152
Contract
.ThrowIfTrue(patternChunk.SimilarityChecker.IsDefault);
Remote\ExportRemoteServiceCallbackDispatcherAttribute.cs (1)
19
Contract
.ThrowIfFalse(serviceInterface.IsInterface);
Remote\IRemoteKeepAliveService.cs (1)
73
Contract
.Fail("Should have been disposed!");
Remote\RemoteArguments.cs (1)
63
Contract
.ThrowIfNull(project, WorkspacesResources.Symbols_project_could_not_be_found_in_the_provided_solution);
Remote\RemoteServiceCallbackDispatcher.cs (2)
25
Contract
.ThrowIfTrue(callbackInstances?.TryRemove(Id, out _) == false);
47
Contract
.ThrowIfFalse(_callbackInstances.TryGetValue(callbackId, out var instance));
Remote\RemoteServiceCallbackDispatchers.cs (1)
24
Contract
.ThrowIfNull(serviceInterface);
Rename\ConflictEngine\ConflictResolver.cs (6)
184
Contract
.ThrowIfNull(implicitUsageConflict.SourceTree);
208
Contract
.ThrowIfNull(implicitConflict.SourceTree);
235
Contract
.ThrowIfNull(projectOpt);
287
Contract
.ThrowIfNull(projectOpt);
302
Contract
.ThrowIfNull(languageConflict.SourceTree);
329
Contract
.ThrowIfNull(oldLocation.SourceTree);
Rename\ConflictEngine\ConflictResolver.Session.cs (1)
157
Contract
.ThrowIfTrue(conflictLocations.Count != 0, "We're the first phase, so we should have no conflict locations yet");
Rename\ConflictEngine\MutableConflictResolution.cs (2)
108
Contract
.ThrowIfNull(directory);
186
Contract
.ThrowIfFalse(_options.RenameInSourceGeneratedDocuments);
Rename\IRemoteRenamerService.cs (2)
117
Contract
.ThrowIfNull(serializableLocations);
184
Contract
.ThrowIfNull(Resolution);
Rename\LightweightRenameLocations.cs (5)
39
Contract
.ThrowIfTrue(locations.IsDefault);
40
Contract
.ThrowIfTrue(implicitLocations.IsDefault);
41
Contract
.ThrowIfTrue(referencedSymbols.IsDefault);
75
Contract
.ThrowIfNull(solution);
76
Contract
.ThrowIfNull(symbol);
Rename\Renamer.cs (6)
149
Contract
.ThrowIfNull(solution);
150
Contract
.ThrowIfNull(symbol);
151
Contract
.ThrowIfTrue(string.IsNullOrEmpty(newName));
191
Contract
.ThrowIfNull(solution);
192
Contract
.ThrowIfNull(symbol);
193
Contract
.ThrowIfTrue(string.IsNullOrEmpty(newName));
Rename\RenameUtilities.cs (4)
101
Contract
.ThrowIfFalse(isSubset);
307
Contract
.ThrowIfNull(definitionSymbol);
318
Contract
.ThrowIfNull(symbol);
319
Contract
.ThrowIfNull(solution);
Rename\SymbolicRenameLocations.cs (4)
42
Contract
.ThrowIfTrue(locations.IsDefault);
43
Contract
.ThrowIfTrue(implicitLocations.IsDefault);
44
Contract
.ThrowIfTrue(referencedSymbols.IsDefault);
60
Contract
.ThrowIfNull(symbol);
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (2)
274
Contract
.ThrowIfNull(aliasLocation.SourceTree);
297
Contract
.ThrowIfNull(aliasLocation.SourceTree);
Rename\SymbolicRenameLocations.SearchResult.cs (1)
23
Contract
.ThrowIfNull(locations);
Serialization\SerializableSourceText.cs (1)
179
Contract
.ThrowIfFalse(kind is SerializationKinds.Bits or SerializationKinds.MemoryMapFile);
Serialization\SerializedPortableExecutableReference.cs (1)
35
Contract
.ThrowIfTrue(storageHandles.IsDefault);
Serialization\SerializerService.cs (2)
206
Contract
.ThrowIfFalse(count <= 2);
214
Contract
.ThrowIfFalse(language is LanguageNames.CSharp or LanguageNames.VisualBasic);
Serialization\SerializerService_Reference.cs (10)
78
Contract
.ThrowIfFalse(TryGetAnalyzerImageReferenceGuid(analyzerImageReference, out var guid), "AnalyzerImageReferences are only supported during testing");
153
Contract
.ThrowIfFalse(TryGetAnalyzerImageReferenceGuid(analyzerImageReference, out var guid), "AnalyzerImageReferences are only supported during testing");
175
Contract
.ThrowIfFalse(TryGetAnalyzerImageReferenceFromGuid(guid, out var analyzerImageReference));
283
Contract
.ThrowIfFalse(kind is SerializationKinds.Bits or SerializationKinds.MemoryMapFile);
363
Contract
.ThrowIfTrue(handles.Count == 0);
400
Contract
.ThrowIfFalse(metadataKind == MetadataImageKind.Module);
412
Contract
.ThrowIfFalse(metadataKind == MetadataImageKind.Module);
422
Contract
.ThrowIfFalse(kind is SerializationKinds.Bits or SerializationKinds.MemoryMapFile);
446
Contract
.ThrowIfTrue(length != storageHandle.Identifier.Size);
460
Contract
.ThrowIfFalse(storageHandle.Identifier.Size == unmanagedStream.Length);
Shared\Extensions\DocumentExtensions.cs (1)
17
Contract
.ThrowIfNull(result);
Shared\Extensions\FileLinePositionSpanExtensions.cs (2)
88
Contract
.ThrowIfTrue(start < text.Lines.GetLinePosition(0));
89
Contract
.ThrowIfTrue(end > text.Lines.GetLinePosition(text.Length));
Shared\Extensions\IMethodSymbolExtensions.cs (1)
17
Contract
.ThrowIfFalse(delegateType.TypeKind == TypeKind.Delegate);
Shared\Extensions\ISymbolExtensions.cs (1)
363
Contract
.ThrowIfNull(candidate);
Shared\Extensions\SourceTextExtensions.cs (9)
200
Contract
.ThrowIfTrue(buffer.Length != CharArrayLength);
223
Contract
.ThrowIfFalse(offset == length);
256
Contract
.ThrowIfTrue(chunkSize != CharArrayLength);
269
Contract
.ThrowIfTrue(length > CharArrayLength);
273
Contract
.ThrowIfTrue(currentChunk.Length != CharArrayLength);
276
Contract
.ThrowIfTrue(i < numberOfChunks - 1 && currentChunkLength != CharArrayLength);
282
Contract
.ThrowIfFalse(offset == length);
285
Contract
.ThrowIfTrue(chunksArray.Any(static (c, s) => c.Length != s, CharArrayLength));
369
Contract
.ThrowIfTrue(Position > Length);
Shared\Extensions\TelemetryExtensions.cs (1)
18
Contract
.ThrowIfNull(type.FullName);
Shared\TestHooks\AsynchronousOperationListener.cs (3)
113
Contract
.ThrowIfFalse(_gate.LockHeldByMe());
119
Contract
.ThrowIfFalse(_gate.LockHeldByMe());
184
Contract
.ThrowIfFalse(TrackActiveTokens);
Shared\Utilities\BloomFilter_Serialization.cs (1)
28
Contract
.ThrowIfTrue(bitArray.Length % 8 != 0);
Shared\Utilities\ExtensionOrderer.Graph.cs (1)
20
Contract
.ThrowIfNull(name);
src\Dependencies\Collections\Extensions\FixedSizeArrayBuilder.cs (1)
62
Contract
.ThrowIfTrue(condition, lineNumber, filePath);
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
270
Contract
.ThrowIfFalse(batchResultTask.IsCompleted);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\ImmutableIntervalTree`1.cs (2)
237
Contract
.ThrowIfTrue(leftMaxEndValue < 0 && rightMaxEndValue < 0);
248
Contract
.ThrowIfFalse(rightMaxEndValue > leftMaxEndValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeHelpers.NodeEnumerator.cs (2)
77
Contract
.ThrowIfTrue(_currentNodeHasValue);
78
Contract
.ThrowIfTrue(_stack.Count == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSeparatedSyntaxNodeList.cs (1)
27
Contract
.ThrowIfTrue(nodesAndTokens.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\VirtualChars\VirtualChar.cs (1)
71
Contract
.ThrowIfFalse(surrogateChar == 0 || rune == Rune.ReplacementChar,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalysisContextExtensions.cs (4)
165
Contract
.ThrowIfNull(context.FilterTree);
166
Contract
.ThrowIfFalse(context.FilterSpan.HasValue);
177
Contract
.ThrowIfNull(context.FilterTree);
178
Contract
.ThrowIfFalse(context.FilterSpan.HasValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\AnalyzerConfigOptionsExtensions.cs (1)
22
Contract
.ThrowIfFalse(option.Definition.IsEditorConfigOption);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\LocationExtensions.cs (1)
14
Contract
.ThrowIfNull(location.SourceTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (1)
105
Contract
.ThrowIfTrue(b1 != b2);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticModelExtensions.cs (3)
101
Contract
.ThrowIfNull(semanticModel.ParentModel);
102
Contract
.ThrowIfTrue(semanticModel.ParentModel.IsSpeculativeSemanticModel);
103
Contract
.ThrowIfTrue(semanticModel.ParentModel.ParentModel != null);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SourceTextExtensions_SharedWithCodeStyle.cs (1)
18
Contract
.ThrowIfNull(text);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StackExtensions.cs (2)
48
Contract
.ThrowIfNull(stack);
49
Contract
.ThrowIfNull(range);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\StringExtensions.cs (10)
16
Contract
.ThrowIfNull(line);
31
Contract
.ThrowIfNull(line);
46
Contract
.ThrowIfNull(lineText);
57
Contract
.ThrowIfNull(lineText);
208
Contract
.ThrowIfNull(line);
209
Contract
.ThrowIfFalse(0 <= endPosition && endPosition <= line.Length);
210
Contract
.ThrowIfFalse(tabSize > 0);
217
Contract
.ThrowIfNull(line);
218
Contract
.ThrowIfFalse(column >= 0);
219
Contract
.ThrowIfFalse(tabSize > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (4)
107
Contract
.ThrowIfNull(node);
179
Contract
.ThrowIfTrue(node1.RawKind == 0 || node2.RawKind == 0);
298
Contract
.ThrowIfNull(nodes);
299
Contract
.ThrowIfFalse(nodes.Any());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxTreeExtensions.cs (2)
72
Contract
.ThrowIfNull(syntaxTree);
134
Contract
.ThrowIfNull(syntaxTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (1)
34
Contract
.ThrowIfNull(formattingRules);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.cs (4)
57
Contract
.ThrowIfNull(engine);
58
Contract
.ThrowIfNull(tokenStream);
124
Contract
.ThrowIfNull(operations);
413
Contract
.ThrowIfFalse(intervals.Length == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Context\FormattingContext.InitialContextFinder.cs (3)
34
Contract
.ThrowIfNull(tokenStream);
35
Contract
.ThrowIfNull(formattingRules);
36
Contract
.ThrowIfNull(rootNode);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractAggregatedFormattingResult.cs (2)
31
Contract
.ThrowIfNull(node);
32
Contract
.ThrowIfNull(formattingResults);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.cs (1)
94
Contract
.ThrowIfTrue(treeData.Root.IsInvalidTokenRange(startToken, endToken));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractFormatEngine.OperationApplier.cs (6)
52
Contract
.ThrowIfFalse(triviaInfo.LineBreaks == 0);
85
Contract
.ThrowIfFalse(triviaInfo.LineBreaks == 0);
123
Contract
.ThrowIfFalse(triviaInfo.LineBreaks == 0);
262
Contract
.ThrowIfNull(previousChangesMap);
451
Contract
.ThrowIfFalse(triviaInfo.SecondTokenIsFirstTokenOnLine);
478
Contract
.ThrowIfFalse(baseToken.RawKind != 0 && startToken.RawKind != 0 && endToken.RawKind != 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.AbstractComplexTrivia.cs (3)
22
Contract
.ThrowIfNull(treeInfo);
75
Contract
.ThrowIfFalse(line > 0);
132
Contract
.ThrowIfFalse(list.Count > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.cs (4)
27
Contract
.ThrowIfNull(treeInfo);
88
Contract
.ThrowIfFalse(space >= 0);
107
Contract
.ThrowIfFalse(lineBreaks >= 0);
108
Contract
.ThrowIfFalse(indentation >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.ModifiedWhitespace.cs (1)
25
Contract
.ThrowIfNull(original);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.Whitespace.cs (2)
25
Contract
.ThrowIfFalse(space >= 0);
55
Contract
.ThrowIfFalse(line > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
33
Contract
.ThrowIfNull(formattingRules);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenData.cs (4)
27
Contract
.ThrowIfNull(tokenStream);
28
Contract
.ThrowIfFalse((indexInStream == -1) || (0 <= indexInStream && indexInStream < tokenStream.TokenCount));
61
Contract
.ThrowIfFalse(this.TokenStream == other.TokenStream);
81
Contract
.ThrowIfNull(commonRoot);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenPairWithOperations.cs (2)
27
Contract
.ThrowIfNull(tokenStream);
29
Contract
.ThrowIfFalse(0 <= tokenPairIndex && tokenPairIndex < tokenStream.TokenCount - 1);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TokenStream.cs (10)
136
Contract
.ThrowIfFalse(0 <= index && index < this.TokenCount);
235
Contract
.ThrowIfNull(data);
241
Contract
.ThrowIfNull(data);
247
Contract
.ThrowIfNull(data);
248
Contract
.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1);
427
Contract
.ThrowIfFalse(this.FormatBeginningOfTree);
439
Contract
.ThrowIfFalse(this.FormatEndOfTree);
451
Contract
.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1);
463
Contract
.ThrowIfFalse(0 <= pairIndex && pairIndex < this.TokenCount - 1);
476
Contract
.ThrowIfTrue(token.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.cs (1)
40
Contract
.ThrowIfNull(root);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Debug.cs (1)
18
Contract
.ThrowIfFalse(text == _debugNodeData.GetTextBetween(token1, token2));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.Node.cs (2)
17
Contract
.ThrowIfFalse(root.GetFirstToken(includeZeroWidth: true).RawKind != 0);
22
Contract
.ThrowIfTrue(token.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.NodeAndText.cs (2)
19
Contract
.ThrowIfNull(text);
25
Contract
.ThrowIfTrue(token.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\TreeData.StructuredTrivia.cs (1)
21
Contract
.ThrowIfFalse(trivia.HasStructure);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (1)
183
Contract
.ThrowIfFalse(lines.Length > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AdjustNewLinesOperation.cs (3)
14
Contract
.ThrowIfFalse(option != AdjustNewLinesOption.ForceLines || line > 0);
15
Contract
.ThrowIfFalse(option != AdjustNewLinesOption.PreserveLines || line >= 0);
16
Contract
.ThrowIfFalse(option != AdjustNewLinesOption.ForceLinesIfOnSingleLine || line > 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AdjustSpacesOperation.cs (1)
14
Contract
.ThrowIfFalse(space >= 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AlignTokensOperation.cs (1)
18
Contract
.ThrowIfNull(tokens);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\AnchorIndentationOperation.cs (3)
17
Contract
.ThrowIfTrue(anchorToken.RawKind == 0);
18
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
20
Contract
.ThrowIfTrue(endToken.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\IndentBlockOperation.cs (10)
16
Contract
.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask));
18
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
19
Contract
.ThrowIfTrue(startToken.RawKind == 0);
20
Contract
.ThrowIfTrue(endToken.RawKind == 0);
35
Contract
.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.PositionMask));
37
Contract
.ThrowIfFalse(option.IsMaskOn(IndentBlockOption.RelativePositionMask));
38
Contract
.ThrowIfFalse(baseToken.Span.End <= textSpan.Start);
40
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
41
Contract
.ThrowIfTrue(startToken.RawKind == 0);
42
Contract
.ThrowIfTrue(endToken.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\Operations\SuppressOperation.cs (3)
21
Contract
.ThrowIfTrue(textSpan.Start < 0 || textSpan.Length < 0);
22
Contract
.ThrowIfTrue(startToken.RawKind == 0);
23
Contract
.ThrowIfTrue(endToken.RawKind == 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (6)
71
Contract
.ThrowIfNull(context);
72
Contract
.ThrowIfNull(formattingRules);
73
Contract
.ThrowIfNull(originalString);
75
Contract
.ThrowIfFalse(lineBreaks >= 0);
76
Contract
.ThrowIfFalse(spaces >= 0);
78
Contract
.ThrowIfTrue(token1 == default && token2 == default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Log\Logger.LogBlock.cs (1)
21
Contract
.ThrowIfNull(logger);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (4)
61
Contract
.ThrowIfFalse(serializableRules.IsEmpty == namingStyles.IsEmpty);
62
Contract
.ThrowIfFalse(serializableRules.IsEmpty == symbolSpecifications.IsEmpty);
80
Contract
.ThrowIfFalse(namingRules.IsEmpty == namingStyles.IsEmpty);
81
Contract
.ThrowIfFalse(namingRules.IsEmpty == symbolSpecifications.IsEmpty);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\EditorConfigValueSerializer`1.cs (1)
58
Contract
.ThrowIfTrue(RoslynString.IsNullOrEmpty(editorConfigStringForValue));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Options\PublicOptionFactory.cs (4)
89
Contract
.ThrowIfNull(option.PublicOption);
95
Contract
.ThrowIfNull(option.PublicOption);
101
Contract
.ThrowIfNull(option.PublicOption);
107
Contract
.ThrowIfNull(option.PublicOption);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\AbstractDocumentationCommentService.cs (1)
49
Contract
.ThrowIfNull(documentationComment);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Services\SyntaxFacts\ISyntaxFactsExtensions.cs (1)
29
Contract
.ThrowIfNull(node);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BodyLevelSymbolKey.cs (5)
21
Contract
.ThrowIfFalse(IsBodyLevelSymbol(symbol));
22
Contract
.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
61
Contract
.ThrowIfTrue(symbol.DeclaringSyntaxReferences.IsEmpty && symbol.Locations.IsEmpty);
65
Contract
.ThrowIfFalse(locations.All(loc => loc != null && loc.IsInSource));
257
Contract
.ThrowIfTrue(semanticModel.SyntaxTree != containerDeclaration.SyntaxTree);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.BuiltinOperatorSymbolKey.cs (1)
46
Contract
.ThrowIfNull(returnTypeSymbol);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (2)
85
Contract
.ThrowIfFalse(typeArguments.IsDefault);
90
Contract
.ThrowIfTrue(typeArguments.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.FunctionPointerTypeSymbolKey.cs (2)
69
Contract
.ThrowIfFalse(parameterTypes.IsDefault);
74
Contract
.ThrowIfTrue(parameterTypes.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamedTypeSymbolKey.cs (2)
62
Contract
.ThrowIfFalse(typeArguments.IsDefault);
68
Contract
.ThrowIfTrue(typeArguments.IsDefault);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyReader.cs (5)
126
Contract
.ThrowIfNull(result);
417
Contract
.ThrowIfTrue(_methodSymbolStack.Count == 0);
418
Contract
.ThrowIfFalse(Equals(method, _methodSymbolStack[^1]));
433
Contract
.ThrowIfTrue(_contextualSymbolStack.Count == 0);
434
Contract
.ThrowIfFalse(Equals(contextualSymbol, _contextualSymbolStack.Peek()));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.SymbolKeyWriter.cs (2)
517
Contract
.ThrowIfTrue(_methodSymbolStack.Count == 0);
518
Contract
.ThrowIfFalse(method.Equals(_methodSymbolStack[^1]));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.TypeParameterOrdinalSymbolKey.cs (1)
13
Contract
.ThrowIfFalse(symbol.TypeParameterKind == TypeParameterKind.Method);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AnnotationTable.cs (1)
103
Contract
.ThrowIfNull(ra.Data);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (12)
116
Contract
.ThrowIfNull(asynchronousComputeFunction);
140
Contract
.ThrowIfTrue(Monitor.IsEntered(SyncObject), "Attempt to take the lock while already holding it!");
153
Contract
.ThrowIfFalse(Monitor.IsEntered(asyncLazy.SyncObject));
162
Contract
.ThrowIfTrue(_asynchronousComputationCancellationSource != null &&
166
Contract
.ThrowIfTrue(_requests != null &&
171
Contract
.ThrowIfTrue(_requests != null &&
175
Contract
.ThrowIfTrue(_cachedResult != null &&
180
Contract
.ThrowIfTrue(_asynchronousComputeFunction == null && _synchronousComputeFunction != null);
260
Contract
.ThrowIfNull(_synchronousComputeFunction);
312
Contract
.ThrowIfNull(_cachedResult, $"We called {nameof(CompleteWithTask)} with a result, there should be a cached result.");
377
Contract
.ThrowIfTrue(_computationActive);
378
Contract
.ThrowIfNull(_asynchronousComputeFunction);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (7)
54
Contract
.ThrowIfNull(concatenatedLowerCaseWords, nameof(_concatenatedLowerCaseWords));
55
Contract
.ThrowIfTrue(nodes.IsDefault, $"{nameof(nodes)}.{nameof(nodes.IsDefault)}");
56
Contract
.ThrowIfTrue(edges.IsDefault, $"{nameof(edges)}.{nameof(edges.IsDefault)}");
67
Contract
.ThrowIfNull(value, nameof(value));
68
Contract
.ThrowIfNull(_concatenatedLowerCaseWords, nameof(_concatenatedLowerCaseWords));
69
Contract
.ThrowIfTrue(_nodes.IsDefault, $"{nameof(_nodes)}.{nameof(_nodes.IsDefault)}");
70
Contract
.ThrowIfTrue(_edges.IsDefault, $"{nameof(_edges)}.{nameof(_edges.IsDefault)}");
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\CommonFormattingHelpers.cs (15)
47
Contract
.ThrowIfNull(root);
48
Contract
.ThrowIfFalse(spans.Count > 0);
83
Contract
.ThrowIfNull(root);
84
Contract
.ThrowIfTrue(textSpan.IsEmpty);
123
Contract
.ThrowIfFalse(startToken.Equals(endToken) || startToken.Span.End <= endToken.SpanStart);
147
Contract
.ThrowIfNull(tree);
148
Contract
.ThrowIfTrue(token.RawKind == 0);
169
Contract
.ThrowIfTrue(token1.RawKind == 0 && token2.RawKind == 0);
170
Contract
.ThrowIfTrue(token1.Equals(token2));
285
Contract
.ThrowIfFalse(backwardPosition < parentNode.FullSpan.End);
289
Contract
.ThrowIfTrue(nextToken.RawKind == 0);
310
Contract
.ThrowIfNull(parentNode);
311
Contract
.ThrowIfFalse(parentNode.FullSpan.Start < forwardPosition);
315
Contract
.ThrowIfTrue(previousToken.RawKind == 0);
359
Contract
.ThrowIfNull(root);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumerableConditionalWeakTable.cs (1)
114
Contract
.ThrowIfFalse(_table.Remove(key));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
148
Contract
.ThrowIfTrue(typeof(TFromEnum).GetEnumUnderlyingType() != typeof(TToEnum).GetEnumUnderlyingType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\NonReentrantLock.cs (1)
173
=>
Contract
.ThrowIfFalse(LockHeldByMe());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ReferenceCountedDisposable.cs (1)
294
Contract
.ThrowIfNull(weakInstance);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\TaskExtensions.cs (2)
69
Contract
.ThrowIfFalse(task.IsCompleted);
85
Contract
.ThrowIfFalse(task.IsCompleted);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ValueTaskExtensions.cs (1)
22
Contract
.ThrowIfFalse(task.IsCompleted, message);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\INamedTypeSymbolExtensions.cs (3)
336
Contract
.ThrowIfNull(classOrStructType);
337
Contract
.ThrowIfNull(interfacesOrAbstractClasses);
338
Contract
.ThrowIfNull(isImplemented);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions.cs (1)
558
Contract
.ThrowIfFalse(symbol.IsNormalAnonymousType());
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ISymbolExtensions_Accessibility.cs (7)
90
Contract
.ThrowIfNull(symbol);
91
Contract
.ThrowIfNull(within);
180
Contract
.ThrowIfNull(type);
218
Contract
.ThrowIfNull(assembly);
255
Contract
.ThrowIfNull(containingType);
431
Contract
.ThrowIfNull(withinType);
432
Contract
.ThrowIfNull(originalContainingType);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\AbstractFlagsEnumGenerator.cs (5)
77
Contract
.ThrowIfNull(enumType.EnumUnderlyingType);
118
Contract
.ThrowIfNull(finalNode);
148
Contract
.ThrowIfNull(field.ConstantValue);
171
Contract
.ThrowIfNull(enumType.EnumUnderlyingType);
187
Contract
.ThrowIfNull(enumType.EnumUnderlyingType);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationHelpers.cs (2)
181
Contract
.ThrowIfNull(attribute);
200
Contract
.ThrowIfTrue(availableIndices != null && availableIndices.Count != declarationList.Count + 1);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationOptionsProviders.cs (1)
42
Contract
.ThrowIfNull(document.Project.ParseOptions);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\SyntaxAnnotationExtensions.cs (1)
17
Contract
.ThrowIfFalse(symbol is CodeGenerationSymbol);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\DocumentExtensions.cs (1)
130
Contract
.ThrowIfFalse(document.SupportsSemanticModel);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
442
Contract
.ThrowIfNull(type);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions_Negate.cs (1)
552
Contract
.ThrowIfFalse(syntaxFacts.IsNotPattern(pattern));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\TextDocumentExtensions.cs (2)
50
Contract
.ThrowIfFalse(textDocument is AdditionalDocument);
59
Contract
.ThrowIfFalse(textDocument is AnalyzerConfigDocument);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\FindSymbols\LinkedFileReferenceLocationEqualityComparer.cs (1)
24
Contract
.ThrowIfFalse(x.Document == y.Document);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Indentation\IIndentationService.cs (1)
35
Contract
.ThrowIfNull(firstNonWhitespacePos);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\AbstractSimplificationService.cs (1)
163
Contract
.ThrowIfFalse(nodesAndTokensToReduce.Any());
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Simplification\SimplificationHelpers.cs (1)
65
Contract
.ThrowIfNull(expression);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Utilities\ParsedDocument.cs (1)
70
Contract
.ThrowIfFalse(Id == oldDocument.Id);
Storage\SQLite\v2\Interop\SqlConnection.cs (2)
55
Contract
.ThrowIfFalse(wrote == length);
316
Contract
.ThrowIfFalse(MemoryMarshal.TryRead(bytes, out Checksum result));
Storage\SQLite\v2\Interop\SqlStatement.cs (1)
90
Contract
.ThrowIfFalse(Encoding.UTF8.GetBytes(charsPtr, value.Length, bytesPtr, utf8ByteCount) == utf8ByteCount);
Storage\SQLite\v2\SQLitePersistentStorage.Accessor.cs (6)
152
Contract
.ThrowIfTrue(optional.HasValue && optional.Value == null);
166
Contract
.ThrowIfFalse(TaskScheduler.Current == this.Storage.Scheduler.ConcurrentScheduler);
225
Contract
.ThrowIfFalse(TaskScheduler.Current == this.Storage.Scheduler.ExclusiveScheduler);
290
Contract
.ThrowIfTrue(exception != null);
307
Contract
.ThrowIfTrue(exception != null);
364
Contract
.ThrowIfFalse(TaskScheduler.Current == this.Storage.Scheduler.ExclusiveScheduler);
Storage\SQLite\v2\SQLitePersistentStorage.cs (3)
101
Contract
.ThrowIfNull(solutionKey.FilePath);
149
Contract
.ThrowIfNull(directoryName);
159
Contract
.ThrowIfNull(directory);
Storage\SQLite\v2\SQLitePersistentStorage_FlushWrites.cs (1)
35
Contract
.ThrowIfFalse(TaskScheduler.Current == this.Scheduler.ExclusiveScheduler);
Storage\SQLite\v2\SQLitePersistentStorage_StringIds.cs (3)
48
Contract
.ThrowIfFalse(
67
Contract
.ThrowIfFalse(TaskScheduler.Current == this.Scheduler.ExclusiveScheduler);
133
Contract
.ThrowIfTrue(id == -1);
Storage\SQLite\v2\SQLitePersistentStorageService.cs (1)
63
Contract
.ThrowIfTrue(string.IsNullOrWhiteSpace(workingFolderPath));
TemporaryStorage\TemporaryStorageService.cs (2)
177
Contract
.ThrowIfNull(storageIdentifier.Name, $"{nameof(GetStreamHandle)} should only be called for VS on Windows (where named memory mapped files as supported)");
188
Contract
.ThrowIfNull(storageIdentifier.Name, $"{nameof(GetTextHandle)} should only be called for VS on Windows (where named memory mapped files as supported)");
Utilities\Documentation\XmlDocumentationProvider.cs (2)
105
Contract
.ThrowIfNull(xmlDocCommentBytes);
153
Contract
.ThrowIfNull(filePath);
Workspace\DocumentActiveContextChangedEventArgs.cs (4)
19
Contract
.ThrowIfNull(solution);
20
Contract
.ThrowIfNull(sourceTextContainer);
21
Contract
.ThrowIfNull(oldActiveContextDocumentId);
22
Contract
.ThrowIfNull(newActiveContextDocumentId);
Workspace\DocumentEventArgs.cs (1)
15
Contract
.ThrowIfNull(document);
Workspace\Host\DocumentService\AbstractSpanMappingService.cs (1)
32
Contract
.ThrowIfFalse(mappedSpanResults.Length == textChanges.Length);
Workspace\Host\PersistentStorage\IPersistentStorageConfiguration.cs (1)
53
Contract
.ThrowIfNull(fileName);
Workspace\ProjectSystem\FileWatchedPortableExecutableReferenceFactory.cs (1)
160
Contract
.ThrowIfFalse(newRefCount >= 0, "Ref count cannot be negative");
Workspace\ProjectSystem\ProjectSystemProject.BatchingDocumentCollection.cs (4)
212
Contract
.ThrowIfNull(documentInfo.FilePath);
495
Contract
.ThrowIfNull(fileInfo, "We previously received a dynamic file for this path, and we're responding to a change, so we expect to get a new one.");
600
Contract
.ThrowIfNull(documentInfo.FilePath, "We shouldn't be adding documents without file paths.");
636
Contract
.ThrowIfTrue(folders.IsDefault);
Workspace\ProjectSystem\ProjectSystemProject.cs (4)
790
Contract
.ThrowIfTrue(analyzersRemoved.Count == 0 && analyzersAdded.Count == 0, "Should only be called when there is work to do");
974
Contract
.ThrowIfNull(providerForFileInfo);
1413
Contract
.ThrowIfNull(originalMetadataReferences);
1414
Contract
.ThrowIfNull(originalAnalyzerReferences);
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (11)
207
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
214
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
308
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
355
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
383
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
422
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
447
Contract
.ThrowIfFalse(_gate.CurrentCount == 0);
451
Contract
.ThrowIfFalse(_projectUpdateState.ProjectReferenceInfos.Count == 0);
452
Contract
.ThrowIfFalse(_projectToMaxSupportedLangVersionMap.Count == 0);
453
Contract
.ThrowIfFalse(_projectToDependencyNodeTargetIdentifier.Count == 0);
855
Contract
.ThrowIfTrue(oldAnalyzerFilePath != newAnalyzerFilePath);
Workspace\ProjectSystem\ProjectSystemProjectOptionsProcessor.cs (1)
203
Contract
.ThrowIfNull(sender);
Workspace\Solution\Checksum.cs (2)
57
Contract
.ThrowIfFalse(MemoryMarshal.TryRead(checksum, out Checksum result));
88
Contract
.ThrowIfTrue(span.Length < HashSize);
Workspace\Solution\ChecksumCollection.cs (3)
70
Contract
.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksums));
82
Contract
.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksums));
97
Contract
.ThrowIfFalse(values.Count == checksums.Children.Length);
Workspace\Solution\ChecksumsAndIds.cs (3)
23
Contract
.ThrowIfTrue(ids.Length != checksums.Children.Length);
75
Contract
.ThrowIfTrue(ids.Length != attributeChecksums.Children.Length);
76
Contract
.ThrowIfTrue(ids.Length != textChecksums.Children.Length);
Workspace\Solution\Document.cs (2)
356
Contract
.ThrowIfNull(result);
596
Contract
.ThrowIfNull(_cachedOptions);
Workspace\Solution\DocumentState.cs (8)
47
Contract
.ThrowIfFalse(ParseOptions is null == TreeSource is null);
72
Contract
.ThrowIfNull(options);
172
Contract
.ThrowIfNull(tree);
244
Contract
.ThrowIfNull(newTree);
339
Contract
.ThrowIfFalse(SupportsSyntaxTree);
401
Contract
.ThrowIfTrue(ReferenceEquals(newAttributes, Attributes));
515
Contract
.ThrowIfNull(ParseOptions);
661
Contract
.ThrowIfFalse(existingId == id);
Workspace\Solution\DocumentState_LinkedFileReuse.cs (1)
78
Contract
.ThrowIfNull(siblingTreeSource);
Workspace\Solution\Project.cs (2)
38
Contract
.ThrowIfNull(solution);
39
Contract
.ThrowIfNull(projectState);
Workspace\Solution\ProjectCone.cs (1)
21
Contract
.ThrowIfFalse(projectIds.Contains(rootProjectId));
Workspace\Solution\ProjectDependencyGraph.cs (3)
100
Contract
.ThrowIfNull(transitiveReferencesMap);
101
Contract
.ThrowIfNull(reverseTransitiveReferencesMap);
137
Contract
.ThrowIfFalse(ProjectIds.Contains(projectId));
Workspace\Solution\ProjectDependencyGraph_AddProjectReference.cs (1)
17
Contract
.ThrowIfFalse(ProjectIds.Contains(projectId));
Workspace\Solution\ProjectDependencyGraph_RemoveAllProjectReferences.cs (1)
16
Contract
.ThrowIfFalse(ProjectIds.Contains(projectId));
Workspace\Solution\ProjectDependencyGraph_RemoveProject.cs (1)
20
Contract
.ThrowIfFalse(projectIdsBuilder.Remove(projectId));
Workspace\Solution\ProjectDependencyGraph_RemoveProjectReference.cs (2)
16
Contract
.ThrowIfFalse(ProjectIds.Contains(projectId));
17
Contract
.ThrowIfFalse(_referencesMap[projectId].Contains(referencedProjectId));
Workspace\Solution\ProjectReference.cs (1)
21
Contract
.ThrowIfNull(projectId);
Workspace\Solution\ProjectState.cs (7)
82
Contract
.ThrowIfNull(projectInfo);
83
Contract
.ThrowIfNull(languageServices);
372
Contract
.ThrowIfNull(projectDirectory);
982
Contract
.ThrowIfTrue(oldDocuments.IsEmpty);
983
Contract
.ThrowIfFalse(oldDocuments.Length == newDocuments.Length);
1008
Contract
.ThrowIfTrue(oldDocuments.IsEmpty);
1009
Contract
.ThrowIfFalse(oldDocuments.Length == newDocuments.Length);
Workspace\Solution\Solution.cs (7)
95
Contract
.ThrowIfTrue(this.WorkspaceKind == CodeAnalysis.WorkspaceKind.RemoteWorkspace, "Access .Workspace off of a RemoteWorkspace Solution is not supported.");
168
Contract
.ThrowIfNull(state);
262
Contract
.ThrowIfNull(documentId);
277
Contract
.ThrowIfNull(documentId);
339
Contract
.ThrowIfNull(generatedDocument, "The call to GetDocumentState found a SourceGeneratedDocumentState, so we should have found it now.");
1560
Contract
.ThrowIfTrue(solution._documentIdToFrozenSolution.Count != 0);
1641
Contract
.ThrowIfNull(newDocumentState, "Because we just froze this document, it should always exist.");
Workspace\Solution\SolutionCompilationState.CompilationTracker.CompilationTrackerState.cs (5)
94
Contract
.ThrowIfTrue(pendingTranslationActions is null);
105
Contract
.ThrowIfTrue(this.CompilationWithoutGeneratedDocuments.SyntaxTrees.Contains(generatedDocument.GetSyntaxTree(CancellationToken.None)));
182
Contract
.ThrowIfNull(finalCompilationWithGeneratedDocuments);
205
Contract
.ThrowIfTrue(compilationWithoutGeneratedDocuments.SyntaxTrees.Contains(generatedDocument.GetSyntaxTree(CancellationToken.None)));
272
Contract
.ThrowIfNull(projectId);
Workspace\Solution\SolutionCompilationState.cs (8)
77
Contract
.ThrowIfTrue(projectCone != null);
107
Contract
.ThrowIfTrue(_projectIdToTrackerMap.Any(kvp => kvp.Key != kvp.Value.ProjectState.Id));
110
Contract
.ThrowIfFalse(this.SolutionState.SortedProjectStates
1159
Contract
.ThrowIfNull(projectState);
1364
Contract
.ThrowIfFalse(trackerMap.TryGetValue(projectId, out var existingTracker));
1395
Contract
.ThrowIfTrue(sourceText is null && syntaxNode is null);
1396
Contract
.ThrowIfTrue(sourceText is not null && syntaxNode is not null);
1411
Contract
.ThrowIfNull(syntaxNode);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (8)
64
Contract
.ThrowIfNull(project);
136
Contract
.ThrowIfTrue(forkedTrackerState is FinalCompilationTrackerState);
137
Contract
.ThrowIfFalse(forkedTrackerState is null or InProgressState);
206
Contract
.ThrowIfNull(compilation);
407
Contract
.ThrowIfTrue(inProgressState.PendingTranslationActions.IsEmpty);
478
Contract
.ThrowIfTrue(inProgressState.PendingTranslationActions.Count > 0);
543
Contract
.ThrowIfFalse(creationPolicy.SkeletonReferenceCreationPolicy is SkeletonReferenceCreationPolicy.CreateIfAbsent or SkeletonReferenceCreationPolicy.DoNotCreate);
996
/// This is just the same as <see cref="
Contract
.ThrowIfFalse(bool, string, int, string)"/> but throws a custom exception type to make this easier to find in telemetry since the exception type
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker_Generators.cs (11)
125
Contract
.ThrowIfFalse(documentId.IsSourceGenerated);
178
Contract
.ThrowIfTrue(generatedSources.Length != documentsToAddOrUpdate.Count);
186
Contract
.ThrowIfFalse(documentId.IsSourceGenerated);
205
Contract
.ThrowIfTrue(generatedDocument.GetOriginalSourceTextContentHash() != contentIdentity.OriginalSourceTextContentHash, "Checksums must match!");
212
Contract
.ThrowIfTrue(existingDocument.Identity != documentIdentity, "Identities must match!");
213
Contract
.ThrowIfTrue(existingDocument.GetOriginalSourceTextContentHash() != contentIdentity.OriginalSourceTextContentHash, "Checksums must match!");
247
Contract
.ThrowIfNull(generatorDriver);
270
Contract
.ThrowIfNull(generatorDriver);
414
Contract
.ThrowIfNull(stateMember);
416
Contract
.ThrowIfNull(additionalTextsMember);
420
Contract
.ThrowIfFalse(additionalTexts.Length == projectState.AdditionalDocumentStates.Count);
Workspace\Solution\SolutionCompilationState.SymbolToProjectId.cs (1)
83
Contract
.ThrowIfNull(syntaxTree);
Workspace\Solution\SolutionCompilationState.TranslationAction_Actions.cs (1)
244
Contract
.ThrowIfNull(this.NewProjectState.CompilationOptions);
Workspace\Solution\SolutionCompilationState_Checksum.cs (2)
73
Contract
.ThrowIfNull(projectId);
83
Contract
.ThrowIfNull(projectCone);
Workspace\Solution\SolutionCompilationState_SourceGenerators.cs (2)
69
Contract
.ThrowIfFalse(projectState.SupportsCompilation);
75
Contract
.ThrowIfNull(map);
Workspace\Solution\SolutionState.cs (10)
162
Contract
.ThrowIfFalse(SortedProjectStates.Length == ProjectIds.Count);
163
Contract
.ThrowIfFalse(SortedProjectStates.Length == _dependencyGraph.ProjectIds.Count);
350
Contract
.ThrowIfNull(result);
359
Contract
.ThrowIfTrue(projectInfos.HasDuplicates(static p => p.Id), "Duplicate ProjectId provided");
464
Contract
.ThrowIfTrue(projectIds.HasDuplicates(), "Duplicate ProjectId provided");
496
Contract
.ThrowIfFalse(amount is -1 or +1);
525
Contract
.ThrowIfFalse(newCount == 0);
1183
Contract
.ThrowIfFalse(projectStateIndex >= 0);
1264
Contract
.ThrowIfTrue(documentId.ProjectId == relatedProjectIdHint);
1293
Contract
.ThrowIfTrue(relatedProject == projectState);
Workspace\Solution\SolutionState_Checksum.cs (1)
67
Contract
.ThrowIfNull(projectId);
Workspace\Solution\SourceGeneratedDocumentIdentity.cs (1)
28
Contract
.ThrowIfFalse(documentId.IsSourceGenerated);
Workspace\Solution\SourceGeneratedDocumentState.cs (3)
62
Contract
.ThrowIfTrue(generatedSourceText is null && syntaxNode is null);
63
Contract
.ThrowIfTrue(generatedSourceText is not null && syntaxNode is not null);
68
Contract
.ThrowIfNull(syntaxNode);
Workspace\Solution\StateChecksums.cs (11)
34
Contract
.ThrowIfFalse(frozenSourceGeneratedDocumentIdentities.Count == frozenSourceGeneratedDocuments.Length);
96
Contract
.ThrowIfFalse(result.Checksum == checksum);
147
Contract
.ThrowIfFalse(compilationState.FrozenSourceGeneratedDocumentStates.TryGetState(documentId, out var state));
161
Contract
.ThrowIfFalse(compilationState.FrozenSourceGeneratedDocumentStates.TryGetState(id, out var state));
174
Contract
.ThrowIfFalse(solutionState.TryGetStateChecksums(out var solutionChecksums));
180
Contract
.ThrowIfFalse(solutionState.TryGetStateChecksums(projectCone.RootProjectId, out var solutionChecksums));
250
Contract
.ThrowIfFalse(result.Checksum == checksum);
290
Contract
.ThrowIfTrue(
421
Contract
.ThrowIfFalse(result.Checksum == checksum);
435
Contract
.ThrowIfFalse(state.TryGetStateChecksums(out var stateChecksum));
436
Contract
.ThrowIfFalse(this == stateChecksum);
Workspace\Solution\TextDocument.cs (2)
26
Contract
.ThrowIfNull(project);
27
Contract
.ThrowIfNull(state);
Workspace\Solution\TextDocumentStates.cs (1)
227
Contract
.ThrowIfTrue(!ignoreUnchangedContent && ignoreUnchangeableDocuments);
Workspace\Solution\VersionSource\LoadableTextAndVersionSource.cs (1)
88
Contract
.ThrowIfTrue(_gate.CurrentCount != 0);
Workspace\Solution\VersionSource\RecoverableTextAndVersion.cs (4)
160
Contract
.ThrowIfTrue(source is LoadableTextAndVersionSource { CacheResult: true });
173
Contract
.ThrowIfNull(_storageHandle);
183
Contract
.ThrowIfNull(_storageHandle);
193
Contract
.ThrowIfFalse(_storageHandle == null); // Cannot save more than once
Workspace\Solution\VersionSource\RecoverableTextAndVersion.RecoverableText.cs (1)
130
Contract
.ThrowIfTrue(Gate.CurrentCount != 0);
Workspace\TextExtensions.cs (1)
89
Contract
.ThrowIfFalse(solution.ContainsAnalyzerConfigDocument(id));
Workspace\Workspace.cs (6)
354
Contract
.ThrowIfTrue(relatedDocumentId == addedDocumentId);
357
Contract
.ThrowIfTrue(relatedDocumentId.ProjectId == addedDocumentId.ProjectId);
507
Contract
.ThrowIfNull(transformation);
1357
Contract
.ThrowIfNull(newDocument);
1730
Contract
.ThrowIfNull(projectChanges.OldProject.CompilationOptions);
1731
Contract
.ThrowIfNull(projectChanges.NewProject.CompilationOptions);
Workspace\Workspace_Editor.cs (7)
272
Contract
.ThrowIfNull(currentContextId, "The document is open, so we should have had some context ID.");
474
Contract
.ThrowIfFalse(_openSourceGeneratedDocumentIdentities.Remove(document.Id));
801
Contract
.ThrowIfFalse(_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
809
Contract
.ThrowIfFalse(!_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
827
Contract
.ThrowIfFalse(!_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
831
Contract
.ThrowIfFalse(_bufferToDocumentInCurrentContextMap.ContainsKey(textContainer));
855
Contract
.ThrowIfFalse(doc.TryGetText(out var text));
Microsoft.CodeAnalysis.Workspaces.MSBuild (12)
MSBuild\BuildHostProcessManager.cs (2)
94
Contract
.ThrowIfNull(process, "Process.Start failed to launch a process.");
126
Contract
.ThrowIfNull(sender, $"{nameof(BuildHostProcess)}.{nameof(BuildHostProcess.Disconnected)} was raised with a null sender.");
MSBuild\MSBuildWorkspace.cs (1)
494
Contract
.ThrowIfNull(dir);
MSBuild\SolutionFileReader.cs (1)
24
Contract
.ThrowIfFalse(pathResolver.TryGetAbsoluteSolutionPath(solutionFilePath, baseDirectory: Directory.GetCurrentDirectory(), DiagnosticReportingMode.Throw, out var absoluteSolutionPath));
MSBuild\SolutionFileReader.SolutionFilterReader.cs (2)
38
Contract
.ThrowIfFalse(pathResolver.TryGetAbsoluteSolutionPath(solutionPath, baseDirectory, DiagnosticReportingMode.Throw, out solutionFilename));
61
Contract
.ThrowIfFalse(pathResolver.TryGetAbsoluteProjectPath(projectPath, baseDirectory, DiagnosticReportingMode.Throw, out var absoluteProjectPath));
Rpc\RpcClient.cs (3)
71
Contract
.ThrowIfNull(response);
73
Contract
.ThrowIfFalse(_outstandingRequests.TryRemove(response.Id, out var completionSourceAndExpectedType), $"We got a response for request ID {response.Id} but that was already completed.");
136
Contract
.ThrowIfNull(result, "We expected a non-null result but got null back.");
src\Workspaces\MSBuild\BuildHost\Rpc\Contracts\MonoMSBuildDiscovery.cs (3)
71
Contract
.ThrowIfTrue(PlatformInformation.IsWindows);
95
Contract
.ThrowIfTrue(PlatformInformation.IsWindows);
132
Contract
.ThrowIfTrue(PlatformInformation.IsWindows);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (7)
src\Workspaces\MSBuild\BuildHost\Rpc\RpcServer.cs (7)
72
Contract
.ThrowIfNull(request);
85
_ =>
Contract
.ThrowIfFalse(runningTasks.Remove(runningTask)),
110
Contract
.ThrowIfFalse(
116
Contract
.ThrowIfNull(method, $"The invoked method '{request.Method}' could not be found.");
123
Contract
.ThrowIfFalse(request.Parameters.Length == methodParameters.Length - 1, $"The arguments list should contain every parameter for {request.Method} except the final CancellationToken.");
125
Contract
.ThrowIfFalse(request.Parameters.Length == methodParameters.Length, $"The arguments list should contain every parameter for {request.Method}.");
173
Contract
.ThrowIfTrue(responseJson.Contains("\r") || responseJson.Contains("\n"));
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (43)
Fakes\SimpleAssetSource.cs (2)
25
Contract
.ThrowIfFalse(map.TryGetValue(checksum, out var data));
37
Contract
.ThrowIfNull(asset);
GenerateFileForEachAdditionalFileWithContentsCommented.cs (1)
30
Contract
.ThrowIfNull(sourceText, "Failed to fetch the text of an additional file.");
MEF\TestComposition.cs (1)
191
Contract
.ThrowIfFalse(testAssembly == null, $"Test assemblies are not allowed in test composition: {testAssembly}. Specify explicit test parts instead.");
Remote\InProcRemostHostClient.cs (4)
49
Contract
.ThrowIfNull(client);
129
Contract
.ThrowIfFalse(options.ClientRpcTarget is null == descriptor.ClientInterface is null);
133
Contract
.ThrowIfNull(options.ClientRpcTarget);
240
Contract
.ThrowIfFalse(descriptor.ClientInterface == null);
Remote\TestSerializerService.cs (2)
104
Contract
.ThrowIfFalse(_sharedTestGeneratorReferences.TryGetValue(testGeneratorReferenceGuid, out var generatorReference));
154
Contract
.ThrowIfFalse(_sharedTestGeneratorReferences == null ||
TestExportJoinableTaskContext.cs (1)
53
Contract
.ThrowIfFalse(dispatcherTaskJoiner?.IsDispatcherSynchronizationContext(currentContext) == true);
Workspaces\TestHostDocument.cs (6)
48
Contract
.ThrowIfNull(_id);
57
Contract
.ThrowIfNull(_project);
102
Contract
.ThrowIfNull(filePath);
103
Contract
.ThrowIfFalse(generator == null || PathUtilities.IsAbsolute(filePath));
168
Contract
.ThrowIfFalse(project.Id == this.Id.ProjectId);
205
Contract
.ThrowIfTrue(IsSourceGenerated, "We shouldn't be producing a DocumentInfo for a source generated document.");
Workspaces\TestWorkspace_XmlConsumption.cs (1)
653
Contract
.ThrowIfTrue(cursorPosition != null);
Workspaces\TestWorkspace_XmlCreation.cs (2)
39
Contract
.ThrowIfTrue(fileContainingFolders.Length != files.Length, "Please specify containing folder for each file.");
144
Contract
.ThrowIfFalse(options.SpecificDiagnosticOptions.IsEmpty);
Workspaces\TestWorkspace`1.cs (23)
375
Contract
.ThrowIfNull(hostProject);
389
Contract
.ThrowIfNull(hostProject);
392
Contract
.ThrowIfNull(hostDocument);
401
Contract
.ThrowIfNull(hostProject);
411
Contract
.ThrowIfNull(hostProject);
425
Contract
.ThrowIfNull(hostProject);
435
Contract
.ThrowIfNull(hostProject);
451
Contract
.ThrowIfNull(hostProject);
470
Contract
.ThrowIfNull(testDocument);
471
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
480
Contract
.ThrowIfNull(testDocument);
481
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
482
Contract
.ThrowIfFalse(IsDocumentOpen(documentId));
490
Contract
.ThrowIfNull(testDocument);
491
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
492
Contract
.ThrowIfFalse(IsDocumentOpen(documentId));
500
Contract
.ThrowIfNull(testDocument);
501
Contract
.ThrowIfTrue(testDocument.IsSourceGenerated);
502
Contract
.ThrowIfFalse(IsDocumentOpen(documentId));
510
Contract
.ThrowIfNull(testDocument);
511
Contract
.ThrowIfFalse(testDocument.IsSourceGenerated);
512
Contract
.ThrowIfFalse(IsDocumentOpen(documentId));
515
Contract
.ThrowIfNull(document);
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
SolutionTests\SolutionWithSourceGeneratorTests.cs (1)
705
Contract
.ThrowIfNull(document);
Microsoft.VisualStudio.LanguageServices.CSharp (37)
CodeModel\CSharpCodeModelService.cs (12)
965
Contract
.ThrowIfNull(symbol);
1731
Contract
.ThrowIfNull(parsedArgumentList);
1758
Contract
.ThrowIfNull(node.Parent);
2719
Contract
.ThrowIfNull(typeSymbol);
2752
Contract
.ThrowIfNull(fieldDeclaration);
2762
Contract
.ThrowIfNull(newFieldDeclaration);
2791
Contract
.ThrowIfNull(attributeList);
2809
Contract
.ThrowIfNull(newAttributeList);
2818
Contract
.ThrowIfNull(argumentList);
2820
Contract
.ThrowIfNull(newArgumentList);
2828
Contract
.ThrowIfNull(parameterList);
2830
Contract
.ThrowIfNull(newParameterList);
CSharpPackage.cs (2)
88
Contract
.ThrowIfFalse(JoinableTaskFactory.Context.IsOnMainThread);
105
Contract
.ThrowIfFalse(JoinableTaskFactory.Context.IsOnMainThread);
ProjectSystemShim\CSharpProjectShim.OptionsProcessor.cs (1)
159
Contract
.ThrowIfFalse(
ProjectSystemShim\TempPECompilerService.cs (2)
37
Contract
.ThrowIfFalse(fileNames.Length == fileContents.Length);
71
Contract
.ThrowIfFalse(optionNames.Length == optionValues.Length);
SemanticSearch\SemanticSearchQueryExecutor.cs (1)
45
Contract
.ThrowIfFalse(query is null ^ queryDocument is null);
SemanticSearch\SemanticSearchToolWindowImpl.cs (18)
125
Contract
.ThrowIfFalse(textDocumentFactory.TryGetTextDocument(_textBuffer, out var textDocument));
271
Contract
.ThrowIfFalse(threadingContext.JoinableTaskContext.IsOnMainThread);
304
Contract
.ThrowIfNull(textViewHost);
315
Contract
.ThrowIfFalse(threadingContext.JoinableTaskContext.IsOnMainThread);
316
Contract
.ThrowIfNull(_executeButton);
323
Contract
.ThrowIfFalse(threadingContext.JoinableTaskContext.IsOnMainThread);
324
Contract
.ThrowIfNull(_executeButton);
325
Contract
.ThrowIfNull(_cancelButton);
340
Contract
.ThrowIfFalse(threadingContext.JoinableTaskContext.IsOnMainThread);
341
Contract
.ThrowIfNull(_textBuffer);
343
Contract
.ThrowIfFalse(undoHistoryRegistry.TryGetHistory(_textBuffer, out var undoHistory));
357
Contract
.ThrowIfFalse(threadingContext.JoinableTaskContext.IsOnMainThread);
358
Contract
.ThrowIfFalse(IsExecutingUIState());
373
Contract
.ThrowIfFalse(threadingContext.JoinableTaskContext.IsOnMainThread);
374
Contract
.ThrowIfFalse(!IsExecutingUIState());
375
Contract
.ThrowIfNull(_textBuffer);
409
Contract
.ThrowIfNull(source);
424
Contract
.ThrowIfNull(_textView);
Utilities\CSharpParseOptionsChangingService.cs (1)
50
Contract
.ThrowIfFalse(LanguageVersionFacts.TryParse(maxLangVersion, out var parsedMaxLanguageVersion));
Microsoft.VisualStudio.LanguageServices.DevKit (1)
src\VisualStudio\Core\Def\Telemetry\Shared\TelemetryLogger.cs (1)
150
Contract
.ThrowIfFalse(_pendingScopes.TryRemove(blockId, out var scope));
Microsoft.VisualStudio.LanguageServices.Xaml (8)
Implementation\LanguageServer\Handler\Commands\CreateEventCommandHandler.cs (1)
46
Contract
.ThrowIfNull(request.Arguments);
Implementation\LanguageServer\Handler\Completion\CompletionResolveHandler.cs (1)
46
Contract
.ThrowIfNull(context.Solution);
Implementation\LanguageServer\Handler\Definitions\GoToDefinitionHandler.cs (2)
113
Contract
.ThrowIfNull(sourceDefinition.FilePath);
155
Contract
.ThrowIfNull(symbolDefinition.Symbol);
Implementation\LanguageServer\Handler\Diagnostics\AbstractPullDiagnosticHandler.cs (1)
64
Contract
.ThrowIfNull(context.Solution);
Implementation\LanguageServer\Handler\Diagnostics\WorkspacePullDiagnosticHandler.cs (1)
41
Contract
.ThrowIfNull(context.Solution);
Implementation\LanguageServer\Handler\OnAutoInsert\OnAutoInsertHandler.cs (1)
55
Contract
.ThrowIfNull(result.TextChange.NewText);
Implementation\LanguageServer\Handler\OnTypeRename\OnTypeRenameHandler.cs (1)
88
Contract
.ThrowIfTrue(result.Ranges.IsDefault);
Roslyn.VisualStudio.DiagnosticsWindow (1)
DiagnosticsWindow.cs (1)
71
Contract
.ThrowIfFalse(Workspace == null);
Roslyn.VisualStudio.Next.UnitTests (14)
Remote\SerializationValidator.cs (6)
86
Contract
.ThrowIfNull(data);
93
Contract
.ThrowIfNull(data.Value);
103
Contract
.ThrowIfNull(reader);
107
Contract
.ThrowIfNull<object?>(result);
213
Contract
.ThrowIfFalse(solution.CompilationState.TryGetStateChecksums(out var solutionCompilationObjectFromSolution));
218
Contract
.ThrowIfFalse(solution.CompilationState.SolutionState.TryGetStateChecksums(out var solutionObjectFromSolution));
Remote\SnapshotSerializationTests.cs (1)
76
Contract
.ThrowIfNull(data);
Services\AssetProviderTests.cs (1)
212
Contract
.ThrowIfNull(deserialized);
Services\ServiceHubServicesTests.cs (2)
431
Contract
.ThrowIfTrue(throwIfCalled);
1430
Contract
.ThrowIfFalse(workspace.TryApplyChanges(workspace.CurrentSolution.WithDocumentText(normalDocId, SourceText.From("// new text"))));
Services\ServiceHubServicesTests_ExtensionMessageHandler.cs (4)
732
Contract
.ThrowIfTrue(unloadCalled);
737
Contract
.ThrowIfTrue(unloadCalled);
741
Contract
.ThrowIfTrue(unloadCalled);
746
Contract
.ThrowIfFalse(unloadCalled);