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